2017-03-21 02:27:40 +08:00
|
|
|
# convertzone -- Converts a standard DNS zonefile into tsv, pretty, or DSL
|
|
|
|
|
2017-08-05 23:59:35 +08:00
|
|
|
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.
|
|
|
|
|
2017-04-14 00:46:47 +08:00
|
|
|
## Building the software
|
|
|
|
|
|
|
|
Build the software and install in your personal bin:
|
|
|
|
|
|
|
|
```cmd
|
2017-05-26 08:42:30 +08:00
|
|
|
$ cd cmd/convertzone
|
2017-04-14 00:46:47 +08:00
|
|
|
$ go build
|
|
|
|
$ cp convertzone ~/bin/.
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
## Usage Overview
|
|
|
|
|
2017-03-21 02:27:40 +08:00
|
|
|
convertzone converts an old-style DNS zone file into one of three formats:
|
|
|
|
|
Improve convertzone documentation (#54)
* NEW: convertzone/ Read BIND zone files, output records as DSL, TSV, or pretty-print.
* Refactored to be more gostyle.
* Fix buffering issue.
* Delete the hacky awk script.
* Linting.
* Lint and documentation fixes.
* DNSimple provider (#43)
* Implement a basic DNSimple provider.
Handles domain delegation as well as record create, update, and delete.
Note that this is completely untested at the moment. It’s so alpha it might burn your face off.
* Add some inline comments. Always use the StackExchange libs.
* Clean up dnsimple docs a little
* This will need to be changed before merging.
* Import the dnsimple dnscontrol package from its expected path
* Properly build the FQDN and implement record listing so create/update/delete are used correctly.
* Add support for overriding base URL to allow connection to sandbox.
* Vendor dnsimple-go and its dependencies.
* Remove unnecessary doc file.
* Use dnsutil.AddOrigin for combining record name and origin.
* Modifying dnsimple provider to pass tests
* NEW: convertzone/ Read BIND zone files, output records as DSL, TSV, o… (#49)
* NEW: convertzone/ Read BIND zone files, output records as DSL, TSV, or pretty-print.
* Refactored to be more gostyle.
* Fix buffering issue.
* Delete the hacky awk script.
* Linting.
* Update README.md
* Update README.md
* Update README.md
* Docs
2017-03-21 05:21:09 +08:00
|
|
|
convertzone [-mode=MODE] zonename [filename]
|
2017-03-21 02:27:40 +08:00
|
|
|
|
Improve convertzone documentation (#54)
* NEW: convertzone/ Read BIND zone files, output records as DSL, TSV, or pretty-print.
* Refactored to be more gostyle.
* Fix buffering issue.
* Delete the hacky awk script.
* Linting.
* Lint and documentation fixes.
* DNSimple provider (#43)
* Implement a basic DNSimple provider.
Handles domain delegation as well as record create, update, and delete.
Note that this is completely untested at the moment. It’s so alpha it might burn your face off.
* Add some inline comments. Always use the StackExchange libs.
* Clean up dnsimple docs a little
* This will need to be changed before merging.
* Import the dnsimple dnscontrol package from its expected path
* Properly build the FQDN and implement record listing so create/update/delete are used correctly.
* Add support for overriding base URL to allow connection to sandbox.
* Vendor dnsimple-go and its dependencies.
* Remove unnecessary doc file.
* Use dnsutil.AddOrigin for combining record name and origin.
* Modifying dnsimple provider to pass tests
* NEW: convertzone/ Read BIND zone files, output records as DSL, TSV, o… (#49)
* NEW: convertzone/ Read BIND zone files, output records as DSL, TSV, or pretty-print.
* Refactored to be more gostyle.
* Fix buffering issue.
* Delete the hacky awk script.
* Linting.
* Update README.md
* Update README.md
* Update README.md
* Docs
2017-03-21 05:21:09 +08:00
|
|
|
-mode=tsv Output the zone recoreds as tab-separated values
|
|
|
|
-mode=pretty Output the zone pretty-printed.
|
|
|
|
-mode=dsl Output the zone records as the DNSControl DSL language.
|
2017-03-21 02:27:40 +08:00
|
|
|
|
Improve convertzone documentation (#54)
* NEW: convertzone/ Read BIND zone files, output records as DSL, TSV, or pretty-print.
* Refactored to be more gostyle.
* Fix buffering issue.
* Delete the hacky awk script.
* Linting.
* Lint and documentation fixes.
* DNSimple provider (#43)
* Implement a basic DNSimple provider.
Handles domain delegation as well as record create, update, and delete.
Note that this is completely untested at the moment. It’s so alpha it might burn your face off.
* Add some inline comments. Always use the StackExchange libs.
* Clean up dnsimple docs a little
* This will need to be changed before merging.
* Import the dnsimple dnscontrol package from its expected path
* Properly build the FQDN and implement record listing so create/update/delete are used correctly.
* Add support for overriding base URL to allow connection to sandbox.
* Vendor dnsimple-go and its dependencies.
* Remove unnecessary doc file.
* Use dnsutil.AddOrigin for combining record name and origin.
* Modifying dnsimple provider to pass tests
* NEW: convertzone/ Read BIND zone files, output records as DSL, TSV, o… (#49)
* NEW: convertzone/ Read BIND zone files, output records as DSL, TSV, or pretty-print.
* Refactored to be more gostyle.
* Fix buffering issue.
* Delete the hacky awk script.
* Linting.
* Update README.md
* Update README.md
* Update README.md
* Docs
2017-03-21 05:21:09 +08:00
|
|
|
zonename The FQDN of the zone name.
|
|
|
|
filename File to read (optional. Defaults to stdin)
|
2017-03-21 02:27:40 +08:00
|
|
|
|
|
|
|
Output is sent to stdout.
|
|
|
|
|
Improve convertzone documentation (#54)
* NEW: convertzone/ Read BIND zone files, output records as DSL, TSV, or pretty-print.
* Refactored to be more gostyle.
* Fix buffering issue.
* Delete the hacky awk script.
* Linting.
* Lint and documentation fixes.
* DNSimple provider (#43)
* Implement a basic DNSimple provider.
Handles domain delegation as well as record create, update, and delete.
Note that this is completely untested at the moment. It’s so alpha it might burn your face off.
* Add some inline comments. Always use the StackExchange libs.
* Clean up dnsimple docs a little
* This will need to be changed before merging.
* Import the dnsimple dnscontrol package from its expected path
* Properly build the FQDN and implement record listing so create/update/delete are used correctly.
* Add support for overriding base URL to allow connection to sandbox.
* Vendor dnsimple-go and its dependencies.
* Remove unnecessary doc file.
* Use dnsutil.AddOrigin for combining record name and origin.
* Modifying dnsimple provider to pass tests
* NEW: convertzone/ Read BIND zone files, output records as DSL, TSV, o… (#49)
* NEW: convertzone/ Read BIND zone files, output records as DSL, TSV, or pretty-print.
* Refactored to be more gostyle.
* Fix buffering issue.
* Delete the hacky awk script.
* Linting.
* Update README.md
* Update README.md
* Update README.md
* Docs
2017-03-21 05:21:09 +08:00
|
|
|
The zonename is required as it can not be guessed automatically from the input.
|
|
|
|
|
2017-03-21 02:27:40 +08:00
|
|
|
Example:
|
|
|
|
|
Improve convertzone documentation (#54)
* NEW: convertzone/ Read BIND zone files, output records as DSL, TSV, or pretty-print.
* Refactored to be more gostyle.
* Fix buffering issue.
* Delete the hacky awk script.
* Linting.
* Lint and documentation fixes.
* DNSimple provider (#43)
* Implement a basic DNSimple provider.
Handles domain delegation as well as record create, update, and delete.
Note that this is completely untested at the moment. It’s so alpha it might burn your face off.
* Add some inline comments. Always use the StackExchange libs.
* Clean up dnsimple docs a little
* This will need to be changed before merging.
* Import the dnsimple dnscontrol package from its expected path
* Properly build the FQDN and implement record listing so create/update/delete are used correctly.
* Add support for overriding base URL to allow connection to sandbox.
* Vendor dnsimple-go and its dependencies.
* Remove unnecessary doc file.
* Use dnsutil.AddOrigin for combining record name and origin.
* Modifying dnsimple provider to pass tests
* NEW: convertzone/ Read BIND zone files, output records as DSL, TSV, o… (#49)
* NEW: convertzone/ Read BIND zone files, output records as DSL, TSV, or pretty-print.
* Refactored to be more gostyle.
* Fix buffering issue.
* Delete the hacky awk script.
* Linting.
* Update README.md
* Update README.md
* Update README.md
* Docs
2017-03-21 05:21:09 +08:00
|
|
|
convertzone stackoverflow.com zone.stackoverflow.com >new/stackoverflow.com
|
|
|
|
|
|
|
|
|
2017-04-14 00:46:47 +08:00
|
|
|
### -mode=tsv:
|
Improve convertzone documentation (#54)
* NEW: convertzone/ Read BIND zone files, output records as DSL, TSV, or pretty-print.
* Refactored to be more gostyle.
* Fix buffering issue.
* Delete the hacky awk script.
* Linting.
* Lint and documentation fixes.
* DNSimple provider (#43)
* Implement a basic DNSimple provider.
Handles domain delegation as well as record create, update, and delete.
Note that this is completely untested at the moment. It’s so alpha it might burn your face off.
* Add some inline comments. Always use the StackExchange libs.
* Clean up dnsimple docs a little
* This will need to be changed before merging.
* Import the dnsimple dnscontrol package from its expected path
* Properly build the FQDN and implement record listing so create/update/delete are used correctly.
* Add support for overriding base URL to allow connection to sandbox.
* Vendor dnsimple-go and its dependencies.
* Remove unnecessary doc file.
* Use dnsutil.AddOrigin for combining record name and origin.
* Modifying dnsimple provider to pass tests
* NEW: convertzone/ Read BIND zone files, output records as DSL, TSV, o… (#49)
* NEW: convertzone/ Read BIND zone files, output records as DSL, TSV, or pretty-print.
* Refactored to be more gostyle.
* Fix buffering issue.
* Delete the hacky awk script.
* Linting.
* Update README.md
* Update README.md
* Update README.md
* Docs
2017-03-21 05:21:09 +08:00
|
|
|
|
|
|
|
This is useful for `awk` and other systems that expect a very
|
|
|
|
uniform set of input.
|
|
|
|
|
|
|
|
Example: Print all CNAMEs:
|
|
|
|
|
|
|
|
convertzone -mode=tsv foo.com <zone.foo.com | awk '$4 == "CNAME" { print $1 " -> " $5 }'
|
|
|
|
|
|
|
|
|
2017-04-14 00:46:47 +08:00
|
|
|
### -mode=pretty:
|
Improve convertzone documentation (#54)
* NEW: convertzone/ Read BIND zone files, output records as DSL, TSV, or pretty-print.
* Refactored to be more gostyle.
* Fix buffering issue.
* Delete the hacky awk script.
* Linting.
* Lint and documentation fixes.
* DNSimple provider (#43)
* Implement a basic DNSimple provider.
Handles domain delegation as well as record create, update, and delete.
Note that this is completely untested at the moment. It’s so alpha it might burn your face off.
* Add some inline comments. Always use the StackExchange libs.
* Clean up dnsimple docs a little
* This will need to be changed before merging.
* Import the dnsimple dnscontrol package from its expected path
* Properly build the FQDN and implement record listing so create/update/delete are used correctly.
* Add support for overriding base URL to allow connection to sandbox.
* Vendor dnsimple-go and its dependencies.
* Remove unnecessary doc file.
* Use dnsutil.AddOrigin for combining record name and origin.
* Modifying dnsimple provider to pass tests
* NEW: convertzone/ Read BIND zone files, output records as DSL, TSV, o… (#49)
* NEW: convertzone/ Read BIND zone files, output records as DSL, TSV, or pretty-print.
* Refactored to be more gostyle.
* Fix buffering issue.
* Delete the hacky awk script.
* Linting.
* Update README.md
* Update README.md
* Update README.md
* Docs
2017-03-21 05:21:09 +08:00
|
|
|
|
|
|
|
This is useful for cleaning up a zonefile. It sorts the records,
|
|
|
|
moving SOA and NS records to the top of the zone; all other records
|
|
|
|
are alphabetically sorted; if a label has mutiple records, they are
|
|
|
|
listed in a logical (not numeric) order, multiple A records are
|
|
|
|
listed sorted by IP address, MX records are sorted by priority,
|
|
|
|
etc. Use `-ttl` to set a default TTL.
|
|
|
|
|
|
|
|
Example: Clean up a zone file:
|
|
|
|
|
|
|
|
convertzone -mode=pretty foo.com <old/zone.foo.com >new/zone.foo.com
|
|
|
|
|
|
|
|
|
2017-04-14 00:46:47 +08:00
|
|
|
### -mode=dsl:
|
Improve convertzone documentation (#54)
* NEW: convertzone/ Read BIND zone files, output records as DSL, TSV, or pretty-print.
* Refactored to be more gostyle.
* Fix buffering issue.
* Delete the hacky awk script.
* Linting.
* Lint and documentation fixes.
* DNSimple provider (#43)
* Implement a basic DNSimple provider.
Handles domain delegation as well as record create, update, and delete.
Note that this is completely untested at the moment. It’s so alpha it might burn your face off.
* Add some inline comments. Always use the StackExchange libs.
* Clean up dnsimple docs a little
* This will need to be changed before merging.
* Import the dnsimple dnscontrol package from its expected path
* Properly build the FQDN and implement record listing so create/update/delete are used correctly.
* Add support for overriding base URL to allow connection to sandbox.
* Vendor dnsimple-go and its dependencies.
* Remove unnecessary doc file.
* Use dnsutil.AddOrigin for combining record name and origin.
* Modifying dnsimple provider to pass tests
* NEW: convertzone/ Read BIND zone files, output records as DSL, TSV, o… (#49)
* NEW: convertzone/ Read BIND zone files, output records as DSL, TSV, or pretty-print.
* Refactored to be more gostyle.
* Fix buffering issue.
* Delete the hacky awk script.
* Linting.
* Update README.md
* Update README.md
* Update README.md
* Docs
2017-03-21 05:21:09 +08:00
|
|
|
|
|
|
|
This is useful for generating your draft `dnsconfig.js` configuration.
|
|
|
|
The output can be appended to the `dnsconfig.js` file as a good first draft.
|
2017-04-14 00:46:47 +08:00
|
|
|
|
|
|
|
Example: Generate statements for a dnsconfig.js file:
|
|
|
|
|
|
|
|
convertzone -mode=dsl foo.com <old/zone.foo.com >first-draft.js
|
|
|
|
|
|
|
|
Note: The conversion is not perfect. You'll need to manually clean
|
|
|
|
it up and insert it into `dnsconfig.js`. More instructions in the
|
|
|
|
DNSControl [migration doc]({site.github.url}}/migration).
|