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

  • Postfix + Letโ€™s Encrypt + BIND9 + DANE Fully Automated TLSA Update Guide
  • Postfix + Letโ€™s Encrypt + BIND9 + DANE TLSA ๆŒ‡็ด‹่‡ชๅ‹•ๆ›ดๆ–ฐๅฎŒๆ•ดๆ•™ๅญธ
  • Deploying DANE in Postfix
  • ๅฆ‚ไฝ•ๅœจ Postfix ไธญ้ƒจ็ฝฒ DANE
  • DANE: DNSSEC-Based TLS Protection

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
  • QoS
  • Samba
  • Switch
  • Virtualization
  • VPN
  • WordPress
© 2025 Nuface Blog | Powered by Superbs Personal Blog theme