Last reviewed:
Translated from German; if the versions differ, the German version applies.
MTA-STS
In short: MTA-STS (SMTP MTA Strict Transport Security) is a method by which a domain announces that its mail servers only accept email over an encrypted connection with a valid certificate. Sending servers that honour MTA-STS then do not deliver unencrypted or to the wrong servers (RFC 8461).
Why MTA-STS exists
Between mail servers, encryption is usually negotiated with STARTTLS. This method is opportunistic: anyone who can tamper with the connection can remove the “250 STARTTLS” announcement or redirect the connection to another server, and the sender then passes the message on without protection. RFC 8461 describes exactly this attack as the motivation (Section 1).
MTA-STS closes the gap with two components that belong together:
- a TXT record under
_mta-sts.of the domain. It contains the versionv=STSv1and an identifieridthat changes with every change to the policy (Section 3.1); - a policy file, retrievable over HTTPS at
https://mta-sts.<domain>/.well-known/mta-sts.txt. It names the mode, the permitted mail servers (mx) and how long sending servers may cache the policy (max_age, at most 31557600 seconds, i.e. about one year; Section 3.2).
The three modes
enforce– Sending servers do not deliver to mail servers that do not match the list, do not present a valid certificate or do not offer STARTTLS.testing– Messages are delivered as if there were no policy; servers that also support TLS-RPT do, however, send reports on failures.none– The domain no longer has an active policy; this mode is used to switch off in an orderly way.
This is how RFC 8461 describes it in Section 5.
How it differs
- MTA-STS and SPF, DKIM, DMARC: The three authentication methods answer whether a message comes from an authorised sender. MTA-STS answers something else: whether the route to the recipient’s mailbox is encrypted. It protects a domain’s receipt of email, not the sending of a newsletter.
- MTA-STS and TLS-RPT: TLS-RPT (RFC 8460) is the reporting channel for it. Through a separate TXT record under
_smtp._tls., the domain asks for reports on failed encrypted deliveries. - MTA-STS and DANE: DANE pursues the same goal but requires DNSSEC. MTA-STS relies on certification authorities instead and works without DNSSEC (RFC 8461, Section 2).
Easily confused
- “Encrypted email”: MTA-STS only encrypts the transport between two servers. On the servers themselves, the message is stored as before; this is not end-to-end encryption.
- Mode
noneand no record:noneis a valid policy by which a domain expressly declares that it no longer uses MTA-STS. RFC 8461 recommends it as an intermediate step before the TXT record and the policy file are removed (Section 8.3).
Example
From RFC 8461, Appendix A, with the standard’s example domain. There, the owner of example.com first only wants to collect reports without affecting delivery. The TXT record:
_mta-sts.example.com. IN TXT "v=STSv1; id=20160831085700Z;"
The policy file at https://mta-sts.example.com/.well-known/mta-sts.txt, here in test mode:
version: STSv1
mode: testing
mx: mx1.example.com
mx: mx2.example.com
mx: mx.backup-example.com
max_age: 1296000
Once the test run has shown no errors, mode is set to enforce and the id in the TXT record is changed so that sending servers fetch the new version.
Frequently asked questions
Do I need MTA-STS for my newsletter? Not for sending: MTA-STS concerns the domain that receives email. For sending to Gmail accounts, Google requires messages to be transmitted over a TLS connection.
What happens if the policy file is briefly unreachable? Sending servers use a cached policy as long as its max_age has not expired, and otherwise try to fetch a new one (RFC 8461, Section 5.1). If a delivery fails because of an enforce policy, they are to check for a newer policy before failing permanently (Section 5).
Why is max_age so long? RFC 8461 expects values in the range of weeks or more, so that an attacker cannot exploit the very moment of renewal (Section 3.2).
Related terms
Matching tool
- There is no dedicated tool for MTA-STS here. For the sending side: DMARC builder and SPF builder.