mirror of
https://github.com/StackExchange/dnscontrol.git
synced 2024-05-11 05:55:12 +00:00
convertzone should do a better job with NS records. Fixes https://github.com/StackExchange/dnscontrol/issues/162
This commit is contained in:
@@ -1,5 +1,9 @@
|
|||||||
# convertzone -- Converts a standard DNS zonefile into tsv, pretty, or DSL
|
# convertzone -- Converts a standard DNS zonefile into tsv, pretty, or DSL
|
||||||
|
|
||||||
|
This is a crude hack we put together to read a BIND-style zonefile
|
||||||
|
and output a draft DNSControl dnsconfig.js file. It does about 90%
|
||||||
|
of the work, but it isn't complete.
|
||||||
|
|
||||||
## Building the software
|
## Building the software
|
||||||
|
|
||||||
Build the software and install in your personal bin:
|
Build the software and install in your personal bin:
|
||||||
|
@@ -106,6 +106,11 @@ func rrFormat(zonename string, filename string, r io.Reader, defaultTTL uint32,
|
|||||||
target = strings.Replace(target, " ", "\t", 1)
|
target = strings.Replace(target, " ", "\t", 1)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// NS records at the apex should be NAMESERVER() records.
|
||||||
|
if hdr.Rrtype == dns.TypeNS && name == "@" {
|
||||||
|
typeStr = "NAMESERVER"
|
||||||
|
}
|
||||||
|
|
||||||
if !dsl { // TSV format:
|
if !dsl { // TSV format:
|
||||||
fmt.Printf("%s\t%s\t%s\t%s\t%s\n", name, ttl, classStr, typeStr, target)
|
fmt.Printf("%s\t%s\t%s\t%s\t%s\n", name, ttl, classStr, typeStr, target)
|
||||||
} else { // DSL format:
|
} else { // DSL format:
|
||||||
|
@@ -21,8 +21,8 @@ more important, zones as you gain confidence.
|
|||||||
Experience has taught us that the best way to migrate a zone is
|
Experience has taught us that the best way to migrate a zone is
|
||||||
to create an exact duplicate first. That is, convert the old DNS records
|
to create an exact duplicate first. That is, convert the old DNS records
|
||||||
with no changes. It is tempting to clean up the data as you do the migration...
|
with no changes. It is tempting to clean up the data as you do the migration...
|
||||||
removing that old CNAME that nobody uses any more, or adding that missing
|
removing that old CNAME that nobody uses any more, or adding an
|
||||||
A record you noticed. Resist that temptation. If you make any
|
A record you discovered was missing. Resist that temptation. If you make any
|
||||||
changes it will be difficult to tell which changes were intentional
|
changes it will be difficult to tell which changes were intentional
|
||||||
and which are typos. During the migration you will know you are done
|
and which are typos. During the migration you will know you are done
|
||||||
when `dnscontrol preview` says there are no changes needed. If there
|
when `dnscontrol preview` says there are no changes needed. If there
|
||||||
@@ -59,6 +59,11 @@ Edit dnsconfig.js until `dnscontrol preview` shows no errors and
|
|||||||
no changes to be made. This means the conversion of your old DNS
|
no changes to be made. This means the conversion of your old DNS
|
||||||
data is correct.
|
data is correct.
|
||||||
|
|
||||||
|
convertzone makes a guess at what to do with NS records. If
|
||||||
|
they An NS record at the AP is turned into a NAMESERVER() call, the
|
||||||
|
rest are left as NS(). You probably want to check each of them for
|
||||||
|
correctness.
|
||||||
|
|
||||||
Resist the temptation to clean up and old, obsolete, records or to
|
Resist the temptation to clean up and old, obsolete, records or to
|
||||||
add anything new. Experience has shown that making changes at this
|
add anything new. Experience has shown that making changes at this
|
||||||
time leads to unhappy surprises, and people will blame DNSControl.
|
time leads to unhappy surprises, and people will blame DNSControl.
|
||||||
|
Reference in New Issue
Block a user