Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

msdns crashes on DNAME records. #2840

Open
spreegabe opened this issue Feb 14, 2024 · 2 comments
Open

msdns crashes on DNAME records. #2840

spreegabe opened this issue Feb 14, 2024 · 2 comments
Assignees

Comments

@spreegabe
Copy link

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

  1. Have an MSDNS Zone with DNAME records.
  2. Export the zone.
  3. 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
@cafferata
Copy link
Collaborator

cc: @tlimoncelli, the maintainer of the provider MSDNS ☺️

@tlimoncelli
Copy link
Contributor

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).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants