Skip to content

Nuface Blog

ιš¨ζ„ιš¨ζ‰‹θ¨˜ Casual Notes

Menu
  • Home
  • About
  • Services
  • Blog
  • Contact
  • Privacy Policy
  • Login
Menu

MTA-STS: SMTP Strict Transport Security

Posted on 2025-12-032025-12-03 by Rico

πŸ“Œ Introduction

Traditional SMTP transmits email in plaintext, which makes it vulnerable to downgrade attacks, DNS spoofing, and man-in-the-middle (MITM) attacks. To strengthen email security, major providers like Google, Microsoft, and Yahoo introduced MTA-STS (Mail Transfer Agent – Strict Transport Security).

The goal of MTA-STS is simple:

πŸ‘‰ Force all sending MTAs to use encrypted TLS with valid certificates, otherwise reject the delivery.


πŸ” What Is MTA-STS?

MTA-STS is a security policy that allows domain owners to declare that inbound email must use:

  1. TLS encryption
  2. Valid certificates (no self-signed or expired certs)
  3. No fallback to plaintext SMTP

If a secure TLS session cannot be established, the sending MTA will temporarily defer or reject the message instead of sending it insecurely.


🧩 Four Components of MTA-STS

1️⃣ DNS TXT record

Announces that your domain uses MTA-STS:

_mta-sts.example.com. TXT "v=STSv1; id=20250101"

id is a version identifier and must be updated when policies change.


2️⃣ HTTPS Endpoint

Senders download your STS policy from:

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

Requirements:

  • Must use HTTPS
  • Must have a valid public CA certificate
  • Must be publicly accessible

3️⃣ MTA-STS Policy File

Example:

version: STSv1
mode: enforce
mx: mail.example.com
mx: mx-backup.example.com
max_age: 604800

Parameter reference:

ParameterMeaning
versionAlways STSv1
modetesting / enforce / none
mxAuthorized MX hosts
max_ageCache duration in seconds

4️⃣ Sender MTA Cache

Sending MTAs cache STS policies to avoid DNS interception.


πŸ”„ How MTA-STS Works

  1. Sender checks _mta-sts.example.com TXT
  2. Downloads the HTTPS STS policy
  3. Validates MX hostnames
  4. Enforces TLS for delivery
  5. Validates certificate chain
  6. Caches the policy and completes delivery

If TLS negotiation or certificate validation fails, the sender will defer or reject delivery depending on the mode.


πŸ†š MTA-STS vs TLS-RPT vs DANE

TechnologyPurposeProsCons
MTA-STSEnforce TLSNo DNSSEC required, widely adoptedNeeds HTTPS endpoint
TLS-RPTTLS error reportingEasy monitoringGenerates many reports
DANECertificate validation via DNSSECExtremely secureDNSSEC is complex

Most enterprises deploy:
πŸ‘‰ MTA-STS (enforce) + TLS-RPT


πŸ— How to Deploy MTA-STS

1️⃣ Add DNS TXT

_mta-sts.example.com. TXT "v=STSv1; id=20250101"

2️⃣ Create HTTPS endpoint

File path:

/var/www/mta-sts/.well-known/mta-sts.txt

3️⃣ Create policy file

version: STSv1
mode: enforce
mx: mail.example.com
max_age: 604800

4️⃣ Ensure MX servers use valid public CA TLS certificates

  • Proper CN/SAN
  • TLS 1.2 / 1.3 support

5️⃣ (Recommended) Enable TLS-RPT

_smtp._tls.example.com. TXT "v=TLSRPTv1; rua=mailto:tls-rpt@example.com"

⚠ Common Mistakes

❌ Certificate CN/SAN mismatch

β†’ Email rejected

❌ Self-signed certificate

β†’ Delivery fails under enforce mode

❌ Forgetting to update id

β†’ Policy will not refresh

❌ Staying in “testing” mode

β†’ TLS is not enforced


🎯 Conclusion

MTA-STS is an essential security layer for any modern email system. It is easy to deploy, requires no DNSSEC, and is supported by all major providers. If you manage Postfix, Dovecot, or any enterprise mail infrastructure, enabling MTA-STS + TLS-RPT greatly enhances trust, security, and deliverability.

Recent Posts

  • Building an Internal API Platform with Python, Flask, Docker, and Apache Reverse Proxy
  • 打造企ζ₯­ε…§ιƒ¨ API εΉ³ε°οΌšδ½Ώη”¨ Python + Flask + Docker + Apache Reverse Proxy
  • Cleaning Up Unused Let’s Encrypt Certificates in a Docker Certbot Environment
  • 使用 Docker Certbot εˆͺι™€δΈε†δ½Ώη”¨ηš„ Let’s Encrypt 憑證
  • Postfix + Let’s Encrypt + BIND9 + DANE Fully Automated TLSA Update Guide

Recent Comments

  1. Building a Complete Enterprise-Grade Mail System (Overview) - Nuface Blog on High Availability Architecture, Failover, GeoDNS, Monitoring, and Email Abuse Automation (SOAR)
  2. Building a Complete Enterprise-Grade Mail System (Overview) - Nuface Blog on MariaDB + PostfixAdmin: The Core of Virtual Domain & Mailbox Management
  3. Building a Complete Enterprise-Grade Mail System (Overview) - Nuface Blog on Daily Operations, Monitoring, and Performance Tuning for an Enterprise Mail System
  4. Building a Complete Enterprise-Grade Mail System (Overview) - Nuface Blog on Final Chapter: Complete Troubleshooting Guide & Frequently Asked Questions (FAQ)
  5. Building a Complete Enterprise-Grade Mail System (Overview) - Nuface Blog on Network Architecture, DNS Configuration, TLS Design, and Postfix/Dovecot SNI Explained

Archives

  • December 2025
  • November 2025
  • October 2025

Categories

  • AI
  • Apache
  • Cybersecurity
  • Database
  • DNS
  • Docker
  • Fail2Ban
  • FileSystem
  • Firewall
  • Linux
  • LLM
  • Mail
  • N8N
  • OpenLdap
  • OPNsense
  • PHP
  • Python
  • QoS
  • Samba
  • Switch
  • Virtualization
  • VPN
  • WordPress
© 2025 Nuface Blog | Powered by Superbs Personal Blog theme