mirror of
https://github.com/StackExchange/dnscontrol.git
synced 2024-05-11 05:55:12 +00:00
Add CAA support (#161)
* Added CAA support * Fixed bind parsing of CAA records * Added CAA parsing test * Renamed CAA json fields * Added CAA tag validation * Updated CAA docs to clarify on the value field * parse_tests: Fixed typo in caaflags * Added integration test * Small cleanups
This commit is contained in:
@ -118,6 +118,8 @@ function DefaultTTL(v) {
|
||||
}
|
||||
}
|
||||
|
||||
// CAA_CRITICAL: Critical CAA flag
|
||||
var CAA_CRITICAL = 1<<0;
|
||||
|
||||
|
||||
// DnsProvider("providerName", 0)
|
||||
@ -156,6 +158,18 @@ function ALIAS(name, target) {
|
||||
}
|
||||
}
|
||||
|
||||
// CAA(name,tag,value, recordModifiers...)
|
||||
function CAA(name, tag, value){
|
||||
checkArgs([_.isString, _.isString, _.isString], arguments, "CAA expects (name, tag, value) plus optional flag as a meta argument")
|
||||
|
||||
var mods = getModifiers(arguments,3)
|
||||
mods.push({caatag: tag});
|
||||
|
||||
return function(d) {
|
||||
addRecord(d,"CAA",name,value,mods)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// CNAME(name,target, recordModifiers...)
|
||||
function CNAME(name, target) {
|
||||
@ -303,6 +317,9 @@ function addRecord(d,type,name,target,mods) {
|
||||
var m = mods[i]
|
||||
if (_.isFunction(m)) {
|
||||
m(rec);
|
||||
} else if (_.isObject(m) && m.caatag) {
|
||||
// caatag is a top level object, not in meta
|
||||
rec.caatag = m.caatag;
|
||||
} else if (_.isObject(m)) {
|
||||
//convert transforms to strings
|
||||
if (m.transform && _.isArray(m.transform)){
|
||||
@ -312,6 +329,8 @@ function addRecord(d,type,name,target,mods) {
|
||||
_.extend(rec.meta,m);
|
||||
} else if (_.isNumber(m) && type == "MX") {
|
||||
rec.mxpreference = m;
|
||||
} else if (_.isNumber(m) && type == "CAA") {
|
||||
rec.caaflags |= m;
|
||||
} else {
|
||||
console.log("WARNING: Modifier type unsupported:", typeof m, "(Skipping!)");
|
||||
}
|
||||
|
Reference in New Issue
Block a user