MTA-STS and TLS-RPT in 15 minutes

2026-12-02来源 dev.toEnglish

SMTP encryption between servers is opportunistic by default: an attacker on the path can strip it. MTA-STS (RFC 8461) lets your domain announce "deliver to my MX only over validated TLS". TLS-RPT (RFC 8460) gives you reports on failures.

You need a web server answering on mta-sts.yourdomain.com with a valid certificate.

1. The policy file

Serve it at exactly this URL over HTTPS:

https://mta-sts.yourdomain.com/.well-known/mta-sts.txt 

Content:

version: STSv1 mode: testing mx: mail.yourdomain.com max_age: 86400 

mx: lists each MX host (wildcards like *.example.net are allowed). mode is none, testing or enforce. In testing, failures are reported but mail is still delivered.

2. The DNS records

_mta-sts.yourdomain.com. TXT "v=STSv1; id=20261201000000" _smtp._tls.yourdomain.com. TXT "v=TLSRPTv1; rua=mailto:tlsrpt@yourdomain.com" 

The id is any string that you change every time the policy changes, so senders refetch it.

3. Verify

dig TXT _mta-sts.yourdomain.com +short dig TXT _smtp._tls.yourdomain.com +short curl -i https://mta-sts.yourdomain.com/.well-known/mta-sts.txt 

The HTTP status must be 200 with a valid certificate (the RFC does not accept redirects). Also confirm each MX has a valid certificate matching its name:

openssl s_client -starttls smtp -connect mail.yourdomain.com:25 -servername mail.yourdomain.com 

4. Move to enforce

Read the TLS-RPT JSON reports for a few weeks. When no legitimate failure remains, set mode: enforce, raise max_age (the RFC caps it at 31557600 seconds), and update the id.

Check your own domain

If you would rather not run these commands by hand, there is a free check at https://attackscout.com/en?utm_source=devto&utm_medium=article

原文:https://www.a8q9.cn/en/article/mta-sts-and-tls-rpt-in-15-minutes-5241f2.html

相关文章