MTA-STS: making senders use encrypted delivery
Updated
Email between servers is encrypted when both sides support it, but a sender will quietly fall back to plain text if the encryption fails. An attacker on the network can cause that failure on purpose. MTA-STS (RFC 8461) is how a domain tells senders: only deliver to my mail servers over a properly encrypted connection, and hold the mail if you cannot.
Two parts
A TXT record at _mta-sts says that a policy exists, and carries an id that you change whenever the policy changes. The policy itself is a small text file that senders fetch over HTTPS, so it is protected by a certificate.
_mta-sts.example.com. TXT "v=STSv1; id=20260101T000000"
https://mta-sts.example.com/.well-known/mta-sts.txt
The policy file
version: STSv1 mode: enforce mx: mail.example.com mx: *.example.net max_age: 604800
- mode is testing, enforce or none. In testing, senders report problems but still deliver. In enforce, they refuse to deliver without valid encryption. None withdraws the policy
- Each mx line names a mail server you use. A *. entry matches exactly one name in front, so *.example.net covers mx1.example.net but not a.b.example.net
- max_age is how many seconds senders remember the policy, up to a year. A week (604800) or more is typical; under a day protects very little
- The file must be served as plain text with no redirect, from the mta-sts name, with a valid certificate
Start in testing mode
If the mx lines miss a mail server you really use, an enforcing policy makes senders refuse to deliver to it. Start with mode testing, publish TLS-RPT so senders tell you about failures, read the reports for a few weeks, then move to enforce. Whenever you change the file, change the id in the record too, or senders keep using their saved copy.
What it does and does not do
MTA-STS protects mail on its way to your domain from being downgraded or redirected. It does not say a message is genuine, and it does not protect mail after it arrives. Only senders that support it use it; large mail providers do. Subnetti reads the record and fetches the policy file once, and says what it found.
Check a domain's MTA-STS policy
Related
- TLS-RPT: hearing about failed encrypted deliveryWhat a TLS-RPT record is, where reports go and what they contain, and how it pairs with MTA-STS.
- DANE: pinning a mail server's certificate in DNSWhat a DANE (TLSA) record says, why it only works with DNSSEC, and which record form mail senders use.
- MX records and how email finds its wayHow MX records tell the world which servers accept mail for a domain, what the priority number means, and what a null MX is.