barnybug / cli53

Command line tool for Amazon Route 53

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

cli53 import converts all relative names to absolute ones

mostfunkyduck opened this issue · comments

Issue type

  • Bug report

cli53 version (cli53 --version)

revision f1b23d1 (master as of when I discovered this)

OS / Platform

Found on Linux (Linux user-ubuntu 5.0.0-31-generic #33~18.04.1-Ubuntu SMP Tue Oct 1 10:20:39 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux)

Steps to reproduce

I switched the domain in my account with 'example.com.' for these steps. For this to happen, you'll need to be using a domain in your r53.

Bind file:
$ORIGIN example.com.
subdomain 300 IN NS ns-613.awsdns-12.net

command:
cli53 import --dry-run --file ./example.com. example.com.

output:

+ subdomain.example.com. 300     IN      NS      ns-613.awsdns-12.net.example.com.

The relative names in the bind file have been converted to absolute names, which means that in a regularly formatted bind file extracted from AWS, all records will show up as needing replacement.

Expected behaviour

The dry run will use the relative names found in the bind file

Actual behaviour

The dry run will show absolute names

+ subdomain.example.com. 300     IN      NS      ns-613.awsdns-12.net.example.com.

Have you checked if the documentation has the information you require?

I didn't spot anything

Could you contribute a fix or help testing with this issue?

I can try, but as far as I can tell the problem is in the miekg/dns library's ParseZone function. I can log either a bug or a feature request with them if there's no existing way to parse it without this conversion. I believe there isn't, based on a quick read of that project, but I haven't dug deeply.

You will need to fix the export with something like this:
https://github.com/barnybug/cli53#broken-cname-exports-godaddy

A record in a bind file without the trailing dot is defined as a relative name, so the behaviour of cli53 is correct in this instance - it's your export file that is not correct.