Fix issue #1461- use a recommended dh group instead of a self-generated one#1463
Fix issue #1461- use a recommended dh group instead of a self-generated one#1463erik-wramner merged 10 commits intodocker-mailserver:masterfrom
Conversation
|
LGTM. Unable to review the bats files though, doesn't look like the Should also have the PR link to #1455 for auto closing on merge. Referenced issues that the PR fixes covers these two informative links to justify the use of pre-defined DH groups 👍 :
Related security stackexchange discussion reaffirms the advice:
|
|
Thanks for the review @polarathene! |
use by default ffdhe4096 for DHE params use by default ffdhe4096 for DHE params
polarathene
left a comment
There was a problem hiding this comment.
Thanks for responding with those changes so quickly! 👍
Just a few questions regarding how the tests have been implemented and a minor documentation comment to benefit maintainers in future to sort out :)
Co-Authored-By: Brennan Kinney <[email protected]>
Co-Authored-By: Brennan Kinney <[email protected]>
Co-Authored-By: Brennan Kinney <[email protected]>
|
Nice cooperation! |
|
I'm still getting familiar with this stuff, but I have read about the move from 2048-bit to 4096-bit here will incur about 400% more overhead in operations/sec (just handshakes I guess?). I am not sure yet, but it may only apply to If no |
DHE is weak and should be avoided. If the client is only supporting DHE and not ECDHE, update the client. If your server is consuming too many resources due to DHE usage: I would recommend disabling DHE- ciphers and update the clients. The DHE ciphers have been phased out in Chrome 53 - 2016 ECDHE is preferred instead of DHE.
It applies to any DHE-* cipher suite. See this https://vincent.bernat.ch/en/blog/2011-ssl-perfect-forward-secrecy and this https://security.stackexchange.com/questions/94390/whats-the-purpose-of-dh-parameters. To sum up, (Ephemeral) Elliptic-Curve Diffie-Hellman (ECDHE) is preferred over static DHE. When using static DHE, the same parameters are used between different sessions and that's why it's bad. Ephemeral ECDHE are by conception, not affected by this issue.
MTA-MTA can be secured using MTA-STS, the sender mail server is asked to use encryption when he's delivering emails to the receiver server. (Currently, it requires postfix to use https://github.com/Snawoot/postfix-mta-sts-resolver). As you can see, the negotiated cipher depends on what the sender mailserver supports and what the receiver mail server supports (negotiation). |
Doesn't the 4096-bit params in this PR resolve that at the expense of added overhead to support that strength?
Not possible if you're not in control of the client, eg third-party MTA sending email to your server on port 25. I assume your advice is for mandatory TLS with the reduced cipherlist that direct users would be able to update to a better client.
They're advising plain-RSA if ECDHE is not available? That gives up PFS, I assume that decision is based on the 512-1024-bit strength for DHE(I didn't read the more info links they provide), and that either the increase overhead by increasing strength was a negative or they weren't trusting of servers to use stronger strength DH params? Good to know though, thanks.
When you are comparing My understanding of EDIT: Read your
This discussion, details the difference further.
Source? RFC 2487 and RFC 3207 both state it is not required for inbound port 25(in the context of the port being open to the internet).
Not sure why this is being brought up here? I'm well aware of this, but the RFC you linked also points out the reassignment of port 465 to an implicit TLS submission port. I would advise using 465 when possible over 587.
All plain-text mail server ports(SMTP, POP, IMAP protocols) support In this project, we enforce TLS connections over
It will still happily receive plain-text or |
|
This PR is just updating DH parameters as the NCSC-NL TLS Guidelines recommend. Cipher choices are up to the mail server administrator, depending on his needs. If you need to support outdated clients, you will have choices to make. It's a tradeoff between compatibility and security.
I've not calculated the cost of this. As I said, it's here only for backward compatibility. Drop DHE-* ciphers if you don't need them (as dovecot recommends). Modern TLS configuration should not rely on DHE-* ciphers.
Not our concern. The server will be able to deliver on 25/plain. If the sender server is only supporting DHE-* ciphers you are facing a misconfigured/outdated sender server (you can enforce incoming messages to use TLS if you want, but it's not recommended).
Not for MUA----[:25]-->MTA. I was not talking about MTA----[:25]---->MDA (the MTA-STS example is using TLS).
Both DHE and ECDHE use ephemeral keys, we are updating the dh parameters (used by DHE only, ECDHE uses elliptic curve) which are vulnerable to logjam attacks. 4096bits is currently considered as sufficient BUT it does not make DHE-* ciphers best choice during cipher negotiation. |
There is some shared results in this thread, although as a user later points out, it was all run locally instead of taking client/server timing into consideration.
This project doesn't include them in The prior link has explanations for why Mozilla includes them in their intermediate config, which is being referenced for my PR updating the cipherlist(their modern config is just TLS 1.3 which is not suitable for SMTP).
We expect broader compatibility for receiving e-mail, so port 25 is more relaxed on ciphers, restriction is mostly on supported protocols. So
Source? Why wouldn't you want Best practice would be not to have a MUA submit to port 25, that's fine as advice.
I don't think anyone was claiming them to be best choice? |
https://wiki.dovecot.org/SSL/DovecotConfiguration - SSL security settings For broad compatibility, this image supports It is known for a while DHE ciphers are less efficient than ECDHE: Server is enforcing cipher order preference, according to that, DHE-* ciphers will be used when there is no preceding cipher available (if server cipher preference order is disabled, a misconfigured client could use DHE instead of ECDHE and use more resources...). To my mind, I don't see why DHE-* ciphers should be kept in a modern configuration if I don't need them and it would probably better to drop them as Google Chrome did:
Dovecot is recommending disabling non-ECC DH algorithms, which mail server/client is not supporting ECC DH algorithms nowadays? Regarding Mozilla statement:
It's a point of view, Dovecot and Google Chrome don't share this opinion. (I would recommend not to support DHE-* ciphers if you don't need them, at least on dovecot, for postfix if you are confident and you don't want DHE to be resource consuming, otherwise keep it for postfix only).
Why
ffdhe4096 is a choice made for having a sufficient secured DHE-* cipher usage but it would be better to drop it if you have concerns about resources usage.
Why would you use port 25 instead of 465 or 587 when you are using STARTTLS? Some MSPs are still using 25 for plain text; it's misleading to configure a MUA to submit messages on port 25 when 465 or 587 are available.
The RFC https://tools.ietf.org/html/rfc8314 advises dropping plain text and start using implicit TLS but giving the background history of the port 25, why would you use this port when 465 or 587 are available. Anyway, plain text over any port should not be available (and that's not part of this PR). |
|
Cipher support is a complicated topic, it widely depends on the needs and I'm not gonna find a one fit all solutions about DHE, it consumes resources, it's a fact and we can't do a lot about that. If you have any concern about using FFDHE4096, you could switch on FFDHE3092. To conclude, thank you for these interesting exchanges but I don't have a lot of time these days. |
For mandatory TLS connections, that's probably fine for our
I don't believe that's been debated? I was just pointing out that the impact of bumping up from 2048-bit to 4096-bit takes 4x as long (apparently), adding CPU overhead. For many users of this image that's unlikely an issue and the better security is good.
I'm of the understanding Google Chrome has done so from a client perspective. If a server is is using weak DH params, then the client isn't able to do much about that is it? So from their end it's safer to not support those cipher suites in the first place, given that HTTPS has greater modern TLS adoption and should have better options as you have stated.
Define "configured", if the client is saying it wants DHE, could it not be configured to only say it supports DHE too? Then it wouldn't matter what server cipher preference is if they only agree on a cipherlist intersection (I don't know how possible that is).
Old ones? All I know is SMTP servers lag behind web servers/browsers. Google reports some big companies like Samsung, AOL, AliExpress, Adobe not always negotiating encryption when sending email to gmail servers. Either they don't support TLS, or Google is too restrictive that they fallback to plain text.
Both serve a different type of connection, where the user is involved. Different story with postfix as you agree. Additionally, even if you exclude DHE, I'm not sure if this has any effect on TLS 1.3 (you can't define them in the cipherlist, the cipherlist you supply is ignored, and client is free to choose, DHE is available in TLS 1.3, but does not use custom DH groups).
How is it dangerous? I treated their I only take consideration to their cipherlist really, not so much their postfix generator which I've learned is probably not as well considered, but still is worth reading over their justification for certain choices.
I meant there was no one claiming that DHE key exchange was best choice. ffdhe4096 is fine.
I didn't say that. I asked you why you would not have I had pointed out RFCs regarding I agreed with you that submission ports were better for that. Port 465 is implicit TLS btw, no Some people may opt to have a container service send email without authentication by submitting to port 25, there's no real security issue when this is all done locally on the same server, no credentials to leak, and you'll get TLS anyway via Just to clarify, absolutely stick to submission ports when connecting to the server, eg via ThunderBird.
MSP is related to servicing users. Your containers that send transactional email are not the same. If they were sending email to an external server themselves instead of via your local SMTP server, then yes, they should absolutely do so securely over 465 if available, otherwise 587. Port 25 isn't going anywhere, users should not interact with it, but it's still important for transfer between MTAs.
That'd equate to dropped emails on port 25 if enforced, which the two RFC linked previously instruct you not to do.
Yeah, sorry about going off-topic here. Totally understand, it's costing me a lot of time too.. Thanks for the insights :) |
This feature was introduced by the PR: docker-mailserver#1463 There is no official documented support for custom DH parameters. As no guarantee is provided, this is considered an internal change, not a breaking one. There is no apparent need for special handling with `ONE_DIR=1`.
This feature was originally introduced by the PR: #1463 - Assign default DH params to use via Dockerfile build instead of copy and update at runtime. - Parameterized service names and paths. - Refactor postfix and dovecot dh methods to wrap shared dh logic - I don't see any value in checking the alternative service for dh params file to copy over, so that's now dropped too. - Another conditional check is dropped and the default fallback message for existing DH params file is no longer relevant. - Improved the remaining `_notify` messages. Collapsing the warning into a single logged message also seemed relevant. - There is no apparent need for special handling with `ONE_DIR=1`. Dropped it. - Refactor DH params tests - Combine custom and default DH param tests into single test file - docs: Add instructions to use custom DH params There is no official documented support for custom DH parameters. As no guarantee is provided, this is considered an internal change, not a breaking one.

Fix #1461, fix #1455.
DHE parameters choice is now compliant with the NCSC-NL TLS Guidelines.