Skip to content

BIND9 DNSSEC signing and key rollover

Signing a zone with BIND9 dnssec-policy, automating KSK and ZSK rollover, and the operational signals that confirm validators see the change.

A zone needs DNSSEC and the operator needs to sleep through the next key rollover. This article walks the modern BIND9 dnssec-policy machinery: define the policy, attach it to the zone, publish the DS, and let named handle rotation. The deliverable is a signed zone with a documented policy, a working DS chain at the parent, and a verified roll plan that does not require manual dnssec-keygen runs every six months.

How to verify

Before signing, confirm what the resolvers see today. An unsigned zone returns no RRSIG; a signed-but-not-published zone validates as bogus.

dig +dnssec example.com SOA @8.8.8.8
delv @1.1.1.1 example.com SOA
dig DS example.com @8.8.8.8 +short
dig DNSKEY example.com @ns1.example.com +short
sudo rndc dnssec -status example.com

delv does its own validation and prints “fully validated” when the chain works. If DS is empty at the parent, you have not handed off yet. If DNSKEY is empty at the authoritative, the zone is not signed.

What’s happening

DNSSEC adds three new RR types you care about: DNSKEY (the public key), RRSIG (a signature over each RRset), and DS (the parent’s pointer to your DNSKEY hash). A signed zone has every RRset signed with one or more keys. Validating resolvers fetch the DNSKEY, verify the RRSIG, and walk up to the parent to verify the DS matches.

There are conventionally two key types:

  • KSK (Key Signing Key) — signs only the DNSKEY RRset. Its hash is published as the DS at the parent. Long-lived (1-2 years), rolled less often because it requires parent action.
  • ZSK (Zone Signing Key) — signs all other records. Shorter-lived (3-12 months), rolls without parent involvement.

Modern BIND (9.16+) replaces the old auto-dnssec/inline-signing mess with dnssec-policy. You define a policy once, attach it to the zone, and named handles key generation, signing, and rollover according to RFC 7583 timelines. See DNSSEC NSEC3 key rollover for the NSEC3 specifics.

The procedure

  1. Define the policy in named.conf.options. A reasonable default policy for most zones:

    dnssec-policy "default-policy" {
        keys {
            ksk lifetime P1Y algorithm ecdsap256sha256;
            zsk lifetime P3M algorithm ecdsap256sha256;
        };
        dnskey-ttl 3600;
        publish-safety PT12H;
        retire-safety PT12H;
        signatures-refresh P5D;
        signatures-validity P14D;
        signatures-validity-dnskey P14D;
        max-zone-ttl PT24H;
        zone-propagation-delay PT5M;
        parent-propagation-delay PT1H;
        parent-ds-ttl 86400;
        nsec3param iterations 0 optout no salt-length 0;
    };

    ECDSA P-256 keys are short and CPU-cheap to verify — preferable to RSA for new zones. iterations 0 for NSEC3 follows RFC 9276.

  2. Attach the policy to the zone. In named.conf.local:

    zone "example.com" {
        type primary;
        file "/etc/bind/zones/db.example.com";
        dnssec-policy "default-policy";
        inline-signing yes;
        key-directory "/var/cache/bind/keys/example.com";
        allow-transfer { key "transfer-key"; };
    };

    inline-signing yes keeps the unsigned source file intact and writes the signed copy alongside — useful when humans edit the zone or another tool writes it.

  3. Create the key directory and reload. named will generate keys on first reload:

    sudo mkdir -p /var/cache/bind/keys/example.com
    sudo chown bind:bind /var/cache/bind/keys/example.com
    sudo chmod 0750 /var/cache/bind/keys/example.com
    sudo named-checkconf -z
    sudo systemctl reload named
    sudo rndc dnssec -status example.com
  4. Hand off the DS to the parent. Get the DS records from the zone:

    sudo rndc dnssec -checkds published example.com
    dig DNSKEY example.com @ns1.example.com +short
    # Convert DNSKEY -> DS, or read the .key files:
    ls /var/cache/bind/keys/example.com/
    cat /var/cache/bind/keys/example.com/dsset-example.com.

    Submit the DS records to the registrar via their portal or DNSSEC API. After submission, tell named the DS is published so it can advance the timer:

    sudo rndc dnssec -checkds -key <KEY-TAG> published example.com
  5. Verify the chain. From a validating resolver:

    delv @1.1.1.1 example.com SOA
    dig +dnssec example.com @1.1.1.1 | grep -E 'RRSIG|ad'

    The ad flag in the response header confirms the resolver accepted the signature. If you see bogus, the chain is broken — check that the DS at the parent matches a current KSK at the child.

  6. Let rollover happen automatically. When dnssec-policy decides a ZSK is due to roll, it generates the new key, publishes it, switches signing to it, and retires the old one. Each phase has a built-in safety margin tied to max-zone-ttl. The operator’s job is to watch rndc dnssec -status and not interfere:

    sudo rndc dnssec -status example.com
    # KSK rollover is similar but pauses at "waiting for DS to be seen at parent"
    # Submit the new DS, then:
    sudo rndc dnssec -checkds -key <NEW-KEY-TAG> published example.com

Common pitfalls

  • Forgetting NSEC3 opt-out semantics. optout yes only signs delegations that have a DS — useful for very large registry-style zones, dangerous for normal authoritative use because it disables proof of non-existence for unsigned delegations.
  • Submitting DS before the DNSKEY is fully propagated. Validators that hit a secondary still serving the old keyset will see “bogus.” Wait one parent-DS-TTL plus your zone-propagation-delay before submitting.
  • Key directory permissions. bind user needs read + write on the key directory. World-readable private keys are a finding in any audit — keep mode 0750 and chown to bind:bind.
  • Inline signing journal explosion. Long-lived zones with frequent edits accumulate large .jnl.signed files. They are normal, but watch disk usage and rotate journals on a schedule (rndc sync -clean).
  • Resigning storm on policy change. Changing the policy (e.g. algorithm change) triggers a resign of every record. On a million-record zone this is CPU-heavy — schedule it for low-traffic windows.

In the engagements we run, DNSSEC is one of those features that is invisible when it works and on the front page of the post-mortem when it does not. The dnssec-policy machinery in modern BIND makes day-two operations a non-event; the operational work is in monitoring the rollover state, hooking the DS handoff into the registrar API, and alerting on validation failures from a separate vantage point. We bake all of that into how we operate clustered environments for clients.