<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:media="http://search.yahoo.com/mrss/"><channel><title>DNSSEC | A DevOps Blog</title><link>https://blog.bsdserver.nl/tag/dnssec/</link><description>Hands-on DevOps and homelab content: Kubernetes clusters, self-hosted services, CI/CD pipelines and infrastructure as code, by Patrick de Ruiter of We Build Your Cloud.</description><language>en</language><image><url>https://blog.bsdserver.nl/images/app-icon.svg</url><title>A DevOps Blog</title><link>https://blog.bsdserver.nl/</link></image><lastBuildDate>Wed, 18 Nov 2026 09:00:00 +0100</lastBuildDate><atom:link href="https://blog.bsdserver.nl/tag/dnssec/rss/" rel="self" type="application/rss+xml"/><ttl>60</ttl><item><title>Signing Your DNS Zones with DNSSEC on BIND Authoritative Servers</title><link>https://blog.bsdserver.nl/signing-your-dns-zones-with-dnssec-on-bind-authoritative-servers/</link><guid isPermaLink="false">693b6e4179eb54000160a599</guid><dc:creator>Patrick de Ruiter</dc:creator><pubDate>Fri, 12 Dec 2025 01:22:09 +0000</pubDate><description>After configuring DNSSEC validation on your resolvers, the next step is signing your own authoritative zones.</description><category>BIND</category><category>DNS</category><category>DNSSEC</category><category>Security</category><category>Homelab</category><category>Linux</category><media:content url="https://blog.bsdserver.nl/content/images/2026/01/bind-dnssec.png" medium="image"/><content:encoded><![CDATA[<p>After configuring DNSSEC validation on your resolvers, the next step is signing your own authoritative zones. Without signatures, a validating resolver has nothing to check: your records can still be forged in transit.</p>
<p>This post signs zones on a BIND authoritative server. It covers key types and algorithms, a manual signing run to show the moving parts, automated signing with <code>dnssec-policy</code>, publishing the DS record, and key rollovers.</p>
<h2 id="why-sign-your-zones">Why sign your zones? <a class="anchor" data-pagefind-ignore href="#why-sign-your-zones" aria-label="Link to this section">#</a></h2>
<ul>
<li><strong>Authentic answers</strong>: validating resolvers can prove your records came from you, unmodified.</li>
<li><strong>Completes the chain of trust</strong>: the DS record in the parent zone links your zone to the root.</li>
<li><strong>Enables DNSSEC-based features</strong>: records like TLSA (DANE) and SSHFP are only trusted when signed.</li>
</ul>
<h3 id="when-to-use-it">When to use it <a class="anchor" data-pagefind-ignore href="#when-to-use-it" aria-label="Link to this section">#</a></h3>
<ul>
<li><strong>Use it</strong> for public zones you control, where your registrar supports DS records.</li>
<li><strong>Skip it</strong> (for now) if nobody can monitor signature expiry or handle a KSK rollover. An expired signature takes the whole zone offline for validating resolvers, which is worse than no DNSSEC.</li>
</ul>
<h2 id="how-it-works">How it works <a class="anchor" data-pagefind-ignore href="#how-it-works" aria-label="Link to this section">#</a></h2>
<table>
	<thead>
			<tr>
					<th>Component</th>
					<th>Lives in</th>
					<th>Job</th>
			</tr>
	</thead>
	<tbody>
			<tr>
					<td>KSK (Key Signing Key)</td>
					<td>Your zone</td>
					<td>Signs the DNSKEY RRset (the zone&rsquo;s public keys)</td>
			</tr>
			<tr>
					<td>ZSK (Zone Signing Key)</td>
					<td>Your zone</td>
					<td>Signs all other records</td>
			</tr>
			<tr>
					<td>RRSIG records</td>
					<td>Your zone</td>
					<td>The signatures, one per record set</td>
			</tr>
			<tr>
					<td>NSEC / NSEC3</td>
					<td>Your zone</td>
					<td>Prove that a name or type does not exist</td>
			</tr>
			<tr>
					<td>DS record</td>
					<td>Parent zone</td>
					<td>Hash of your KSK; links your zone into the chain of trust</td>
			</tr>
	</tbody>
</table>
<p>The flow: resolver trusts the parent → parent&rsquo;s DS matches your KSK → KSK signs your DNSKEY set → ZSK signs your records → answer validated.</p>
<h3 id="key-signing-key-ksk">Key Signing Key (KSK) <a class="anchor" data-pagefind-ignore href="#key-signing-key-ksk" aria-label="Link to this section">#</a></h3>
<ul>
<li>Signs the DNSKEY RRset (the zone&rsquo;s public keys)</li>
<li>Longer lifetime (typically 1-2 years)</li>
<li>Larger key size for stronger security</li>
<li>Its hash (DS record) is published in the parent zone</li>
</ul>
<h3 id="zone-signing-key-zsk">Zone Signing Key (ZSK) <a class="anchor" data-pagefind-ignore href="#zone-signing-key-zsk" aria-label="Link to this section">#</a></h3>
<ul>
<li>Signs all other records in the zone</li>
<li>Shorter lifetime (typically 1-3 months)</li>
<li>Smaller key size for performance</li>
<li>Rolled more frequently</li>
</ul>
<p>The split exists because a KSK change needs your registrar (a new DS record), while a ZSK change does not. Keeping the KSK stable means you can roll the ZSK as often as you like without touching the parent.</p>
<h2 id="choosing-dnssec-algorithms">Choosing DNSSEC Algorithms <a class="anchor" data-pagefind-ignore href="#choosing-dnssec-algorithms" aria-label="Link to this section">#</a></h2>
<p>Modern BIND supports several algorithms:</p>
<table>
	<thead>
			<tr>
					<th>Algorithm</th>
					<th>Number</th>
					<th>Recommendation</th>
			</tr>
	</thead>
	<tbody>
			<tr>
					<td>RSASHA256</td>
					<td>8</td>
					<td>Good, widely supported</td>
			</tr>
			<tr>
					<td>RSASHA512</td>
					<td>10</td>
					<td>Good, wider margins</td>
			</tr>
			<tr>
					<td>ECDSAP256SHA256</td>
					<td>13</td>
					<td>Recommended, smaller keys</td>
			</tr>
			<tr>
					<td>ECDSAP384SHA384</td>
					<td>14</td>
					<td>Strong, larger signatures</td>
			</tr>
			<tr>
					<td>ED25519</td>
					<td>15</td>
					<td>Best, smallest signatures</td>
			</tr>
	</tbody>
</table>
<p>For new deployments, use <strong>ECDSAP256SHA256 (13)</strong> or <strong>ED25519 (15)</strong> for best performance and security. Smaller signatures keep responses under the UDP size limit.</p>
<h2 id="manual-signing-or-dnssec-policy">Manual signing or dnssec-policy? <a class="anchor" data-pagefind-ignore href="#manual-signing-or-dnssec-policy" aria-label="Link to this section">#</a></h2>
<table>
	<thead>
			<tr>
					<th>Approach</th>
					<th>Use it for</th>
			</tr>
	</thead>
	<tbody>
			<tr>
					<td>Manual (<code>dnssec-keygen</code> + <code>dnssec-signzone</code>)</td>
					<td>Understanding the mechanics, or offline signing. You re-sign before signatures expire and run rollovers yourself.</td>
			</tr>
			<tr>
					<td><code>dnssec-policy</code> + inline signing</td>
					<td>Production. BIND generates keys, signs, re-signs and rolls the ZSK automatically.</td>
			</tr>
	</tbody>
</table>
<p>The manual steps below show what BIND automates. If you only want a working setup, skip to <a href="#automated-dnssec-with-dnssec-policy">Automated DNSSEC with dnssec-policy</a>.</p>
<h2 id="manual-dnssec-configuration">Manual DNSSEC Configuration <a class="anchor" data-pagefind-ignore href="#manual-dnssec-configuration" aria-label="Link to this section">#</a></h2>
<h3 id="generating-keys-manually">Generating Keys Manually <a class="anchor" data-pagefind-ignore href="#generating-keys-manually" aria-label="Link to this section">#</a></h3>
<p>First create a key directory that only BIND can read. The private keys in it can sign anything for your zone.</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">mkdir -p /var/cache/bind/keys
</span></span><span class="line"><span class="cl">chown bind:bind /var/cache/bind/keys
</span></span><span class="line"><span class="cl">chmod <span class="m">700</span> /var/cache/bind/keys
</span></span></code></pre></div><p>Generate the KSK. <code>-f KSK</code> sets the KSK flag; <code>-n ZONE</code> marks it as a zone key.</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl"><span class="nb">cd</span> /var/cache/bind/keys
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="c1"># Generate KSK with ECDSAP256SHA256</span>
</span></span><span class="line"><span class="cl">dnssec-keygen -a ECDSAP256SHA256 -f KSK -n ZONE example.com
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="c1"># Or with RSA (2048-bit minimum, 4096 recommended for KSK)</span>
</span></span><span class="line"><span class="cl">dnssec-keygen -a RSASHA256 -b <span class="m">4096</span> -f KSK -n ZONE example.com
</span></span></code></pre></div><p>Generate the ZSK (same command, without <code>-f KSK</code>):</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl"><span class="c1"># Generate ZSK with ECDSAP256SHA256</span>
</span></span><span class="line"><span class="cl">dnssec-keygen -a ECDSAP256SHA256 -n ZONE example.com
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="c1"># Or with RSA (2048-bit)</span>
</span></span><span class="line"><span class="cl">dnssec-keygen -a RSASHA256 -b <span class="m">2048</span> -n ZONE example.com
</span></span></code></pre></div><p>This creates two files per key:</p>
<ul>
<li><code>Kexample.com.+013+12345.key</code> - Public key (DNSKEY record)</li>
<li><code>Kexample.com.+013+12345.private</code> - Private key</li>
</ul>
<p>The <code>013</code> in the name is the algorithm number; <code>12345</code> is the key tag.</p>
<h3 id="manual-zone-signing">Manual Zone Signing <a class="anchor" data-pagefind-ignore href="#manual-zone-signing" aria-label="Link to this section">#</a></h3>
<p>Add the public keys to the zone with <code>$INCLUDE</code>, so the DNSKEY records are part of what gets signed:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-dns" data-lang="dns"><span class="line"><span class="cl"><span class="c">; /var/cache/bind/zones/db.example.com</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="na">$TTL</span><span class="w"> </span><span class="sc">86400</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="na">$INCLUDE</span><span class="w"> </span><span class="err">/var/cache/bind/keys/</span><span class="nc">Kexample.com.</span><span class="err">+</span><span class="sc">013</span><span class="err">+</span><span class="sc">12345</span><span class="err">.key</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="na">$INCLUDE</span><span class="w"> </span><span class="err">/var/cache/bind/keys/</span><span class="nc">Kexample.com.</span><span class="err">+</span><span class="sc">013</span><span class="err">+</span><span class="sc">67890</span><span class="err">.key</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="nc">@</span><span class="w">   </span><span class="k">IN</span><span class="w">  </span><span class="k">SOA</span><span class="w"> </span><span class="py">ns1.example.com. admin.example.com. </span><span class="p">(</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">        </span><span class="sc">2024011001</span><span class="w">  </span><span class="c">; Serial</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">        </span><span class="sc">3600</span><span class="w">        </span><span class="c">; Refresh</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">        </span><span class="sc">1800</span><span class="w">        </span><span class="c">; Retry</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">        </span><span class="sc">604800</span><span class="w">      </span><span class="c">; Expire</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">        </span><span class="sc">86400</span><span class="w"> </span><span class="p">)</span><span class="w">     </span><span class="c">; Minimum TTL</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">    </span><span class="k">IN</span><span class="w">  </span><span class="k">NS</span><span class="w">  </span><span class="py">ns1.example.com.</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">    </span><span class="k">IN</span><span class="w">  </span><span class="k">NS</span><span class="w">  </span><span class="py">ns2.example.com.</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">    </span><span class="k">IN</span><span class="w">  </span><span class="k">MX</span><span class="w">  </span><span class="sc">10</span><span class="w"> </span><span class="py">mail.example.com.</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">    </span><span class="k">IN</span><span class="w">  </span><span class="k">A</span><span class="w">   </span><span class="mi">192.168.1.10</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="nc">ns1</span><span class="w"> </span><span class="k">IN</span><span class="w">  </span><span class="k">A</span><span class="w">   </span><span class="mi">192.168.1.1</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="nc">ns2</span><span class="w"> </span><span class="k">IN</span><span class="w">  </span><span class="k">A</span><span class="w">   </span><span class="mi">192.168.1.2</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="nc">mail</span><span class="w"> </span><span class="k">IN</span><span class="w"> </span><span class="k">A</span><span class="w">   </span><span class="mi">192.168.1.20</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="nc">www</span><span class="w"> </span><span class="k">IN</span><span class="w">  </span><span class="k">A</span><span class="w">   </span><span class="mi">192.168.1.10</span><span class="w">
</span></span></span></code></pre></div><p>Then sign the zone:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl"><span class="c1"># Sign zone with NSEC3 (no salt, 0 iterations as per RFC 9276)</span>
</span></span><span class="line"><span class="cl">dnssec-signzone -3 - <span class="se">\
</span></span></span><span class="line"><span class="cl">    -N INCREMENT -o example.com -t <span class="se">\
</span></span></span><span class="line"><span class="cl">    -K /var/cache/bind/keys <span class="se">\
</span></span></span><span class="line"><span class="cl">    /var/cache/bind/zones/db.example.com
</span></span></code></pre></div><ul>
<li><code>-3 -</code>: use NSEC3 with no salt.</li>
<li><code>-N INCREMENT</code>: increase the SOA serial so slave servers pick up the signed version.</li>
<li><code>-o example.com</code>: the zone origin.</li>
<li><code>-t</code>: print signing statistics.</li>
<li><code>-K</code>: where to find the keys.</li>
</ul>
<p>This creates <code>db.example.com.signed</code> containing:</p>
<ul>
<li>RRSIG records (signatures)</li>
<li>NSEC3 records (authenticated denial of existence)</li>
<li>NSEC3PARAM record</li>
</ul>
<p>Point the zone&rsquo;s <code>file</code> at the <code>.signed</code> file. You have to repeat the signing run before the signatures expire.</p>
<h2 id="automated-dnssec-with-dnssec-policy">Automated DNSSEC with dnssec-policy <a class="anchor" data-pagefind-ignore href="#automated-dnssec-with-dnssec-policy" aria-label="Link to this section">#</a></h2>
<p>BIND 9.16+ supports automatic key management with <code>dnssec-policy</code>. This is the recommended approach: you describe the keys and timings once, and BIND does the rest.</p>
<h3 id="define-dnssec-policies">Define DNSSEC Policies <a class="anchor" data-pagefind-ignore href="#define-dnssec-policies" aria-label="Link to this section">#</a></h3>
<p>A policy says which keys to use, how long they live and how long signatures stay valid. Define it once and reuse it for many zones.</p>
<pre tabindex="0"><code class="language-named" data-lang="named">// /etc/bind/named.conf.options

dnssec-policy &#34;standard&#34; {
    // Key algorithm and parameters
    keys {
        // KSK: ECDSA P-256, unlimited lifetime (manual rollover)
        ksk key-directory lifetime unlimited algorithm ecdsap256sha256;
        // ZSK: ECDSA P-256, 90-day lifetime (auto rollover)
        zsk key-directory lifetime 90d algorithm ecdsap256sha256;
    };

    // Timing parameters
    dnskey-ttl 3600;              // TTL for DNSKEY records
    publish-safety 1h;             // Safety margin for publishing
    retire-safety 1h;              // Safety margin for retiring
    purge-keys 90d;                // Remove old keys after 90 days

    // Signature parameters
    signatures-refresh 5d;         // Re-sign 5 days before expiry
    signatures-validity 14d;       // Signatures valid for 14 days
    signatures-validity-dnskey 14d;

    // NSEC3 parameters (authenticated denial)
    nsec3param iterations 0 optout no salt-length 0;

    // Key storage: key-directory is not valid inside dnssec-policy,
    // set it in the zone (or options) statement instead
};

// More conservative policy for critical zones
dnssec-policy &#34;critical&#34; {
    keys {
        ksk key-directory lifetime unlimited algorithm ecdsap384sha384;
        zsk key-directory lifetime 30d algorithm ecdsap384sha384;
    };
    dnskey-ttl 1800;
    signatures-refresh 3d;
    signatures-validity 7d;
    signatures-validity-dnskey 7d;
    nsec3param iterations 0 optout no salt-length 0;
};

// Default policy (built-in)
// Uses a single ECDSAP256SHA256 CSK with unlimited lifetime, NSEC
</code></pre><p>What the key settings do:</p>
<table>
	<thead>
			<tr>
					<th>Setting</th>
					<th>What it does</th>
					<th>When to change it</th>
			</tr>
	</thead>
	<tbody>
			<tr>
					<td><code>ksk ... lifetime unlimited</code></td>
					<td>KSK never rolls automatically</td>
					<td>Keep; KSK rolls need the registrar</td>
			</tr>
			<tr>
					<td><code>zsk ... lifetime 90d</code></td>
					<td>ZSK is replaced every 90 days</td>
					<td>Shorter for critical zones</td>
			</tr>
			<tr>
					<td><code>dnskey-ttl</code></td>
					<td>TTL of the DNSKEY records</td>
					<td>Lower if you want faster rollovers</td>
			</tr>
			<tr>
					<td><code>publish-safety</code> / <code>retire-safety</code></td>
					<td>Extra margin before a new key is used and after an old key is retired</td>
					<td>Raise if caches upstream are slow</td>
			</tr>
			<tr>
					<td><code>purge-keys</code></td>
					<td>Delete old key files this long after removal</td>
					<td>Keep long enough for troubleshooting</td>
			</tr>
			<tr>
					<td><code>signatures-validity</code></td>
					<td>How long each signature is valid</td>
					<td>Shorter = less replay window, more re-signing</td>
			</tr>
			<tr>
					<td><code>signatures-refresh</code></td>
					<td>Re-sign this long before expiry</td>
					<td>Must stay well below the validity</td>
			</tr>
			<tr>
					<td><code>nsec3param iterations 0 ... salt-length 0</code></td>
					<td>NSEC3 with the RFC 9276 values</td>
					<td>Keep</td>
			</tr>
	</tbody>
</table>
<p>The <code>critical</code> policy uses a stronger algorithm, a 30-day ZSK and shorter signature validity. <code>dnssec-policy default</code> uses BIND&rsquo;s built-in policy, described in the last comment of the block.</p>
<h3 id="apply-policy-to-zones">Apply Policy to Zones <a class="anchor" data-pagefind-ignore href="#apply-policy-to-zones" aria-label="Link to this section">#</a></h3>
<p>Attach a policy to each zone with <code>dnssec-policy</code>. The zone file stays as you wrote it.</p>
<pre tabindex="0"><code class="language-named" data-lang="named">// /etc/bind/named.conf.local

zone &#34;example.com&#34; {
    type primary;
    file &#34;/var/cache/bind/zones/db.example.com&#34;;
    dnssec-policy &#34;standard&#34;;
    inline-signing yes;  // Sign dynamically, keep unsigned source
    key-directory &#34;/var/cache/bind/keys&#34;;
};

zone &#34;critical.example.com&#34; {
    type primary;
    file &#34;/var/cache/bind/zones/db.critical.example.com&#34;;
    dnssec-policy &#34;critical&#34;;
    inline-signing yes;
    key-directory &#34;/var/cache/bind/keys&#34;;
};
</code></pre><ul>
<li><code>inline-signing yes</code>: BIND keeps your unsigned file and serves a signed copy.</li>
<li><code>key-directory</code>: where BIND creates and reads the keys for this zone.</li>
</ul>
<h3 id="inline-signing">Inline Signing <a class="anchor" data-pagefind-ignore href="#inline-signing" aria-label="Link to this section">#</a></h3>
<p>With <code>inline-signing yes</code>, BIND:</p>
<ul>
<li>Keeps your original zone file unchanged</li>
<li>Creates a signed version automatically</li>
<li>Re-signs when signatures approach expiry</li>
<li>Handles key rollovers automatically</li>
</ul>
<p>You keep editing the normal zone file and reloading; BIND signs the changes.</p>
<h2 id="publishing-the-ds-record">Publishing the DS Record <a class="anchor" data-pagefind-ignore href="#publishing-the-ds-record" aria-label="Link to this section">#</a></h2>
<p>A signed zone is not trusted until the parent zone holds its DS record. Until then, validating resolvers treat it as unsigned.</p>
<h3 id="generate-ds-record">Generate DS Record <a class="anchor" data-pagefind-ignore href="#generate-ds-record" aria-label="Link to this section">#</a></h3>
<p><code>dnssec-dsfromkey</code> computes the DS record from the KSK. <code>-2</code> selects SHA-256:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl"><span class="c1"># Generate DS records from your KSK</span>
</span></span><span class="line"><span class="cl">dnssec-dsfromkey -2 /var/cache/bind/keys/Kexample.com.+013+12345.key
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="c1"># Output:</span>
</span></span><span class="line"><span class="cl"><span class="c1"># example.com. IN DS 12345 13 2 E2D3C916F6DED0ED3D9A8E6C1C0A2ED7...</span>
</span></span></code></pre></div><p>The DS record contains:</p>
<ul>
<li>Key tag (12345)</li>
<li>Algorithm (13 = ECDSAP256SHA256)</li>
<li>Digest type (2 = SHA-256)</li>
<li>Digest (hash of the KSK)</li>
</ul>
<h3 id="submit-ds-record-to-registrar">Submit DS Record to Registrar <a class="anchor" data-pagefind-ignore href="#submit-ds-record-to-registrar" aria-label="Link to this section">#</a></h3>
<p>For domains registered with a registrar:</p>
<ol>
<li>Log into your registrar&rsquo;s control panel</li>
<li>Find DNS/DNSSEC settings</li>
<li>Add the DS record with:
<ul>
<li>Key Tag: 12345</li>
<li>Algorithm: 13</li>
<li>Digest Type: 2</li>
<li>Digest: (the hash value)</li>
</ul>
</li>
</ol>
<p>For subzones under your control, add the DS record to the parent zone:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-dns" data-lang="dns"><span class="line"><span class="cl"><span class="c">; In parent zone</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="nc">subdomain</span><span class="w"> </span><span class="k">IN</span><span class="w"> </span><span class="k">DS</span><span class="w"> </span><span class="sc">12345</span><span class="w"> </span><span class="sc">13</span><span class="w"> </span><span class="sc">2</span><span class="w"> </span><span class="py">E2D3C916F6DED0ED3D9A8E6C1C0A2ED7...</span><span class="w">
</span></span></span></code></pre></div><h2 id="nsec-vs-nsec3">NSEC vs NSEC3 <a class="anchor" data-pagefind-ignore href="#nsec-vs-nsec3" aria-label="Link to this section">#</a></h2>
<p>A signed zone must also prove that a name does <em>not</em> exist. NSEC and NSEC3 do this in different ways:</p>
<table>
	<thead>
			<tr>
					<th></th>
					<th>NSEC</th>
					<th>NSEC3</th>
			</tr>
	</thead>
	<tbody>
			<tr>
					<td>How</td>
					<td>Links each name to the next one, in clear text</td>
					<td>Links hashed names</td>
			</tr>
			<tr>
					<td>Zone walking</td>
					<td>Possible: anyone can list all names</td>
					<td>Prevented</td>
			</tr>
			<tr>
					<td>Cost</td>
					<td>Simpler, smaller responses</td>
					<td>Slightly larger responses, more CPU</td>
			</tr>
			<tr>
					<td>In dnssec-policy</td>
					<td>Default (no <code>nsec3param</code>)</td>
					<td>Add <code>nsec3param</code></td>
			</tr>
	</tbody>
</table>
<h3 id="nsec-original">NSEC (Original) <a class="anchor" data-pagefind-ignore href="#nsec-original" aria-label="Link to this section">#</a></h3>
<pre tabindex="0"><code class="language-named" data-lang="named">// Enable NSEC (default)
dnssec-policy &#34;nsec-policy&#34; {
    keys {
        ksk lifetime unlimited algorithm ecdsap256sha256;
        zsk lifetime 90d algorithm ecdsap256sha256;
    };
    // No nsec3param = use NSEC
};
</code></pre><h3 id="nsec3-recommended">NSEC3 (Recommended) <a class="anchor" data-pagefind-ignore href="#nsec3-recommended" aria-label="Link to this section">#</a></h3>
<pre tabindex="0"><code class="language-named" data-lang="named">// Enable NSEC3
dnssec-policy &#34;nsec3-policy&#34; {
    keys {
        ksk lifetime unlimited algorithm ecdsap256sha256;
        zsk lifetime 90d algorithm ecdsap256sha256;
    };
    // NSEC3 parameters
    // iterations: 0 recommended (RFC 9276)
    // optout: no (sign all records)
    // salt-length: 0 recommended (RFC 9276)
    nsec3param iterations 0 optout no salt-length 0;
};
</code></pre><p>RFC 9276 recommends 0 iterations and no salt: extra iterations cost resolvers CPU without adding real protection.</p>
<h2 id="key-rollover-procedures">Key Rollover Procedures <a class="anchor" data-pagefind-ignore href="#key-rollover-procedures" aria-label="Link to this section">#</a></h2>
<table>
	<thead>
			<tr>
					<th>Key</th>
					<th>Rollover</th>
					<th>Parent involved</th>
			</tr>
	</thead>
	<tbody>
			<tr>
					<td>ZSK</td>
					<td>Automatic with <code>dnssec-policy</code></td>
					<td>No</td>
			</tr>
			<tr>
					<td>KSK</td>
					<td>Manual, triggered by you</td>
					<td>Yes, new DS record</td>
			</tr>
	</tbody>
</table>
<h3 id="automatic-zsk-rollover">Automatic ZSK Rollover <a class="anchor" data-pagefind-ignore href="#automatic-zsk-rollover" aria-label="Link to this section">#</a></h3>
<p>With <code>dnssec-policy</code>, ZSK rollovers happen automatically. Check the key states and the next scheduled rollover:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl"><span class="c1"># Check key states and the next scheduled rollover</span>
</span></span><span class="line"><span class="cl">rndc dnssec -status example.com
</span></span></code></pre></div><p><code>rndc signing -list</code> does not work for zones that use <code>dnssec-policy</code>; BIND answers &ldquo;zone uses dnssec-policy, use rndc dnssec command instead&rdquo;.</p>
<h3 id="manual-ksk-rollover-double-ds-method">Manual KSK Rollover (Double-DS Method) <a class="anchor" data-pagefind-ignore href="#manual-ksk-rollover-double-ds-method" aria-label="Link to this section">#</a></h3>
<p>A KSK rollover changes the DS record in the parent, so you coordinate it with the registrar. With the double-DS method the old and new DS are both published for a while, so validation never breaks.</p>
<p><strong>Step 1: Generate new KSK</strong></p>
<p><code>rndc dnssec -rollover</code> starts the rollover of an existing key under <code>dnssec-policy</code>; <code>dnssec-keygen</code> is the manual alternative.</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl"><span class="c1"># Generate successor KSK</span>
</span></span><span class="line"><span class="cl">rndc dnssec -rollover -key <span class="m">12345</span> example.com
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="c1"># Or manually</span>
</span></span><span class="line"><span class="cl">dnssec-keygen -a ECDSAP256SHA256 -f KSK -n ZONE example.com
</span></span></code></pre></div><p><strong>Step 2: Add new DS to parent</strong></p>
<p>Compute the DS for the new key and add it at the registrar next to the old one:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl"><span class="c1"># Generate DS for new key</span>
</span></span><span class="line"><span class="cl">dnssec-dsfromkey /var/cache/bind/keys/Kexample.com.+013+NEW_ID.key
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="c1"># Submit new DS to registrar (keep old DS)</span>
</span></span></code></pre></div><p><strong>Step 3: Wait for propagation</strong></p>
<p>Wait at least 2x the TTL of the DS record in the parent zone.</p>
<p><strong>Step 4: Complete rollover</strong></p>
<p>BIND does not watch your registrar; tell it when each DS change is live. Run the first command once the new DS is published. Then remove the old DS at your registrar and run the second command.</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl"><span class="c1"># Tell BIND the new DS is published in the parent</span>
</span></span><span class="line"><span class="cl">rndc dnssec -checkds -key NEW_ID published example.com
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="c1"># After TTL expires, remove old DS from parent, then tell BIND it is withdrawn</span>
</span></span><span class="line"><span class="cl">rndc dnssec -checkds -key <span class="m">12345</span> withdrawn example.com
</span></span></code></pre></div><h2 id="monitoring-dnssec-health">Monitoring DNSSEC Health <a class="anchor" data-pagefind-ignore href="#monitoring-dnssec-health" aria-label="Link to this section">#</a></h2>
<h3 id="check-zone-signatures">Check Zone Signatures <a class="anchor" data-pagefind-ignore href="#check-zone-signatures" aria-label="Link to this section">#</a></h3>
<p>Expired signatures are the most common DNSSEC outage. This script reads the expiry of the SOA signature and warns when fewer than <code>WARN_DAYS</code> remain:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl"><span class="cp">#!/bin/bash
</span></span></span><span class="line"><span class="cl"><span class="c1"># check-dnssec.sh - Monitor DNSSEC signature expiry</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="nv">ZONE</span><span class="o">=</span><span class="s2">&#34;example.com&#34;</span>
</span></span><span class="line"><span class="cl"><span class="nv">WARN_DAYS</span><span class="o">=</span><span class="m">7</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="c1"># Get signature expiry from zone</span>
</span></span><span class="line"><span class="cl"><span class="nv">EXPIRY</span><span class="o">=</span><span class="k">$(</span>dig +dnssec @localhost <span class="nv">$ZONE</span> SOA <span class="p">|</span> <span class="se">\
</span></span></span><span class="line"><span class="cl">    grep RRSIG <span class="p">|</span> <span class="se">\
</span></span></span><span class="line"><span class="cl">    awk <span class="s1">&#39;{print $9}&#39;</span> <span class="p">|</span> <span class="se">\
</span></span></span><span class="line"><span class="cl">    head -1<span class="k">)</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="k">if</span> <span class="o">[</span> -n <span class="s2">&#34;</span><span class="nv">$EXPIRY</span><span class="s2">&#34;</span> <span class="o">]</span><span class="p">;</span> <span class="k">then</span>
</span></span><span class="line"><span class="cl">    <span class="c1"># Parse DNSSEC timestamp (YYYYMMDDHHMMSS)</span>
</span></span><span class="line"><span class="cl">    <span class="nv">EXPIRY_EPOCH</span><span class="o">=</span><span class="k">$(</span>date -d <span class="s2">&#34;</span><span class="si">${</span><span class="nv">EXPIRY</span><span class="p">:</span><span class="nv">0</span><span class="p">:</span><span class="nv">8</span><span class="si">}</span><span class="s2"> </span><span class="si">${</span><span class="nv">EXPIRY</span><span class="p">:</span><span class="nv">8</span><span class="p">:</span><span class="nv">2</span><span class="si">}</span><span class="s2">:</span><span class="si">${</span><span class="nv">EXPIRY</span><span class="p">:</span><span class="nv">10</span><span class="p">:</span><span class="nv">2</span><span class="si">}</span><span class="s2">:</span><span class="si">${</span><span class="nv">EXPIRY</span><span class="p">:</span><span class="nv">12</span><span class="p">:</span><span class="nv">2</span><span class="si">}</span><span class="s2">&#34;</span> +%s 2&gt;/dev/null<span class="k">)</span>
</span></span><span class="line"><span class="cl">    <span class="nv">NOW_EPOCH</span><span class="o">=</span><span class="k">$(</span>date +%s<span class="k">)</span>
</span></span><span class="line"><span class="cl">    <span class="nv">DAYS_LEFT</span><span class="o">=</span><span class="k">$((</span> <span class="o">(</span>EXPIRY_EPOCH <span class="o">-</span> NOW_EPOCH<span class="o">)</span> <span class="o">/</span> <span class="m">86400</span> <span class="k">))</span>
</span></span><span class="line"><span class="cl">    
</span></span><span class="line"><span class="cl">    <span class="nb">echo</span> <span class="s2">&#34;Zone: </span><span class="nv">$ZONE</span><span class="s2">&#34;</span>
</span></span><span class="line"><span class="cl">    <span class="nb">echo</span> <span class="s2">&#34;Signature expires: </span><span class="nv">$EXPIRY</span><span class="s2">&#34;</span>
</span></span><span class="line"><span class="cl">    <span class="nb">echo</span> <span class="s2">&#34;Days remaining: </span><span class="nv">$DAYS_LEFT</span><span class="s2">&#34;</span>
</span></span><span class="line"><span class="cl">    
</span></span><span class="line"><span class="cl">    <span class="k">if</span> <span class="o">[</span> <span class="nv">$DAYS_LEFT</span> -lt <span class="nv">$WARN_DAYS</span> <span class="o">]</span><span class="p">;</span> <span class="k">then</span>
</span></span><span class="line"><span class="cl">        <span class="nb">echo</span> <span class="s2">&#34;WARNING: Signatures expiring soon!&#34;</span>
</span></span><span class="line"><span class="cl">        <span class="nb">exit</span> <span class="m">1</span>
</span></span><span class="line"><span class="cl">    <span class="k">fi</span>
</span></span><span class="line"><span class="cl"><span class="k">else</span>
</span></span><span class="line"><span class="cl">    <span class="nb">echo</span> <span class="s2">&#34;ERROR: Could not retrieve DNSSEC signatures for </span><span class="nv">$ZONE</span><span class="s2">&#34;</span>
</span></span><span class="line"><span class="cl">    <span class="nb">exit</span> <span class="m">2</span>
</span></span><span class="line"><span class="cl"><span class="k">fi</span>
</span></span></code></pre></div><p>With <code>dnssec-policy</code>, signatures are refreshed automatically, so a warning here means re-signing has stopped.</p>
<h3 id="verify-chain-of-trust">Verify Chain of Trust <a class="anchor" data-pagefind-ignore href="#verify-chain-of-trust" aria-label="Link to this section">#</a></h3>
<p>Check the full chain from outside, then compare the parent&rsquo;s DS with your key and verify the signed zone file:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl"><span class="c1"># Full chain verification</span>
</span></span><span class="line"><span class="cl">delv @8.8.8.8 example.com SOA +rtrace
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="c1"># Check DS record matches</span>
</span></span><span class="line"><span class="cl">dig DS example.com @parent-ns.tld
</span></span><span class="line"><span class="cl">dnssec-dsfromkey /var/cache/bind/keys/Kexample.com.+013+12345.key
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="c1"># Verify signatures</span>
</span></span><span class="line"><span class="cl">dnssec-verify -o example.com /var/cache/bind/zones/db.example.com.signed
</span></span></code></pre></div><ul>
<li><code>delv ... +rtrace</code>: validates through a public resolver, like your users&rsquo; resolvers would.</li>
<li><code>dnssec-verify</code>: checks that every record in the signed file has valid signatures.</li>
</ul>
<h3 id="online-validation-tools">Online Validation Tools <a class="anchor" data-pagefind-ignore href="#online-validation-tools" aria-label="Link to this section">#</a></h3>
<p>Use these services to verify your DNSSEC deployment:</p>
<ul>
<li>DNSViz: <a href="https://dnsviz.net/" rel="noopener">https://dnsviz.net/</a></li>
<li>Verisign DNSSEC Analyzer: <a href="https://dnssec-analyzer.verisignlabs.com/" rel="noopener">https://dnssec-analyzer.verisignlabs.com/</a></li>
<li>SIDN DNSSEC Test: <a href="https://check.sidnlabs.nl/" rel="noopener">https://check.sidnlabs.nl/</a></li>
</ul>
<h2 id="complete-configuration-example">Complete Configuration Example <a class="anchor" data-pagefind-ignore href="#complete-configuration-example" aria-label="Link to this section">#</a></h2>
<p>Here&rsquo;s a production-ready DNSSEC configuration. The options and policy go in <code>named.conf.options</code>:</p>
<pre tabindex="0"><code class="language-named" data-lang="named">// /etc/bind/named.conf.options

options {
    directory &#34;/var/cache/bind&#34;;
    
    // DNSSEC validation for the server&#39;s own recursive lookups
    dnssec-validation auto;
    
    // Key and managed-keys directory (both must exist, named exits otherwise)
    key-directory &#34;/var/cache/bind/keys&#34;;
    managed-keys-directory &#34;/var/cache/bind/managed-keys&#34;;
    
    // Logging
    querylog yes;
};

// Standard DNSSEC policy
dnssec-policy &#34;production&#34; {
    keys {
        ksk key-directory lifetime unlimited algorithm ecdsap256sha256;
        zsk key-directory lifetime P90D algorithm ecdsap256sha256;
    };
    
    // Timing
    dnskey-ttl PT1H;
    publish-safety PT1H;
    retire-safety PT1H;
    purge-keys P90D;
    
    // Signatures
    signatures-refresh P5D;
    signatures-validity P14D;
    signatures-validity-dnskey P14D;
    
    // NSEC3 (RFC 9276 recommendations)
    nsec3param iterations 0 optout no salt-length 0;
};

logging {
    channel dnssec_log {
        file &#34;/var/log/named/dnssec.log&#34; versions 3 size 10m;
        severity info;
        print-time yes;
        print-severity yes;
    };
    category dnssec { dnssec_log; };
};
</code></pre><ul>
<li><code>key-directory</code> / <code>managed-keys-directory</code>: both directories must exist, or <code>named</code> will not start.</li>
<li>The policy values use ISO 8601 durations (<code>P90D</code>, <code>PT1H</code>); they mean the same as <code>90d</code> and <code>1h</code> above.</li>
</ul>
<p>The zones go in <code>named.conf.local</code>, with the reverse zone signed too:</p>
<pre tabindex="0"><code class="language-named" data-lang="named">// /etc/bind/named.conf.local

zone &#34;example.com&#34; {
    type primary;
    file &#34;/var/cache/bind/zones/db.example.com&#34;;
    dnssec-policy &#34;production&#34;;
    inline-signing yes;
    
    // Allow zone transfers to secondaries
    // (key &#34;transfer-key&#34; must be defined, see the RNDC and TSIG post)
    allow-transfer { key &#34;transfer-key&#34;; };
    also-notify { 192.168.1.2; };
};

zone &#34;1.168.192.in-addr.arpa&#34; {
    type primary;
    file &#34;/var/cache/bind/zones/db.192.168.1&#34;;
    dnssec-policy &#34;production&#34;;
    inline-signing yes;
    allow-transfer { key &#34;transfer-key&#34;; };
};
</code></pre><ul>
<li><code>allow-transfer { key &quot;transfer-key&quot;; }</code>: only servers with the TSIG key may transfer the zone. They receive the signed version.</li>
<li><code>also-notify</code>: tell the slave server at 192.168.1.2 about changes, including re-signing.</li>
</ul>
<h2 id="troubleshooting-dnssec">Troubleshooting DNSSEC <a class="anchor" data-pagefind-ignore href="#troubleshooting-dnssec" aria-label="Link to this section">#</a></h2>
<table>
	<thead>
			<tr>
					<th>Symptom</th>
					<th>Cause</th>
					<th>Fix</th>
			</tr>
	</thead>
	<tbody>
			<tr>
					<td>Signatures expired</td>
					<td>Re-signing stopped</td>
					<td>Check <code>rndc dnssec -status</code>, force <code>rndc sign</code></td>
			</tr>
			<tr>
					<td>SERVFAIL after DS change</td>
					<td>DS at parent does not match the KSK</td>
					<td>Compare DS records</td>
			</tr>
			<tr>
					<td>Zone not signed</td>
					<td>Key files missing or unreadable</td>
					<td>Check permissions</td>
			</tr>
			<tr>
					<td>Zone won&rsquo;t load</td>
					<td>Syntax error in config or zone</td>
					<td><code>named-checkconf</code>, <code>named-checkzone</code></td>
			</tr>
	</tbody>
</table>
<h3 id="common-issues">Common Issues <a class="anchor" data-pagefind-ignore href="#common-issues" aria-label="Link to this section">#</a></h3>
<p><strong>Signatures expired:</strong></p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl"><span class="c1"># Check key and signing state</span>
</span></span><span class="line"><span class="cl">rndc dnssec -status example.com
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="c1"># Force re-signing</span>
</span></span><span class="line"><span class="cl">rndc sign example.com
</span></span></code></pre></div><p><strong>DS record mismatch:</strong></p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl"><span class="c1"># Compare DS records</span>
</span></span><span class="line"><span class="cl">dig DS example.com @parent-ns
</span></span><span class="line"><span class="cl">dnssec-dsfromkey Kexample.com.+013+12345.key
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="c1"># Ensure key tag, algorithm, and digest match</span>
</span></span></code></pre></div><p><strong>Key not found:</strong></p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl"><span class="c1"># Check key files exist and permissions</span>
</span></span><span class="line"><span class="cl">ls -la /var/cache/bind/keys/
</span></span><span class="line"><span class="cl">chown bind:bind /var/cache/bind/keys/*
</span></span><span class="line"><span class="cl">chmod <span class="m">600</span> /var/cache/bind/keys/*.private
</span></span></code></pre></div><p><strong>Zone won&rsquo;t load:</strong></p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl"><span class="c1"># Check configuration</span>
</span></span><span class="line"><span class="cl">named-checkconf
</span></span><span class="line"><span class="cl">named-checkzone example.com /var/cache/bind/zones/db.example.com
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="c1"># Check logs</span>
</span></span><span class="line"><span class="cl">tail -f /var/log/named/dnssec.log
</span></span></code></pre></div><h2 id="security-best-practices">Security Best Practices <a class="anchor" data-pagefind-ignore href="#security-best-practices" aria-label="Link to this section">#</a></h2>
<ol>
<li><strong>Protect private keys</strong> - Use proper file permissions (600) and consider HSM for high-security deployments</li>
<li><strong>Monitor signature expiry</strong> - Set up alerts for signatures approaching expiry</li>
<li><strong>Test rollovers</strong> - Practice key rollovers in a test environment first</li>
<li><strong>Use NSEC3</strong> - Prevents zone enumeration attacks</li>
<li><strong>Keep BIND updated</strong> - Security fixes often affect DNSSEC</li>
<li><strong>Document procedures</strong> - Especially for manual KSK rollovers</li>
<li><strong>Backup keys securely</strong> - Store encrypted backups offline</li>
</ol>
<h2 id="automate-it">Automate it <a class="anchor" data-pagefind-ignore href="#automate-it" aria-label="Link to this section">#</a></h2>
<p>The Ansible roles and Terraform code that build this setup are on GitHub: <a href="https://github.com/pderuiter/blog-bind-dnssec-signing" rel="noopener">pderuiter/blog-bind-dnssec-signing</a>. It creates an Ubuntu 24.04 VM on Proxmox and sets up the complete configuration from this post (the <code>production</code> dnssec-policy, inline-signed forward and reverse zones, TSIG-protected transfers and the expiry check script); run <code>terraform apply</code>, then <code>ansible-playbook site.yml</code>.</p>
<h2 id="conclusion">Conclusion <a class="anchor" data-pagefind-ignore href="#conclusion" aria-label="Link to this section">#</a></h2>
<p>DNSSEC on authoritative servers completes the chain of trust for your domains. <code>dnssec-policy</code> with inline signing automates most of the work; monitoring makes sure your zones stay signed.</p>
<p>Key takeaways:</p>
<ul>
<li>Use ECDSAP256SHA256 or ED25519 algorithms</li>
<li>Enable inline-signing for automatic signature maintenance</li>
<li>Use NSEC3 to prevent zone enumeration</li>
<li>Monitor signature expiry proactively</li>
<li>Plan and test key rollovers carefully</li>
</ul>
<p>The next post will cover Response Policy Zones (RPZ), using BIND to block malicious domains and enforce DNS-based security policies.</p>
]]></content:encoded></item><item><title>Enabling DNSSEC Validation on BIND Resolvers</title><link>https://blog.bsdserver.nl/enabling-dnssec-validation-on-bind-resolvers/</link><guid isPermaLink="false">693b6dbb79eb54000160a58e</guid><dc:creator>Patrick de Ruiter</dc:creator><pubDate>Fri, 12 Dec 2025 01:19:55 +0000</pubDate><description>DNSSEC (Domain Name System Security Extensions) adds cryptographic authentication to DNS responses, protecting against cache poisoning and…</description><category>BIND</category><category>DNS</category><category>DNSSEC</category><category>Security</category><category>Linux</category><media:content url="https://blog.bsdserver.nl/content/images/2026/01/bind-dnssec-validation.png" medium="image"/><content:encoded><![CDATA[<p>DNSSEC (Domain Name System Security Extensions) adds cryptographic authentication to DNS responses, protecting against cache poisoning and man-in-the-middle attacks. A plain resolver accepts whatever answer arrives first; it cannot tell a forged response from a real one.</p>
<p>This post turns a BIND recursive resolver into a validating resolver. It covers enabling validation, testing it, handling domains with broken DNSSEC, and monitoring the result.</p>
<h2 id="why-dnssec-validation">Why DNSSEC validation? <a class="anchor" data-pagefind-ignore href="#why-dnssec-validation" aria-label="Link to this section">#</a></h2>
<ul>
<li><strong>Tamper detection</strong>: a forged or modified answer fails signature checks and never reaches the client.</li>
<li><strong>Protects every client</strong>: laptops, servers and IoT devices behind the resolver get validation without any client changes.</li>
<li><strong>Low effort</strong>: modern BIND ships the root trust anchor; one setting turns it on.</li>
</ul>
<h3 id="when-to-use-it">When to use it <a class="anchor" data-pagefind-ignore href="#when-to-use-it" aria-label="Link to this section">#</a></h3>
<ul>
<li><strong>Use it</strong> on every recursive resolver you run. Most signed zones validate fine, and the default in current BIND is already <code>auto</code>.</li>
<li><strong>Skip it</strong> only on a forwarder that sends everything to an upstream resolver you trust to validate, or where the clock cannot be kept accurate (signatures have validity periods).</li>
</ul>
<h2 id="how-dnssec-validation-works">How DNSSEC Validation Works <a class="anchor" data-pagefind-ignore href="#how-dnssec-validation-works" aria-label="Link to this section">#</a></h2>
<p>DNSSEC creates a chain of trust from the DNS root zone down to individual domains:</p>
<table>
	<thead>
			<tr>
					<th>Level</th>
					<th>Signed by</th>
					<th>Role in validation</th>
			</tr>
	</thead>
	<tbody>
			<tr>
					<td>Root zone</td>
					<td>ICANN</td>
					<td>Its key is the trust anchor, built into DNS software</td>
			</tr>
			<tr>
					<td>TLD (.com, .org)</td>
					<td>The registry</td>
					<td>Root holds a DS record for the TLD key</td>
			</tr>
			<tr>
					<td>Domain</td>
					<td>The domain owner</td>
					<td>TLD holds a DS record for the domain key</td>
			</tr>
			<tr>
					<td>Resolver</td>
					<td>-</td>
					<td>Checks every signature up to the trust anchor</td>
			</tr>
	</tbody>
</table>
<p>When the resolver receives a signed response, it fetches the zone&rsquo;s DNSKEY records, verifies the RRSIG on the answer, checks the DS record in the parent zone, and repeats up to the root trust anchor.</p>
<p>The flow: client query → resolver fetches answer + RRSIG → DNSKEY → DS in parent → … → root trust anchor → answer with <code>ad</code> flag, or SERVFAIL if any signature fails.</p>
<h2 id="enabling-dnssec-validation-in-bind">Enabling DNSSEC Validation in BIND <a class="anchor" data-pagefind-ignore href="#enabling-dnssec-validation-in-bind" aria-label="Link to this section">#</a></h2>
<p>There are two ways to tell BIND which root key to trust:</p>
<table>
	<thead>
			<tr>
					<th>Option</th>
					<th>Use it for</th>
			</tr>
	</thead>
	<tbody>
			<tr>
					<td><code>dnssec-validation auto</code></td>
					<td>Almost every resolver. BIND uses its built-in root anchor and keeps it current itself.</td>
			</tr>
			<tr>
					<td><code>dnssec-validation yes</code> + <code>trust-anchors</code></td>
					<td>Explicit control, or setups where you manage anchors yourself. You must update them on a root key rollover.</td>
			</tr>
	</tbody>
</table>
<h3 id="automatic-configuration">Automatic Configuration <a class="anchor" data-pagefind-ignore href="#automatic-configuration" aria-label="Link to this section">#</a></h3>
<p>This is the recommended setup. Add <code>dnssec-validation auto</code> to the <code>options</code> block of a recursive resolver:</p>
<pre tabindex="0"><code>options {
    directory &#34;/var/named&#34;;
    
    recursion yes;
    allow-recursion { trusted; };
    
    dnssec-validation auto;
};
</code></pre><ul>
<li><code>dnssec-validation auto</code>: use the built-in managed trust anchors for the root zone. BIND keeps them up to date through RFC 5011 automated trust anchor maintenance.</li>
<li><code>allow-recursion { trusted; }</code>: only your own networks may use the resolver (the <code>trusted</code> ACL is defined in the complete configuration below).</li>
</ul>
<h3 id="manual-trust-anchor-configuration">Manual Trust Anchor Configuration <a class="anchor" data-pagefind-ignore href="#manual-trust-anchor-configuration" aria-label="Link to this section">#</a></h3>
<p>Use this only if you need explicit control. Include both root KSKs: the root zone rolled from KSK-2017 (key tag 20326) to KSK-2024 (key tag 38696) in October 2026, and the root DNSKEY set is now signed by 38696. A fresh resolver that only knows 20326 returns SERVFAIL for every signed name.</p>
<pre tabindex="0"><code>trust-anchors {
    // KSK-2017 (20326), still published in the root zone during the rollover
    . initial-key 257 3 8 &#34;AwEAAaz/tAm8yTn4Mfeh5eyI96WSVexTBAvkMgJzkKTOiW1vkIbzxeF3
        +/4RgWOq7HrxRixHlFlExOLAJr5emLvN7SWXgnLh4+B5xQlNVz8Og8kv
        ArMtNROxVQuCaSnIDdD5LKyWbRd2n9WGe2R8PzgCmr3EgVLrjyBxWezF
        0jLHwVN8efS3rCj/EWgvIWgb9tarpVUDK/b58Da+sqqls3eNbuv7pr+e
        oZG+SrDK6nWeL3c6H5Apxz7LjVc1uTIdsIXxuOLYA4/ilBmSVIzuDWfd
        RUfhHdY6+cn8HFRm+2hM8AnXGXws9555KrUB5qihylGa8subX2Nn6UwN
        R1AkUTV74bU=&#34;;
    // KSK-2024 (38696), the key that signs the root DNSKEY set
    . initial-ds 38696 8 2 &#34;683D2D0ACB8C9B712A1948B27F741219298D0A450D612C483AF444A4C0FB2B16&#34;;
};

options {
    dnssec-validation yes;
};
</code></pre><ul>
<li><code>initial-key</code>: the full public key. <code>initial-ds</code>: only its hash (DS format).</li>
<li><code>initial-*</code> anchors are a starting point; BIND then maintains them with RFC 5011, like <code>auto</code> does.</li>
<li><code>dnssec-validation yes</code>: validate using the configured anchors instead of the built-in ones.</li>
</ul>
<p>These are the same anchors BIND ships in <code>bind.keys</code>; copy them from there when the root rolls again.</p>
<h3 id="verify-dnssec-is-working">Verify DNSSEC Is Working <a class="anchor" data-pagefind-ignore href="#verify-dnssec-is-working" aria-label="Link to this section">#</a></h3>
<p>Query a signed domain with <code>+dnssec</code> and look at the flags line:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl"><span class="c1"># Query a signed domain</span>
</span></span><span class="line"><span class="cl">dig @localhost dnssec-tools.org +dnssec
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="c1"># Look for &#39;ad&#39; (Authenticated Data) flag</span>
</span></span><span class="line"><span class="cl">dig @localhost example.com +dnssec <span class="p">|</span> grep flags
</span></span><span class="line"><span class="cl"><span class="p">;;</span> flags: qr rd ra ad<span class="p">;</span> QUERY: 1, ANSWER: 2, AUTHORITY: 0, ADDITIONAL: <span class="m">1</span>
</span></span></code></pre></div><p>The <code>ad</code> (Authenticated Data) flag means the resolver validated the response.</p>
<h3 id="test-with-known-goodbad-domains">Test with Known Good/Bad Domains <a class="anchor" data-pagefind-ignore href="#test-with-known-goodbad-domains" aria-label="Link to this section">#</a></h3>
<p>A deliberately broken domain is the quickest proof that validation is really on. If <code>dnssec-failed.org</code> resolves, validation is off.</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl"><span class="c1"># Should succeed (valid DNSSEC)</span>
</span></span><span class="line"><span class="cl">dig @localhost www.dnssec-tools.org
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="c1"># Should fail with SERVFAIL (deliberately broken DNSSEC)</span>
</span></span><span class="line"><span class="cl">dig @localhost www.dnssec-failed.org
</span></span></code></pre></div><h2 id="handling-dnssec-failures">Handling DNSSEC Failures <a class="anchor" data-pagefind-ignore href="#handling-dnssec-failures" aria-label="Link to this section">#</a></h2>
<h3 id="why-queries-fail">Why Queries Fail <a class="anchor" data-pagefind-ignore href="#why-queries-fail" aria-label="Link to this section">#</a></h3>
<p>A validating resolver returns SERVFAIL when it cannot verify an answer. Common causes:</p>
<table>
	<thead>
			<tr>
					<th>Cause</th>
					<th>Typical origin</th>
			</tr>
	</thead>
	<tbody>
			<tr>
					<td>Expired signatures</td>
					<td>RRSIG past its validity; the zone stopped re-signing</td>
			</tr>
			<tr>
					<td>DS mismatch</td>
					<td>Zone keys changed but the parent DS record was not updated</td>
			</tr>
			<tr>
					<td>Broken key rollover</td>
					<td>Keys replaced without a proper rollover</td>
			</tr>
			<tr>
					<td>Truncated response</td>
					<td>UDP size issues with large DNSSEC answers</td>
			</tr>
			<tr>
					<td>Missing DNSKEY</td>
					<td>Network issues prevent fetching the DNSKEY records</td>
			</tr>
	</tbody>
</table>
<h3 id="diagnosing-failures">Diagnosing Failures <a class="anchor" data-pagefind-ignore href="#diagnosing-failures" aria-label="Link to this section">#</a></h3>
<p><code>delv</code> (DNSSEC lookup and validation utility) validates like BIND does and shows where the chain breaks:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl"><span class="c1"># Check validation chain</span>
</span></span><span class="line"><span class="cl">delv @localhost example.com
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="c1"># Verbose output</span>
</span></span><span class="line"><span class="cl">delv @localhost example.com +vtrace
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="c1"># Show trust chain</span>
</span></span><span class="line"><span class="cl">delv @localhost example.com +rtrace
</span></span></code></pre></div><ul>
<li><code>+vtrace</code>: show each validation step.</li>
<li><code>+rtrace</code>: show the queries made to build the trust chain.</li>
</ul>
<p>Example failure output:</p>
<pre tabindex="0"><code>;; resolution failed: broken trust chain
</code></pre><p><code>delv</code> only reports the result class. The specific reason (for example <code>verify failed due to bad signature (keyid=30617): RRSIG has expired</code>) is logged by <code>named</code> in the <code>dnssec</code> category.</p>
<h3 id="check-signature-validity">Check Signature Validity <a class="anchor" data-pagefind-ignore href="#check-signature-validity" aria-label="Link to this section">#</a></h3>
<p>Look at the records that make up the chain: the signatures, the zone keys and the DS in the parent.</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl"><span class="c1"># View RRSIG records and expiration</span>
</span></span><span class="line"><span class="cl">dig @localhost example.com RRSIG +short
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="c1"># Check DNSKEY records</span>
</span></span><span class="line"><span class="cl">dig @localhost example.com DNSKEY +short
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="c1"># Check DS record at parent</span>
</span></span><span class="line"><span class="cl">dig @localhost example.com DS +short
</span></span></code></pre></div><h2 id="negative-trust-anchors-ntas">Negative Trust Anchors (NTAs) <a class="anchor" data-pagefind-ignore href="#negative-trust-anchors-ntas" aria-label="Link to this section">#</a></h2>
<p>Sometimes a domain you need has broken DNSSEC that its owner has not fixed. A Negative Trust Anchor turns validation off for that one domain, temporarily, while the rest stays protected.</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl"><span class="c1"># Add NTA (valid for 1 hour by default)</span>
</span></span><span class="line"><span class="cl">rndc nta example.com
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="c1"># Add NTA with specific lifetime</span>
</span></span><span class="line"><span class="cl">rndc nta -lifetime <span class="m">3600</span> example.com
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="c1"># List active NTAs</span>
</span></span><span class="line"><span class="cl">rndc nta -dump
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="c1"># Remove NTA</span>
</span></span><span class="line"><span class="cl">rndc nta -remove example.com
</span></span></code></pre></div><h3 id="persistent-ntas">Persistent NTAs <a class="anchor" data-pagefind-ignore href="#persistent-ntas" aria-label="Link to this section">#</a></h3>
<p><code>rndc nta</code> entries expire. For a permanent exception, use <code>validate-except</code> in named.conf:</p>
<pre tabindex="0"><code>options {
    dnssec-validation auto;
    
    // Permanent negative trust anchors
    // Use sparingly - security trade-off!
    validate-except { &#34;broken-domain.example.com&#34;; };
};
</code></pre><p>There is no <code>nta</code> statement in named.conf; <code>validate-except</code> is the permanent equivalent of <code>rndc nta</code>.</p>
<p><strong>Warning</strong>: NTAs disable DNSSEC protection for that domain. Use only when necessary and investigate the root cause.</p>
<h2 id="edns-buffer-size">EDNS Buffer Size <a class="anchor" data-pagefind-ignore href="#edns-buffer-size" aria-label="Link to this section">#</a></h2>
<p>DNSSEC responses are larger than regular DNS answers. Large UDP packets get fragmented, and fragments are often dropped, which shows up as timeouts and SERVFAIL. Cap the UDP size so large answers fall back to TCP instead:</p>
<pre tabindex="0"><code>options {
    edns-udp-size 1232;
    max-udp-size 1232;
};
</code></pre><ul>
<li><code>edns-udp-size</code>: the buffer size BIND advertises in its own queries upstream.</li>
<li><code>max-udp-size</code>: the largest UDP response BIND sends to clients.</li>
</ul>
<p>The 1232 value avoids fragmentation on most networks (1280 IPv6 minimum MTU - 48 header bytes).</p>
<h2 id="logging-dnssec-events">Logging DNSSEC Events <a class="anchor" data-pagefind-ignore href="#logging-dnssec-events" aria-label="Link to this section">#</a></h2>
<p>Send the <code>dnssec</code> category to its own file. That is where the exact reason for a validation failure ends up.</p>
<pre tabindex="0"><code>logging {
    channel dnssec_log {
        file &#34;/var/log/named/dnssec.log&#34; versions 5 size 10m;
        severity info;
        print-time yes;
        print-category yes;
        print-severity yes;
    };
    
    category dnssec { dnssec_log; };
};
</code></pre><p>Log messages show:</p>
<ul>
<li>Successful validations</li>
<li>Validation failures with reason</li>
<li>Trust anchor updates (RFC 5011)</li>
<li>Key rollover events</li>
</ul>
<h2 id="trust-anchor-management">Trust Anchor Management <a class="anchor" data-pagefind-ignore href="#trust-anchor-management" aria-label="Link to this section">#</a></h2>
<h3 id="automatic-updates-rfc-5011">Automatic Updates (RFC 5011) <a class="anchor" data-pagefind-ignore href="#automatic-updates-rfc-5011" aria-label="Link to this section">#</a></h3>
<p>With <code>dnssec-validation auto</code>, BIND manages root trust anchors automatically and stores them in <code>managed-keys.bind</code>. Check their state with <code>rndc</code>:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl"><span class="c1"># View managed keys</span>
</span></span><span class="line"><span class="cl">rndc managed-keys status
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="c1"># Force refresh</span>
</span></span><span class="line"><span class="cl">rndc managed-keys refresh
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="c1"># Check managed keys database</span>
</span></span><span class="line"><span class="cl">cat /var/named/managed-keys.bind
</span></span></code></pre></div><h3 id="key-rollover-events">Key Rollover Events <a class="anchor" data-pagefind-ignore href="#key-rollover-events" aria-label="Link to this section">#</a></h3>
<p>When the root zone key changes (rare), BIND follows RFC 5011:</p>
<ol>
<li>Detects the new key in the root DNSKEY response</li>
<li>Waits a hold-down period (30 days default)</li>
<li>Adds the new key to the trust store</li>
<li>Removes the old key after it is no longer advertised</li>
</ol>
<p>Monitor for key rollover (with the logging configuration above, these messages go to the <code>dnssec</code> channel):</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">grep <span class="s2">&#34;managed-keys&#34;</span> /var/log/named/dnssec.log
</span></span></code></pre></div><h2 id="complete-resolver-configuration">Complete Resolver Configuration <a class="anchor" data-pagefind-ignore href="#complete-resolver-configuration" aria-label="Link to this section">#</a></h2>
<p>This combines everything above into one <code>named.conf</code>:</p>
<pre tabindex="0"><code>// /etc/named.conf

acl &#34;trusted&#34; {
    localhost;
    localnets;
    192.168.0.0/16;
    10.0.0.0/8;
};

options {
    directory &#34;/var/named&#34;;
    pid-file &#34;/run/named/named.pid&#34;;
    
    // Network settings
    listen-on port 53 { any; };
    listen-on-v6 port 53 { any; };
    
    // Recursion settings
    recursion yes;
    allow-recursion { trusted; };
    allow-query-cache { trusted; };
    
    // DNSSEC validation
    dnssec-validation auto;
    
    // EDNS settings for DNSSEC
    edns-udp-size 1232;
    max-udp-size 1232;
    
    // Security
    version &#34;not disclosed&#34;;
    minimal-responses yes;
    
    // Performance
    prefetch 10 60;
};

logging {
    channel default_log {
        file &#34;/var/log/named/named.log&#34; versions 5 size 10m;
        severity info;
        print-time yes;
        print-severity yes;
    };
    
    channel dnssec_log {
        file &#34;/var/log/named/dnssec.log&#34; versions 5 size 10m;
        severity debug;
        print-time yes;
        print-category yes;
    };
    
    category default { default_log; };
    category dnssec { dnssec_log; };
};

zone &#34;.&#34; {
    type hint;
    file &#34;named.ca&#34;;
};
</code></pre><p>What the settings outside DNSSEC do:</p>
<ul>
<li><code>acl &quot;trusted&quot;</code>: the networks allowed to use the resolver; used by <code>allow-recursion</code> and <code>allow-query-cache</code>.</li>
<li><code>version &quot;not disclosed&quot;</code>: hide the BIND version from <code>version.bind</code> queries.</li>
<li><code>minimal-responses yes</code>: leave optional records out of answers; smaller responses.</li>
<li><code>prefetch 10 60</code>: refresh popular records shortly before they expire, so clients do not wait for a cache miss.</li>
<li><code>severity debug</code> on <code>dnssec_log</code>: more detail than the earlier example; lower it to <code>info</code> once things work.</li>
</ul>
<h2 id="testing-dnssec-validation">Testing DNSSEC Validation <a class="anchor" data-pagefind-ignore href="#testing-dnssec-validation" aria-label="Link to this section">#</a></h2>
<h3 id="command-line-tests">Command Line Tests <a class="anchor" data-pagefind-ignore href="#command-line-tests" aria-label="Link to this section">#</a></h3>
<p>Run these after every config change. Signed domains should show <code>ad</code>, broken ones SERVFAIL, unsigned ones resolve without <code>ad</code>.</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl"><span class="c1"># Check if validation is enabled</span>
</span></span><span class="line"><span class="cl">dig @localhost . SOA +dnssec <span class="p">|</span> grep -E <span class="s2">&#34;(flags|ad)&#34;</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="c1"># Test known-good signed domain</span>
</span></span><span class="line"><span class="cl">dig @localhost cloudflare.com +dnssec +short
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="c1"># Test validation failure (should return SERVFAIL)</span>
</span></span><span class="line"><span class="cl">dig @localhost dnssec-failed.org
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="c1"># Check AD flag on signed domain</span>
</span></span><span class="line"><span class="cl">dig @localhost sigok.verteiltesysteme.net <span class="p">|</span> grep <span class="s2">&#34;flags:&#34;</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="c1"># Check that AD flag is absent for unsigned domain (no &#34;ad&#34; in the flags line)</span>
</span></span><span class="line"><span class="cl">dig @localhost unsigned-domain.com <span class="p">|</span> grep <span class="s2">&#34;flags:&#34;</span>
</span></span></code></pre></div><h3 id="using-drill-from-ldns">Using drill (from ldns) <a class="anchor" data-pagefind-ignore href="#using-drill-from-ldns" aria-label="Link to this section">#</a></h3>
<p><code>drill</code> traces the chain from the root and shows each signature it checks, a useful second opinion next to <code>delv</code>:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl"><span class="c1"># Trace DNSSEC chain</span>
</span></span><span class="line"><span class="cl">drill -DT cloudflare.com
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="c1"># Show signature details</span>
</span></span><span class="line"><span class="cl">drill -TD cloudflare.com
</span></span></code></pre></div><h2 id="monitoring-dnssec-health">Monitoring DNSSEC Health <a class="anchor" data-pagefind-ignore href="#monitoring-dnssec-health" aria-label="Link to this section">#</a></h2>
<h3 id="statistics">Statistics <a class="anchor" data-pagefind-ignore href="#statistics" aria-label="Link to this section">#</a></h3>
<p>BIND counts validation results. <code>rndc stats</code> writes them to the statistics file:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl"><span class="c1"># View DNSSEC statistics (written to statistics-file, default &#34;named.stats&#34; in the working directory)</span>
</span></span><span class="line"><span class="cl">rndc stats
</span></span><span class="line"><span class="cl">grep <span class="s2">&#34;DNSSEC&#34;</span> /var/named/named.stats
</span></span></code></pre></div><p>The text dump labels these counters &ldquo;DNSSEC validation attempted/succeeded/failed&rdquo;. In the XML/JSON statistics channel they are called:</p>
<ul>
<li><code>ValOk</code>: Successful validations</li>
<li><code>ValNegOk</code>: Validated negative responses</li>
<li><code>ValFail</code>: Validation failures</li>
<li><code>ValIndeterminate</code>: Non-DNSSEC responses</li>
</ul>
<h3 id="alerting-on-failures">Alerting on Failures <a class="anchor" data-pagefind-ignore href="#alerting-on-failures" aria-label="Link to this section">#</a></h3>
<p>This check queries a signed domain and fails if the <code>ad</code> flag is missing. It fits Nagios-style monitoring (exit 2 = critical).</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl"><span class="cp">#!/bin/bash
</span></span></span><span class="line"><span class="cl"><span class="c1"># /usr/local/bin/check-dnssec.sh</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="nv">RESULT</span><span class="o">=</span><span class="k">$(</span>dig @localhost cloudflare.com +dnssec +short 2&gt;<span class="p">&amp;</span>1<span class="k">)</span>
</span></span><span class="line"><span class="cl"><span class="nv">AD_FLAG</span><span class="o">=</span><span class="k">$(</span>dig @localhost cloudflare.com <span class="p">|</span> grep -cE <span class="s2">&#34;flags:.* ad[ ;]&#34;</span><span class="k">)</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="k">if</span> <span class="o">[</span> <span class="nv">$AD_FLAG</span> -eq <span class="m">0</span> <span class="o">]</span><span class="p">;</span> <span class="k">then</span>
</span></span><span class="line"><span class="cl">    <span class="nb">echo</span> <span class="s2">&#34;CRITICAL: DNSSEC validation not working&#34;</span>
</span></span><span class="line"><span class="cl">    <span class="nb">exit</span> <span class="m">2</span>
</span></span><span class="line"><span class="cl"><span class="k">fi</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="nb">echo</span> <span class="s2">&#34;OK: DNSSEC validation operational&#34;</span>
</span></span><span class="line"><span class="cl"><span class="nb">exit</span> <span class="m">0</span>
</span></span></code></pre></div><h2 id="troubleshooting">Troubleshooting <a class="anchor" data-pagefind-ignore href="#troubleshooting" aria-label="Link to this section">#</a></h2>
<table>
	<thead>
			<tr>
					<th>Symptom</th>
					<th>Likely cause</th>
					<th>Check</th>
			</tr>
	</thead>
	<tbody>
			<tr>
					<td>SERVFAIL for one signed domain</td>
					<td>Broken DNSSEC on that domain, or authoritative servers unreachable</td>
					<td><code>+cd</code> query, <code>delv</code>, <code>dnssec.log</code></td>
			</tr>
			<tr>
					<td>SERVFAIL for every signed domain</td>
					<td>Clock wrong, or stale trust anchor</td>
					<td><code>date</code>, <code>rndc managed-keys status</code></td>
			</tr>
			<tr>
					<td>No <code>ad</code> flag anywhere</td>
					<td>Validation off</td>
					<td><code>dnssec-validation</code> setting</td>
			</tr>
	</tbody>
</table>
<h3 id="servfail-for-dnssec-domains">&ldquo;SERVFAIL&rdquo; for DNSSEC Domains <a class="anchor" data-pagefind-ignore href="#servfail-for-dnssec-domains" aria-label="Link to this section">#</a></h3>
<p>First check that the resolver can reach the authoritative servers, then repeat the query with validation disabled:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl"><span class="c1"># Try direct query to authoritative</span>
</span></span><span class="line"><span class="cl">dig @ns1.example.com example.com DNSKEY
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="c1"># Check if DNSKEY is retrievable</span>
</span></span><span class="line"><span class="cl">dig @localhost example.com DNSKEY +cd
</span></span></code></pre></div><p>The <code>+cd</code> flag (Checking Disabled) bypasses validation - if this works but normal query fails, the issue is DNSSEC.</p>
<h3 id="clock-skew">Clock Skew <a class="anchor" data-pagefind-ignore href="#clock-skew" aria-label="Link to this section">#</a></h3>
<p>DNSSEC signatures have validity periods. A wrong system clock makes valid signatures look expired or not yet valid:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl"><span class="c1"># Check time</span>
</span></span><span class="line"><span class="cl">date
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="c1"># Sync time (chrony)</span>
</span></span><span class="line"><span class="cl">chronyc makestep
</span></span><span class="line"><span class="cl"><span class="c1"># or</span>
</span></span><span class="line"><span class="cl">timedatectl set-ntp <span class="nb">true</span>
</span></span></code></pre></div><h3 id="trust-anchor-problems">Trust Anchor Problems <a class="anchor" data-pagefind-ignore href="#trust-anchor-problems" aria-label="Link to this section">#</a></h3>
<p>If the managed keys are missing or stale, every signed domain fails. Check the managed keys state and file:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl"><span class="c1"># Check managed keys</span>
</span></span><span class="line"><span class="cl">rndc managed-keys status
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="c1"># Verify root key file exists</span>
</span></span><span class="line"><span class="cl">ls -la /var/named/managed-keys.bind
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="c1"># Check key validity (the file stores KEYDATA records with key id and &#34;trusted since&#34;)</span>
</span></span><span class="line"><span class="cl">grep -A12 <span class="s2">&#34;KEYDATA&#34;</span> /var/named/managed-keys.bind
</span></span></code></pre></div><h2 id="automate-it">Automate it <a class="anchor" data-pagefind-ignore href="#automate-it" aria-label="Link to this section">#</a></h2>
<p>The Ansible roles and Terraform code that build this setup are on GitHub: <a href="https://github.com/pderuiter/blog-bind-dnssec-validation" rel="noopener">pderuiter/blog-bind-dnssec-validation</a>. Terraform creates an Ubuntu 24.04 VM on Proxmox, and <code>ansible-playbook site.yml</code> turns it into the validating resolver from this post, including the logging channels and the <code>check-dnssec.sh</code> script; <code>tests/verify.yml</code> runs the checks above.</p>
<h2 id="conclusion">Conclusion <a class="anchor" data-pagefind-ignore href="#conclusion" aria-label="Link to this section">#</a></h2>
<p>DNSSEC validation on your resolver protects all clients from DNS spoofing attacks. Turn it on with <code>dnssec-validation auto</code>, log the <code>dnssec</code> category, watch the validation counters, and use Negative Trust Anchors only for domains whose DNSSEC is broken.</p>
<p>The next post will cover signing your own zones with DNSSEC on authoritative servers, completing the DNSSEC trust chain for your domains.</p>
]]></content:encoded></item></channel></rss>