diff --git a/integrationTest/integration_test.go b/integrationTest/integration_test.go index 66dadb8fe..366898880 100644 --- a/integrationTest/integration_test.go +++ b/integrationTest/integration_test.go @@ -536,6 +536,10 @@ func cname(name, target string) *models.RecordConfig { return makeRec(name, target, "CNAME") } +func dhcid(name, target string) *models.RecordConfig { + return makeRec(name, target, "DHCID") +} + func ds(name string, keyTag uint16, algorithm, digestType uint8, digest string) *models.RecordConfig { r := makeRec(name, "", "DS") r.SetTargetDS(keyTag, algorithm, digestType, digest) @@ -1554,6 +1558,11 @@ func makeTests(t *testing.T) []*TestGroup { // ns("another-child", "ns101.cloudns.net."), //), ), + testgroup("PTR", + requires(providers.CanUsePTR), + tc("Create DHCPID record", dhcid("test", "AAIBY2/AuCccgoJbsaxcQc9TUapptP69lOjxfNuVAA2kjEA=")), + tc("Modify DHCPID record", dhcid("test", "Test/AuCccgoJbsaxcQc9TUapptP69lOjxfNuVAA2kjEA=")), + ), //// Vendor-specific record types diff --git a/models/domain.go b/models/domain.go index 63c8a8a27..b7640745d 100644 --- a/models/domain.go +++ b/models/domain.go @@ -135,7 +135,7 @@ func (dc *DomainConfig) Punycode() error { rec.SetTarget(t) case "CF_REDIRECT", "CF_TEMP_REDIRECT", "CF_WORKER_ROUTE": rec.SetTarget(rec.GetTargetField()) - case "A", "AAAA", "CAA", "DS", "LOC", "NAPTR", "SOA", "SSHFP", "TXT", "TLSA", "AZURE_ALIAS": + case "A", "AAAA", "CAA", "DHCPID", "DS", "LOC", "NAPTR", "SOA", "SSHFP", "TXT", "TLSA", "AZURE_ALIAS": // Nothing to do. default: return fmt.Errorf("Punycode rtype %v unimplemented", rec.Type) diff --git a/models/record.go b/models/record.go index a8ebd9436..894c49dac 100644 --- a/models/record.go +++ b/models/record.go @@ -595,7 +595,7 @@ func Downcase(recs []*RecordConfig) { // Target is case insensitive. Downcase it. r.target = strings.ToLower(r.target) // BUGFIX(tlim): isn't ALIAS in the wrong case statement? - case "A", "ALIAS", "CAA", "CF_REDIRECT", "CF_TEMP_REDIRECT", "CF_WORKER_ROUTE", "IMPORT_TRANSFORM", "LOC", "SSHFP", "TXT": + case "A", "ALIAS", "CAA", "CF_REDIRECT", "CF_TEMP_REDIRECT", "CF_WORKER_ROUTE", "DHCID", "IMPORT_TRANSFORM", "LOC", "SSHFP", "TXT": // Do nothing. (IP address or case sensitive target) case "SOA": if r.target != "DEFAULT_NOT_SET." { @@ -619,7 +619,7 @@ func CanonicalizeTargets(recs []*RecordConfig, origin string) { case "AKAMAICDN", "ANAME", "CNAME", "DS", "MX", "NS", "NAPTR", "PTR", "SRV": // Target is a hostname that might be a shortname. Turn it into a FQDN. r.target = dnsutil.AddOrigin(r.target, originFQDN) - case "A", "ALIAS", "CAA", "CF_REDIRECT", "CF_TEMP_REDIRECT", "CF_WORKER_ROUTE", "IMPORT_TRANSFORM", "LOC", "SSHFP", "TLSA", "TXT": + case "A", "ALIAS", "CAA", "DHCID", "CF_REDIRECT", "CF_TEMP_REDIRECT", "CF_WORKER_ROUTE", "IMPORT_TRANSFORM", "LOC", "SSHFP", "TLSA", "TXT": // Do nothing. case "SOA": if r.target != "DEFAULT_NOT_SET." { diff --git a/models/t_parse.go b/models/t_parse.go index 374526e91..1cbfeea63 100644 --- a/models/t_parse.go +++ b/models/t_parse.go @@ -59,6 +59,8 @@ func (rc *RecordConfig) PopulateFromString(rtype, contents, origin string) error return rc.SetTargetCAAString(contents) case "DS": return rc.SetTargetDSString(contents) + case "DHCID": + return rc.SetTarget(contents) case "LOC": return rc.SetTargetLOCString(origin, contents) case "MX": diff --git a/pkg/normalize/validate.go b/pkg/normalize/validate.go index 998baeaf0..3b30cc34b 100644 --- a/pkg/normalize/validate.go +++ b/pkg/normalize/validate.go @@ -61,6 +61,7 @@ func validateRecordTypes(rec *models.RecordConfig, domain string, pTypes []strin "ALIAS": false, "CAA": true, "CNAME": true, + "DHCID": true, "DS": true, "IMPORT_TRANSFORM": false, "LOC": true, @@ -73,7 +74,6 @@ func validateRecordTypes(rec *models.RecordConfig, domain string, pTypes []strin "SSHFP": true, "TLSA": true, "TXT": true, - "DHCID": true, } _, ok := validTypes[rec.Type] if !ok { diff --git a/pkg/prettyzone/prettyzone_test.go b/pkg/prettyzone/prettyzone_test.go index 85e2f3c93..88f93454d 100644 --- a/pkg/prettyzone/prettyzone_test.go +++ b/pkg/prettyzone/prettyzone_test.go @@ -272,6 +272,7 @@ func TestWriteZoneFileEach(t *testing.T) { d = append(d, mustNewRR(`_443._tcp.bosun.org. 300 IN TLSA 3 1 1 abcdef0`)) // Label must be _port._proto d = append(d, mustNewRR(`sub.bosun.org. 300 IN NS bosun.org.`)) // Must be a label with no other records. d = append(d, mustNewRR(`x.bosun.org. 300 IN CNAME bosun.org.`)) // Must be a label with no other records. + d = append(d, mustNewRR(`bosun.org. 300 IN DHCID AAIBY2/AuCccgoJbsaxcQc9TUapptP69lOjxfNuVAA2kjEA=`)) buf := &bytes.Buffer{} WriteZoneFileRR(buf, d, "bosun.org") if buf.String() != testdataZFEach { @@ -289,6 +290,7 @@ var testdataZFEach = `$TTL 300 IN SRV 10 10 9999 foo.com. IN TXT "my text" IN CAA 0 issue "letsencrypt.org" + IN DHCID AAIBY2/AuCccgoJbsaxcQc9TUapptP69lOjxfNuVAA2kjEA= 4.5 IN PTR y.bosun.org. _443._tcp IN TLSA 3 1 1 abcdef0 sub IN NS bosun.org. diff --git a/providers/capability_string.go b/providers/capability_string.go index fd5753163..1363be8dd 100644 --- a/providers/capability_string.go +++ b/providers/capability_string.go @@ -14,26 +14,26 @@ func _() { _ = x[CanUseAlias-3] _ = x[CanUseAzureAlias-4] _ = x[CanUseCAA-5] - _ = x[CanUseDS-6] - _ = x[CanUseDSForChildren-7] - _ = x[CanUseLOC-8] - _ = x[CanUseNAPTR-9] - _ = x[CanUsePTR-10] - _ = x[CanUseRoute53Alias-11] - _ = x[CanUseSOA-12] - _ = x[CanUseSRV-13] - _ = x[CanUseSSHFP-14] - _ = x[CanUseTLSA-15] - _ = x[CantUseNOPURGE-16] - _ = x[DocCreateDomains-17] - _ = x[DocDualHost-18] - _ = x[DocOfficiallySupported-19] - _ = x[CanUseDHCID-20] + _ = x[CanUseDHCID-6] + _ = x[CanUseDS-7] + _ = x[CanUseDSForChildren-8] + _ = x[CanUseLOC-9] + _ = x[CanUseNAPTR-10] + _ = x[CanUsePTR-11] + _ = x[CanUseRoute53Alias-12] + _ = x[CanUseSOA-13] + _ = x[CanUseSRV-14] + _ = x[CanUseSSHFP-15] + _ = x[CanUseTLSA-16] + _ = x[CantUseNOPURGE-17] + _ = x[DocCreateDomains-18] + _ = x[DocDualHost-19] + _ = x[DocOfficiallySupported-20] } -const _Capability_name = "CanAutoDNSSECCanGetZonesCanUseAKAMAICDNCanUseAliasCanUseAzureAliasCanUseCAACanUseDSCanUseDSForChildrenCanUseLOCCanUseNAPTRCanUsePTRCanUseRoute53AliasCanUseSOACanUseSRVCanUseSSHFPCanUseTLSACantUseNOPURGEDocCreateDomainsDocDualHostDocOfficiallySupportedCanUseDHCID" +const _Capability_name = "CanAutoDNSSECCanGetZonesCanUseAKAMAICDNCanUseAliasCanUseAzureAliasCanUseCAACanUseDHCIDCanUseDSCanUseDSForChildrenCanUseLOCCanUseNAPTRCanUsePTRCanUseRoute53AliasCanUseSOACanUseSRVCanUseSSHFPCanUseTLSACantUseNOPURGEDocCreateDomainsDocDualHostDocOfficiallySupported" -var _Capability_index = [...]uint16{0, 13, 24, 39, 50, 66, 75, 83, 102, 111, 122, 131, 149, 158, 167, 178, 188, 202, 218, 229, 251, 262} +var _Capability_index = [...]uint16{0, 13, 24, 39, 50, 66, 75, 86, 94, 113, 122, 133, 142, 160, 169, 178, 189, 199, 213, 229, 240, 262} func (i Capability) String() string { if i >= Capability(len(_Capability_index)-1) {