DMARC is the only one of SPF / DKIM / DMARC that actually tells receivers what to do with a failed message. This article is the OpenDMARC install we run after opendkim-signing-postfix and spf-policy-records-deep — wire OpenDMARC as a milter, configure header alignment, publish a DMARC TXT record that starts at p=none for observation and graduates to quarantine/reject, and route the aggregate XML reports to a mailbox you actually read.
How to verify
Before publishing any DMARC record, confirm DKIM and SPF both produce pass on a probe message. DMARC compounds the two — if either is broken, DMARC will be too.
dig +short TXT _dmarc.example.com
dig +short TXT example.com # for the SPF record
dig +short TXT sh2026q2._domainkey.example.com
echo "test" | mail -s "dmarc probe" check-auth@verifier.port25.com
sudo journalctl -u opendmarc -n 50 --no-pager
Run the probe through the submission port (so OpenDKIM signs), wait for the verifier’s reply, and read the Authentication-Results. You want spf=pass, dkim=pass, and dmarc=pass — the last line is what proves alignment works.
What’s happening
DMARC sits on top of SPF and DKIM and adds two things that neither has on its own: a policy (what to do on failure) and alignment (the From: header domain must match either the SPF MAIL FROM domain or the DKIM d= domain). A message that passes SPF for bounces.example.com but has From: alice@example.com will fail DMARC alignment under the default relaxed mode unless the org domain matches.
The policy progression is operational doctrine:
p=none— receivers report but do not act. Run this for at least 4 weeks while you collect aggregate reports and identify every legitimate sender of your domain (CRM, ticketing, internal mailers, the CEO’s personal SaaS).p=quarantine; pct=10— receivers spam-folder a percentage of failing mail. Bumppctquarterly.p=quarantine(pct=100) — full quarantine.p=reject— receivers refuse failing mail at SMTP time.
OpenDMARC is again a milter — same pattern as OpenDKIM, on a different socket. Order matters: OpenDKIM must be in the milter chain before OpenDMARC, because OpenDMARC reads the Authentication-Results header OpenDKIM produces.
The procedure
-
Install OpenDMARC. The package ships the milter and a report aggregator:
sudo apt update sudo apt install -y opendmarc sudo systemctl status opendmarc --no-pager -
Configure OpenDMARC. Edit
/etc/opendmarc.conf:AuthservID mx1.example.com TrustedAuthservIDs mx1.example.com Socket local:/var/spool/postfix/opendmarc/opendmarc.sock PidFile /run/opendmarc/opendmarc.pid UserID opendmarc:opendmarc UMask 0002 IgnoreAuthenticatedClients true RejectFailures false FailureReports false FailureReportsBcc postmaster@example.com HistoryFile /var/lib/opendmarc/opendmarc.dat Syslog true SoftwareHeader false SPFSelfValidate trueRejectFailures falsematters during thep=noneand earlyp=quarantinephases — let the policy in DNS drive enforcement, not the milter; this avoids surprise drops while you collect telemetry. -
Create the socket directory in Postfix’s chroot:
sudo mkdir -p /var/spool/postfix/opendmarc sudo chown opendmarc:postfix /var/spool/postfix/opendmarc sudo chmod 750 /var/spool/postfix/opendmarcThen
/etc/default/opendmarc:SOCKET="local:/var/spool/postfix/opendmarc/opendmarc.sock" -
Wire OpenDMARC into Postfix after OpenDKIM. The order in
smtpd_miltersis the order milters run; OpenDMARC needs OpenDKIM’s verdict first:smtpd_milters = unix:opendkim/opendkim.sock, unix:opendmarc/opendmarc.sock non_smtpd_milters = $smtpd_milters -
Publish the DMARC TXT record at
_dmarc.example.com. Start atp=nonewith a reporting address you control:_dmarc.example.com. 3600 IN TXT "v=DMARC1; p=none; rua=mailto:dmarc-rua@example.com; ruf=mailto:dmarc-ruf@example.com; fo=1; adkim=r; aspf=r; pct=100"Verify:
dig +short TXT _dmarc.example.comadkim=randaspf=rare relaxed alignment —mail.example.comaligns withexample.com. Uses(strict) only when subdomain identity needs to be enforced. -
Reload Postfix and tail both milter logs:
sudo systemctl restart opendmarc sudo systemctl reload postfix sudo journalctl -u opendmarc -u opendkim -f -
Run the external probe and confirm full alignment. Same swaks command as in the OpenDKIM article, but check the
dmarc=line specifically:swaks --to check-auth@verifier.port25.com \ --from user@example.com --server mx1.example.com:587 -tls \ --auth LOGIN --auth-user user@example.com --auth-password 'pw'The reply should contain
dmarc=pass action=none p=none— pass on alignment, action none because policy isp=none. -
Set up aggregate (RUA) report ingestion. Major providers (Google, Microsoft, Yahoo) will send daily XML aggregates to the
rua=address. Use a tool to parse them: open-source options areparsedmarc(the one we run for clients) anddmarc-srg. Install minimally:sudo apt install -y python3-pip sudo pip3 install parsedmarc[elastic] parsedmarc --versionPipe the mailbox through
parsedmarcdaily; the output is per-source-IP pass/fail counts and the raw XML for the audit trail.
The DMARC progression — operational notes
- Run
p=nonefor at least 4 weeks. Use the RUA reports to find every sender of your domain — including the CEO’s personal newsletter tool, the ticketing system that pretends to besupport@example.com, and the marketing automation platform with its own SPF includes. - Add the legitimate senders to SPF and DKIM. Only move to
p=quarantine; pct=10when the RUA reports show >99% pass on a 7-day window. - Bump
pctby 20-30 per quarter. Hold atpct=100; p=quarantinefor one quarter, then move top=reject. - A subdomain that sends mail and doesn’t have its own DMARC record inherits the org-domain policy via the
sp=tag. Default behavior is “the same policy”; setsp=noneif a subdomain hasn’t been audited yet.
Common pitfalls
- The milter chain has OpenDMARC before OpenDKIM — OpenDMARC reads an empty
Authentication-Resultsand every check fails; order insmtpd_miltersis significant. p=rejectis published before SPF and DKIM are fully aligned across every legitimate sender — Gmail and Microsoft hard-bounce mail, including from the CFO; never publishrejectwithout 4+ weeks of RUA evidence.- The
rua=mailbox has a quota and silently drops daily aggregates from large receivers — use a dedicated account with generous storage, or pipe directly into a database viaparsedmarc. - A third-party sender (Mailgun, SendGrid, Mailchimp) appears in RUA reports failing alignment because the message goes out as
From: user@example.combut the DKIMd=ismg.mailgun.org— the fix is per-vendor (CNAME the DKIM selector under your domain). - The DMARC record uses
tag=value;with semicolons but a copy-paste from a blog post imports curly quotes — the record is silently invalid;dig +short TXT _dmarc.example.comwill show the right characters.
Stack Harbor runs DMARC as a quarterly program in the engagements we run — p=none with RUA ingestion at month one, telemetry-driven progression to quarantine, and reject only after evidence shows zero legitimate failure. If you have a domain stuck at p=none because nobody owns the telemetry, that program is part of our Managed Operations practice.