Tool for uploading and syncing BIND style zone files to Cloudflare
Find a file
Anders Brander 9ad8b3f5c4
Merge pull request #14 from cego/version
Add version guard
2020-01-06 13:32:35 +01:00
.gitignore Improvements around using a live / split-horizon Bind + Cloudflare configuration 2019-09-24 13:47:40 +01:00
LICENSE Added license. 2017-09-13 08:46:53 +02:00
main.go Add version guard. 2019-12-12 14:28:40 +01:00
main_test.go Fix tests broken in #9. 2019-12-04 13:52:09 +01:00
README.md Update docs 2019-09-24 13:58:49 +01:00
recordCollection.go More linter fixes. 2019-12-11 14:55:40 +01:00
recordCollection_test.go Linter fixes. 2019-12-11 14:45:47 +01:00

cfzone

This is a utility to update a cloudflare zone based on a bind-style zone file.

Limitations

Only A, AAAA, CNAME, MX, and TXT records are supported.

Cloudflare supported record types LOC, NS, SRV, SPF and CAA are not currently supported.

Flags exist to skip SRV and SPF types.

Cloudflare supports (at least) two modes not easily representable in a BIND zone. To support these features a few magic TTL values are used.

TTL Status
-autottl (0) Automatic TTL, DNS only
-cachettl (1) Automatic TTL, DNS and HTTP proxy (CDN)
Other values Set as TTL, DNS only

Pull requests welcome :-)

Running cfzone

cfzone need two environment variables:

  • CF_API_KEY - Your API key from Cloudflare
  • CF_API_EMAIL - Your Cloudflare email address.

Run cfzone as with the following command: cfzone [-leaveunknown] [-yes] <zonefile>

Available optional flags:

Flag Description
-leaveunknown Don't delete unknown records
-yes will cause cfzone to continue syncing without confirmation.
-autottl <int> Specify the TTL to interpret as 'Auto' for Cloudflare (default 0)
-cachettl <int> Specify the TTL to interpret as 'Cache' for Cloufdlare (default 1)
-ignorespf Skip SPF records in the BIND zone file rather than erroring
-ignoresrv Skip SRV records in the BIND zone file rather than erroring
-origin Specify zone origin to resolve @ at the top level

Building

You'll need a working Go environment to build cfzone.

go get github.com/cego/cfzone should retrieve the source code, build it and place the binary in $GOPATH/bin/cfzone.