DMARC_BUILDER: specify version, use values when specified (#1236)

* Allow version, use values when specified

* Updated DMARC_BUILDER docs
This commit is contained in:
Patrik Kernstock 2021-08-14 19:43:39 +01:00 committed by GitHub
parent fd6478a8ab
commit 9316517291
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 3 deletions

View file

@ -71,6 +71,7 @@ insecure IN TXT "v=DMARC1; p=none; ruf=mailto:mailauth-reports@example.com;
### Parameters
* `label:` The DNS label for the DMARC record (`_dmarc` prefix 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'`)

View file

@ -965,6 +965,7 @@ function CAA_BUILDER(value) {
// DMARC_BUILDER takes an object:
// label: The DNS label for the DMARC record (_dmarc prefix is added; default: '@')
// version: The DMARC version, by default DMARC1 (optional)
// 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')
@ -984,6 +985,10 @@ function DMARC_BUILDER(value) {
value.label = '@';
}
if (!value.version) {
value.version = 'DMARC1';
}
var label = '_dmarc';
if (value.label !== '@') {
label += '.' + value.label;
@ -997,7 +1002,8 @@ function DMARC_BUILDER(value) {
throw 'Invalid DMARC policy';
}
var record = ['v=DMARC1'];
var record = [];
record.push('v=' + value.version);
record.push('p=' + value.policy);
// Subdomain policy
@ -1045,7 +1051,7 @@ function DMARC_BUILDER(value) {
}
// Percentage
if (value.percent && value.percent != 100) {
if (value.percent) {
record.push('pct=' + value.percent);
}
@ -1082,7 +1088,7 @@ function DMARC_BUILDER(value) {
}
// Failure report format
if (value.ruf && value.failureFormat && value.failureFormat !== 'afrf') {
if (value.ruf && value.failureFormat) {
record.push('rf=' + value.failureFormat);
}