All documentation pages ↓

On this page

Dynamic zones and TSIG keys

A dynamic zone accepts DNS updates (RFC 2136): a DHCP server registers its clients' names, an ACME client proves it owns a name with a TXT record, nsupdate changes a record from a script. Each of them signs its updates with a TSIG key, and LiteBlox decides what each key may change.

A zone of their own (dhcp.example.com for DHCP clients, say) is a good idea but not required: it keeps machines' records apart from the ones you maintain by hand, and your main zone keeps its sorted order and the comments on its records' lines.

Switching a zone to dynamic

On the zone's Settings tab, Dynamic updates → Switch on. It needs:

LiteBlox backs the nodes up, moves the zone's file on the primary to /var/lib/bind/liteblox/dyn/db.<zone> (where named may write it and its journal) and declares it with an update-policy that lets LiteBlox's own key change anything, plus the grants you've given other keys. Secondaries are unchanged: they keep transferring the zone, and named sends them each update as an incremental transfer.

From then on named rewrites the file: comments and your record order are gone, and the file is in named's own order.

Switch off turns it back into a static zone: what named serves at that moment becomes the published copy in /etc/bind/liteblox/, and updates from other keys stop. Grants for the zone are kept, shown as inactive, and apply again if you switch it back on.

Editing a dynamic zone

The grid looks and works the same, with these differences:

History

named owns the file, so LiteBlox keeps the history from what named serves:

Compare works as for any zone. Restore sends the difference between that version and the zone now as one guarded update, instead of making a draft.

TSIG keys

Settings → TSIG keys lists every key LiteBlox writes into keys.conf on each node it has taken over:

Key What it's for
liteblox-xfr LiteBlox's own: signs zone transfers from the primary to its secondaries
liteblox LiteBlox's own: it reads dynamic zones with it and sends grid edits as updates
imported keys found in a server's configuration when it was taken over
client keys the ones you create for DHCP, ACME and other clients

LiteBlox's own keys are created when you first pick a primary, and their secrets never leave LiteBlox and its nodes.

Add a client key

Add a client key: a Name (what the client puts in its configuration, such as dhcp or acme-web) and an Algorithm (hmac-sha256 unless the client needs another). Add key writes it to every node and shows the secret once, with Download NAME.key (BIND's key-file format, which nsupdate -k reads). Only you see that page, and it's gone once you click I've saved it, or after 10 minutes. If the secret is lost, Replace secret makes a new one and shows it once in the same way; the old one stops working.

Delete removes the key and its grants from every node. A key still named in a list (for example a zone's Allow transfers to) can't be deleted until it's taken out.

Grants

A key can't change anything until it's granted. On the key, Grant a zone:

Each grant becomes a line in the zone's update-policy on the primary, for example grant dhcp zonesub A AAAA DHCID;. Revoke takes it out again. An update a key isn't granted is refused by named (REFUSED), and nothing changes.

Typical grants:

Client Zone What Types
DHCP (forward) dhcp.example.com the whole zone A AAAA DHCID
DHCP (reverse) 0.168.192.in-addr.arpa the whole zone PTR DHCID
ACME for one name example.com only the name _acme-challenge.www.example.com TXT

From the command line: liteblox key add|grant|revoke|delete|list (reference).

Clients

Updates go to the primary. After a promote, point your clients at the new primary. LiteBlox's own DHCP needs none of this: see Registering clients in DNS.

nsupdate, with the downloaded key file:

nsupdate -k dhcp.key <<'EOF'
server 192.168.1.213
zone dhcp.example.com
update add laptop.dhcp.example.com 300 A 192.168.0.51
send
EOF

Kea: its DHCP-DDNS server (kea-dhcp-ddns) takes the key's name, algorithm and secret from the key file:

"tsig-keys": [
    { "name": "dhcp", "algorithm": "HMAC-SHA256", "secret": "…from dhcp.key…" }
],
"forward-ddns": {
    "ddns-domains": [
        { "name": "dhcp.example.com.", "key-name": "dhcp",
          "dns-servers": [ { "ip-address": "192.168.1.213" } ] }
    ]
},
"reverse-ddns": {
    "ddns-domains": [
        { "name": "0.168.192.in-addr.arpa.", "key-name": "dhcp",
          "dns-servers": [ { "ip-address": "192.168.1.213" } ] }
    ]
}

ACME clients with an RFC 2136 plugin (certbot's dns-rfc2136, lego's rfc2136) take the same server, key name, algorithm and secret.

PTR records across static and dynamic zones

Sync PTR works between any two zones; when the PTR lands depends on both:

Forward zone Reverse zone The PTR change
static static goes into the reverse zone's draft, linked: both are reviewed and published together
static dynamic waits with the forward zone's draft (Review lists it) and is sent as an update once that publish succeeds; discarding the draft drops it. If the update fails, see below.
dynamic dynamic applies at once, like the edit
dynamic static goes into the reverse zone's draft, with a note to publish it there

PTR updates that didn't go out

When the forward zone is published but sending its PTR changes fails, the changes stay queued. Causes include the reverse zone's primary being down, or the reverse zone being frozen on it. The forward zone's Records tab then shows a PTR updates that didn't go out card, with the changes and the error. You can:

The next publish of the forward zone also sends them again. Discarding a later draft doesn't drop them, because they belong to a publish that already went out.

Stale DHCP names

Kea removes the name it registered when the lease ends. Sometimes that update is lost: the primary was down, a promote was under way, or Kea's lease file was reset. The name then stays in the zone, pointing at an address someone else may get. Stale names above the grid of a dynamic zone lists the names Kea registered (an A record with a DHCID beside it) and says which are stale.

A name is stale when all of these hold:

Kea forgets an expired lease after an hour, so LiteBlox remembers each name's last lease expiry from the health check's lease reads. A name it never saw a lease for counts from when it first noticed it, so after an install or a re-adopt nothing is stale before a full reclaim time has passed. Names nobody gave a DHCID (typed in, ACME, another key's) are never stale.

Delete the ticked names removes the stale names at once (tick or untick any): their A and DHCID records in one update, and in a dynamic reverse zone LiteBlox holds, the PTR that points at each (with its DHCID). A PTR pointing at another name stays.

Reclaiming them on a schedule

Under the zone's Settings → Stale DHCP names, Reclaim stale DHCP names (off by default) checks the zone once an hour and deletes its stale names the same way. Turning it on shows what would go now. A pass that deletes something runs as a Reclaim job (user liteblox) whose log names each name and address; it's in the audit log too. A pass holds back, deleting nothing:

Dynamic zones on a server you take over

A server you take over may already have zones that take updates. LiteBlox imports one when its update rules are TSIG key grants:

Each rule becomes a grant on Settings → TSIG keys, and the key comes in with the rest of the server's keys. During the takeover the zone is held with rndc freeze for a few seconds, so no update is lost; clients retry. The zone then moves, journal included, to /var/lib/bind/liteblox/dyn/.

LiteBlox reads and edits the zone once you pick a primary (Make … the primary on the Nodes page). That step also gives LiteBlox's own liteblox key its grant. Clients keep updating the zone the whole time.

These block the takeover instead: