22.4. Signing and Maintaining Authoritative DNS
DNSSEC gives a zone's answers provable integrity: every record is
signed, the signatures chain from the zone's keys to a trust anchor
a validator already holds, and a resolver that cannot complete the
chain refuses the answer. The cost is key management - keys must be
generated, published, matched by the parent, and eventually
replaced, all without breaking validation for a single client.
BIND's dnssec-policy automates the entire schedule; the
administrator's job becomes watching it and knowing what failure
looks like.
22.4.1. DNSSEC Signing Keys, Signed Zones, and Validation Chains
Two keys with two jobs sign each zone:
- the KSK (key-signing key) signs the zone's DNSKEY record set - the key list itself. Its digest is what the parent publishes as the DS record, so this key is the junction between the zone and the chain above it.
- the ZSK (zone-signing key) signs the actual data records and the delegation-related records at the apex.
A validator starts from a trust anchor it already believes, finds the parent's DS for the zone, checks that the DS digest matches a DNSKEY in the child's set (the KSK), verifies the DNSKEY set's signature (made with the KSK), then verifies each data record's signature (made with the ZSK). Every link in that sentence is a place the chain can break, and Section 22.4.3 breaks one on purpose.
Figure 22.4. One trust anchor, one DS handoff at the delegation, two
keys inside the zone. The resolver walks this chain on every
uncached answer; harden-dnssec-stripped from Section 22.2.3 means
a signed zone that arrives with its signatures removed is also
refused.
The chapter's zones were signed by the dnssec-policy "lab" block
already in named.conf.local: a KSK with unlimited lifetime and a
ZSK with a 30-day lifetime, both ECDSAP256SHA256 (algorithm 13 -
small signatures, wide validator support). BIND implements this
with inline signing: the administrator's file stays unsigned,
named maintains a parallel signed view of the zone, re-signs
records as their signatures approach expiry, and rolls keys on the
policy's schedule. The keys themselves are generated automatically
into /var/cache/bind as pairs like
Khandbook.test.+013+60043.key and .private - the number in the
name is the key tag validators cite.
Watch the policy's own report - as root on ns1:
# rndc dnssec -status handbook.test
dnssec-policy: lab
current time: Sun Nov 22 11:14:29 2026
key: 60043 (ECDSAP256SHA256), KSK
published: yes - since Sun Nov 22 11:12:22 2026
key signing: yes - since Sun Nov 22 11:12:22 2026
No rollover scheduled
- goal: omnipresent
- dnskey: rumoured
- ds: hidden
- key rrsig: rumoured
key: 14632 (ECDSAP256SHA256), ZSK
published: yes - since Sun Nov 22 11:12:22 2026
zone signing: yes - since Sun Nov 22 11:12:22 2026
Next rollover scheduled on Tue Dec 22 09:07:22 2026
- goal: omnipresent
- dnskey: rumoured
- zone rrsig: rumoured
Two keys, exactly as designed: 60043 signing the key list, 14632
signing the zone, and a ZSK rollover already scheduled for its
lifetime's end.
The goal/state vocabulary is DNSSEC's publication lifecycle: a key
moves from rumoured (published, waiting for caches to learn it)
toward omnipresent (every validator can have seen it), and each
of the four state lines tracks one publication channel - the
DNSKEY record, the parent's DS, the signatures each key makes. A
KSK additionally has a ds: state because its rollout must be
coordinated with the parent, which is the next subsection's subject.
The states here show a young zone still in its initial publication;
after the TTL-driven propagation completes, everything settles at
omnipresent and rndc dnssec -status becomes a quiet,
nothing-to-report command.
The signatures themselves are ordinary records, visible in every answer. On ns1, as root:
# dig @127.0.0.1 www.handbook.test A +dnssec +noall +answer | grep RRSIG | head -1
www.handbook.test. 300 IN RRSIG A 13 3 300 20261206043016 20261122101226 14632 handbook.test. 5EQ1yF6cOSOn+8DmwVUxl+pH4zDqQtarTfmaiyS4LtmRoJRK7i5AhI3K usiUmyU0tc3H5E6FECHTShZiX/eKvQ==
The RRSIG's fields read left to right: it covers A records, made
with algorithm 13, over a name of 3 labels, with original TTL 300,
expiring 20261206043016, valid from 20261122101226, by key tag
14632, for signer handbook.test. - and then the signature
itself. The two timestamps are the operational clock: BIND re-signs
each record well before the expiry field approaches, and Section
22.4.3 discusses what happens if that machinery stops.
With the zone signed and its DS published (next subsection), the
resolver of Section 22.2.3 validated it end to end - the ad flag
in the www.handbook.test capture is this policy's output.
22.4.2. Publishing DS Records and Testing a Delegation
The chain of trust crosses zones at the delegation, and the record
that carries it is the DS - a digest of the child's KSK, published
in the parent zone. For the lab's handbook.test, the parent is
the local test zone on the same server; for a registered domain,
the parent is the TLD, and the DS is submitted through the
registrar's DNSSEC panel in exactly the format produced here.
Produce the DS as root on ns1, with
dnssec-dsfromkey -2 /var/cache/bind/Khandbook.test.+013+60043.key:
the command reads the KSK's key file and prints one DS line - key
tag 60043, algorithm 13, digest type 2, and the digest itself - in
the same format the delegation carries. The -2 selects the
SHA-256 digest, the deployable default (-1 would emit the
deprecated SHA-1). rndc dnssec -status names each key's tag, which
is how you find the KSK's file among the Khandbook.test.* key
files without guessing: the status output above shows the KSK is
tag 60043, so the file is Khandbook.test.+013+60043.key. Run the
same way on the test zone's KSK, the command produced the
trust-anchor: line in Section 22.2.1's resolver configuration - a
trust anchor is simply a DS published in the validator's
configuration instead of in a parent zone.
Publish the DS into the parent zone the way every change reaches a
dynamic zone: a TSIG-signed update. The update itself is a short
batch of nsupdate commands; keep it as a file in the workspace so
the invocation stays readable. A batch file holds one command per
line and nsupdate accepts no comments in it - the file is pure
commands, and the prose around it carries the explanation. As john
on ns1, create ~/debian-handbook/dns-dhcp/publish-ds.update:
server 127.0.0.1
zone test
update delete handbook.test. DS
update add handbook.test. 300 DS 60043 13 2 57401ED7241F21F582C279568A57504A11317BFAC911F2CF6912C79A0E2759C9
send
The batch names the server and the zone to update, replaces any
existing DS for the child, and adds the new one - the delete/add
pair makes the batch idempotent, so re-running it never stacks
stale DS records. The DS values in this listing are the lab's real
zone; regenerate your own with dnssec-dsfromkey and substitute
them. Apply it - as root on ns1:
# nsupdate -y hmac-sha256:ddns-key:Y2hhcHRlcjIyLWRkbnMta2V5LTAwMDEtYWJjZGVm < /home/john/debian-handbook/dns-dhcp/publish-ds.update
nsupdate prints nothing on success; a failure prints one line
and exits nonzero, with update failed: REFUSED naming a policy
problem (wrong key, wrong zone) and a timeout naming an unreachable
server. Verify the parent now serves the DS - from lanclient, as
john:
$ dig @192.168.232.10 handbook.test DS +short
60043 13 2 57401ED7241F21F582C279568A57504A11317BFAC911F2CF6912C79A 0E2759C9
The parent answers with the child's key fingerprint. That single
record completes the chain: the resolver's trust anchor for test.
(Section 22.2.1), the signed test zone carrying this DS, and the
child's signed zone - every link of Figure 22.4 now exists on the
wire, and the validating capture in Section 22.2.3 (ad flag on
www.handbook.test) is the end-to-end proof.
Testing a delegation means testing all three records together, not
just the DS: the NS set in the parent, the glue that resolves it,
and the DS. A query for the DS (above) proves the parent side; the
NS/glue half is Section 22.3.4's test.db listing; and a
validating query through the resolver proves the whole chain at
once. If the validating query fails while the authoritative servers
answer directly, the break is somewhere between parent and child -
which is precisely the diagnostic Section 22.4.3 rehearses.
For a registered domain, this subsection's procedure is the same
with a different last mile: the DS line dnssec-dsfromkey prints is
what the registrar's DNSSEC form asks for, the TLD's servers play
the parent role the local test zone plays here, and the
trust-anchor: line in the resolver is unnecessary because the
chain from the public root already reaches the TLD.
22.4.3. Key Rollover, Signature Expiry, and Recovery from Validation Failure
Keys do not live forever - a compromised key is only useful to an attacker until it is replaced, and routine replacement keeps the operational machinery oiled. The ZSK rollover happens entirely inside the zone: the policy publishes the new key alongside the old, signs with both, lets the old one age out of caches, then retires it. The KSK rollover additionally touches the parent, because a new KSK means a new DS - the standard procedure publishes the new DS alongside the old (double-DS), waits out the TTLs, then removes the old pair, and the registrar coordination makes it a scheduled, deliberate event rather than an automatic one.
The lab's 30-day ZSK lifetime makes rollover a scheduled event, but one can be rehearsed immediately. As root on ns1, tell the policy to retire the current ZSK ahead of schedule:
# rndc dnssec -rollover -key 14632 handbook.test
Key 14632: Rollover scheduled on 22-Nov-2026 11:14:51.000
The command echoes the decision: key 14632's retirement is now on the clock. A few seconds later, the status report shows the transition in motion:
# rndc dnssec -status handbook.test | grep -E "^key:|goal:"
key: 60043 (ECDSAP256SHA256), KSK
- goal: omnipresent
key: 14632 (ECDSAP256SHA256), ZSK
- goal: hidden
key: 16225 (ECDSAP256SHA256), ZSK
- goal: omnipresent
Three keys now: the KSK unchanged, the old ZSK with its goal set to hidden - the policy is retiring it - and a new ZSK, 16225, publishing toward omnipresent. The resolver still validates throughout; flush its cached view of the zone - as root on resolver - and check from the client side, as john on lanclient:
# unbound-control flush_zone handbook.test
ok removed 3 rrsets, 3 messages and 1 key entries
$ dig @192.168.232.53 www.handbook.test A +dnssec | grep flags
;; flags: qr rd ra ad; QUERY: 1, ANSWER: 2, AUTHORITY: 0, ADDITIONAL: 1
; EDNS: version: 0, flags: do; udp: 1232
The ad flag is back - the zone validated with the new key active. The old key's
records remain in the zone during the transition's propagation
window; the full multi-day retirement completes on the policy's
timers, and the rehearsal's point is that the mechanism runs without
taking validation down.
Signature expiry is the other clock in every RRSIG. The capture in
Section 22.4.1 showed signatures valid for two weeks, with BIND
refreshing each record's signature well before its expiry field -
rndc zonestatus's next resign time line is that schedule. The
failure mode worth knowing: if signing stops - a full disk, a
daemon down for longer than the signature validity, a clock jump
past the expiry - signatures start being expired at answer time,
and every validating resolver serves SERVFAIL for the zone. The
defense is monitoring the next resign schedule and keeping
signature validity comfortably longer than your worst plausible
outage.
The rest of this subsection breaks a chain on purpose, because
recovery is a rehearsal skill. The fastest break available is the
one from Section 22.4.2: replace the parent's DS with a digest
that matches nothing. As john on ns1, write
~/debian-handbook/dns-dhcp/break-ds.update:
server 127.0.0.1
zone test
update delete handbook.test. DS
update add handbook.test. 300 DS 12345 13 2 0000000000000000000000000000000000000000000000000000000000000000
send
All-zero digest, nonexistent key tag. Apply it as root on ns1:
# nsupdate -y hmac-sha256:ddns-key:Y2hhcHRlcjIyLWRkbnMta2V5LTAwMDEtYWJjZGVm < /home/john/debian-handbook/dns-dhcp/break-ds.update
Silent - the update applied. Flush the resolver's cached validation state, on resolver as root:
# unbound-control flush_zone handbook.test
ok removed 0 rrsets, 0 messages and 0 key entries
Nothing was cached this time, so nothing needed removal - the next query starts cold. That query, from lanclient as john:
$ dig @192.168.232.53 www.handbook.test A +dnssec | grep -E "status:|flags:"
;; ->>HEADER<<- opcode: QUERY, status: SERVFAIL, id: 58317
;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 1
; EDNS: version: 0, flags: do; udp: 1232
SERVFAIL, no ad, no answer. This is the resolver doing its job:
the parent presented a DS that matches no key in the child, so the
chain is broken, and a validating resolver must not serve data it
cannot prove. The diagnostic split is now obvious - query the
authoritative server directly (dig @192.168.232.10
www.handbook.test A +short still answers, as in Section 22.1.1),
and the data is fine; query through the resolver, and validation
refuses it. The zone is healthy; the chain is broken, and only
chain-level records - DS, DNSKEY, RRSIG - can be at fault.
Recovery is the same procedure in reverse. Restore the real DS with
the publish-ds.update batch from Section 22.4.2 (as root on ns1):
# nsupdate -y hmac-sha256:ddns-key:Y2hhcHRlcjIyLWRkbnMta2V5LTAwMDEtYWJjZGVm < /home/john/debian-handbook/dns-dhcp/publish-ds.update
Flush the resolver again - on resolver, as root:
# unbound-control flush_zone handbook.test
ok removed 3 rrsets, 3 messages and 1 key entries
This flush removed real state: the cached records and the key entry - the resolver had cached the negative validation result after the broken query, and serving the restored zone correctly requires dropping that too. The proof, from lanclient as john:
$ dig @192.168.232.53 www.handbook.test A +dnssec | grep -E "status:|flags:"
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 19872
;; flags: qr rd ra ad; QUERY: 1, ANSWER: 2, AUTHORITY: 0, ADDITIONAL: 1
; EDNS: version: 0, flags: do; udp: 1232
NOERROR, ad restored, the chain re-proven. The general recipe
for DNSSEC outages is what this rehearsal demonstrated: compare
direct-authoritative against through-resolver queries to localize
the fault to the chain, fix the offending chain record (DS, DNSKEY,
or signature), then flush the resolvers' cached validation state
and re-test. Every actor in the recipe - dnssec -status, dig
+dnssec, unbound-control flush_zone - is already in the
chapter's toolbox.