foxcpp / maddy

✉️ Composable all-in-one mail server.
https://maddy.email
GNU General Public License v3.0
4.81k stars 238 forks source link

Downgrade protection for Opportunistic Security schemes for SMTP #178

Open foxcpp opened 4 years ago

foxcpp commented 4 years ago

Transport security in SMTP world is merely Opportunistic, there is no practice like in the Web to always require encryption with matching DNS-ID and trusted certificate. Additionally, things get complicated with the use of MX records to delegate mail handling.

Overall, here are possible options for each SMTP connection, sorted by protection "strength":

Each of these options is better than the previous one so it makes sense to support all of them without directly falling back to the weakest one (no encryption).

Interaction with REQUIRETLS

SMTP REQUIRETLS extension requires TLS with valid and matching certificates and MX records authentication using either DNSSEC or MTA-STS. So messages using it are handled in a "strongest security or fail delivery" way instead of Opportunistic Security approach typically employed by MTAs.

Though, MTA-STS and DANE have similar but not same security characteristics (as was noted in the draft spec review, see References). This might degrade the actual security provided by extension in the long term if DANE becomes more widespread than MTA-STS (unlikely).

Proposal

  1. Implement REQUIRETLS extension (issue #123)

  2. Provide policy options to require certain security level for all messages (already done, see authenticate_mx, require_mx_auth and require_tls directives for remote module).

  3. (Possibly) Implement downgrade protection for non-REQUIRETLS messages by remembering the authentication/encryption status like chasquid does it. It will help with messages sent without using REQUIRETLS extension (as practice shows, SMTP extensions support is poor and grows slowly). Though, it is not clear whether to group options by protection scope (passive/active attacks) for simplicity or provide high granularity. Later option may be better for security but also increases the chance of unexpected interactions.

References

foxcpp commented 4 years ago

Another option:

Observation: Most deployed TLSA records use DANE-EE.