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", REG_MY_PROVIDER, DnsProvider(DSP_MY_PROVIDER),
DMARC_BUILDER({
policy: "reject",
ruf: [
"mailto:[email protected]",
],
}),
);This yield the following record:
@ IN TXT "v=DMARC1; p=reject; ruf=mailto:[email protected]"Advanced example
D("example.com", REG_MY_PROVIDER, DnsProvider(DSP_MY_PROVIDER),
DMARC_BUILDER({
policy: "reject",
subdomainPolicy: "quarantine",
percent: 50,
alignmentSPF: "r",
alignmentDKIM: "strict",
rua: [
"mailto:[email protected]",
"https://dmarc.example.com/submit",
],
ruf: [
"mailto:[email protected]",
],
failureOptions: "1",
reportInterval: "1h",
}),
);D("example.com", REG_MY_PROVIDER, DnsProvider(DSP_MY_PROVIDER),
DMARC_BUILDER({
label: "insecure",
policy: "none",
ruf: [
"mailto:[email protected]",
],
failureOptions: {
SPF: false,
DKIM: true,
},
}),
);This yields the following records:
@ IN TXT "v=DMARC1; p=reject; sp=quarantine; adkim=s; aspf=r; pct=50; rua=mailto:[email protected],https://dmarc.example.com/submit; ruf=mailto:[email protected]; fo=1; ri=3600"
insecure IN TXT "v=DMARC1; p=none; ruf=mailto:[email protected]; fo=d"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)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:Number between0and100, percentage for which policies are applied (pct=, default:100)rua:Array of aggregate report targets (optional)ruf:Array of failure report targets (optional)failureOptions:Object or string; Object containing booleansSPFandDKIM, string is passed raw (fo=, default:"0")failureFormat:Format in which failure reports are requested (rf=, default:"afrf")reportInterval:Interval in which reports are requested (ri=)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