DMARC_BUILDER
DNSControl contains a DMARC_BUILDER which can be used to simply create DMARC policies for your domains.
Example
Simple example
D("example.com", REGISTRAR("my_registrar"), SERVICE("my_dns_provider"),
DMARC_BUILDER({
policy: "reject",
ruf: [
"mailto:mailauth-reports@example.com",
],
}),
);This yield the following record:
@ IN TXT "v=DMARC1; p=reject; ruf=mailto:mailauth-reports@example.com"Advanced example
D("example.com", REGISTRAR("my_registrar"), SERVICE("my_dns_provider"),
DMARC_BUILDER({
policy: "reject",
subdomainPolicy: "quarantine",
alignmentSPF: "r",
alignmentDKIM: "strict",
rua: [
"mailto:mailauth-reports@example.com",
"https://dmarc.example.com/submit",
],
ruf: [
"mailto:mailauth-reports@example.com",
],
failureOptions: "1",
}),
);This yields the following records:
Parameters
label:The DNS label for the DMARC record (_dmarcprefix is added, default:"@")version:The DMARC version to be used (default:DMARC1)policy:The DMARC policy (p=), must be one of"none","quarantine","reject"subdomainPolicy:The DMARC policy for subdomains (sp=), must be one of"none","quarantine","reject"(optional)nonexistentSubdomainPolicy:The DMARC policy for nonexistent subdomains (np=), must be one of"none","quarantine","reject"(optional)alignmentSPF:"strict"/"s"or"relaxed"/"r"alignment for SPF (aspf=, default:"r")alignmentDKIM:"strict"/"s"or"relaxed"/"r"alignment for DKIM (adkim=, default:"r")percent:Integer percentage (0-100) of messages to which the DMARC policy is applied (pct=, optional)rua:Array of aggregate report targets (optional)ruf:Array of failure report targets (optional)publicSuffixDomain:"y", or"n"or"u"indicates whether the domain is a Public Suffix Domain (psd=, default:"u")testMode:"y"or"n"DMARC policy test mode dictates whether p, sp, or np policy tags are applied (t=, default:"n")failureOptions:Object or string; Object containing booleansSPFandDKIM, string is passed raw (fo=, default:"0")failureFormat:Format of the message's failure reports (rf=); only emitted whenrufis also set (optional)reportInterval:Requested interval between aggregate reports, as aDurationor number of seconds (ri=, optional)ttl:Input forTTLmethod (optional)
Caveats
TXT records are automatically split using
AUTOSPLIT.URIs in the
ruaandrufarrays are passed raw. You must percent-encode all commas and exclamation points in the URI itself.
Last updated