Check your own server: a checklist
The checks to run on any mail server, in order, with the commands to run them and the chapter that explains each.
Run these from a machine outside your network, unless a step says
otherwise. Replace example.org with your domain, mx.example.org with your
MX host, and 203.0.113.25 with its address. Each step links to the chapter
that explains what a good answer looks like.
DNS
- One MX, or several, each a host name with an A or AAAA record, and no
CNAME.
dig +short MX example.org, thendig +short A mx.example.org. (DNS for email) - Reverse DNS matches.
dig +short -x 203.0.113.25names the MX host, and that name's A record is the same address. (DNS for email) - Exactly one SPF record, within 10 lookups, ending in
-allor~all.dig +short TXT example.org | grep spf1. (SPF) - A DKIM key for every selector you sign with.
dig +short TXT <selector>._domainkey.example.org. (DKIM) - A DMARC record, with
ruapointing somewhere you read.dig +short TXT _dmarc.example.org. Start atp=none. (DMARC) - Domains that send no mail say so:
v=spf1 -all, and a null MX if they receive none. (DNS for email)
Not an open relay
- Relaying for a stranger is refused.
swaks --server mx.example.org --from test@example.net --to someone@gmail.comis refused atRCPT TOwith454or554, not accepted with250. (The open relay) -
AUTHis not offered on port 25. TheEHLOreply on port 25 has noAUTHline. (Who may send) - Submission requires sign-in, over TLS. On 465 (or 587 after
STARTTLS),MAIL FROMbeforeAUTHis refused with530. (Who may send)
Encryption
- Port 25 offers STARTTLS, with a valid certificate for the MX name.
openssl s_client -starttls smtp -connect mx.example.org:25 -servername mx.example.org -brief. (Encryption in transit) - Mail apps connect with implicit TLS, on 465, 993 and 995, TLS 1.2 or later.
openssl s_client -connect mx.example.org:993 -brief. - No password is accepted in the clear on 587, 143 or 110 before
STARTTLS. - MTA-STS, if published, matches reality.
curl -s https://mta-sts.example.org/.well-known/mta-sts.txtlists every MX, and the_mta-stsTXT record'sidchanged when the policy last did. (MTA-STS and DANE)
Sending
- A message to an account at a large provider passes everything. Open
"Show original" and read
Authentication-Results:spf=pass,dkim=pass,dmarc=pass. (DMARC) - The sending address is on no blocklist, and not on a list of home addresses. (Deliverability)
- Signed-in users can only send as themselves, and have a sending limit. (Who may send)
- Bulk mail has one-click unsubscribe, DKIM-signed. (Bulk mail)
Receiving
- Mail to an address that does not exist is refused during the
conversation with
550 5.1.1, not accepted and bounced later. (Bounces) - Mail that is accepted is delivered or bounced, never dropped. Know where each filter's discards and quarantines go. (The black hole)
- Bounces and auto-replies are sent from
<>, and never sent in reply to<>. (Bounces)
Keeping it working
- The queue is not growing.
postqueue -por your server's equivalent; read the errors. (Bounces) - Certificates renew, for the MX, submission, IMAP,
mta-sts.andautoconfig.. - DKIM keys rotate, at least every six months. (DKIM)
- Someone reads the DMARC and TLS-RPT reports, or software does. (Why the security layers are so hard)
With REST Mail
chore dns:show prints every record a domain needs, and chore dns:check
compares them with what is published. The relay, sign-in, encryption, sender
and refusal checks above are REST Mail's defaults, not settings; the list in
Solved, solving, still open shows the
gaps that remain.