Lesson 5 of 14 · 15m
STARTTLS Is a Suggestion
STARTTLS upgrades are opportunistic and strippable; MTA-STS pins transport encryption with an HTTPS-fetched policy and TLS-RPT closes the visibility loop.
What Actually Happens
SMTP was born plaintext. When a sending MTA connects to your port 25 and gets 250-STARTTLS in the EHLO response, it may issue STARTTLS and upgrade the socket. May. If the capability isn't advertised, it sends in cleartext. If the certificate fails validation — and the baseline MTA does no validation, just opportunistic encryption — it proceeds anyway. This is "opportunistic TLS": better than nothing, indistinguishable from nothing under an active attacker.
The attack is embarrassingly mechanical. A MITM between the two servers proxies the TCP connection, strips STARTTLS from the EHLO advertisement (or answers the STARTTLS command with an error), and both sides fall back to cleartext. Neither MTA logs anything unusual — from each side it looks like the peer simply doesn't do TLS. Measurements published in 2015 ("Neither Snow Nor Rain Nor MITM") found exactly this at scale in the wild, and lazy cleartext fallback remained the dominant inter-MTA behavior for years after.
The Wrong Mental Model
"STARTTLS encrypts mail." It offers encryption. There is a difference between a protocol that allows TLS and one that requires it, and SMTP's requirement is zero. No MTA refuses to deliver because the peer lacks TLS — if it did, a large share of internet mail would stop moving, which is precisely why the fallback exists and precisely why stripping works.
MTA-STS: Pinning for Mail
RFC 8461 borrows the HSTS idea. Two artifacts:
- A DNS record:
_mta-sts.sudosecurity.org→v=STSv1; id=20261103T01. Theidis a cache-buster — bump it every time the policy changes. - A policy file served over HTTPS from
https://mta-sts.sudosecurity.org/.well-known/mta-sts.txt:
version: STSv1
mode: testing
mx: mail.sudosecurity.org
mx: *.sudosecurity.org
max_age: 86400A sending MTA that supports MTA-STS fetches this policy and caches it for max_age seconds. In mode: enforce, it refuses to deliver to any MX host not matching an mx: pattern, refuses unauthenticated TLS (valid cert covering the MX hostname — matching the MX name, not the domain), and refuses cleartext fallback. In testing, it delivers normally but reports failures. none withdraws the policy.
Because the policy comes over HTTPS, an attacker on the SMTP path can't forge it — they already needed to not-strip TLS to reach the point where they learn the policy exists. The mx: globs must cover every MX hostname exactly as published; *.example.com matches exactly one leading label — mail.example.com yes, foo.bar.example.com no — and example.com matches literally.
TLS-RPT: The Reporting Half
RFC 8460's _smtp._tls.sudosecurity.org → v=TLSRPTv1; rua=mailto:dmarc@sudosecurity.org gives senders somewhere to mail JSON failure reports — which MX host, which certificate chain failed, whether a policy blocked them. Without it, an enforced MTA-STS deployment is flying blind: mail that can't be delivered securely just doesn't arrive, and the first you hear of it is a user complaint a week later.
DANE: The Other Answer
DANE (RFC 7672) publishes certificate fingerprints in DNS: TLSA _25._tcp.mail.example.com, usage 3 1 1 (DANE-EE, SPKI sha256). Stronger than MTA-STS in one way — no web PKI dependency — but requires DNSSEC end to end, and DNSSEC deployment is its own operational commitment. Postfix supports it (smtp_dns_support_level = dnssec, smtp_tls_security_level = dane). Pick one: for most operators MTA-STS + TLS-RPT is the reachable bar.
Correct Practice
Deploy mode: testing plus TLS-RPT first and actually read the reports — they tell you whether your certificate and MX names hold up under real senders. Bump id= on every change. Keep max_age at 86400 until you're confident. Move to enforce only after weeks of clean reports. This is exactly the progression a fresh Stalwart setup follows — and the mailadmin-side HTTPS host is already the natural place to serve mta-sts.txt.
Keep reading
Related articles from the SudoSecurity blog.
Self-Hosted Email in 2026: Mailcow vs Mailu vs Stalwart — Which Mail Server Should You Trust?
Self-hosted email in 2026 comes with more choices than ever. This guide compares Mailcow, Mailu, and Stalwart across security, performance, resource usage, scalability, administration, and deliverability to help you choose the right mail server for your needs.
Stalwart 1.0 Says It's the Fastest Mail Server on the Planet. Here Are the Numbers.
After five years, Stalwart hit its first stable release on October 26 with benchmarks claiming it beats Postfix and Dovecot in 35 of 38 head-to-head tests. Every one of those numbers was produced by the vendor.
How to Self-Host Your Own Email Server With Mailcow in 2026 — Complete Setup Guide
How to Self-Host Your Own Email Server With Mailcow in 2026 — Complete Setup Guide Meta Description: Stop letting Google and Microsoft read your email. This guide sets up a complete private email server with Mailcow on a NetCup VPS — DNS, SPF, DKIM, DMARC, TLS, webmail, and mobile clients.
What Self-Hosters Are Ripping Out of Their Stacks in 2026
Self-hosted email is losing to Gmail's hard SMTP rejections. Self-hosted password managers are split down the middle. And self-hosted music is doing the opposite of what you'd expect.