1
0
mirror of https://github.com/StackExchange/dnscontrol.git synced 2024-05-11 05:55:12 +00:00

NEW PROVIDER: OctoDNS (#309)

* govendor gopkg.in/yaml.v2
* Ignore YAML and BIND test data litter.  Create README.txt files to force git to create subdirectories.
* Update convertzone to also read OctoDNS files
This commit is contained in:
Tom Limoncelli
2018-02-27 17:36:47 -05:00
committed by GitHub
parent b83630044f
commit 54de1ff698
58 changed files with 11708 additions and 118 deletions

View File

@@ -1,8 +1,18 @@
# 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.
This is a crude hack we put together to read a couple common zonefile
formats and output them in a few different formats. Current input
formats are BIND zonefiles and OctoDNS "config" YAML files. Current
output formats as BIND zonefiles, tab separated records, or a draft
DNSControl dnsconfig.js file. For dnsconfig.js, it does about 90%
of the work, but should be manually verified.
The primary purpose of this program is to convert BIND-style
zonefiles to DNSControl dnsconfig.js files. Nearly all DNS Service
providers include the ability to export records as a BIND-style zonefile.
This makes it easy to import DNS data from other systems into DNSControl.
Later OctoDNS input was added because we had the parser (as part of
the OctoDNS provider), so why not use it?
## Building the software
@@ -17,37 +27,53 @@ $ cp convertzone ~/bin/.
## Usage Overview
convertzone converts an old-style DNS zone file into one of three formats:
convertzone: Read and write DNS zone files.
convertzone [-mode=MODE] zonename [filename]
convertzone [-in=INPUT] [-out=OUTPUT] zonename [filename]
-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.
Input format:
-in=bind BIND-style zonefiles (DEFAULT)
-in=octodns OctoDNS YAML "config" files.
zonename The FQDN of the zone name.
filename File to read (optional. Defaults to stdin)
Output format:
-out=dsl DNSControl DSL language (dnsconfig.js) (DEFAULT)
-out=tsv TAB-separated values
-out=pretty pretty-printed (BIND-style zonefiles)
zonename The FQDN of the zone name.
filename File to read (optional. Defaults to stdin)
The DSL output format is useful for creating the first
draft of your dnsconfig.js when importing zones from
other services.
The TSV format makes it easy to process a zonefile with
shell tools.
The PRETTY format is just a nice way to clean up a zonefile.
If no filename is specified, stdin is assumed.
Output is sent to stdout.
The zonename is required as it can not be guessed automatically from the input.
Example:
convertzone stackoverflow.com zone.stackoverflow.com >new/stackoverflow.com
convertzone stackoverflow.com zone.stackoverflow.com >new/draft.js
### -mode=tsv:
### -out=tsv:
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 }'
convertzone -out=tsv foo.com <zone.foo.com | awk '$4 == "CNAME" { print $1 " -> " $5 }'
### -mode=pretty:
### -out=pretty:
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
@@ -58,18 +84,18 @@ 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
convertzone -out=pretty foo.com <old/zone.foo.com >new/zone.foo.com
### -mode=dsl:
### -out=dsl:
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.
Example: Generate statements for a dnsconfig.js file:
convertzone -mode=dsl foo.com <old/zone.foo.com >first-draft.js
convertzone -out=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).
DNSControl [migration doc]({site.github.url}}/migration).