Skip to content

Publish DMARC and receive reports

DMARC requires alignment of the visible From domain with successful SPF or DKIM. A real receiving report mailbox is required.

Setup

Prepare your values and Debian packages. Replace every example domain and IP.

Complete SPF, DKIM and their sending tests first. Start with p=none, evaluate actual reports for every legitimate sending route, then move deliberately to quarantine or reject. This block prints the initial DNS TXT value:

. /root/mailserver.env
printf '_dmarc.%s. IN TXT "v=DMARC1; p=none; rua=mailto:%s"\n' "$DOMAIN" "$REPORT_MAILBOX"

Test

set -euo pipefail
. /root/mailserver.env
dig "_dmarc.$DOMAIN" TXT +short
python3 - <<'PY'
import dns.resolver, os
values = ["".join(p.decode() for p in r.strings) for r in dns.resolver.resolve("_dmarc." + os.environ["DOMAIN"], "TXT")]
policies = [r for r in values if r.startswith("v=DMARC1;")]
assert len(policies) == 1
tags = dict(part.strip().split("=", 1) for part in policies[0].split(";") if "=" in part)
assert tags["p"] in ("none", "quarantine", "reject")
assert "mailto:" + os.environ["REPORT_MAILBOX"] in tags.get("rua", "").split(",")
print("PASS: a single DMARC policy and the expected reporting destination are published.")
PY

Also send an actual external message to REPORT_MAILBOX and confirm receipt. DNS does not prove mailbox delivery. An external reporting provider may require additional DMARC reporting authorization. For receiving checks in Rspamd, rspamadm configdump dmarc shows the active module; outgoing messages still need alignment.