dnscontrol
dnscontrol copied to clipboard
msdns crashes on DNAME records.
NOTE: Have a general question? You'll get a better response on the dnscontrol-discuss email list!
Describe the bug When exporting a zone from active directory dns with DNAME records, dnscontrol crashes.
failed GetZone gzr: msdns/convert.go:nativeToRecord rtype="DNAME" unknown: props=map[DomainNameAlias:asdfasdfasdfasdfasdf.gx.internal.cloudapp.net.] and map[]
To Reproduce
- Have an MSDNS Zone with DNAME records.
- Export the zone.
- crash with no exported zone files, just an error message on the console.
DNS Provider
- MSDNS
- not tested on any others.
Additional context This works* in v3 with the activedirectory provider. The DNAME records aren't in the pretty dnscontrol output, but are in the dump from the underlying powershell command and marked as unsupported, snippets below.
the following is output from dnscontrol v3 with the activedir
provider.
-- adzonedump.contoso.ai.json
{
"hostname": "prod.azure",
"recordtype": "DNAME",
"timestamp": null,
"timetolive": 60,
"recorddata": "unsupported_record_type"
},
-- powershell.log
# 2024-02-13 22:12:14.8822189 +0000 UTC
(Get-Module -ListAvailable DnsServer) -ne $null
OUTPUT: START
True
OUTPUT: END
# 2024-02-13 22:12:15.709802 +0000 UTC
@("contoso.ai") | %{
Get-DnsServerResourceRecord -ComputerName azprod-dc01.ad.contoso.ai -ZoneName $_ | select hostname,recordtype,@{n="timestamp";e={$_.timestamp.tostring()}},@{n="timetolive";e={$_.timetolive.totalseconds}},@{n="recorddata";e={($_.recorddata.ipv4address,$_.recorddata.ipv6address,$_.recorddata.HostNameAlias,$_.recorddata.NameServer,"unsupported_record_type" -ne $null)[0]-as [string]}} | ConvertTo-Json > adzonedump.contoso.ai.json
}
OUTPUT: START
OUTPUT: END
cc: @tlimoncelli, the maintainer of the provider MSDNS
☺️
Hey there!
I have good news and bad news. The good news is that I can reproduce the issue and have a work-around. The bad news is that implementing DNAME could be quite difficult.
As a work-around, you can change this error into a no-op:
$ git diff
diff --git a/providers/msdns/convert.go b/providers/msdns/convert.go
index d27372a1..f5219217 100644
--- a/providers/msdns/convert.go
+++ b/providers/msdns/convert.go
@@ -117,9 +117,7 @@ func nativeToRecords(nr nativeRecord, origin string) (*models.RecordConfig, erro
//rc.SetTargetTXTString(sprops["DescriptiveText"])
rc.SetTargetTXT(sprops["DescriptiveText"])
default:
- return nil, fmt.Errorf(
- "msdns/convert.go:nativeToRecord rtype=%q unknown: props=%+v and %+v",
- rtype, sprops, uprops)
+ return nil, nil
}
return rc, nil
Sadly implementing the DNAME record would be difficult since there doesn't seem to be a powershell command that can create those records. (DNSControl generates PowerShell statements to do most of the work in MSDNS).