Mail Transport Security
Every mail domain on the server asks senders for an encrypted, verified connection (MTA-STS) and for reports on it (TLS-RPT), as it publishes SPF and DMARC: the panel sets both up, and Enforce is the default. The account holder can choose Testing or Off on the mail service's Sender Verification tab and reads the reports on its TLS Reports tab; the account docs explain it from their side.
Your part is the view across the server, the commands, and what sits behind them: the certificates, the policy endpoint, the report address, and the certificate senders without SNI are shown. Honouring other domains' policies when this server sends is a separate piece, MTA-STS on outgoing mail.
Wanted and served
Each mail domain has two modes. The desired mode is what its holder, or you, chose: Enforce (the default), Testing or Off. Nobody's choice is refused. The served mode is what the domain publishes now, and the panel alone moves it:
| Served | Published |
|---|---|
| Off | Nothing. |
| Not published yet | Only the name mta-sts.<domain> and its addresses, so that a certificate can cover it. No policy, no TXT record. |
| Testing | The policy with mode: testing, the _mta-sts TXT record, the name. |
| Enforced | The same, with mode: enforce. |
| Turning off | The same, with mode: none, for one max_age (a week by default). |
TLS reporting is on for every domain by default as well, and its
_smtp._tls record is published wherever MTA-STS can be.
When a domain publishes a policy
A domain goes from Off to Not published yet to the desired mode, when all of these hold:
- its mail comes to this server: no third-party incoming mail gateway;
- the panel writes its DNS: its zone's backend is not observe-only, since the TXT record's id changes with every policy change and a zone kept by hand could not follow;
- the certificates the panel has installed for the MX host and for the
domain's host are issued, not self-signed, not expired, and cover
mail.<domain>andmta-sts.<domain>, wildcards included.
The panel reads all of it from its own records; it runs no network check before publishing. Testing and Enforce then swap at once when the desired mode changes. Off, a gateway taking the MX, or a zone the panel stops writing turns a published policy off through Turning off, and withdraws one not published yet.
Once a domain enforces, the panel doesn't weaken the policy when a certificate goes bad later. A sender that honours it can't verify the MX and keeps the mail, retrying, until the certificate is fixed. Nothing tells the account holder or you yet: keep an eye on Certificates.
The pace
The panel takes one step per domain a minute after a change: of the desired mode, of the domain's certificates (the edge serves a new certificate within the minute after it is installed), or of the zone's DNS backend. A sweep every 15 minutes takes every step still due.
The upgrade that brought MTA-STS set every existing mail domain to Enforce with TLS reporting on, and published nothing by itself. The sweep then starts at most 100 domains a run and takes at most 500 steps, about 400 new domains an hour, so a server with 10,000 mail domains gets there in a day. Certificates follow at their own pace: a name the domain's wildcard certificate already covers needs no order, and an order goes to the CA at most once every 36 seconds, Let's Encrypt's own rate.
The admin view
System › Mail Transport Security lists every mail domain, 50 to a page, with the buttons above the list narrowing it to one served mode:
| Column | What it shows |
|---|---|
| Domain | The mail service, linked, and the account that owns it. |
| Served | The served mode. A note under it only while it differs from the wanted mode, e.g. "Not published yet. Starts once the certificate for mail.example.com, mta-sts.example.com is issued.", "Turning off until …", or why the domain can't publish (an incoming mail gateway, a zone whose DNS the panel doesn't write). |
| Wanted | The desired mode. |
| TLS-RPT | Reports requested or Not published. |
| Actions | Stop enforcing (wanted Enforce), Turn MTA-STS off (wanted Testing or Enforce). Both set the desired mode, as the account holder could. |
This Server, above the list, is the server's side, as the worker last
found it (hourly; mail tls status checks now):
- Certificate without SNI: the certificate the incoming mail server
shows a sender that doesn't name the host it wants. It is the
certificate of
mail.<server hostname>, and it should be publicly trusted. - Outbound MTA-STS: whether outgoing mail honours other domains' policies (see MTA-STS on outgoing mail).
How the policy is served
mta-sts.<domain>is a name of the domain's own host, not a host or service of its own, with the account's addresses (A and AAAA, no HTTPS record). It joins the host's certificate set, so the domain's wildcard certificate usually covers it already.- The web server passes
/.well-known/mta-sts.txt, in every virtual host and default host, to the panel over its socket (elpan-httpd 1.1.23 and later). The panel answers the domain's policy astext/plain, or 404 for a domain that publishes none. - The policy's
mxlines are the domain's MX records,mail.<domain>. The TXT record isv=STSv1; id=<YmdHis>, and the id changes when the policy does, and only then.
The policy endpoint comes before a suspended site's 503, and the panel doesn't look at the account's state. The policy is still true, the MX still answers, and withdrawing it would leave senders enforcing a policy they can no longer refresh.
Turning off keeps everything published for one max_age after the
policy says mode: none, the longest a sender may hold the previous
policy. A task in the panel's worker ends due retirements every hour.
When an account holder calls
"Mail from X doesn't arrive." The usual cause is a sender that enforces
MTA-STS but sends no SNI, so it is shown the certificate of
mail.<server hostname> instead of the domain's; the domain's
TLS Reports tab names it as a certificate name mismatch on
mail.<domain>. Set the domain to testing, here with Stop enforcing
or with:
elpanctl service mail mta-sts mode <domain> testing
The policy says mode: testing with a new id at once. A sender that looks
the TXT record up again sees it within the record's TTL; one that waits
for its cached copy to expire, within one max_age.
To see the domain as a sending server would, from this server:
elpanctl service mail mta-sts check <domain>
It checks, live, the policy name at each authoritative name server, the policy host's certificate, the policy downloaded through the web server with no redirect followed, the document against what the panel publishes, the TXT record's id, the MX's certificate over STARTTLS with SNI, and the TLS-RPT record. It is a diagnostic only: it stores nothing and changes no mode. The STARTTLS check runs as root through a privileged helper, because the server's firewall rejects outgoing port 25 for every user but root and the mail system.
Where the reports go
One address takes the reports of every domain:
tlsrpt@bounces.<server hostname>, on the bounce host, beside the
forwarder bounces. The incoming mail server pipes each message (at most
10 MB) to the panel, which reads the report and keeps, per domain, one
row per day and reporting organisation, with the session counts and the
failures by type and MX. Nothing the panel does depends on a report.
The address takes mail from anyone, so the panel accepts and drops, without an error, a message that is not a report, a report about a domain that is not on this server or has reporting off, a report whose period starts more than 31 days back or more than a day ahead, a second copy of a report, and the 101st organisation for a domain's day.
The rows are deleted 90 days after the day they cover, by a daily task (see Housekeeping). Deleting a mail service deletes its rows.
Commands
| Command | Does |
|---|---|
service mail mta-sts status <domain> | The desired and served mode, the status, whether its mail and DNS are this server's, the names still without a certificate, the policy id, max_age, the end of a retirement, and the TXT record and policy served. |
service mail mta-sts mode <domain> <mode> | Sets the desired mode, off, testing or enforce; the served mode follows. |
service mail mta-sts check <domain> | The live diagnostic. Changes nothing. |
service mail mta-sts max-age <domain> <seconds> | From 86400 (a day) to 31557600 (a year). A new value is a new policy and a new id. |
service mail mta-sts sweep | Takes the publication steps due and ends the retirements due, as the schedules do. --as-of=<time> is for a lab only. |
service mail edit <domain> --tls-rpt on|off | Turns TLS reporting on or off. |
A sender keeps the policy for the max_age it fetched it with. Lower it
well before a planned change, not on the day: a retirement started later
waits only the new value, while senders may still hold the old one.