Dnscontrol

From NixOS Wiki
Jump to: navigation, search

Dnscontrol is a tool to synchronize your DNS to multiple providers from a simple DSL.

Installation

Install dnscontrol in your current environment

# nix-env -iA nixos.dnscontrol

Configuration

In the following example usage, we'll create a credentials file called creds.json with the login details for the domain provider Inwx.com:

Breeze-text-x-plain.png
creds.json
{
  "inwx": {
    "TYPE": "INWX",
    "username": "myuser",
    "password": "mypassword"
  }
}


See upstream documentation for available provider and their authentication syntax.

The second required configuration file called dnsconfig.js defines providers and domain configurations. In this example, we'll add a subdomain test to the domain example.org with a specific A-record.

Breeze-text-x-plain.png
dnsconfig.js
var REG_NONE = NewRegistrar("none");
var DSP_INWX = NewDnsProvider("inwx");

D("example.org", REG_NONE, DnsProvider(DSP_INWX), NO_PURGE,
    A("test", "1.2.3.4")
);


The provider will be Inwx for which we configured the credentials earlier. The option NO_PURGE tells dnscontrol to only add the new record while leaving all other entries untouched.

Usage

Preview the changes which will be made to your domain

# dnscontrol preview

Apply changes with the following command

# dnscontrol push

Confirm changes to the dns record using the tool dig.

# nix shell nixpkgs#dnsutils --command dig +short test.example.org

See also

  • Octodns, tool that allows for easy management of DNS records across multiple providers