Mail authentication: SPF, DKIM, DMARC, MTA-STS and DANE
How Berth signs and protects a domain's mail with SPF, DKIM and DMARC, reads DMARC and TLS-RPT reports, moves DMARC to reject in one click once at least 98 % of mail passes, and adds MTA-STS, DANE and OpenPGP keys via WKD.
On this page
Receiving mail servers decide whether to trust your mail based on a handful of DNS records: SPF says which servers may send for the domain, DKIM signs each message, and DMARC tells receivers what to do when both fail. MTA-STS, TLS-RPT and DANE do the same for the encrypted connection between mail servers. Berth sets all of these up when you switch mail on, publishes them where it can, and reads the reports that come back so you can tighten the policy with confidence.
The records Berth recommends
When you switch mail on, the card Mail DNS on the domain's Mail tab lists these records:
| Record | Name | What it does |
|---|---|---|
| MX | example.com | Incoming mail arrives at this server. |
| SPF (TXT) | example.com | v=spf1 mx ~all: only the servers in the MX record may send for the domain. |
| DKIM (TXT) | berth._domainkey.example.com | The public half of the domain's signing key. |
| DMARC (TXT) | _dmarc.example.com | v=DMARC1; p=quarantine; rua=mailto:dmarc-rapport@example.com |
| TLS-RPT (TXT) | _smtp._tls.example.com | v=TLSRPTv1; rua=mailto:tlsrpt-rapport@example.com |
When the panel has HTTPS, an autodiscover SRV record for Outlook is added (see Webmail and mail clients), and with the domain's own mail hostnames switched on, the _mta-sts TXT record joins them (see MTA-STS below). When a subscription sends from its own outbound IP address, the recommended SPF record includes that address.
Check the DNS records compares every record with what public resolvers return. It also catches the classic mistakes: two SPF records or two DMARC records (receivers then ignore all of them), or an existing record that is weaker than the recommendation.
berth mail status --domain example.com --checkHow the records get published
Berth handles DNS in three ways, which you can mix per domain (details in DNS):
- DNS on this server. The zone on Berth's own BIND server always contains the mail records; you don't have to do anything.
- Through a DNS provider's API (Cloudflare, TransIP, Hetzner, deSEC, OXXA, Route 53, DigitalOcean, or your own nameserver over RFC 2136). The panel writes MX, SPF, DKIM, DMARC, MTA-STS and autodiscover and leaves your other records alone. When an SPF or DMARC record already exists, it is merged rather than replaced, and the stricter existing DMARC policy is kept.
- DNS elsewhere. The panel shows the records to copy, each with a copy button, and checks them on request.
DKIM
Every mail domain gets its own 2048-bit RSA key, created when mail is switched on. All outgoing mail for the domain is signed with this key (by rspamd, or by OpenDKIM on servers without the spam filter), but only when the sender is entitled to the domain: the From: domain must match the envelope sender and, for mail sent with a login, the authenticated mailbox. A site or mailbox of one subscription can never get mail signed with another subscription's domain; see outbound mail. New domains use the selector berth; domains taken over from another server keep their existing selector and key, so mail keeps verifying during and after a migration.
The private key is part of the subscription's backup, so a restored or migrated domain signs with the same key.
DMARC, the reports and moving to reject
The recommended DMARC record starts at p=quarantine: mail that fails both SPF and DKIM alignment goes to the receiver's spam folder. The record asks receivers for daily aggregate reports, which arrive at dmarc-rapport@<domain> and are read by the panel itself.
Reading the reports
The Reports tab of the mail page, titled DMARC and TLS reports, shows for the last 7, 30 or 90 days or the whole year:
- the share of mail that passes DMARC, and the policy receivers saw;
- every source (IP address) that sent mail as your domain, with the service name where it is recognised, how much of its mail passed, and what the receiver did with mail that failed (delivered anyway, spam folder, refused);
- which organisations sent reports (Google, Microsoft and others);
- advice, for example which source to add to SPF or sign with DKIM before you tighten the policy.
When the pass rate drops sharply, the administrators get an alert. A package can be set to warn the customer as well (berth plan set … --notify-customer).
berth mail-reports show --domain example.com --days 30
berth mail-reports import # read newly arrived reports nowOne-click reject
p=reject tells receivers to refuse spoofed mail outright, which is what you want once you know all your legitimate mail passes. The domain's Internet.nl tab checks the domain against the standards that internet.nl tests, and its DMARC item has a fix button: To p=reject, or Fix when there is no valid policy yet.
The panel only sets reject when the reports of the last 30 days show that at least 98 % of the domain's mail passes DMARC. Below that it sets quarantine and the reports page tells you which sources still fail.
berth domain internetnl --domain example.com
berth domain internetnl --domain example.com --fix dmarcThe fix changes the record on the panel's own DNS server or at a linked provider. With DNS elsewhere, the page shows the record to set.
TLS-RPT
TLS-RPT (RFC 8460) asks sending servers to report whether they managed to deliver to your server over an encrypted connection. The reports arrive at tlsrpt-rapport@<domain> and appear on the same Reports tab: the share of encrypted connections and, per sending server, the outcome. A sudden failure there usually points to a certificate or DANE problem.
MTA-STS
MTA-STS (RFC 8461) lets senders that cannot check DNSSEC still insist on an encrypted connection with a valid certificate. Berth serves the policy at https://mta-sts.<domain>/.well-known/mta-sts.txt when the domain's own mail hostnames are switched on: card Mail under the domain's own name on the mail page, or:
berth mail hosts --domain example.com --onThe policy names the server's mail hostname (and mail.<domain> when that is on) as the allowed MX. It starts in testing mode and moves to enforce only once the mail hostname has a publicly trusted certificate, so a self-signed or test certificate never causes senders to refuse delivery. The _mta-sts.<domain> TXT record carries an id that changes whenever the policy changes, so senders fetch the new version.
DANE
DANE (RFC 7672) ties the mail server's certificate to DNSSEC-signed TLSA records, so a sender can verify it is talking to the right server without trusting any certificate authority.
Inbound: TLSA records for this server
The panel publishes TLSA records of type 3 1 1 on _25._tcp.<mailhost> when it manages the zone (its own DNS server or a linked provider). Switch it on in the card DANE for the mail server on the DNS providers page, or:
berth dns dane --onThe records cover the current key and the next one. A certificate with the next key is only requested once its TLSA record has been in DNS, validated, for at least two days, so a key rollover never breaks delivery for senders that cache the old record. DANE requires DNSSEC on the zone; without it, senders ignore the records.
Outbound: checking other servers
For mail it sends, Postfix uses DANE where the receiving domain publishes TLSA records. That needs a local DNSSEC-validating resolver; Berth installs unbound for this unless you install with --no-resolver.
OpenPGP and WKD
A mailbox can publish a public OpenPGP key. Open the mailbox on the mail page, section Encrypt (PGP), choose Add public key, paste the key and click Publish key. Never paste a private key.
The key is published through the Web Key Directory (WKD), at openpgpkey.<domain> or directly on the domain, so Thunderbird, GnuPG and Mailvelope find it by themselves when someone writes to that address.
Optionally the server can encrypt all incoming mail for the mailbox with that key on arrival, as PGP/MIME, before it is stored: Turn on encryption. Sender and subject stay visible; the content can then only be read with the private key, for example in Thunderbird, FairEmail or Mailvelope, and searching message bodies on the server no longer works.
berth mail account pgp --address anna@example.com --file anna.asc
berth mail account pgp --address anna@example.com --encrypt on
berth mail account pgp --address anna@example.com --removeWhat is not included
BIMI and SRS are not part of Berth. ARC headers on incoming mail are checked by the spam filter, but Berth does not add its own ARC signature when forwarding.