Command line client to synchronize DNS hosted zones with local zone files
Project description
The dnssync script allows DNS zones hosted at various DNS providers to be synchronized with local bind-style text zone files. This allows the DNS zones to be easily version-controlled, even if the service provider does not directly support that.
Currently supported DNS service providers:
Project
Installation
$ pip install dnssync
Usage
To download a zone from PowerDNS:
$ dnssync download --driver powerdns --param apikey={KEY} --domain {DOMAIN} {ZONEFILE}
These command line options can also be stored in a configuration file, e.g. config.ini:
driver = powerdns
apikey = {KEY}
domain = {DOMAIN}
zonefile = {ZONEFILE}
And then invoke dnssync as follows:
$ dnssync download --config config.ini
To upload a zone:
$ dnssync upload --config config.ini
And to show differences between the hosted zone and the local zonefile:
$ dnssync diff --config config.ini
Configuration
The dnssync configuration file can specify the following options:
driver:
The driver for the specific DNS hosting service; currently supported values:
powerdns: for PowerDNS.net
domain:
The name of the zone to be operated on.
zonefile:
The filename of the local zone file. If specified in the configuration, it is taken to be relative to the configuration file. If specified on the command line, it is taken to be relative to the current working directory.
PowerDNS
The following options exist for the powerdns driver:
apikey:
The API access key provided by PowerDNS. Note that an account must first be enabled (via the PowerDNS website) before it can be used.
DomainMonster
The following options exist for the domainmonster driver:
username:
The username of the account to log into DomainMonster with.
password:
The password of the specified username account.
Multiple Profiles
Several different profiles can be stored in the same configuration; each profile should have a section named after the domain. Global parameters can be stored in the “DEFAULT” section. For example:
[DEFAULT]
# set some global parameters
driver = powerdns
apikey = 2f16eef6-5b1f-4d80-96f7-0237da03db48
# set the default domain to manage
domain = example.com
[example.com]
zonefile = example-com.zone
[other-example.com]
zonefile = other-example-com.zone
Then, to upload the zones:
# upload 'example.com'
$ dnssync upload -c config.ini
# upload 'other-example.com'
$ dnssync upload -c config.ini -d other-example.com
Zonefile Local Variables
The zonefile can also specify the configuration file via emacs-style local variables. The configuration file specified on the command line, however, takes precedence. For example, given the following example-com.zone zonefile:
;; -*- coding: utf-8; dnssync-config: config.ini -*-
$ORIGIN example.com.
example.com. 3600 IN SOA ...
... more DNS records ...
The following command will pull all options from the config.ini file:
# report differences
$ dnssync diff example-com.zone
# upload a new version
$ dnssync upload example-com.zone
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file dnssync-0.2.3.tar.gz
.
File metadata
- Download URL: dnssync-0.2.3.tar.gz
- Upload date:
- Size: 29.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1f00ef370e49f3763c3ec51e55198f3ef1a83e12d851e42c70f5f56f29e3be23 |
|
MD5 | d8ae7130d3394379112d157b6c4df15f |
|
BLAKE2b-256 | 6fbb0e3772c6e16f0fbec0017db8c1f0ca45d0c3bdaaf473475f4bee2904a50e |