On import, it appended my domain name to all the CNAME records #39

Closed
treeder opened this Issue Sep 10, 2012 · 7 comments

4 participants

@treeder

If this was in the zone file:

gdocs   3600    IN  CNAME   ghs.google.com

It ended up like this in Route 53:

ghs.google.com.mydomain.com.
@amix

I can confirm this bug as well :-/

@barnybug
Owner

I can confirm this is a bug.. in your zone files! ;)
Records must be terminated with a period, otherwise they are relative records.
See:
http://tools.ietf.org/html/rfc1033
"Domain names in the zone files can be one of two types, either
absolute or relative. An absolute name is the fully qualified domain
name and is terminated with a period. A relative name does not
terminate with a period, and the current default domain is appended
to it. The default domain is usually the name of the domain that was
specified in the boot file that loads each zone."

@barnybug barnybug closed this Sep 11, 2012
@treeder

hmmm, ok, well that's direct export from GoDaddy. Perhaps you could at least supply a flag that would not append the domain like import --no-append or something.

@barnybug
Owner

Suggest either manually fix file or running perl over the GoDaddy export to fix, this should do the trick:
perl -pe 's/(CNAME .+)(?!.)$/$1./i' broken.txt > fixed.txt

I'll add a note to the README.

@jdunck

FWIW, I had this same issue exporting from one account's route53 and importing to another. I checked my source zonefile (not the export from cli53 export, but the route53 api response) and confirmed it was missing the period. It turns out to be my fault: I have cnames without the trailing period -- which have worked, apparently, all this time, despite being wrong.

I'd suggest changing the readme (which I read, but skipped the relevant section due to GoDaddy mention) to instead note that it's useful to check whether exported cnames are defined correctly (that is, with either a trailing period or intentionally relative).

@jdunck

Also, the regex is not quite right - it didn't allow for hostnames with hyphens:
perl -pe 's/(CNAME\s+[-a-zA-Z0-9.-]+)(?!.)$/$1./i'
rather than
perl -pe 's/(CNAME\s+[a-zA-Z0-9.-
]+)(?!.)$/$1./i'

@barnybug
Owner

Please sent patch to docs

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