本站包含推广链接——通过链接注册我们可能获得佣金。

MTA-STS和TLS-RPT检测器:邮件传输安全完整指南 (2026)

MTA-STS和TLS-RPT检测器:邮件传输安全完整指南 (2026)

简介

MTA-STS (Mail Transfer Agent Strict Transport Security) คือ RFC 8461 ที่กำหนดให้ Mail Server ที่ส่งอีเมลไปหาโดเมนของคุณ ต้องใช้ TLS ที่ผ่านการตรวจสอบ Certificate แล้วเท่านั้น ป้องกันการโจมตีแบบ SMTP Downgrade ที่แฮกเกอร์บังคับให้ Mail Server ส่งผ่าน Plaintext หรือ TLS ที่ไม่ผ่านการตรวจสอบ

MTA-STS (RFC 8461) is a security standard that tells sending mail servers they must deliver email to your domain using verified TLS — not plaintext, not self-signed certificates. Before MTA-STS, an attacker performing a man-in-the-middle attack on the SMTP path could force servers to downgrade from TLS to plaintext, intercepting email content entirely.

重要性

ก่อน MTA-STS อีเมลที่ส่งระหว่างเซิร์ฟเวอร์อาจ Downgrade เป็น Plaintext ได้ถ้าแฮกเกอร์ขัดขวาง STARTTLS Negotiation ปัญหานี้เรียกว่า STARTTLS Stripping ซึ่ง MTA-STS ป้องกันได้โดยกำหนดไว้ล่วงหน้า (Out-of-Band) ว่าต้องใช้ TLS เสมอ

STARTTLS, the most common email encryption mechanism, is vulnerable to downgrade attacks. An attacker with network access between two mail servers can strip the STARTTLS capability advertisement, forcing servers to communicate in plaintext. MTA-STS prevents this by publishing the TLS requirement as an HTTPS-fetched policy, separate from the mail delivery path that an attacker might manipulate.

策略文件

Policy File คือไฟล์ Text ธรรมดาที่ต้องอยู่ที่ https://mta-sts.yourdomain.com/.well-known/mta-sts.txt Subdomain mta-sts ต้องมี Valid SSL Certificate เพราะ Sending Server จะ Fetch Policy ผ่าน HTTPS

The MTA-STS policy is a plain-text file served over HTTPS at a specific path on a subdomain. The subdomain must have a valid TLS certificate because sending servers verify it during the policy fetch. The policy specifies three key fields: the enforcement mode, the list of authorised MX hosts, and how long servers may cache the policy.

ตัวอย่าง Policy File สำหรับโหมด enforce:
version: STSv1
mode: enforce
mx: mail.example.com
mx: mail2.example.com
max_age: 604800

TXT记录

TXT Record ที่ _mta-sts.yourdomain.com บอก Sending Server ว่าโดเมนนี้มี MTA-STS Policy และอยู่ที่ Version ใด ค่า id= ต้องเปลี่ยนทุกครั้งที่แก้ Policy File เพื่อให้ Server ที่ Cache ไว้รู้ว่า Policy เปลี่ยนแล้ว

The _mta-sts TXT record signals to sending servers that an MTA-STS policy exists for this domain. The id= field acts as a version identifier — it must change every time the policy file changes so that mail servers that have cached the old policy know to fetch the new one.

ตัวอย่าง TXT Record:
_mta-sts.example.com. 300 IN TXT "v=STSv1; id=20260627T000000Z;"

TLS-RPT报告

TLS-RPT (TLS Reporting, RFC 8460) เป็นส่วนเสริมของ MTA-STS ที่ให้ Mail Server รายงานปัญหา TLS Connection กลับมาหาคุณ เพื่อให้รู้ว่ามี Server ใดที่ไม่สามารถส่งอีเมลได้เพราะ Policy ของคุณ

TLS-RPT (RFC 8460) complements MTA-STS by giving you visibility into TLS connection failures. Sending servers submit aggregate reports to the address you specify in the _smtp._tls TXT record, telling you how many sessions succeeded and failed, and why. This is invaluable when you first switch to enforce mode.

TLS-RPT TXT Record ตัวอย่าง:
_smtp._tls.example.com. 300 IN TXT "v=TLSRPTv1; rua=mailto:[email protected];"

使用方法

เครื่องมือ MTA-STS Checker ที่ Analyze.in.th ตรวจสอบทุกส่วนของ MTA-STS ในครั้งเดียว: TXT Record, Policy File, Mode และ TLS-RPT

The Analyze.in.th MTA-STS Checker verifies every component of your MTA-STS setup in one step: the _mta-sts TXT record, the HTTPS policy file reachability and content, the enforcement mode, MX host list, and the _smtp._tls TLS-RPT record.

  1. เปิด https://dnsxray.com/mta-sts.php
  2. พิมพ์ชื่อโดเมนในช่องค้นหา เช่น gmail.com
  3. กด Check MTA-STS
  4. ผลลัพธ์แสดง: TXT Record, Policy File Content, Mode, max_age, MX List, TLS-RPT

Results include: _mta-sts TXT record status; policy file reachability and full content (version, mode, MX hosts, max_age); policy ID match between TXT and file; and _smtp._tls TLS-RPT record with reporting URI.

配置步骤

การตั้งค่า MTA-STS ต้องสร้าง Subdomain, ทำ Policy File, และเพิ่ม TXT Record 2 อัน ทำตามลำดับนี้เพื่อหลีกเลี่ยงปัญหา

MTA-STS setup requires three steps: create the mta-sts subdomain with HTTPS, publish the policy file at the correct path, and add two TXT records. Do this in order — publishing the TXT record before the policy file is reachable can cause sending servers to report failures.

  1. สร้าง Subdomain: mta-sts.yourdomain.com พร้อม Valid SSL (Let's Encrypt)
  2. สร้าง Policy File: /.well-known/mta-sts.txt เนื้อหา mode: testing ก่อน
  3. เพิ่ม TXT Record: _mta-sts.yourdomain.com = v=STSv1; id=20260627T000000Z;
  4. เพิ่ม TLS-RPT: _smtp._tls.yourdomain.com = v=TLSRPTv1; rua=mailto:[email protected];
  5. Monitor Report: รอรับ Report 7 วัน ตรวจว่าไม่มี Failure
  6. เปลี่ยนเป็น enforce: เปลี่ยน mode: enforce และเปลี่ยน id= ใน TXT

常见问题

ปัญหาที่พบบ่อยที่สุดใน MTA-STS Setup คือ SSL Certificate ของ mta-sts Subdomain หมดอายุ หรือ Policy File ไม่ถูก Serve ด้วย Content-Type ถูกต้อง

The most common MTA-STS problems are: the mta-sts subdomain SSL certificate expiring (this immediately breaks policy delivery for sending servers); the policy file served with the wrong Content-Type header; the MX host list in the policy not matching actual MX records; and forgetting to update the id= field after changing the policy.

主机推荐

MTA-STS ตั้งค่าได้บน Hosting ทุกเจ้าที่ให้คุณสร้าง Subdomain และติดตั้ง SSL ได้ ไม่ต้องพึ่ง Hosting ที่ Support MTA-STS โดยเฉพาะ เพราะ Policy File คือ Static Text File ธรรมดา

MTA-STS can be configured on any hosting that lets you create a subdomain and install a TLS certificate — no special server software is required because the policy file is just a plain text file served over HTTPS. What matters is that your email routing uses MX hosts you control, and that those hosts support valid TLS. AsiaGB.com provides hosting with SSD storage, DirectAdmin, and 24-hour Thai-language support.

推荐AsiaGB.com — 我们使用并推荐的虚拟主机和VPS服务。服务器位于泰国和新加坡,SSD存储,DirectAdmin控制面板,24小时泰语支持,99%正常运行时间。

编辑首选泰国虚拟主机 — 可靠、实惠且有本地支持。

访问 AsiaGB →

常见问题 (FAQ)

MTA-STS แตกต่างจาก DANE อย่างไร
DANE (DNS-based Authentication of Named Entities) ใช้ DNSSEC เป็น Transport ในการ Authenticate TLS Certificate ต้องการ DNSSEC บนโดเมน MTA-STS ใช้ HTTPS Fetch แทน ไม่ต้องการ DNSSEC จึง Deploy ง่ายกว่าสำหรับโดเมนทั่วไป
ต้องเปิด MTA-STS บน mode enforce เลยไหม
ไม่แนะนำ เริ่มจาก mode: testing ก่อนและรับ TLS-RPT Report อย่างน้อย 7 วัน เพื่อให้แน่ใจว่าไม่มี MX Server ที่ใช้ Self-Signed Cert อยู่ ก่อนเปลี่ยนเป็น enforce
MTA-STS ป้องกันสแปมได้ไหม
ไม่ MTA-STS ป้องกัน SMTP Downgrade Attack ระหว่าง Server-to-Server ไม่ได้ป้องกันสแปม การป้องกันสแปมทำผ่าน SPF, DKIM, DMARC ซึ่งเป็นคนละชั้น
Policy File ต้องอัปเดตทุกกี่วัน
ไม่ต้องอัปเดตตามกำหนด ต้องอัปเดตเมื่อ MX Server เปลี่ยน หรือเมื่อต้องการเปลี่ยน Mode อย่าลืมเปลี่ยน id= ใน TXT Record ทุกครั้งที่แก้ Policy