mirror of
https://github.com/StackExchange/dnscontrol.git
synced 2024-05-11 05:55:12 +00:00
DMARC_BUILDER: specify version, use values when specified (#1236)
* Allow version, use values when specified * Updated DMARC_BUILDER docs
This commit is contained in:
@ -71,6 +71,7 @@ insecure IN TXT "v=DMARC1; p=none; ruf=mailto:mailauth-reports@example.com;
|
|||||||
### Parameters
|
### Parameters
|
||||||
|
|
||||||
* `label:` The DNS label for the DMARC record (`_dmarc` prefix is added, default: `'@'`)
|
* `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'`
|
* `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)
|
* `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'`)
|
* `alignmentSPF:` `'strict'`/`'s'` or `'relaxed'`/`'r'` alignment for SPF (`aspf=`, default: `'r'`)
|
||||||
|
@ -965,6 +965,7 @@ function CAA_BUILDER(value) {
|
|||||||
|
|
||||||
// DMARC_BUILDER takes an object:
|
// DMARC_BUILDER takes an object:
|
||||||
// label: The DNS label for the DMARC record (_dmarc prefix is added; default: '@')
|
// 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'
|
// 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)
|
// 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')
|
// alignmentSPF: 'strict'/'s' or 'relaxed'/'r' alignment for SPF (aspf=, default: 'r')
|
||||||
@ -984,6 +985,10 @@ function DMARC_BUILDER(value) {
|
|||||||
value.label = '@';
|
value.label = '@';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!value.version) {
|
||||||
|
value.version = 'DMARC1';
|
||||||
|
}
|
||||||
|
|
||||||
var label = '_dmarc';
|
var label = '_dmarc';
|
||||||
if (value.label !== '@') {
|
if (value.label !== '@') {
|
||||||
label += '.' + value.label;
|
label += '.' + value.label;
|
||||||
@ -997,7 +1002,8 @@ function DMARC_BUILDER(value) {
|
|||||||
throw 'Invalid DMARC policy';
|
throw 'Invalid DMARC policy';
|
||||||
}
|
}
|
||||||
|
|
||||||
var record = ['v=DMARC1'];
|
var record = [];
|
||||||
|
record.push('v=' + value.version);
|
||||||
record.push('p=' + value.policy);
|
record.push('p=' + value.policy);
|
||||||
|
|
||||||
// Subdomain policy
|
// Subdomain policy
|
||||||
@ -1045,7 +1051,7 @@ function DMARC_BUILDER(value) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Percentage
|
// Percentage
|
||||||
if (value.percent && value.percent != 100) {
|
if (value.percent) {
|
||||||
record.push('pct=' + value.percent);
|
record.push('pct=' + value.percent);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1082,7 +1088,7 @@ function DMARC_BUILDER(value) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Failure report format
|
// Failure report format
|
||||||
if (value.ruf && value.failureFormat && value.failureFormat !== 'afrf') {
|
if (value.ruf && value.failureFormat) {
|
||||||
record.push('rf=' + value.failureFormat);
|
record.push('rf=' + value.failureFormat);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user