2 - Copyright (C) 2004-2015 Internet Systems Consortium, Inc. ("ISC")
3 - Copyright (C) 2000-2003 Internet Software Consortium.
5 - Permission to use, copy, modify, and/or distribute this software for any
6 - purpose with or without fee is hereby granted, provided that the above
7 - copyright notice and this permission notice appear in all copies.
9 - THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
10 - REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
11 - AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
12 - INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
13 - LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
14 - OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
15 - PERFORMANCE OF THIS SOFTWARE.
17 <!-- $Id: Bv9ARM.ch04.html,v 1.5 2015/09/03 07:33:34 christos Exp $ -->
20 <meta http-equiv=
"Content-Type" content=
"text/html; charset=ISO-8859-1">
21 <title>Chapter
4. Advanced DNS Features
</title>
22 <meta name=
"generator" content=
"DocBook XSL Stylesheets V1.71.1">
23 <link rel=
"start" href=
"Bv9ARM.html" title=
"BIND 9 Administrator Reference Manual">
24 <link rel=
"up" href=
"Bv9ARM.html" title=
"BIND 9 Administrator Reference Manual">
25 <link rel=
"prev" href=
"Bv9ARM.ch03.html" title=
"Chapter 3. Name Server Configuration">
26 <link rel=
"next" href=
"Bv9ARM.ch05.html" title=
"Chapter 5. The BIND 9 Lightweight Resolver">
28 <body bgcolor=
"white" text=
"black" link=
"#0000FF" vlink=
"#840084" alink=
"#0000FF">
29 <div class=
"navheader">
30 <table width=
"100%" summary=
"Navigation header">
31 <tr><th colspan=
"3" align=
"center">Chapter
4. Advanced DNS Features
</th></tr>
33 <td width=
"20%" align=
"left">
34 <a accesskey=
"p" href=
"Bv9ARM.ch03.html">Prev
</a> </td>
35 <th width=
"60%" align=
"center"> </th>
36 <td width=
"20%" align=
"right"> <a accesskey=
"n" href=
"Bv9ARM.ch05.html">Next
</a>
42 <div class=
"chapter" lang=
"en">
43 <div class=
"titlepage"><div><div><h2 class=
"title">
44 <a name=
"Bv9ARM.ch04"></a>Chapter
4. Advanced DNS Features
</h2></div></div></div>
46 <p><b>Table of Contents
</b></p>
48 <dt><span class=
"sect1"><a href=
"Bv9ARM.ch04.html#notify">Notify
</a></span></dt>
49 <dt><span class=
"sect1"><a href=
"Bv9ARM.ch04.html#dynamic_update">Dynamic Update
</a></span></dt>
50 <dd><dl><dt><span class=
"sect2"><a href=
"Bv9ARM.ch04.html#journal">The journal file
</a></span></dt></dl></dd>
51 <dt><span class=
"sect1"><a href=
"Bv9ARM.ch04.html#incremental_zone_transfers">Incremental Zone Transfers (IXFR)
</a></span></dt>
52 <dt><span class=
"sect1"><a href=
"Bv9ARM.ch04.html#id2569920">Split DNS
</a></span></dt>
53 <dd><dl><dt><span class=
"sect2"><a href=
"Bv9ARM.ch04.html#id2569938">Example split DNS setup
</a></span></dt></dl></dd>
54 <dt><span class=
"sect1"><a href=
"Bv9ARM.ch04.html#tsig">TSIG
</a></span></dt>
56 <dt><span class=
"sect2"><a href=
"Bv9ARM.ch04.html#id2570439">Generate Shared Keys for Each Pair of Hosts
</a></span></dt>
57 <dt><span class=
"sect2"><a href=
"Bv9ARM.ch04.html#id2570581">Copying the Shared Secret to Both Machines
</a></span></dt>
58 <dt><span class=
"sect2"><a href=
"Bv9ARM.ch04.html#id2570592">Informing the Servers of the Key's Existence
</a></span></dt>
59 <dt><span class=
"sect2"><a href=
"Bv9ARM.ch04.html#id2570628">Instructing the Server to Use the Key
</a></span></dt>
60 <dt><span class=
"sect2"><a href=
"Bv9ARM.ch04.html#id2570685">TSIG Key Based Access Control
</a></span></dt>
61 <dt><span class=
"sect2"><a href=
"Bv9ARM.ch04.html#id2570734">Errors
</a></span></dt>
63 <dt><span class=
"sect1"><a href=
"Bv9ARM.ch04.html#id2570748">TKEY
</a></span></dt>
64 <dt><span class=
"sect1"><a href=
"Bv9ARM.ch04.html#id2570797">SIG(
0)
</a></span></dt>
65 <dt><span class=
"sect1"><a href=
"Bv9ARM.ch04.html#DNSSEC">DNSSEC
</a></span></dt>
67 <dt><span class=
"sect2"><a href=
"Bv9ARM.ch04.html#id2570934">Generating Keys
</a></span></dt>
68 <dt><span class=
"sect2"><a href=
"Bv9ARM.ch04.html#id2571218">Signing the Zone
</a></span></dt>
69 <dt><span class=
"sect2"><a href=
"Bv9ARM.ch04.html#id2571299">Configuring Servers
</a></span></dt>
71 <dt><span class=
"sect1"><a href=
"Bv9ARM.ch04.html#dnssec.dynamic.zones">DNSSEC, Dynamic Zones, and Automatic Signing
</a></span></dt>
73 <dt><span class=
"sect2"><a href=
"Bv9ARM.ch04.html#id2611126">Converting from insecure to secure
</a></span></dt>
74 <dt><span class=
"sect2"><a href=
"Bv9ARM.ch04.html#id2563650">Dynamic DNS update method
</a></span></dt>
75 <dt><span class=
"sect2"><a href=
"Bv9ARM.ch04.html#id2563686">Fully automatic zone signing
</a></span></dt>
76 <dt><span class=
"sect2"><a href=
"Bv9ARM.ch04.html#id2563933">Private-type records
</a></span></dt>
77 <dt><span class=
"sect2"><a href=
"Bv9ARM.ch04.html#id2582676">DNSKEY rollovers
</a></span></dt>
78 <dt><span class=
"sect2"><a href=
"Bv9ARM.ch04.html#id2582689">Dynamic DNS update method
</a></span></dt>
79 <dt><span class=
"sect2"><a href=
"Bv9ARM.ch04.html#id2582722">Automatic key rollovers
</a></span></dt>
80 <dt><span class=
"sect2"><a href=
"Bv9ARM.ch04.html#id2582748">NSEC3PARAM rollovers via UPDATE
</a></span></dt>
81 <dt><span class=
"sect2"><a href=
"Bv9ARM.ch04.html#id2582758">Converting from NSEC to NSEC3
</a></span></dt>
82 <dt><span class=
"sect2"><a href=
"Bv9ARM.ch04.html#id2582768">Converting from NSEC3 to NSEC
</a></span></dt>
83 <dt><span class=
"sect2"><a href=
"Bv9ARM.ch04.html#id2582780">Converting from secure to insecure
</a></span></dt>
84 <dt><span class=
"sect2"><a href=
"Bv9ARM.ch04.html#id2582818">Periodic re-signing
</a></span></dt>
85 <dt><span class=
"sect2"><a href=
"Bv9ARM.ch04.html#id2582827">NSEC3 and OPTOUT
</a></span></dt>
87 <dt><span class=
"sect1"><a href=
"Bv9ARM.ch04.html#rfc5011.support">Dynamic Trust Anchor Management
</a></span></dt>
89 <dt><span class=
"sect2"><a href=
"Bv9ARM.ch04.html#id2610708">Validating Resolver
</a></span></dt>
90 <dt><span class=
"sect2"><a href=
"Bv9ARM.ch04.html#id2610730">Authoritative Server
</a></span></dt>
92 <dt><span class=
"sect1"><a href=
"Bv9ARM.ch04.html#pkcs11">PKCS#
11 (Cryptoki) support
</a></span></dt>
94 <dt><span class=
"sect2"><a href=
"Bv9ARM.ch04.html#id2666121">Prerequisites
</a></span></dt>
95 <dt><span class=
"sect2"><a href=
"Bv9ARM.ch04.html#id2666131">Native PKCS#
11</a></span></dt>
96 <dt><span class=
"sect2"><a href=
"Bv9ARM.ch04.html#id2611390">OpenSSL-based PKCS#
11</a></span></dt>
97 <dt><span class=
"sect2"><a href=
"Bv9ARM.ch04.html#id2638570">PKCS#
11 Tools
</a></span></dt>
98 <dt><span class=
"sect2"><a href=
"Bv9ARM.ch04.html#id2638606">Using the HSM
</a></span></dt>
99 <dt><span class=
"sect2"><a href=
"Bv9ARM.ch04.html#id2638892">Specifying the engine on the command line
</a></span></dt>
100 <dt><span class=
"sect2"><a href=
"Bv9ARM.ch04.html#id2639009">Running named with automatic zone re-signing
</a></span></dt>
102 <dt><span class=
"sect1"><a href=
"Bv9ARM.ch04.html#dlz-info">DLZ (Dynamically Loadable Zones)
</a></span></dt>
104 <dt><span class=
"sect2"><a href=
"Bv9ARM.ch04.html#id2639074">Configuring DLZ
</a></span></dt>
105 <dt><span class=
"sect2"><a href=
"Bv9ARM.ch04.html#id2611909">Sample DLZ Driver
</a></span></dt>
107 <dt><span class=
"sect1"><a href=
"Bv9ARM.ch04.html#id2571523">IPv6 Support in
<acronym class=
"acronym">BIND
</acronym> 9</a></span></dt>
109 <dt><span class=
"sect2"><a href=
"Bv9ARM.ch04.html#id2571789">Address Lookups Using AAAA Records
</a></span></dt>
110 <dt><span class=
"sect2"><a href=
"Bv9ARM.ch04.html#id2571811">Address to Name Lookups Using Nibble Format
</a></span></dt>
114 <div class=
"sect1" lang=
"en">
115 <div class=
"titlepage"><div><div><h2 class=
"title" style=
"clear: both">
116 <a name=
"notify"></a>Notify
</h2></div></div></div>
118 <acronym class=
"acronym">DNS
</acronym> NOTIFY is a mechanism that allows master
119 servers to notify their slave servers of changes to a zone's data. In
120 response to a
<span><strong class=
"command">NOTIFY
</strong></span> from a master server, the
121 slave will check to see that its version of the zone is the
122 current version and, if not, initiate a zone transfer.
125 For more information about
<acronym class=
"acronym">DNS
</acronym>
126 <span><strong class=
"command">NOTIFY
</strong></span>, see the description of the
127 <span><strong class=
"command">notify
</strong></span> option in
<a href=
"Bv9ARM.ch06.html#boolean_options" title=
"Boolean Options">the section called
“Boolean Options
”</a> and
128 the description of the zone option
<span><strong class=
"command">also-notify
</strong></span> in
129 <a href=
"Bv9ARM.ch06.html#zone_transfers" title=
"Zone Transfers">the section called
“Zone Transfers
”</a>. The
<span><strong class=
"command">NOTIFY
</strong></span>
130 protocol is specified in RFC
1996.
132 <div class=
"note" style=
"margin-left: 0.5in; margin-right: 0.5in;">
133 <h3 class=
"title">Note
</h3>
134 As a slave zone can also be a master to other slaves,
<span><strong class=
"command">named
</strong></span>,
135 by default, sends
<span><strong class=
"command">NOTIFY
</strong></span> messages for every zone
136 it loads. Specifying
<span><strong class=
"command">notify master-only;
</strong></span> will
137 cause
<span><strong class=
"command">named
</strong></span> to only send
<span><strong class=
"command">NOTIFY
</strong></span> for master
141 <div class=
"sect1" lang=
"en">
142 <div class=
"titlepage"><div><div><h2 class=
"title" style=
"clear: both">
143 <a name=
"dynamic_update"></a>Dynamic Update
</h2></div></div></div>
145 Dynamic Update is a method for adding, replacing or deleting
146 records in a master server by sending it a special form of DNS
147 messages. The format and meaning of these messages is specified
151 Dynamic update is enabled by including an
152 <span><strong class=
"command">allow-update
</strong></span> or an
<span><strong class=
"command">update-policy
</strong></span>
153 clause in the
<span><strong class=
"command">zone
</strong></span> statement.
156 If the zone's
<span><strong class=
"command">update-policy
</strong></span> is set to
157 <strong class=
"userinput"><code>local
</code></strong>, updates to the zone
158 will be permitted for the key
<code class=
"varname">local-ddns
</code>,
159 which will be generated by
<span><strong class=
"command">named
</strong></span> at startup.
160 See
<a href=
"Bv9ARM.ch06.html#dynamic_update_policies" title=
"Dynamic Update Policies">the section called
“Dynamic Update Policies
”</a> for more details.
163 Dynamic updates using Kerberos signed requests can be made
164 using the TKEY/GSS protocol by setting either the
165 <span><strong class=
"command">tkey-gssapi-keytab
</strong></span> option, or alternatively
166 by setting both the
<span><strong class=
"command">tkey-gssapi-credential
</strong></span>
167 and
<span><strong class=
"command">tkey-domain
</strong></span> options. Once enabled,
168 Kerberos signed requests will be matched against the update
169 policies for the zone, using the Kerberos principal as the
170 signer for the request.
173 Updating of secure zones (zones using DNSSEC) follows RFC
174 3007: RRSIG, NSEC and NSEC3 records affected by updates are
175 automatically regenerated by the server using an online
176 zone key. Update authorization is based on transaction
177 signatures and an explicit server policy.
179 <div class=
"sect2" lang=
"en">
180 <div class=
"titlepage"><div><div><h3 class=
"title">
181 <a name=
"journal"></a>The journal file
</h3></div></div></div>
183 All changes made to a zone using dynamic update are stored
184 in the zone's journal file. This file is automatically created
185 by the server when the first dynamic update takes place.
186 The name of the journal file is formed by appending the extension
187 <code class=
"filename">.jnl
</code> to the name of the
189 file unless specifically overridden. The journal file is in a
190 binary format and should not be edited manually.
193 The server will also occasionally write (
"dump")
194 the complete contents of the updated zone to its zone file.
195 This is not done immediately after
196 each dynamic update, because that would be too slow when a large
197 zone is updated frequently. Instead, the dump is delayed by
198 up to
15 minutes, allowing additional updates to take place.
199 During the dump process, transient files will be created
200 with the extensions
<code class=
"filename">.jnw
</code> and
201 <code class=
"filename">.jbk
</code>; under ordinary circumstances, these
202 will be removed when the dump is complete, and can be safely
206 When a server is restarted after a shutdown or crash, it will replay
207 the journal file to incorporate into the zone any updates that
209 place after the last zone dump.
212 Changes that result from incoming incremental zone transfers are
214 journalled in a similar way.
217 The zone files of dynamic zones cannot normally be edited by
218 hand because they are not guaranteed to contain the most recent
219 dynamic changes
— those are only in the journal file.
220 The only way to ensure that the zone file of a dynamic zone
221 is up to date is to run
<span><strong class=
"command">rndc stop
</strong></span>.
224 If you have to make changes to a dynamic zone
225 manually, the following procedure will work:
226 Disable dynamic updates to the zone using
227 <span><strong class=
"command">rndc freeze
<em class=
"replaceable"><code>zone
</code></em></strong></span>.
228 This will update the zone's master file with the changes
229 stored in its
<code class=
"filename">.jnl
</code> file.
230 Edit the zone file. Run
231 <span><strong class=
"command">rndc thaw
<em class=
"replaceable"><code>zone
</code></em></strong></span>
232 to reload the changed zone and re-enable dynamic updates.
235 <span><strong class=
"command">rndc sync
<em class=
"replaceable"><code>zone
</code></em></strong></span>
236 will update the zone file with changes from the journal file
237 without stopping dynamic updates; this may be useful for viewing
238 the current zone state. To remove the
<code class=
"filename">.jnl
</code>
239 file after updating the zone file, use
240 <span><strong class=
"command">rndc sync -clean
</strong></span>.
244 <div class=
"sect1" lang=
"en">
245 <div class=
"titlepage"><div><div><h2 class=
"title" style=
"clear: both">
246 <a name=
"incremental_zone_transfers"></a>Incremental Zone Transfers (IXFR)
</h2></div></div></div>
248 The incremental zone transfer (IXFR) protocol is a way for
249 slave servers to transfer only changed data, instead of having to
250 transfer the entire zone. The IXFR protocol is specified in RFC
251 1995. See
<a href=
"Bv9ARM.ch11.html#proposed_standards">Proposed Standards
</a>.
254 When acting as a master,
<acronym class=
"acronym">BIND
</acronym> 9
255 supports IXFR for those zones
256 where the necessary change history information is available. These
257 include master zones maintained by dynamic update and slave zones
258 whose data was obtained by IXFR. For manually maintained master
259 zones, and for slave zones obtained by performing a full zone
260 transfer (AXFR), IXFR is supported only if the option
261 <span><strong class=
"command">ixfr-from-differences
</strong></span> is set
262 to
<strong class=
"userinput"><code>yes
</code></strong>.
265 When acting as a slave,
<acronym class=
"acronym">BIND
</acronym> 9 will
266 attempt to use IXFR unless
267 it is explicitly disabled. For more information about disabling
268 IXFR, see the description of the
<span><strong class=
"command">request-ixfr
</strong></span> clause
269 of the
<span><strong class=
"command">server
</strong></span> statement.
272 <div class=
"sect1" lang=
"en">
273 <div class=
"titlepage"><div><div><h2 class=
"title" style=
"clear: both">
274 <a name=
"id2569920"></a>Split DNS
</h2></div></div></div>
276 Setting up different views, or visibility, of the DNS space to
277 internal and external resolvers is usually referred to as a
278 <span class=
"emphasis"><em>Split DNS
</em></span> setup. There are several
279 reasons an organization would want to set up its DNS this way.
282 One common reason for setting up a DNS system this way is
283 to hide
"internal" DNS information from
"external" clients on the
284 Internet. There is some debate as to whether or not this is actually
286 Internal DNS information leaks out in many ways (via email headers,
287 for example) and most savvy
"attackers" can find the information
288 they need using other means.
289 However, since listing addresses of internal servers that
290 external clients cannot possibly reach can result in
291 connection delays and other annoyances, an organization may
292 choose to use a Split DNS to present a consistent view of itself
293 to the outside world.
296 Another common reason for setting up a Split DNS system is
297 to allow internal networks that are behind filters or in RFC
1918
298 space (reserved IP space, as documented in RFC
1918) to resolve DNS
299 on the Internet. Split DNS can also be used to allow mail from outside
300 back in to the internal network.
302 <div class=
"sect2" lang=
"en">
303 <div class=
"titlepage"><div><div><h3 class=
"title">
304 <a name=
"id2569938"></a>Example split DNS setup
</h3></div></div></div>
306 Let's say a company named
<span class=
"emphasis"><em>Example, Inc.
</em></span>
307 (
<code class=
"literal">example.com
</code>)
308 has several corporate sites that have an internal network with
310 Internet Protocol (IP) space and an external demilitarized zone (DMZ),
311 or
"outside" section of a network, that is available to the public.
314 <span class=
"emphasis"><em>Example, Inc.
</em></span> wants its internal clients
315 to be able to resolve external hostnames and to exchange mail with
316 people on the outside. The company also wants its internal resolvers
317 to have access to certain internal-only zones that are not available
318 at all outside of the internal network.
321 In order to accomplish this, the company will set up two sets
322 of name servers. One set will be on the inside network (in the
324 IP space) and the other set will be on bastion hosts, which are
326 hosts that can talk to both sides of its network, in the DMZ.
329 The internal servers will be configured to forward all queries,
330 except queries for
<code class=
"filename">site1.internal
</code>,
<code class=
"filename">site2.internal
</code>,
<code class=
"filename">site1.example.com
</code>,
331 and
<code class=
"filename">site2.example.com
</code>, to the servers
333 DMZ. These internal servers will have complete sets of information
334 for
<code class=
"filename">site1.example.com
</code>,
<code class=
"filename">site2.example.com
</code>,
<code class=
"filename">site1.internal
</code>,
335 and
<code class=
"filename">site2.internal
</code>.
338 To protect the
<code class=
"filename">site1.internal
</code> and
<code class=
"filename">site2.internal
</code> domains,
339 the internal name servers must be configured to disallow all queries
340 to these domains from any external hosts, including the bastion
344 The external servers, which are on the bastion hosts, will
345 be configured to serve the
"public" version of the
<code class=
"filename">site1
</code> and
<code class=
"filename">site2.example.com
</code> zones.
346 This could include things such as the host records for public servers
347 (
<code class=
"filename">www.example.com
</code> and
<code class=
"filename">ftp.example.com
</code>),
348 and mail exchange (MX) records (
<code class=
"filename">a.mx.example.com
</code> and
<code class=
"filename">b.mx.example.com
</code>).
351 In addition, the public
<code class=
"filename">site1
</code> and
<code class=
"filename">site2.example.com
</code> zones
352 should have special MX records that contain wildcard (`*') records
353 pointing to the bastion hosts. This is needed because external mail
354 servers do not have any other way of looking up how to deliver mail
355 to those internal hosts. With the wildcard records, the mail will
356 be delivered to the bastion host, which can then forward it on to
360 Here's an example of a wildcard MX record:
362 <pre class=
"programlisting">* IN MX
10 external1.example.com.
</pre>
364 Now that they accept mail on behalf of anything in the internal
365 network, the bastion hosts will need to know how to deliver mail
366 to internal hosts. In order for this to work properly, the resolvers
368 the bastion hosts will need to be configured to point to the internal
369 name servers for DNS resolution.
372 Queries for internal hostnames will be answered by the internal
373 servers, and queries for external hostnames will be forwarded back
374 out to the DNS servers on the bastion hosts.
377 In order for all this to work properly, internal clients will
378 need to be configured to query
<span class=
"emphasis"><em>only
</em></span> the internal
379 name servers for DNS queries. This could also be enforced via
381 filtering on the network.
384 If everything has been set properly,
<span class=
"emphasis"><em>Example, Inc.
</em></span>'s
385 internal clients will now be able to:
387 <div class=
"itemizedlist"><ul type=
"disc">
389 Look up any hostnames in the
<code class=
"literal">site1
</code>
391 <code class=
"literal">site2.example.com
</code> zones.
394 Look up any hostnames in the
<code class=
"literal">site1.internal
</code> and
395 <code class=
"literal">site2.internal
</code> domains.
397 <li>Look up any hostnames on the Internet.
</li>
398 <li>Exchange mail with both internal and external people.
</li>
401 Hosts on the Internet will be able to:
403 <div class=
"itemizedlist"><ul type=
"disc">
405 Look up any hostnames in the
<code class=
"literal">site1
</code>
407 <code class=
"literal">site2.example.com
</code> zones.
410 Exchange mail with anyone in the
<code class=
"literal">site1
</code> and
411 <code class=
"literal">site2.example.com
</code> zones.
415 Here is an example configuration for the setup we just
416 described above. Note that this is only configuration information;
417 for information on how to configure your zone files, see
<a href=
"Bv9ARM.ch03.html#sample_configuration" title=
"Sample Configurations">the section called
“Sample Configurations
”</a>.
420 Internal DNS server config:
422 <pre class=
"programlisting">
424 acl internals {
172.16.72.0/
24;
192.168.1.0/
24; };
426 acl externals {
<code class=
"varname">bastion-ips-go-here
</code>; };
432 // forward to external servers
434 <code class=
"varname">bastion-ips-go-here
</code>;
436 // sample allow-transfer (no one)
437 allow-transfer { none; };
438 // restrict query access
439 allow-query { internals; externals; };
440 // restrict recursion
441 allow-recursion { internals; };
446 // sample master zone
447 zone
"site1.example.com" {
449 file
"m/site1.example.com";
450 // do normal iterative resolution (do not forward)
452 allow-query { internals; externals; };
453 allow-transfer { internals; };
457 zone
"site2.example.com" {
459 file
"s/site2.example.com";
460 masters {
172.16.72.3; };
462 allow-query { internals; externals; };
463 allow-transfer { internals; };
466 zone
"site1.internal" {
468 file
"m/site1.internal";
470 allow-query { internals; };
471 allow-transfer { internals; }
474 zone
"site2.internal" {
476 file
"s/site2.internal";
477 masters {
172.16.72.3; };
479 allow-query { internals };
480 allow-transfer { internals; }
484 External (bastion host) DNS server config:
486 <pre class=
"programlisting">
487 acl internals {
172.16.72.0/
24;
192.168.1.0/
24; };
489 acl externals { bastion-ips-go-here; };
494 // sample allow-transfer (no one)
495 allow-transfer { none; };
496 // default query access
497 allow-query { any; };
498 // restrict cache access
499 allow-query-cache { internals; externals; };
500 // restrict recursion
501 allow-recursion { internals; externals; };
507 zone
"site1.example.com" {
509 file
"m/site1.foo.com";
510 allow-transfer { internals; externals; };
513 zone
"site2.example.com" {
515 file
"s/site2.foo.com";
516 masters { another_bastion_host_maybe; };
517 allow-transfer { internals; externals; }
521 In the
<code class=
"filename">resolv.conf
</code> (or equivalent) on
524 <pre class=
"programlisting">
526 nameserver
172.16.72.2
527 nameserver
172.16.72.3
528 nameserver
172.16.72.4
532 <div class=
"sect1" lang=
"en">
533 <div class=
"titlepage"><div><div><h2 class=
"title" style=
"clear: both">
534 <a name=
"tsig"></a>TSIG
</h2></div></div></div>
536 This is a short guide to setting up Transaction SIGnatures
537 (TSIG) based transaction security in
<acronym class=
"acronym">BIND
</acronym>. It describes changes
538 to the configuration file as well as what changes are required for
539 different features, including the process of creating transaction
540 keys and using transaction signatures with
<acronym class=
"acronym">BIND
</acronym>.
543 <acronym class=
"acronym">BIND
</acronym> primarily supports TSIG for server
544 to server communication.
545 This includes zone transfer, notify, and recursive query messages.
546 Resolvers based on newer versions of
<acronym class=
"acronym">BIND
</acronym> 8 have limited support
550 TSIG can also be useful for dynamic update. A primary
551 server for a dynamic zone should control access to the dynamic
552 update service, but IP-based access control is insufficient.
553 The cryptographic access control provided by TSIG
554 is far superior. The
<span><strong class=
"command">nsupdate
</strong></span>
555 program supports TSIG via the
<code class=
"option">-k
</code> and
556 <code class=
"option">-y
</code> command line options or inline by use
557 of the
<span><strong class=
"command">key
</strong></span>.
559 <div class=
"sect2" lang=
"en">
560 <div class=
"titlepage"><div><div><h3 class=
"title">
561 <a name=
"id2570439"></a>Generate Shared Keys for Each Pair of Hosts
</h3></div></div></div>
563 A shared secret is generated to be shared between
<span class=
"emphasis"><em>host1
</em></span> and
<span class=
"emphasis"><em>host2
</em></span>.
564 An arbitrary key name is chosen:
"host1-host2.". The key name must
565 be the same on both hosts.
567 <div class=
"sect3" lang=
"en">
568 <div class=
"titlepage"><div><div><h4 class=
"title">
569 <a name=
"id2570524"></a>Automatic Generation
</h4></div></div></div>
571 The following command will generate a
128-bit (
16 byte) HMAC-SHA256
572 key as described above. Longer keys are better, but shorter keys
573 are easier to read. Note that the maximum key length is the digest
574 length, here
256 bits.
577 <strong class=
"userinput"><code>dnssec-keygen -a hmac-sha256 -b
128 -n HOST host1-host2.
</code></strong>
580 The key is in the file
<code class=
"filename">Khost1-host2.+
163+
00000.private
</code>.
581 Nothing directly uses this file, but the base-
64 encoded string
582 following
"<code class="literal
">Key:</code>"
583 can be extracted from the file and used as a shared secret:
585 <pre class=
"programlisting">Key: La/E5CjG9O+os1jq0a2jdA==
</pre>
587 The string
"<code class="literal
">La/E5CjG9O+os1jq0a2jdA==</code>" can
588 be used as the shared secret.
591 <div class=
"sect3" lang=
"en">
592 <div class=
"titlepage"><div><div><h4 class=
"title">
593 <a name=
"id2570563"></a>Manual Generation
</h4></div></div></div>
595 The shared secret is simply a random sequence of bits, encoded
596 in base-
64. Most ASCII strings are valid base-
64 strings (assuming
597 the length is a multiple of
4 and only valid characters are used),
598 so the shared secret can be manually generated.
601 Also, a known string can be run through
<span><strong class=
"command">mmencode
</strong></span> or
602 a similar program to generate base-
64 encoded data.
606 <div class=
"sect2" lang=
"en">
607 <div class=
"titlepage"><div><div><h3 class=
"title">
608 <a name=
"id2570581"></a>Copying the Shared Secret to Both Machines
</h3></div></div></div>
610 This is beyond the scope of DNS. A secure transport mechanism
611 should be used. This could be secure FTP, ssh, telephone, etc.
614 <div class=
"sect2" lang=
"en">
615 <div class=
"titlepage"><div><div><h3 class=
"title">
616 <a name=
"id2570592"></a>Informing the Servers of the Key's Existence
</h3></div></div></div>
618 Imagine
<span class=
"emphasis"><em>host1
</em></span> and
<span class=
"emphasis"><em>host
2</em></span>
620 both servers. The following is added to each server's
<code class=
"filename">named.conf
</code> file:
622 <pre class=
"programlisting">
624 algorithm hmac-sha256;
625 secret
"La/E5CjG9O+os1jq0a2jdA==";
629 The secret is the one generated above. Since this is a secret, it
630 is recommended that either
<code class=
"filename">named.conf
</code> be
631 non-world readable, or the key directive be added to a non-world
632 readable file that is included by
<code class=
"filename">named.conf
</code>.
635 At this point, the key is recognized. This means that if the
636 server receives a message signed by this key, it can verify the
637 signature. If the signature is successfully verified, the
638 response is signed by the same key.
641 <div class=
"sect2" lang=
"en">
642 <div class=
"titlepage"><div><div><h3 class=
"title">
643 <a name=
"id2570628"></a>Instructing the Server to Use the Key
</h3></div></div></div>
645 Since keys are shared between two hosts only, the server must
646 be told when keys are to be used. The following is added to the
<code class=
"filename">named.conf
</code> file
647 for
<span class=
"emphasis"><em>host1
</em></span>, if the IP address of
<span class=
"emphasis"><em>host2
</em></span> is
650 <pre class=
"programlisting">
652 keys { host1-host2. ;};
656 Multiple keys may be present, but only the first is used.
657 This directive does not contain any secrets, so it may be in a
662 If
<span class=
"emphasis"><em>host1
</em></span> sends a message that is a request
663 to that address, the message will be signed with the specified key.
<span class=
"emphasis"><em>host1
</em></span> will
664 expect any responses to signed messages to be signed with the same
668 A similar statement must be present in
<span class=
"emphasis"><em>host2
</em></span>'s
669 configuration file (with
<span class=
"emphasis"><em>host1
</em></span>'s address) for
<span class=
"emphasis"><em>host2
</em></span> to
670 sign request messages to
<span class=
"emphasis"><em>host1
</em></span>.
673 <div class=
"sect2" lang=
"en">
674 <div class=
"titlepage"><div><div><h3 class=
"title">
675 <a name=
"id2570685"></a>TSIG Key Based Access Control
</h3></div></div></div>
677 <acronym class=
"acronym">BIND
</acronym> allows IP addresses and ranges
678 to be specified in ACL
680 <span><strong class=
"command">allow-{ query | transfer | update }
</strong></span>
682 This has been extended to allow TSIG keys also. The above key would
683 be denoted
<span><strong class=
"command">key host1-host2.
</strong></span>
686 An example of an
<span><strong class=
"command">allow-update
</strong></span> directive would be:
688 <pre class=
"programlisting">
689 allow-update { key host1-host2. ;};
692 This allows dynamic updates to succeed only if the request
693 was signed by a key named
"<span><strong class="command
">host1-host2.</strong></span>".
696 See
<a href=
"Bv9ARM.ch06.html#dynamic_update_policies" title=
"Dynamic Update Policies">the section called
“Dynamic Update Policies
”</a> for a discussion of
697 the more flexible
<span><strong class=
"command">update-policy
</strong></span> statement.
700 <div class=
"sect2" lang=
"en">
701 <div class=
"titlepage"><div><div><h3 class=
"title">
702 <a name=
"id2570734"></a>Errors
</h3></div></div></div>
704 The processing of TSIG signed messages can result in
705 several errors. If a signed message is sent to a non-TSIG aware
706 server, a FORMERR (format error) will be returned, since the server will not
707 understand the record. This is a result of misconfiguration,
708 since the server must be explicitly configured to send a TSIG
709 signed message to a specific server.
712 If a TSIG aware server receives a message signed by an
713 unknown key, the response will be unsigned with the TSIG
714 extended error code set to BADKEY. If a TSIG aware server
715 receives a message with a signature that does not validate, the
716 response will be unsigned with the TSIG extended error code set
717 to BADSIG. If a TSIG aware server receives a message with a time
718 outside of the allowed range, the response will be signed with
719 the TSIG extended error code set to BADTIME, and the time values
720 will be adjusted so that the response can be successfully
721 verified. In any of these cases, the message's rcode (response code) is set to
722 NOTAUTH (not authenticated).
726 <div class=
"sect1" lang=
"en">
727 <div class=
"titlepage"><div><div><h2 class=
"title" style=
"clear: both">
728 <a name=
"id2570748"></a>TKEY
</h2></div></div></div>
729 <p><span><strong class=
"command">TKEY
</strong></span>
730 is a mechanism for automatically generating a shared secret
731 between two hosts. There are several
"modes" of
732 <span><strong class=
"command">TKEY
</strong></span> that specify how the key is generated
733 or assigned.
<acronym class=
"acronym">BIND
</acronym> 9 implements only one of
734 these modes, the Diffie-Hellman key exchange. Both hosts are
735 required to have a Diffie-Hellman KEY record (although this
736 record is not required to be present in a zone). The
737 <span><strong class=
"command">TKEY
</strong></span> process must use signed messages,
738 signed either by TSIG or SIG(
0). The result of
739 <span><strong class=
"command">TKEY
</strong></span> is a shared secret that can be used to
740 sign messages with TSIG.
<span><strong class=
"command">TKEY
</strong></span> can also be
741 used to delete shared secrets that it had previously
745 The
<span><strong class=
"command">TKEY
</strong></span> process is initiated by a
747 or server by sending a signed
<span><strong class=
"command">TKEY
</strong></span>
749 (including any appropriate KEYs) to a TKEY-aware server. The
750 server response, if it indicates success, will contain a
751 <span><strong class=
"command">TKEY
</strong></span> record and any appropriate keys.
753 this exchange, both participants have enough information to
754 determine the shared secret; the exact process depends on the
755 <span><strong class=
"command">TKEY
</strong></span> mode. When using the
757 <span><strong class=
"command">TKEY
</strong></span> mode, Diffie-Hellman keys are
759 and the shared secret is derived by both participants.
762 <div class=
"sect1" lang=
"en">
763 <div class=
"titlepage"><div><div><h2 class=
"title" style=
"clear: both">
764 <a name=
"id2570797"></a>SIG(
0)
</h2></div></div></div>
766 <acronym class=
"acronym">BIND
</acronym> 9 partially supports DNSSEC SIG(
0)
767 transaction signatures as specified in RFC
2535 and RFC
2931.
769 uses public/private keys to authenticate messages. Access control
770 is performed in the same manner as TSIG keys; privileges can be
771 granted or denied based on the key name.
774 When a SIG(
0) signed message is received, it will only be
775 verified if the key is known and trusted by the server; the server
776 will not attempt to locate and/or validate the key.
779 SIG(
0) signing of multiple-message TCP streams is not
783 The only tool shipped with
<acronym class=
"acronym">BIND
</acronym> 9 that
784 generates SIG(
0) signed messages is
<span><strong class=
"command">nsupdate
</strong></span>.
787 <div class=
"sect1" lang=
"en">
788 <div class=
"titlepage"><div><div><h2 class=
"title" style=
"clear: both">
789 <a name=
"DNSSEC"></a>DNSSEC
</h2></div></div></div>
791 Cryptographic authentication of DNS information is possible
792 through the DNS Security (
<span class=
"emphasis"><em>DNSSEC-bis
</em></span>) extensions,
793 defined in RFC
4033, RFC
4034, and RFC
4035.
794 This section describes the creation and use of DNSSEC signed zones.
797 In order to set up a DNSSEC secure zone, there are a series
798 of steps which must be followed.
<acronym class=
"acronym">BIND
</acronym>
801 that are used in this process, which are explained in more detail
802 below. In all cases, the
<code class=
"option">-h
</code> option prints a
803 full list of parameters. Note that the DNSSEC tools require the
804 keyset files to be in the working directory or the
805 directory specified by the
<code class=
"option">-d
</code> option, and
806 that the tools shipped with BIND
9.2.x and earlier are not compatible
807 with the current ones.
810 There must also be communication with the administrators of
811 the parent and/or child zone to transmit keys. A zone's security
812 status must be indicated by the parent zone for a DNSSEC capable
813 resolver to trust its data. This is done through the presence
814 or absence of a
<code class=
"literal">DS
</code> record at the
819 For other servers to trust data in this zone, they must
820 either be statically configured with this zone's zone key or the
821 zone key of another zone above this one in the DNS tree.
823 <div class=
"sect2" lang=
"en">
824 <div class=
"titlepage"><div><div><h3 class=
"title">
825 <a name=
"id2570934"></a>Generating Keys
</h3></div></div></div>
827 The
<span><strong class=
"command">dnssec-keygen
</strong></span> program is used to
831 A secure zone must contain one or more zone keys. The
832 zone keys will sign all other records in the zone, as well as
833 the zone keys of any secure delegated zones. Zone keys must
834 have the same name as the zone, a name type of
835 <span><strong class=
"command">ZONE
</strong></span>, and must be usable for
837 It is recommended that zone keys use a cryptographic algorithm
838 designated as
"mandatory to implement" by the IETF; currently
839 the only one is RSASHA1.
842 The following command will generate a
768-bit RSASHA1 key for
843 the
<code class=
"filename">child.example
</code> zone:
846 <strong class=
"userinput"><code>dnssec-keygen -a RSASHA1 -b
768 -n ZONE child.example.
</code></strong>
849 Two output files will be produced:
850 <code class=
"filename">Kchild.example.+
005+
12345.key
</code> and
851 <code class=
"filename">Kchild.example.+
005+
12345.private
</code>
853 12345 is an example of a key tag). The key filenames contain
854 the key name (
<code class=
"filename">child.example.
</code>),
856 is DSA,
1 is RSAMD5,
5 is RSASHA1, etc.), and the key tag (
12345 in
858 The private key (in the
<code class=
"filename">.private
</code>
860 used to generate signatures, and the public key (in the
861 <code class=
"filename">.key
</code> file) is used for signature
865 To generate another key with the same properties (but with
866 a different key tag), repeat the above command.
869 The
<span><strong class=
"command">dnssec-keyfromlabel
</strong></span> program is used
870 to get a key pair from a crypto hardware and build the key
871 files. Its usage is similar to
<span><strong class=
"command">dnssec-keygen
</strong></span>.
874 The public keys should be inserted into the zone file by
875 including the
<code class=
"filename">.key
</code> files using
876 <span><strong class=
"command">$INCLUDE
</strong></span> statements.
879 <div class=
"sect2" lang=
"en">
880 <div class=
"titlepage"><div><div><h3 class=
"title">
881 <a name=
"id2571218"></a>Signing the Zone
</h3></div></div></div>
883 The
<span><strong class=
"command">dnssec-signzone
</strong></span> program is used
887 Any
<code class=
"filename">keyset
</code> files corresponding to
888 secure subzones should be present. The zone signer will
889 generate
<code class=
"literal">NSEC
</code>,
<code class=
"literal">NSEC3
</code>
890 and
<code class=
"literal">RRSIG
</code> records for the zone, as
891 well as
<code class=
"literal">DS
</code> for the child zones if
892 <code class=
"literal">'-g'
</code> is specified. If
<code class=
"literal">'-g'
</code>
893 is not specified, then DS RRsets for the secure child
894 zones need to be added manually.
897 The following command signs the zone, assuming it is in a
898 file called
<code class=
"filename">zone.child.example
</code>. By
899 default, all zone keys which have an available private key are
900 used to generate signatures.
903 <strong class=
"userinput"><code>dnssec-signzone -o child.example zone.child.example
</code></strong>
906 One output file is produced:
907 <code class=
"filename">zone.child.example.signed
</code>. This
909 should be referenced by
<code class=
"filename">named.conf
</code>
911 input file for the zone.
913 <p><span><strong class=
"command">dnssec-signzone
</strong></span>
914 will also produce a keyset and dsset files and optionally a
915 dlvset file. These are used to provide the parent zone
916 administrators with the
<code class=
"literal">DNSKEYs
</code> (or their
917 corresponding
<code class=
"literal">DS
</code> records) that are the
918 secure entry point to the zone.
921 <div class=
"sect2" lang=
"en">
922 <div class=
"titlepage"><div><div><h3 class=
"title">
923 <a name=
"id2571299"></a>Configuring Servers
</h3></div></div></div>
925 To enable
<span><strong class=
"command">named
</strong></span> to respond appropriately
926 to DNS requests from DNSSEC aware clients,
927 <span><strong class=
"command">dnssec-enable
</strong></span> must be set to yes.
928 (This is the default setting.)
931 To enable
<span><strong class=
"command">named
</strong></span> to validate answers from
932 other servers, the
<span><strong class=
"command">dnssec-enable
</strong></span> option
933 must be set to
<strong class=
"userinput"><code>yes
</code></strong>, and the
934 <span><strong class=
"command">dnssec-validation
</strong></span> options must be set to
935 <strong class=
"userinput"><code>yes
</code></strong> or
<strong class=
"userinput"><code>auto
</code></strong>.
938 If
<span><strong class=
"command">dnssec-validation
</strong></span> is set to
939 <strong class=
"userinput"><code>auto
</code></strong>, then a default
940 trust anchor for the DNS root zone will be used.
941 If it is set to
<strong class=
"userinput"><code>yes
</code></strong>, however,
942 then at least one trust anchor must be configured
943 with a
<span><strong class=
"command">trusted-keys
</strong></span> or
944 <span><strong class=
"command">managed-keys
</strong></span> statement in
945 <code class=
"filename">named.conf
</code>, or DNSSEC validation
946 will not occur. The default setting is
947 <strong class=
"userinput"><code>yes
</code></strong>.
950 <span><strong class=
"command">trusted-keys
</strong></span> are copies of DNSKEY RRs
951 for zones that are used to form the first link in the
952 cryptographic chain of trust. All keys listed in
953 <span><strong class=
"command">trusted-keys
</strong></span> (and corresponding zones)
954 are deemed to exist and only the listed keys will be used
955 to validated the DNSKEY RRset that they are from.
958 <span><strong class=
"command">managed-keys
</strong></span> are trusted keys which are
959 automatically kept up to date via RFC
5011 trust anchor
963 <span><strong class=
"command">trusted-keys
</strong></span> and
964 <span><strong class=
"command">managed-keys
</strong></span> are described in more detail
965 later in this document.
968 Unlike
<acronym class=
"acronym">BIND
</acronym> 8,
<acronym class=
"acronym">BIND
</acronym>
969 9 does not verify signatures on load, so zone keys for
970 authoritative zones do not need to be specified in the
974 After DNSSEC gets established, a typical DNSSEC configuration
975 will look something like the following. It has one or
976 more public keys for the root. This allows answers from
977 outside the organization to be validated. It will also
978 have several keys for parts of the namespace the organization
979 controls. These are here to ensure that
<span><strong class=
"command">named
</strong></span>
980 is immune to compromises in the DNSSEC components of the security
983 <pre class=
"programlisting">
986 "." initial-key
257 3 3 "BNY4wrWM1nCfJ+CXd0rVXyYmobt7sEEfK3clRbGaTwS
987 JxrGkxJWoZu6I7PzJu/E9gx4UC1zGAHlXKdE4zYIpRh
988 aBKnvcC2U9mZhkdUpd1Vso/HAdjNe8LmMlnzY3zy2Xy
989 4klWOADTPzSv9eamj8V18PHGjBLaVtYvk/ln5ZApjYg
990 hf+6fElrmLkdaz MQ2OCnACR817DF4BBa7UR/beDHyp
991 5iWTXWSi6XmoJLbG9Scqc7l70KDqlvXR3M/lUUVRbke
992 g1IPJSidmK3ZyCllh4XSKbje/45SKucHgnwU5jefMtq
993 66gKodQj+MiA21AfUVe7u99WzTLzY3qlxDhxYQQ20FQ
994 97S+LKUTpQcq27R7AT3/V5hRQxScINqwcz4jYqZD2fQ
995 dgxbcDTClU0CRBdiieyLMNzXG3";
999 /* Key for our organization's forward zone */
1000 example.com.
257 3 5 "AwEAAaxPMcR2x0HbQV4WeZB6oEDX+r0QM6
1001 5KbhTjrW1ZaARmPhEZZe3Y9ifgEuq7vZ/z
1002 GZUdEGNWy+JZzus0lUptwgjGwhUS1558Hb
1003 4JKUbbOTcM8pwXlj0EiX3oDFVmjHO444gL
1004 kBOUKUf/mC7HvfwYH/Be22GnClrinKJp1O
1005 g4ywzO9WglMk7jbfW33gUKvirTHr25GL7S
1006 TQUzBb5Usxt8lgnyTUHs1t3JwCY5hKZ6Cq
1007 FxmAVZP20igTixin/1LcrgX/KMEGd/biuv
1008 F4qJCyduieHukuY3H4XMAcR+xia2nIUPvm
1009 /oyWR8BW/hWdzOvnSCThlHf3xiYleDbt/o
1012 /* Key for our reverse zone. */
1013 2.0.192.IN-ADDRPA.NET.
257 3 5 "AQOnS4xn/IgOUpBPJ3bogzwc
1014 xOdNax071L18QqZnQQQAVVr+i
1015 LhGTnNGp3HoWQLUIzKrJVZ3zg
1016 gy3WwNT6kZo6c0tszYqbtvchm
1017 gQC8CzKojM/W16i6MG/eafGU3
1018 siaOdS0yOI6BgPsw+YZdzlYMa
1019 IJGf4M4dyoKIhzdZyQ2bYQrjy
1020 Q4LB0lC7aOnsMyYKHHYeRvPxj
1021 IQXmdqgOJGq+vsevG06zW+1xg
1022 YJh9rCIfnm1GX/KMgxLPG2vXT
1023 D/RnLX+D3T3UL7HJYHJhAZD5L
1024 59VvjSPsZJHeDCUyWYrvPZesZ
1025 DIRvhDD52SKvbheeTJUm6Ehkz
1026 ytNN2SN96QRk8j/iI8ib";
1032 dnssec-validation yes;
1035 <div class=
"note" style=
"margin-left: 0.5in; margin-right: 0.5in;">
1036 <h3 class=
"title">Note
</h3>
1037 None of the keys listed in this example are valid. In particular,
1038 the root key is not valid.
1041 When DNSSEC validation is enabled and properly configured,
1042 the resolver will reject any answers from signed, secure zones
1043 which fail to validate, and will return SERVFAIL to the client.
1046 Responses may fail to validate for any of several reasons,
1047 including missing, expired, or invalid signatures, a key which
1048 does not match the DS RRset in the parent zone, or an insecure
1049 response from a zone which, according to its parent, should have
1052 <div class=
"note" style=
"margin-left: 0.5in; margin-right: 0.5in;">
1053 <h3 class=
"title">Note
</h3>
1055 When the validator receives a response from an unsigned zone
1056 that has a signed parent, it must confirm with the parent
1057 that the zone was intentionally left unsigned. It does
1058 this by verifying, via signed and validated NSEC/NSEC3 records,
1059 that the parent zone contains no DS records for the child.
1062 If the validator
<span class=
"emphasis"><em>can
</em></span> prove that the zone
1063 is insecure, then the response is accepted. However, if it
1064 cannot, then it must assume an insecure response to be a
1065 forgery; it rejects the response and logs an error.
1068 The logged error reads
"insecurity proof failed" and
1069 "got insecure response; parent indicates it should be secure".
1070 (Prior to BIND
9.7, the logged error was
"not insecure".
1071 This referred to the zone, not the response.)
1076 <div class=
"sect1" lang=
"en">
1077 <div class=
"titlepage"><div><div><h2 class=
"title" style=
"clear: both">
1078 <a name=
"dnssec.dynamic.zones"></a>DNSSEC, Dynamic Zones, and Automatic Signing
</h2></div></div></div>
1079 <p>As of BIND
9.7.0 it is possible to change a dynamic zone
1080 from insecure to signed and back again. A secure zone can use
1081 either NSEC or NSEC3 chains.
</p>
1082 <div class=
"sect2" lang=
"en"><div class=
"titlepage"><div><div><h3 class=
"title">
1083 <a name=
"id2611126"></a>Converting from insecure to secure
</h3></div></div></div></div>
1084 <p>Changing a zone from insecure to secure can be done in two
1085 ways: using a dynamic DNS update, or the
1086 <span><strong class=
"command">auto-dnssec
</strong></span> zone option.
</p>
1087 <p>For either method, you need to configure
1088 <span><strong class=
"command">named
</strong></span> so that it can see the
1089 <code class=
"filename">K*
</code> files which contain the public and private
1090 parts of the keys that will be used to sign the zone. These files
1091 will have been generated by
1092 <span><strong class=
"command">dnssec-keygen
</strong></span>. You can do this by placing them
1093 in the key-directory, as specified in
1094 <code class=
"filename">named.conf
</code>:
</p>
1095 <pre class=
"programlisting">
1098 update-policy local;
1099 file
"dynamic/example.net/example.net";
1100 key-directory
"dynamic/example.net";
1103 <p>If one KSK and one ZSK DNSKEY key have been generated, this
1104 configuration will cause all records in the zone to be signed
1105 with the ZSK, and the DNSKEY RRset to be signed with the KSK as
1106 well. An NSEC chain will be generated as part of the initial
1107 signing process.
</p>
1108 <div class=
"sect2" lang=
"en"><div class=
"titlepage"><div><div><h3 class=
"title">
1109 <a name=
"id2563650"></a>Dynamic DNS update method
</h3></div></div></div></div>
1110 <p>To insert the keys via dynamic update:
</p>
1111 <pre class=
"screen">
1114 > update add example.net DNSKEY
256 3 7 AwEAAZn17pUF0KpbPA2c7Gz76Vb18v0teKT3EyAGfBfL8eQ8al35zz3Y I1m/SAQBxIqMfLtIwqWPdgthsu36azGQAX8=
1115 > update add example.net DNSKEY
257 3 7 AwEAAd/
7odU/
64o2LGsifbLtQmtO8dFDtTAZXSX2+X3e/UNlq9IHq3Y0 XtC0Iuawl/qkaKVxXe2lo8Ct+dM6UehyCqk=
1118 <p>While the update request will complete almost immediately,
1119 the zone will not be completely signed until
1120 <span><strong class=
"command">named
</strong></span> has had time to walk the zone and
1121 generate the NSEC and RRSIG records. The NSEC record at the apex
1122 will be added last, to signal that there is a complete NSEC
1124 <p>If you wish to sign using NSEC3 instead of NSEC, you should
1125 add an NSEC3PARAM record to the initial update request. If you
1126 wish the NSEC3 chain to have the OPTOUT bit set, set it in the
1127 flags field of the NSEC3PARAM record.
</p>
1128 <pre class=
"screen">
1131 > update add example.net DNSKEY
256 3 7 AwEAAZn17pUF0KpbPA2c7Gz76Vb18v0teKT3EyAGfBfL8eQ8al35zz3Y I1m/SAQBxIqMfLtIwqWPdgthsu36azGQAX8=
1132 > update add example.net DNSKEY
257 3 7 AwEAAd/
7odU/
64o2LGsifbLtQmtO8dFDtTAZXSX2+X3e/UNlq9IHq3Y0 XtC0Iuawl/qkaKVxXe2lo8Ct+dM6UehyCqk=
1133 > update add example.net NSEC3PARAM
1 1 100 1234567890
1136 <p>Again, this update request will complete almost
1137 immediately; however, the record won't show up until
1138 <span><strong class=
"command">named
</strong></span> has had a chance to build/remove the
1139 relevant chain. A private type record will be created to record
1140 the state of the operation (see below for more details), and will
1141 be removed once the operation completes.
</p>
1142 <p>While the initial signing and NSEC/NSEC3 chain generation
1143 is happening, other updates are possible as well.
</p>
1144 <div class=
"sect2" lang=
"en"><div class=
"titlepage"><div><div><h3 class=
"title">
1145 <a name=
"id2563686"></a>Fully automatic zone signing
</h3></div></div></div></div>
1146 <p>To enable automatic signing, add the
1147 <span><strong class=
"command">auto-dnssec
</strong></span> option to the zone statement in
1148 <code class=
"filename">named.conf
</code>.
1149 <span><strong class=
"command">auto-dnssec
</strong></span> has two possible arguments:
1150 <code class=
"constant">allow
</code> or
1151 <code class=
"constant">maintain
</code>.
</p>
1153 <span><strong class=
"command">auto-dnssec allow
</strong></span>,
1154 <span><strong class=
"command">named
</strong></span> can search the key directory for keys
1155 matching the zone, insert them into the zone, and use them to
1156 sign the zone. It will do so only when it receives an
1157 <span><strong class=
"command">rndc sign
<zonename
></strong></span>.
</p>
1160 <span><strong class=
"command">auto-dnssec maintain
</strong></span> includes the above
1161 functionality, but will also automatically adjust the zone's
1162 DNSKEY records on schedule according to the keys' timing metadata.
1163 (See
<a href=
"man.dnssec-keygen.html" title=
"dnssec-keygen"><span class=
"refentrytitle"><span class=
"application">dnssec-keygen
</span></span>(
8)
</a> and
1164 <a href=
"man.dnssec-settime.html" title=
"dnssec-settime"><span class=
"refentrytitle"><span class=
"application">dnssec-settime
</span></span>(
8)
</a> for more information.)
1167 <span><strong class=
"command">named
</strong></span> will periodically search the key directory
1168 for keys matching the zone, and if the keys' metadata indicates
1169 that any change should be made the zone, such as adding, removing,
1170 or revoking a key, then that action will be carried out. By default,
1171 the key directory is checked for changes every
60 minutes; this period
1172 can be adjusted with the
<code class=
"option">dnssec-loadkeys-interval
</code>, up
1173 to a maximum of
24 hours. The
<span><strong class=
"command">rndc loadkeys
</strong></span> forces
1174 <span><strong class=
"command">named
</strong></span> to check for key updates immediately.
1177 If keys are present in the key directory the first time the zone
1178 is loaded, the zone will be signed immediately, without waiting for an
1179 <span><strong class=
"command">rndc sign
</strong></span> or
<span><strong class=
"command">rndc loadkeys
</strong></span>
1180 command. (Those commands can still be used when there are unscheduled
1181 key changes, however.)
1184 When new keys are added to a zone, the TTL is set to match that
1185 of any existing DNSKEY RRset. If there is no existing DNSKEY RRset,
1186 then the TTL will be set to the TTL specified when the key was
1187 created (using the
<span><strong class=
"command">dnssec-keygen -L
</strong></span> option), if
1188 any, or to the SOA TTL.
1191 If you wish the zone to be signed using NSEC3 instead of NSEC,
1192 submit an NSEC3PARAM record via dynamic update prior to the
1193 scheduled publication and activation of the keys. If you wish the
1194 NSEC3 chain to have the OPTOUT bit set, set it in the flags field
1195 of the NSEC3PARAM record. The NSEC3PARAM record will not appear in
1196 the zone immediately, but it will be stored for later reference. When
1197 the zone is signed and the NSEC3 chain is completed, the NSEC3PARAM
1198 record will appear in the zone.
1201 <span><strong class=
"command">auto-dnssec
</strong></span> option requires the zone to be
1202 configured to allow dynamic updates, by adding an
1203 <span><strong class=
"command">allow-update
</strong></span> or
1204 <span><strong class=
"command">update-policy
</strong></span> statement to the zone
1205 configuration. If this has not been done, the configuration will
1207 <div class=
"sect2" lang=
"en"><div class=
"titlepage"><div><div><h3 class=
"title">
1208 <a name=
"id2563933"></a>Private-type records
</h3></div></div></div></div>
1209 <p>The state of the signing process is signaled by
1210 private-type records (with a default type value of
65534). When
1211 signing is complete, these records will have a nonzero value for
1212 the final octet (for those records which have a nonzero initial
1214 <p>The private type record format: If the first octet is
1215 non-zero then the record indicates that the zone needs to be
1216 signed with the key matching the record, or that all signatures
1217 that match the record should be removed.
</p>
1220 <div class=
"literallayout"><p><br>
1222 algorithm (octet
1)
<br>
1223 key id in network order (octet
2 and
3)
<br>
1224 removal flag (octet
4)
<br>
1225 complete flag (octet
5)
<br>
1229 <p>Only records flagged as
"complete" can be removed via
1230 dynamic update. Attempts to remove other private type records
1231 will be silently ignored.
</p>
1232 <p>If the first octet is zero (this is a reserved algorithm
1233 number that should never appear in a DNSKEY record) then the
1234 record indicates changes to the NSEC3 chains are in progress. The
1235 rest of the record contains an NSEC3PARAM record. The flag field
1236 tells what operation to perform based on the flag bits.
</p>
1239 <div class=
"literallayout"><p><br>
1248 <div class=
"sect2" lang=
"en"><div class=
"titlepage"><div><div><h3 class=
"title">
1249 <a name=
"id2582676"></a>DNSKEY rollovers
</h3></div></div></div></div>
1250 <p>As with insecure-to-secure conversions, rolling DNSSEC
1251 keys can be done in two ways: using a dynamic DNS update, or the
1252 <span><strong class=
"command">auto-dnssec
</strong></span> zone option.
</p>
1253 <div class=
"sect2" lang=
"en"><div class=
"titlepage"><div><div><h3 class=
"title">
1254 <a name=
"id2582689"></a>Dynamic DNS update method
</h3></div></div></div></div>
1255 <p> To perform key rollovers via dynamic update, you need to add
1256 the
<code class=
"filename">K*
</code> files for the new keys so that
1257 <span><strong class=
"command">named
</strong></span> can find them. You can then add the new
1258 DNSKEY RRs via dynamic update.
1259 <span><strong class=
"command">named
</strong></span> will then cause the zone to be signed
1260 with the new keys. When the signing is complete the private type
1261 records will be updated so that the last octet is non
1263 <p>If this is for a KSK you need to inform the parent and any
1264 trust anchor repositories of the new KSK.
</p>
1265 <p>You should then wait for the maximum TTL in the zone before
1266 removing the old DNSKEY. If it is a KSK that is being updated,
1267 you also need to wait for the DS RRset in the parent to be
1268 updated and its TTL to expire. This ensures that all clients will
1269 be able to verify at least one signature when you remove the old
1271 <p>The old DNSKEY can be removed via UPDATE. Take care to
1272 specify the correct key.
1273 <span><strong class=
"command">named
</strong></span> will clean out any signatures generated
1274 by the old key after the update completes.
</p>
1275 <div class=
"sect2" lang=
"en"><div class=
"titlepage"><div><div><h3 class=
"title">
1276 <a name=
"id2582722"></a>Automatic key rollovers
</h3></div></div></div></div>
1277 <p>When a new key reaches its activation date (as set by
1278 <span><strong class=
"command">dnssec-keygen
</strong></span> or
<span><strong class=
"command">dnssec-settime
</strong></span>),
1279 if the
<span><strong class=
"command">auto-dnssec
</strong></span> zone option is set to
1280 <code class=
"constant">maintain
</code>,
<span><strong class=
"command">named
</strong></span> will
1281 automatically carry out the key rollover. If the key's algorithm
1282 has not previously been used to sign the zone, then the zone will
1283 be fully signed as quickly as possible. However, if the new key
1284 is replacing an existing key of the same algorithm, then the
1285 zone will be re-signed incrementally, with signatures from the
1286 old key being replaced with signatures from the new key as their
1287 signature validity periods expire. By default, this rollover
1288 completes in
30 days, after which it will be safe to remove the
1289 old key from the DNSKEY RRset.
</p>
1290 <div class=
"sect2" lang=
"en"><div class=
"titlepage"><div><div><h3 class=
"title">
1291 <a name=
"id2582748"></a>NSEC3PARAM rollovers via UPDATE
</h3></div></div></div></div>
1292 <p>Add the new NSEC3PARAM record via dynamic update. When the
1293 new NSEC3 chain has been generated, the NSEC3PARAM flag field
1294 will be zero. At this point you can remove the old NSEC3PARAM
1295 record. The old chain will be removed after the update request
1297 <div class=
"sect2" lang=
"en"><div class=
"titlepage"><div><div><h3 class=
"title">
1298 <a name=
"id2582758"></a>Converting from NSEC to NSEC3
</h3></div></div></div></div>
1299 <p>To do this, you just need to add an NSEC3PARAM record. When
1300 the conversion is complete, the NSEC chain will have been removed
1301 and the NSEC3PARAM record will have a zero flag field. The NSEC3
1302 chain will be generated before the NSEC chain is
1304 <div class=
"sect2" lang=
"en"><div class=
"titlepage"><div><div><h3 class=
"title">
1305 <a name=
"id2582768"></a>Converting from NSEC3 to NSEC
</h3></div></div></div></div>
1306 <p>To do this, use
<span><strong class=
"command">nsupdate
</strong></span> to
1307 remove all NSEC3PARAM records with a zero flag
1308 field. The NSEC chain will be generated before the NSEC3 chain is
1310 <div class=
"sect2" lang=
"en"><div class=
"titlepage"><div><div><h3 class=
"title">
1311 <a name=
"id2582780"></a>Converting from secure to insecure
</h3></div></div></div></div>
1312 <p>To convert a signed zone to unsigned using dynamic DNS,
1313 delete all the DNSKEY records from the zone apex using
1314 <span><strong class=
"command">nsupdate
</strong></span>. All signatures, NSEC or NSEC3 chains,
1315 and associated NSEC3PARAM records will be removed automatically.
1316 This will take place after the update request completes.
</p>
1317 <p> This requires the
1318 <span><strong class=
"command">dnssec-secure-to-insecure
</strong></span> option to be set to
1319 <strong class=
"userinput"><code>yes
</code></strong> in
1320 <code class=
"filename">named.conf
</code>.
</p>
1321 <p>In addition, if the
<span><strong class=
"command">auto-dnssec maintain
</strong></span>
1322 zone statement is used, it should be removed or changed to
1323 <span><strong class=
"command">allow
</strong></span> instead (or it will re-sign).
1325 <div class=
"sect2" lang=
"en"><div class=
"titlepage"><div><div><h3 class=
"title">
1326 <a name=
"id2582818"></a>Periodic re-signing
</h3></div></div></div></div>
1327 <p>In any secure zone which supports dynamic updates, named
1328 will periodically re-sign RRsets which have not been re-signed as
1329 a result of some update action. The signature lifetimes will be
1330 adjusted so as to spread the re-sign load over time rather than
1332 <div class=
"sect2" lang=
"en"><div class=
"titlepage"><div><div><h3 class=
"title">
1333 <a name=
"id2582827"></a>NSEC3 and OPTOUT
</h3></div></div></div></div>
1335 <span><strong class=
"command">named
</strong></span> only supports creating new NSEC3 chains
1336 where all the NSEC3 records in the zone have the same OPTOUT
1338 <span><strong class=
"command">named
</strong></span> supports UPDATES to zones where the NSEC3
1339 records in the chain have mixed OPTOUT state.
1340 <span><strong class=
"command">named
</strong></span> does not support changing the OPTOUT
1341 state of an individual NSEC3 record, the entire chain needs to be
1342 changed if the OPTOUT state of an individual NSEC3 needs to be
1345 <div class=
"sect1" lang=
"en">
1346 <div class=
"titlepage"><div><div><h2 class=
"title" style=
"clear: both">
1347 <a name=
"rfc5011.support"></a>Dynamic Trust Anchor Management
</h2></div></div></div>
1348 <p>BIND
9.7.0 introduces support for RFC
5011, dynamic trust
1349 anchor management. Using this feature allows
1350 <span><strong class=
"command">named
</strong></span> to keep track of changes to critical
1351 DNSSEC keys without any need for the operator to make changes to
1352 configuration files.
</p>
1353 <div class=
"sect2" lang=
"en">
1354 <div class=
"titlepage"><div><div><h3 class=
"title">
1355 <a name=
"id2610708"></a>Validating Resolver
</h3></div></div></div>
1356 <p>To configure a validating resolver to use RFC
5011 to
1357 maintain a trust anchor, configure the trust anchor using a
1358 <span><strong class=
"command">managed-keys
</strong></span> statement. Information about
1359 this can be found in
1360 <a href=
"Bv9ARM.ch06.html#managed-keys" title=
"managed-keys Statement Definition
1361 and Usage">the section called
“<span><strong class=
"command">managed-keys
</strong></span> Statement Definition
1362 and Usage
”</a>.
</p>
1364 <div class=
"sect2" lang=
"en">
1365 <div class=
"titlepage"><div><div><h3 class=
"title">
1366 <a name=
"id2610730"></a>Authoritative Server
</h3></div></div></div>
1367 <p>To set up an authoritative zone for RFC
5011 trust anchor
1368 maintenance, generate two (or more) key signing keys (KSKs) for
1369 the zone. Sign the zone with one of them; this is the
"active"
1370 KSK. All KSK's which do not sign the zone are
"stand-by"
1372 <p>Any validating resolver which is configured to use the
1373 active KSK as an RFC
5011-managed trust anchor will take note
1374 of the stand-by KSKs in the zone's DNSKEY RRset, and store them
1375 for future reference. The resolver will recheck the zone
1376 periodically, and after
30 days, if the new key is still there,
1377 then the key will be accepted by the resolver as a valid trust
1378 anchor for the zone. Any time after this
30-day acceptance
1379 timer has completed, the active KSK can be revoked, and the
1380 zone can be
"rolled over" to the newly accepted key.
</p>
1381 <p>The easiest way to place a stand-by key in a zone is to
1382 use the
"smart signing" features of
1383 <span><strong class=
"command">dnssec-keygen
</strong></span> and
1384 <span><strong class=
"command">dnssec-signzone
</strong></span>. If a key with a publication
1385 date in the past, but an activation date which is unset or in
1387 <span><strong class="command
">dnssec-signzone -S</strong></span>" will include the DNSKEY
1388 record in the zone, but will not sign with it:
</p>
1389 <pre class=
"screen">
1390 $
<strong class=
"userinput"><code>dnssec-keygen -K keys -f KSK -P now -A now+
2y example.net
</code></strong>
1391 $
<strong class=
"userinput"><code>dnssec-signzone -S -K keys example.net
</code></strong>
1393 <p>To revoke a key, the new command
1394 <span><strong class=
"command">dnssec-revoke
</strong></span> has been added. This adds the
1395 REVOKED bit to the key flags and re-generates the
1396 <code class=
"filename">K*.key
</code> and
1397 <code class=
"filename">K*.private
</code> files.
</p>
1398 <p>After revoking the active key, the zone must be signed
1399 with both the revoked KSK and the new active KSK. (Smart
1400 signing takes care of this automatically.)
</p>
1401 <p>Once a key has been revoked and used to sign the DNSKEY
1402 RRset in which it appears, that key will never again be
1403 accepted as a valid trust anchor by the resolver. However,
1404 validation can proceed using the new active key (which had been
1405 accepted by the resolver when it was a stand-by key).
</p>
1406 <p>See RFC
5011 for more details on key rollover
1408 <p>When a key has been revoked, its key ID changes,
1409 increasing by
128, and wrapping around at
65535. So, for
1410 example, the key
"<code class="filename
">Kexample.com.+005+10000</code>" becomes
1411 "<code class="filename
">Kexample.com.+005+10128</code>".
</p>
1412 <p>If two keys have ID's exactly
128 apart, and one is
1413 revoked, then the two key ID's will collide, causing several
1414 problems. To prevent this,
1415 <span><strong class=
"command">dnssec-keygen
</strong></span> will not generate a new key if
1416 another key is present which may collide. This checking will
1417 only occur if the new keys are written to the same directory
1418 which holds all other keys in use for that zone.
</p>
1419 <p>Older versions of BIND
9 did not have this precaution.
1420 Exercise caution if using key revocation on keys that were
1421 generated by previous releases, or if using keys stored in
1422 multiple directories or on multiple machines.
</p>
1423 <p>It is expected that a future release of BIND
9 will
1424 address this problem in a different way, by storing revoked
1425 keys with their original unrevoked key ID's.
</p>
1428 <div class=
"sect1" lang=
"en">
1429 <div class=
"titlepage"><div><div><h2 class=
"title" style=
"clear: both">
1430 <a name=
"pkcs11"></a>PKCS#
11 (Cryptoki) support
</h2></div></div></div>
1432 PKCS#
11 (Public Key Cryptography Standard #
11) defines a
1433 platform-independent API for the control of hardware security
1434 modules (HSMs) and other cryptographic support devices.
1437 BIND
9 is known to work with three HSMs: The AEP Keyper, which has
1438 been tested with Debian Linux, Solaris x86 and Windows Server
2003;
1439 the Thales nShield, tested with Debian Linux; and the Sun SCA
6000
1440 cryptographic acceleration board, tested with Solaris x86. In
1441 addition, BIND can be used with all current versions of SoftHSM,
1442 a software-based HSM simulator library produced by the OpenDNSSEC
1446 PKCS#
11 makes use of a
"provider library": a dynamically loadable
1447 library which provides a low-level PKCS#
11 interface to drive the HSM
1448 hardware. The PKCS#
11 provider library comes from the HSM vendor, and
1449 it is specific to the HSM to be controlled.
1452 There are two available mechanisms for PKCS#
11 support in BIND
9:
1453 OpenSSL-based PKCS#
11 and native PKCS#
11. When using the first
1454 mechanism, BIND uses a modified version of OpenSSL, which loads
1455 the provider library and operates the HSM indirectly; any
1456 cryptographic operations not supported by the HSM can be carried
1457 out by OpenSSL instead. The second mechanism enables BIND to bypass
1458 OpenSSL completely; BIND loads the provider library itself, and uses
1459 the PKCS#
11 API to drive the HSM directly.
1461 <div class=
"sect2" lang=
"en">
1462 <div class=
"titlepage"><div><div><h3 class=
"title">
1463 <a name=
"id2666121"></a>Prerequisites
</h3></div></div></div>
1465 See the documentation provided by your HSM vendor for
1466 information about installing, initializing, testing and
1467 troubleshooting the HSM.
1470 <div class=
"sect2" lang=
"en">
1471 <div class=
"titlepage"><div><div><h3 class=
"title">
1472 <a name=
"id2666131"></a>Native PKCS#
11</h3></div></div></div>
1474 Native PKCS#
11 mode will only work with an HSM capable of carrying
1475 out
<span class=
"emphasis"><em>every
</em></span> cryptographic operation BIND
9 may
1476 need. The HSM's provider library must have a complete implementation
1477 of the PKCS#
11 API, so that all these functions are accessible. As of
1478 this writing, only the Thales nShield HSM and SoftHSMv2 can be used
1479 in this fashion. For other HSMs, including the AEP Keyper, Sun SCA
1480 6000 and older versions of SoftHSM, use OpenSSL-based PKCS#
11.
1481 (Note: Eventually, when more HSMs become capable of supporting
1482 native PKCS#
11, it is expected that OpenSSL-based PKCS#
11 will
1486 To build BIND with native PKCS#
11, configure as follows:
1488 <pre class=
"screen">
1489 $
<strong class=
"userinput"><code>cd bind9
</code></strong>
1490 $
<strong class=
"userinput"><code>./configure --enable-native-pkcs11 \
1491 --with-pkcs11=
<em class=
"replaceable"><code>provider-library-path
</code></em></code></strong>
1494 This will cause all BIND tools, including
<span><strong class=
"command">named
</strong></span>
1495 and the
<span><strong class=
"command">dnssec-*
</strong></span> and
<span><strong class=
"command">pkcs11-*
</strong></span>
1496 tools, to use the PKCS#
11 provider library specified in
1497 <em class=
"replaceable"><code>provider-library-path
</code></em> for cryptography.
1498 (The provider library path can be overridden using the
1499 <code class=
"option">-E
</code> in
<span><strong class=
"command">named
</strong></span> and the
1500 <span><strong class=
"command">dnssec-*
</strong></span> tools, or the
<code class=
"option">-m
</code> in
1501 the
<span><strong class=
"command">pkcs11-*
</strong></span> tools.)
1503 <div class=
"sect3" lang=
"en">
1504 <div class=
"titlepage"><div><div><h4 class=
"title">
1505 <a name=
"id2610983"></a>Building SoftHSMv2
</h4></div></div></div>
1507 SoftHSMv2, the latest development version of SoftHSM, is available
1509 <a href=
"https://github.com/opendnssec/SoftHSMv2" target=
"_top">
1510 https://github.com/opendnssec/SoftHSMv2
1512 It is a software library developed by the OpenDNSSEC project
1513 (
<a href=
"http://www.opendnssec.org" target=
"_top">
1514 http://www.opendnssec.org
1516 which provides a PKCS#
11 interface to a virtual HSM, implemented in
1517 the form of a SQLite3 database on the local filesystem. It provides
1518 less security than a true HSM, but it allows you to experiment with
1519 native PKCS#
11 when an HSM is not available. SoftHSMv2 can be
1520 configured to use either OpenSSL or the Botan library to perform
1521 cryptographic functions, but when using it for native PKCS#
11 in
1522 BIND, OpenSSL is required.
1525 By default, the SoftHSMv2 configuration file is
1526 <em class=
"replaceable"><code>prefix
</code></em>/etc/softhsm2.conf (where
1527 <em class=
"replaceable"><code>prefix
</code></em> is configured at compile time).
1528 This location can be overridden by the SOFTHSM2_CONF environment
1529 variable. The SoftHSMv2 cryptographic store must be installed and
1530 initialized before using it with BIND.
1532 <pre class=
"screen">
1533 $
<strong class=
"userinput"><code> cd SoftHSMv2
</code></strong>
1534 $
<strong class=
"userinput"><code> configure --with-crypto-backend=openssl --prefix=/opt/pkcs11/usr --enable-gost
</code></strong>
1535 $
<strong class=
"userinput"><code> make
</code></strong>
1536 $
<strong class=
"userinput"><code> make install
</code></strong>
1537 $
<strong class=
"userinput"><code> /opt/pkcs11/usr/bin/softhsm-util --init-token
0 --slot
0 --label softhsmv2
</code></strong>
1541 <div class=
"sect2" lang=
"en">
1542 <div class=
"titlepage"><div><div><h3 class=
"title">
1543 <a name=
"id2611390"></a>OpenSSL-based PKCS#
11</h3></div></div></div>
1545 OpenSSL-based PKCS#
11 mode uses a modified version of the
1546 OpenSSL library; stock OpenSSL does not fully support PKCS#
11.
1547 ISC provides a patch to OpenSSL to correct this. This patch is
1548 based on work originally done by the OpenSolaris project; it has been
1549 modified by ISC to provide new features such as PIN management and
1553 There are two
"flavors" of PKCS#
11 support provided by
1554 the patched OpenSSL, one of which must be chosen at
1555 configuration time. The correct choice depends on the HSM
1558 <div class=
"itemizedlist"><ul type=
"disc">
1560 Use 'crypto-accelerator' with HSMs that have hardware
1561 cryptographic acceleration features, such as the SCA
6000
1562 board. This causes OpenSSL to run all supported
1563 cryptographic operations in the HSM.
1566 Use 'sign-only' with HSMs that are designed to
1567 function primarily as secure key storage devices, but lack
1568 hardware acceleration. These devices are highly secure, but
1569 are not necessarily any faster at cryptography than the
1570 system CPU
— often, they are slower. It is therefore
1571 most efficient to use them only for those cryptographic
1572 functions that require access to the secured private key,
1573 such as zone signing, and to use the system CPU for all
1574 other computationally-intensive operations. The AEP Keyper
1575 is an example of such a device.
1579 The modified OpenSSL code is included in the BIND
9 release,
1580 in the form of a context diff against the latest versions of
1581 OpenSSL. OpenSSL
0.9.8,
1.0.0, and
1.0.1 are supported; there are
1582 separate diffs for each version. In the examples to follow,
1583 we use OpenSSL
0.9.8, but the same methods work with OpenSSL
1586 <div class=
"note" style=
"margin-left: 0.5in; margin-right: 0.5in;">
1587 <h3 class=
"title">Note
</h3>
1588 The latest OpenSSL versions as of this writing (January
2015)
1589 are
0.9.8zc,
1.0.0o, and
1.0.1j.
1590 ISC will provide updated patches as new versions of OpenSSL
1591 are released. The version number in the following examples
1592 is expected to change.
1595 Before building BIND
9 with PKCS#
11 support, it will be
1596 necessary to build OpenSSL with the patch in place, and configure
1597 it with the path to your HSM's PKCS#
11 provider library.
1599 <div class=
"sect3" lang=
"en">
1600 <div class=
"titlepage"><div><div><h4 class=
"title">
1601 <a name=
"id2611564"></a>Patching OpenSSL
</h4></div></div></div>
1602 <pre class=
"screen">
1603 $
<strong class=
"userinput"><code>wget
<a href=
"" target=
"_top">http://www.openssl.org/source/openssl-
0.9.8zc.tar.gz
</a></code></strong>
1605 <p>Extract the tarball:
</p>
1606 <pre class=
"screen">
1607 $
<strong class=
"userinput"><code>tar zxf openssl-
0.9.8zc.tar.gz
</code></strong>
1609 <p>Apply the patch from the BIND
9 release:
</p>
1610 <pre class=
"screen">
1611 $
<strong class=
"userinput"><code>patch -p1 -d openssl-
0.9.8zc \
1612 < bind9/bin/pkcs11/openssl-
0.9.8zc-patch
</code></strong>
1614 <div class=
"note" style=
"margin-left: 0.5in; margin-right: 0.5in;">
1615 <h3 class=
"title">Note
</h3>
1616 Note that the patch file may not be compatible with the
1617 "patch" utility on all operating systems. You may need to
1621 When building OpenSSL, place it in a non-standard
1622 location so that it does not interfere with OpenSSL libraries
1623 elsewhere on the system. In the following examples, we choose
1624 to install into
"/opt/pkcs11/usr". We will use this location
1625 when we configure BIND
9.
1628 Later, when building BIND
9, the location of the custom-built
1629 OpenSSL library will need to be specified via configure.
1632 <div class=
"sect3" lang=
"en">
1633 <div class=
"titlepage"><div><div><h4 class=
"title">
1634 <a name=
"id2611760"></a>Building OpenSSL for the AEP Keyper on Linux
</h4></div></div></div>
1636 The AEP Keyper is a highly secure key storage device,
1637 but does not provide hardware cryptographic acceleration. It
1638 can carry out cryptographic operations, but it is probably
1639 slower than your system's CPU. Therefore, we choose the
1640 'sign-only' flavor when building OpenSSL.
1643 The Keyper-specific PKCS#
11 provider library is
1644 delivered with the Keyper software. In this example, we place
1645 it /opt/pkcs11/usr/lib:
1647 <pre class=
"screen">
1648 $
<strong class=
"userinput"><code>cp pkcs11.GCC4.0
.2.so
.4.05 /opt/pkcs11/usr/lib/libpkcs11.so
</code></strong>
1651 This library is only available for Linux as a
32-bit
1652 binary. If we are compiling on a
64-bit Linux system, it is
1653 necessary to force a
32-bit build, by specifying -m32 in the
1657 Finally, the Keyper library requires threads, so we
1658 must specify -pthread.
1660 <pre class=
"screen">
1661 $
<strong class=
"userinput"><code>cd openssl-
0.9.8zc
</code></strong>
1662 $
<strong class=
"userinput"><code>./Configure linux-generic32 -m32 -pthread \
1663 --pk11-libname=/opt/pkcs11/usr/lib/libpkcs11.so \
1664 --pk11-flavor=sign-only \
1665 --prefix=/opt/pkcs11/usr
</code></strong>
1668 After configuring, run
"<span><strong class="command
">make</strong></span>"
1669 and
"<span><strong class="command
">make test</strong></span>". If
"<span><strong class="command
">make
1670 test</strong></span>" fails with
"pthread_atfork() not found", you forgot to
1671 add the -pthread above.
1674 <div class=
"sect3" lang=
"en">
1675 <div class=
"titlepage"><div><div><h4 class=
"title">
1676 <a name=
"id2611829"></a>Building OpenSSL for the SCA
6000 on Solaris
</h4></div></div></div>
1678 The SCA-
6000 PKCS#
11 provider is installed as a system
1679 library, libpkcs11. It is a true crypto accelerator, up to
4
1680 times faster than any CPU, so the flavor shall be
1681 'crypto-accelerator'.
1684 In this example, we are building on Solaris x86 on an
1687 <pre class=
"screen">
1688 $
<strong class=
"userinput"><code>cd openssl-
0.9.8zc
</code></strong>
1689 $
<strong class=
"userinput"><code>./Configure solaris64-x86_64-cc \
1690 --pk11-libname=/usr/lib/
64/libpkcs11.so \
1691 --pk11-flavor=crypto-accelerator \
1692 --prefix=/opt/pkcs11/usr
</code></strong>
1695 (For a
32-bit build, use
"solaris-x86-cc" and /usr/lib/libpkcs11.so.)
1698 After configuring, run
1699 <span><strong class=
"command">make
</strong></span> and
1700 <span><strong class=
"command">make test
</strong></span>.
1703 <div class=
"sect3" lang=
"en">
1704 <div class=
"titlepage"><div><div><h4 class=
"title">
1705 <a name=
"id2611878"></a>Building OpenSSL for SoftHSM
</h4></div></div></div>
1707 SoftHSM (version
1) is a software library developed by the
1709 (
<a href=
"http://www.opendnssec.org" target=
"_top">
1710 http://www.opendnssec.org
1713 PKCS#
11 interface to a virtual HSM, implemented in the form of
1714 a SQLite3 database on the local filesystem. SoftHSM uses
1715 the Botan library to perform cryptographic functions. Though
1716 less secure than a true HSM, it can allow you to experiment
1717 with PKCS#
11 when an HSM is not available.
1720 The SoftHSM cryptographic store must be installed and
1721 initialized before using it with OpenSSL, and the SOFTHSM_CONF
1722 environment variable must always point to the SoftHSM configuration
1725 <pre class=
"screen">
1726 $
<strong class=
"userinput"><code> cd softhsm-
1.3.7 </code></strong>
1727 $
<strong class=
"userinput"><code> configure --prefix=/opt/pkcs11/usr
</code></strong>
1728 $
<strong class=
"userinput"><code> make
</code></strong>
1729 $
<strong class=
"userinput"><code> make install
</code></strong>
1730 $
<strong class=
"userinput"><code> export SOFTHSM_CONF=/opt/pkcs11/softhsm.conf
</code></strong>
1731 $
<strong class=
"userinput"><code> echo
"0:/opt/pkcs11/softhsm.db" > $SOFTHSM_CONF
</code></strong>
1732 $
<strong class=
"userinput"><code> /opt/pkcs11/usr/bin/softhsm --init-token
0 --slot
0 --label softhsm
</code></strong>
1735 SoftHSM can perform all cryptographic operations, but
1736 since it only uses your system CPU, there is no advantage to using
1737 it for anything but signing. Therefore, we choose the 'sign-only'
1738 flavor when building OpenSSL.
1740 <pre class=
"screen">
1741 $
<strong class=
"userinput"><code>cd openssl-
0.9.8zc
</code></strong>
1742 $
<strong class=
"userinput"><code>./Configure linux-x86_64 -pthread \
1743 --pk11-libname=/opt/pkcs11/usr/lib/libsofthsm.so \
1744 --pk11-flavor=sign-only \
1745 --prefix=/opt/pkcs11/usr
</code></strong>
1748 After configuring, run
"<span><strong class="command
">make</strong></span>"
1749 and
"<span><strong class="command
">make test</strong></span>".
1753 Once you have built OpenSSL, run
1754 "<span><strong class="command
">apps/openssl engine pkcs11</strong></span>" to confirm
1755 that PKCS#
11 support was compiled in correctly. The output
1756 should be one of the following lines, depending on the flavor
1759 <pre class=
"screen">
1760 (pkcs11) PKCS #
11 engine support (sign only)
1763 <pre class=
"screen">
1764 (pkcs11) PKCS #
11 engine support (crypto accelerator)
1768 "<span><strong class="command
">apps/openssl engine pkcs11 -t</strong></span>". This will
1769 attempt to initialize the PKCS#
11 engine. If it is able to
1770 do so successfully, it will report
1771 “<span class=
"quote"><code class=
"literal">[ available ]
</code></span>”.
1774 If the output is correct, run
1775 "<span><strong class="command
">make install</strong></span>" which will install the
1776 modified OpenSSL suite to
<code class=
"filename">/opt/pkcs11/usr
</code>.
1778 <div class=
"sect3" lang=
"en">
1779 <div class=
"titlepage"><div><div><h4 class=
"title">
1780 <a name=
"id2638385"></a>Configuring BIND
9 for Linux with the AEP Keyper
</h4></div></div></div>
1782 To link with the PKCS#
11 provider, threads must be
1783 enabled in the BIND
9 build.
1786 The PKCS#
11 library for the AEP Keyper is currently
1787 only available as a
32-bit binary. If we are building on a
1788 64-bit host, we must force a
32-bit build by adding
"-m32" to
1789 the CC options on the
"configure" command line.
1791 <pre class=
"screen">
1792 $
<strong class=
"userinput"><code>cd ../bind9
</code></strong>
1793 $
<strong class=
"userinput"><code>./configure
CC=
"gcc -m32" --enable-threads \
1794 --with-openssl=/opt/pkcs11/usr \
1795 --with-pkcs11=/opt/pkcs11/usr/lib/libpkcs11.so
</code></strong>
1798 <div class=
"sect3" lang=
"en">
1799 <div class=
"titlepage"><div><div><h4 class=
"title">
1800 <a name=
"id2638417"></a>Configuring BIND
9 for Solaris with the SCA
6000</h4></div></div></div>
1802 To link with the PKCS#
11 provider, threads must be
1803 enabled in the BIND
9 build.
1805 <pre class=
"screen">
1806 $
<strong class=
"userinput"><code>cd ../bind9
</code></strong>
1807 $
<strong class=
"userinput"><code>./configure
CC=
"cc -xarch=amd64" --enable-threads \
1808 --with-openssl=/opt/pkcs11/usr \
1809 --with-pkcs11=/usr/lib/
64/libpkcs11.so
</code></strong>
1811 <p>(For a
32-bit build, omit
CC=
"cc -xarch=amd64".)
</p>
1813 If configure complains about OpenSSL not working, you
1814 may have a
32/
64-bit architecture mismatch. Or, you may have
1815 incorrectly specified the path to OpenSSL (it should be the
1816 same as the --prefix argument to the OpenSSL
1820 <div class=
"sect3" lang=
"en">
1821 <div class=
"titlepage"><div><div><h4 class=
"title">
1822 <a name=
"id2638521"></a>Configuring BIND
9 for SoftHSM
</h4></div></div></div>
1823 <pre class=
"screen">
1824 $
<strong class=
"userinput"><code>cd ../bind9
</code></strong>
1825 $
<strong class=
"userinput"><code>./configure --enable-threads \
1826 --with-openssl=/opt/pkcs11/usr \
1827 --with-pkcs11=/opt/pkcs11/usr/lib/libsofthsm.so
</code></strong>
1831 After configuring, run
1832 "<span><strong class="command
">make</strong></span>",
1833 "<span><strong class="command
">make test</strong></span>" and
1834 "<span><strong class="command
">make install</strong></span>".
1837 (Note: If
"make test" fails in the
"pkcs11" system test, you may
1838 have forgotten to set the SOFTHSM_CONF environment variable.)
1841 <div class=
"sect2" lang=
"en">
1842 <div class=
"titlepage"><div><div><h3 class=
"title">
1843 <a name=
"id2638570"></a>PKCS#
11 Tools
</h3></div></div></div>
1845 BIND
9 includes a minimal set of tools to operate the
1847 <span><strong class=
"command">pkcs11-keygen
</strong></span> to generate a new key pair
1849 <span><strong class=
"command">pkcs11-list
</strong></span> to list objects currently
1851 <span><strong class=
"command">pkcs11-destroy
</strong></span> to remove objects, and
1852 <span><strong class=
"command">pkcs11-tokens
</strong></span> to list available tokens.
1855 In UNIX/Linux builds, these tools are built only if BIND
1856 9 is configured with the --with-pkcs11 option. (Note: If
1857 --with-pkcs11 is set to
"yes", rather than to the path of the
1858 PKCS#
11 provider, then the tools will be built but the
1859 provider will be left undefined. Use the -m option or the
1860 PKCS11_PROVIDER environment variable to specify the path to the
1864 <div class=
"sect2" lang=
"en">
1865 <div class=
"titlepage"><div><div><h3 class=
"title">
1866 <a name=
"id2638606"></a>Using the HSM
</h3></div></div></div>
1868 For OpenSSL-based PKCS#
11, we must first set up the runtime
1869 environment so the OpenSSL and PKCS#
11 libraries can be loaded:
1871 <pre class=
"screen">
1872 $
<strong class=
"userinput"><code>export LD_LIBRARY_PATH=/opt/pkcs11/usr/lib:${LD_LIBRARY_PATH}
</code></strong>
1875 This causes
<span><strong class=
"command">named
</strong></span> and other binaries to load
1876 the OpenSSL library from
<code class=
"filename">/opt/pkcs11/usr/lib
</code>
1877 rather than from the default location. This step is not necessary
1878 when using native PKCS#
11.
1881 Some HSMs require other environment variables to be set.
1882 For example, when operating an AEP Keyper, it is necessary to
1883 specify the location of the
"machine" file, which stores
1884 information about the Keyper for use by the provider
1885 library. If the machine file is in
1886 <code class=
"filename">/opt/Keyper/PKCS11Provider/machine
</code>,
1889 <pre class=
"screen">
1890 $
<strong class=
"userinput"><code>export KEYPER_LIBRARY_PATH=/opt/Keyper/PKCS11Provider
</code></strong>
1893 Such environment variables must be set whenever running
1894 any tool that uses the HSM, including
1895 <span><strong class=
"command">pkcs11-keygen
</strong></span>,
1896 <span><strong class=
"command">pkcs11-list
</strong></span>,
1897 <span><strong class=
"command">pkcs11-destroy
</strong></span>,
1898 <span><strong class=
"command">dnssec-keyfromlabel
</strong></span>,
1899 <span><strong class=
"command">dnssec-signzone
</strong></span>,
1900 <span><strong class=
"command">dnssec-keygen
</strong></span>, and
1901 <span><strong class=
"command">named
</strong></span>.
1904 We can now create and use keys in the HSM. In this case,
1905 we will create a
2048 bit key and give it the label
1908 <pre class=
"screen">
1909 $
<strong class=
"userinput"><code>pkcs11-keygen -b
2048 -l sample-ksk
</code></strong>
1911 <p>To confirm that the key exists:
</p>
1912 <pre class=
"screen">
1913 $
<strong class=
"userinput"><code>pkcs11-list
</code></strong>
1915 object[
0]: handle
2147483658 class
3 label[
8] 'sample-ksk' id[
0]
1916 object[
1]: handle
2147483657 class
2 label[
8] 'sample-ksk' id[
0]
1919 Before using this key to sign a zone, we must create a
1920 pair of BIND
9 key files. The
"dnssec-keyfromlabel" utility
1921 does this. In this case, we will be using the HSM key
1922 "sample-ksk" as the key-signing key for
"example.net":
1924 <pre class=
"screen">
1925 $
<strong class=
"userinput"><code>dnssec-keyfromlabel -l sample-ksk -f KSK example.net
</code></strong>
1928 The resulting K*.key and K*.private files can now be used
1929 to sign the zone. Unlike normal K* files, which contain both
1930 public and private key data, these files will contain only the
1931 public key data, plus an identifier for the private key which
1932 remains stored within the HSM. Signing with the private key takes
1933 place inside the HSM.
1936 If you wish to generate a second key in the HSM for use
1937 as a zone-signing key, follow the same procedure above, using a
1938 different keylabel, a smaller key size, and omitting
"-f KSK"
1939 from the dnssec-keyfromlabel arguments:
1942 (Note: When using OpenSSL-based PKCS#
11 the label is an arbitrary
1943 string which identifies the key. With native PKCS#
11, the label is
1944 a PKCS#
11 URI string which may include other details about the key
1945 and the HSM, including its PIN. See
1946 <a href=
"man.dnssec-keyfromlabel.html" title=
"dnssec-keyfromlabel"><span class=
"refentrytitle"><span class=
"application">dnssec-keyfromlabel
</span></span>(
8)
</a> for details.)
1948 <pre class=
"screen">
1949 $
<strong class=
"userinput"><code>pkcs11-keygen -b
1024 -l sample-zsk
</code></strong>
1950 $
<strong class=
"userinput"><code>dnssec-keyfromlabel -l sample-zsk example.net
</code></strong>
1953 Alternatively, you may prefer to generate a conventional
1954 on-disk key, using dnssec-keygen:
1956 <pre class=
"screen">
1957 $
<strong class=
"userinput"><code>dnssec-keygen example.net
</code></strong>
1960 This provides less security than an HSM key, but since
1961 HSMs can be slow or cumbersome to use for security reasons, it
1962 may be more efficient to reserve HSM keys for use in the less
1963 frequent key-signing operation. The zone-signing key can be
1964 rolled more frequently, if you wish, to compensate for a
1965 reduction in key security. (Note: When using native PKCS#
11,
1966 there is no speed advantage to using on-disk keys, as cryptographic
1967 operations will be done by the HSM regardless.)
1970 Now you can sign the zone. (Note: If not using the -S
1971 option to
<span><strong class=
"command">dnssec-signzone
</strong></span>, it will be
1972 necessary to add the contents of both
<code class=
"filename">K*.key
</code>
1973 files to the zone master file before signing it.)
1975 <pre class=
"screen">
1976 $
<strong class=
"userinput"><code>dnssec-signzone -S example.net
</code></strong>
1978 Verifying the zone using the following algorithms:
1980 Zone signing complete:
1981 Algorithm: NSEC3RSASHA1: ZSKs:
1, KSKs:
1 active,
0 revoked,
0 stand-by
1985 <div class=
"sect2" lang=
"en">
1986 <div class=
"titlepage"><div><div><h3 class=
"title">
1987 <a name=
"id2638892"></a>Specifying the engine on the command line
</h3></div></div></div>
1989 When using OpenSSL-based PKCS#
11, the
"engine" to be used by
1990 OpenSSL can be specified in
<span><strong class=
"command">named
</strong></span> and all of
1991 the BIND
<span><strong class=
"command">dnssec-*
</strong></span> tools by using the
"-E
1992 <engine>" command line option. If BIND
9 is built with
1993 the --with-pkcs11 option, this option defaults to
"pkcs11".
1994 Specifying the engine will generally not be necessary unless
1995 for some reason you wish to use a different OpenSSL
1999 If you wish to disable use of the
"pkcs11" engine
—
2000 for troubleshooting purposes, or because the HSM is unavailable
2001 — set the engine to the empty string. For example:
2003 <pre class=
"screen">
2004 $
<strong class=
"userinput"><code>dnssec-signzone -E '' -S example.net
</code></strong>
2008 <span><strong class=
"command">dnssec-signzone
</strong></span> to run as if it were compiled
2009 without the --with-pkcs11 option.
2012 When built with native PKCS#
11 mode, the
"engine" option has a
2013 different meaning: it specifies the path to the PKCS#
11 provider
2014 library. This may be useful when testing a new provider library.
2017 <div class=
"sect2" lang=
"en">
2018 <div class=
"titlepage"><div><div><h3 class=
"title">
2019 <a name=
"id2639009"></a>Running named with automatic zone re-signing
</h3></div></div></div>
2021 If you want
<span><strong class=
"command">named
</strong></span> to dynamically re-sign zones
2022 using HSM keys, and/or to to sign new records inserted via nsupdate,
2023 then named must have access to the HSM PIN. In OpenSSL-based PKCS#
11,
2024 this is accomplished by placing the PIN into the openssl.cnf file
2025 (in the above examples,
2026 <code class=
"filename">/opt/pkcs11/usr/ssl/openssl.cnf
</code>).
2029 The location of the openssl.cnf file can be overridden by
2030 setting the OPENSSL_CONF environment variable before running
2033 <p>Sample openssl.cnf:
</p>
2034 <pre class=
"programlisting">
2035 openssl_conf = openssl_def
2037 engines = engine_section
2039 pkcs11 = pkcs11_section
2041 PIN =
<em class=
"replaceable"><code><PLACE PIN HERE
></code></em>
2044 This will also allow the dnssec-* tools to access the HSM
2045 without PIN entry. (The pkcs11-* tools access the HSM directly,
2046 not via OpenSSL, so a PIN will still be required to use
2050 In native PKCS#
11 mode, the PIN can be provided in a file specified
2051 as an attribute of the key's label. For example, if a key had the label
2052 <strong class=
"userinput"><code>pkcs11:object=local-zsk;pin-source=/etc/hsmpin
</code></strong>,
2053 then the PIN would be read from the file
2054 <code class=
"filename">/etc/hsmpin
</code>.
2056 <div class=
"warning" style=
"margin-left: 0.5in; margin-right: 0.5in;">
2057 <h3 class=
"title">Warning
</h3>
2059 Placing the HSM's PIN in a text file in this manner may reduce the
2060 security advantage of using an HSM. Be sure this is what you want to
2061 do before configuring the system in this way.
2066 <div class=
"sect1" lang=
"en">
2067 <div class=
"titlepage"><div><div><h2 class=
"title" style=
"clear: both">
2068 <a name=
"dlz-info"></a>DLZ (Dynamically Loadable Zones)
</h2></div></div></div>
2070 DLZ (Dynamically Loadable Zones) is an extension to BIND
9 that allows
2071 zone data to be retrieved directly from an external database. There is
2072 no required format or schema. DLZ drivers exist for several different
2073 database backends including PostgreSQL, MySQL, and LDAP and can be
2074 written for any other.
2077 Historically, DLZ drivers had to be statically linked with the named
2078 binary and were turned on via a configure option at compile time (for
2079 example,
<strong class=
"userinput"><code>"configure --with-dlz-ldap"</code></strong>).
2080 Currently, the drivers provided in the BIND
9 tarball in
2081 <code class=
"filename">contrib/dlz/drivers
</code> are still linked this
2085 In BIND
9.8 and higher, it is possible to link some DLZ modules
2086 dynamically at runtime, via the DLZ
"dlopen" driver, which acts as a
2087 generic wrapper around a shared object implementing the DLZ API. The
2088 "dlopen" driver is linked into named by default, so configure options
2089 are no longer necessary when using these dynamically linkable drivers,
2090 but are still needed for the older drivers in
2091 <code class=
"filename">contrib/dlz/drivers
</code>.
2094 When the DLZ module provides data to named, it does so in text format.
2095 The response is converted to DNS wire format by named. This
2096 conversion, and the lack of any internal caching, places significant
2097 limits on the query performance of DLZ modules. Consequently, DLZ is
2098 not recommended for use on high-volume servers. However, it can be
2099 used in a hidden master configuration, with slaves retrieving zone
2100 updates via AXFR. (Note, however, that DLZ has no built-in support for
2101 DNS notify; slaves are not automatically informed of changes to the
2102 zones in the database.)
2104 <div class=
"sect2" lang=
"en">
2105 <div class=
"titlepage"><div><div><h3 class=
"title">
2106 <a name=
"id2639074"></a>Configuring DLZ
</h3></div></div></div>
2108 A DLZ database is configured with a
<span><strong class=
"command">dlz
</strong></span>
2109 statement in
<code class=
"filename">named.conf
</code>:
2111 <pre class=
"screen">
2113 database
"dlopen driver.so <code class="option
">args</code>";
2118 This specifies a DLZ module to search when answering queries; the
2119 module is implemented in
<code class=
"filename">driver.so
</code> and is
2120 loaded at runtime by the dlopen DLZ driver. Multiple
2121 <span><strong class=
"command">dlz
</strong></span> statements can be specified; when
2122 answering a query, all DLZ modules with
<code class=
"option">search
</code>
2123 set to
<code class=
"literal">yes
</code> will be queried to find out if
2124 they contain an answer for the query name; the best available
2125 answer will be returned to the client.
2128 The
<code class=
"option">search
</code> option in the above example can be
2129 omitted, because
<code class=
"literal">yes
</code> is the default value.
2132 If
<code class=
"option">search
</code> is set to
<code class=
"literal">no
</code>, then
2133 this DLZ module is
<span class=
"emphasis"><em>not
</em></span> searched for the best
2134 match when a query is received. Instead, zones in this DLZ must be
2135 separately specified in a zone statement. This allows you to
2136 configure a zone normally using standard zone option semantics,
2137 but specify a different database back-end for storage of the
2138 zone's data. For example, to implement NXDOMAIN redirection using
2139 a DLZ module for back-end storage of redirection rules:
2141 <pre class=
"screen">
2143 database
"dlopen driver.so <code class="option
">args</code>";
2153 <div class=
"sect2" lang=
"en">
2154 <div class=
"titlepage"><div><div><h3 class=
"title">
2155 <a name=
"id2611909"></a>Sample DLZ Driver
</h3></div></div></div>
2157 For guidance in implementation of DLZ modules, the directory
2158 <code class=
"filename">contrib/dlz/example
</code> contains a basic
2159 dynamically-linkable DLZ module--i.e., one which can be
2160 loaded at runtime by the
"dlopen" DLZ driver.
2161 The example sets up a single zone, whose name is passed
2162 to the module as an argument in the
<span><strong class=
"command">dlz
</strong></span>
2165 <pre class=
"screen">
2167 database
"dlopen driver.so example.nil";
2171 In the above example, the module is configured to create a zone
2172 "example.nil", which can answer queries and AXFR requests, and
2173 accept DDNS updates. At runtime, prior to any updates, the zone
2174 contains an SOA, NS, and a single A record at the apex:
2176 <pre class=
"screen">
2177 example.nil.
3600 IN SOA example.nil. hostmaster.example.nil. (
2178 123 900 600 86400 3600
2180 example.nil.
3600 IN NS example.nil.
2181 example.nil.
1800 IN A
10.53.0.1
2184 The sample driver is capable of retrieving information about the
2185 querying client, and altering its response on the basis of this
2186 information. To demonstrate this feature, the example driver
2187 responds to queries for
"source-addr.<code class="option
">zonename</code>>/TXT"
2188 with the source address of the query. Note, however, that this
2189 record will *not* be included in AXFR or ANY responses. Normally,
2190 this feature would be used to alter responses in some other fashion,
2191 e.g., by providing different address records for a particular name
2192 depending on the network from which the query arrived.
2195 Documentation of the DLZ module API can be found in
2196 <code class=
"filename">contrib/dlz/example/README
</code>. This directory also
2197 contains the header file
<code class=
"filename">dlz_minimal.h
</code>, which
2198 defines the API and should be included by any dynamically-linkable
2203 <div class=
"sect1" lang=
"en">
2204 <div class=
"titlepage"><div><div><h2 class=
"title" style=
"clear: both">
2205 <a name=
"id2571523"></a>IPv6 Support in
<acronym class=
"acronym">BIND
</acronym> 9</h2></div></div></div>
2207 <acronym class=
"acronym">BIND
</acronym> 9 fully supports all currently
2208 defined forms of IPv6 name to address and address to name
2209 lookups. It will also use IPv6 addresses to make queries when
2210 running on an IPv6 capable system.
2213 For forward lookups,
<acronym class=
"acronym">BIND
</acronym> 9 supports
2214 only AAAA records. RFC
3363 deprecated the use of A6 records,
2215 and client-side support for A6 records was accordingly removed
2216 from
<acronym class=
"acronym">BIND
</acronym> 9.
2217 However, authoritative
<acronym class=
"acronym">BIND
</acronym> 9 name servers still
2218 load zone files containing A6 records correctly, answer queries
2219 for A6 records, and accept zone transfer for a zone containing A6
2223 For IPv6 reverse lookups,
<acronym class=
"acronym">BIND
</acronym> 9 supports
2224 the traditional
"nibble" format used in the
2225 <span class=
"emphasis"><em>ip6.arpa
</em></span> domain, as well as the older, deprecated
2226 <span class=
"emphasis"><em>ip6.int
</em></span> domain.
2227 Older versions of
<acronym class=
"acronym">BIND
</acronym> 9
2228 supported the
"binary label" (also known as
"bitstring") format,
2229 but support of binary labels has been completely removed per
2231 Many applications in
<acronym class=
"acronym">BIND
</acronym> 9 do not understand
2232 the binary label format at all any more, and will return an
2234 In particular, an authoritative
<acronym class=
"acronym">BIND
</acronym> 9
2235 name server will not load a zone file containing binary labels.
2238 For an overview of the format and structure of IPv6 addresses,
2239 see
<a href=
"Bv9ARM.ch11.html#ipv6addresses" title=
"IPv6 addresses (AAAA)">the section called
“IPv6 addresses (AAAA)
”</a>.
2241 <div class=
"sect2" lang=
"en">
2242 <div class=
"titlepage"><div><div><h3 class=
"title">
2243 <a name=
"id2571789"></a>Address Lookups Using AAAA Records
</h3></div></div></div>
2245 The IPv6 AAAA record is a parallel to the IPv4 A record,
2246 and, unlike the deprecated A6 record, specifies the entire
2247 IPv6 address in a single record. For example,
2249 <pre class=
"programlisting">
2250 $ORIGIN example.com.
2251 host
3600 IN AAAA
2001:db8::
1
2254 Use of IPv4-in-IPv6 mapped addresses is not recommended.
2255 If a host has an IPv4 address, use an A record, not
2256 a AAAA, with
<code class=
"literal">::ffff:
192.168.42.1</code> as
2260 <div class=
"sect2" lang=
"en">
2261 <div class=
"titlepage"><div><div><h3 class=
"title">
2262 <a name=
"id2571811"></a>Address to Name Lookups Using Nibble Format
</h3></div></div></div>
2264 When looking up an address in nibble format, the address
2265 components are simply reversed, just as in IPv4, and
2266 <code class=
"literal">ip6.arpa.
</code> is appended to the
2268 For example, the following would provide reverse name lookup for
2270 <code class=
"literal">2001:db8::
1</code>.
2272 <pre class=
"programlisting">
2273 $ORIGIN
0.0.0.0.0.0.0.0.8.b.d
.0.1.0.0.2.ip6.arpa.
2274 1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0 14400 IN PTR (
2280 <div class=
"navfooter">
2282 <table width=
"100%" summary=
"Navigation footer">
2284 <td width=
"40%" align=
"left">
2285 <a accesskey=
"p" href=
"Bv9ARM.ch03.html">Prev
</a> </td>
2286 <td width=
"20%" align=
"center"> </td>
2287 <td width=
"40%" align=
"right"> <a accesskey=
"n" href=
"Bv9ARM.ch05.html">Next
</a>
2291 <td width=
"40%" align=
"left" valign=
"top">Chapter
3. Name Server Configuration
</td>
2292 <td width=
"20%" align=
"center"><a accesskey=
"h" href=
"Bv9ARM.html">Home
</a></td>
2293 <td width=
"40%" align=
"right" valign=
"top"> Chapter
5. The
<acronym class=
"acronym">BIND
</acronym> 9 Lightweight Resolver
</td>
2297 <p style=
"text-align: center;">BIND
9.10.2-P4
</p>