2 - Copyright (C) 2004-2009 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.103 2009/11/11 01:14:42 tbox 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#id2570568">Split DNS
</a></span></dt>
53 <dd><dl><dt><span class=
"sect2"><a href=
"Bv9ARM.ch04.html#id2570654">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#id2571088">Generate Shared Keys for Each Pair of Hosts
</a></span></dt>
57 <dt><span class=
"sect2"><a href=
"Bv9ARM.ch04.html#id2571229">Copying the Shared Secret to Both Machines
</a></span></dt>
58 <dt><span class=
"sect2"><a href=
"Bv9ARM.ch04.html#id2571240">Informing the Servers of the Key's Existence
</a></span></dt>
59 <dt><span class=
"sect2"><a href=
"Bv9ARM.ch04.html#id2571345">Instructing the Server to Use the Key
</a></span></dt>
60 <dt><span class=
"sect2"><a href=
"Bv9ARM.ch04.html#id2571539">TSIG Key Based Access Control
</a></span></dt>
61 <dt><span class=
"sect2"><a href=
"Bv9ARM.ch04.html#id2571588">Errors
</a></span></dt>
63 <dt><span class=
"sect1"><a href=
"Bv9ARM.ch04.html#id2571602">TKEY
</a></span></dt>
64 <dt><span class=
"sect1"><a href=
"Bv9ARM.ch04.html#id2571651">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#id2571719">Generating Keys
</a></span></dt>
68 <dt><span class=
"sect2"><a href=
"Bv9ARM.ch04.html#id2571798">Signing the Zone
</a></span></dt>
69 <dt><span class=
"sect2"><a href=
"Bv9ARM.ch04.html#id2571879">Configuring Servers
</a></span></dt>
71 <dt><span class=
"sect1"><a href=
"Bv9ARM.ch04.html#id2572061">IPv6 Support in
<acronym class=
"acronym">BIND
</acronym> 9</a></span></dt>
73 <dt><span class=
"sect2"><a href=
"Bv9ARM.ch04.html#id2572328">Address Lookups Using AAAA Records
</a></span></dt>
74 <dt><span class=
"sect2"><a href=
"Bv9ARM.ch04.html#id2572349">Address to Name Lookups Using Nibble Format
</a></span></dt>
78 <div class=
"sect1" lang=
"en">
79 <div class=
"titlepage"><div><div><h2 class=
"title" style=
"clear: both">
80 <a name=
"notify"></a>Notify
</h2></div></div></div>
82 <acronym class=
"acronym">DNS
</acronym> NOTIFY is a mechanism that allows master
83 servers to notify their slave servers of changes to a zone's data. In
84 response to a
<span><strong class=
"command">NOTIFY
</strong></span> from a master server, the
85 slave will check to see that its version of the zone is the
86 current version and, if not, initiate a zone transfer.
89 For more information about
<acronym class=
"acronym">DNS
</acronym>
90 <span><strong class=
"command">NOTIFY
</strong></span>, see the description of the
91 <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
92 the description of the zone option
<span><strong class=
"command">also-notify
</strong></span> in
93 <a href=
"Bv9ARM.ch06.html#zone_transfers" title=
"Zone Transfers">the section called
“Zone Transfers
”</a>. The
<span><strong class=
"command">NOTIFY
</strong></span>
94 protocol is specified in RFC
1996.
96 <div class=
"note" style=
"margin-left: 0.5in; margin-right: 0.5in;">
97 <h3 class=
"title">Note
</h3>
98 As a slave zone can also be a master to other slaves,
<span><strong class=
"command">named
</strong></span>,
99 by default, sends
<span><strong class=
"command">NOTIFY
</strong></span> messages for every zone
100 it loads. Specifying
<span><strong class=
"command">notify master-only;
</strong></span> will
101 cause
<span><strong class=
"command">named
</strong></span> to only send
<span><strong class=
"command">NOTIFY
</strong></span> for master
105 <div class=
"sect1" lang=
"en">
106 <div class=
"titlepage"><div><div><h2 class=
"title" style=
"clear: both">
107 <a name=
"dynamic_update"></a>Dynamic Update
</h2></div></div></div>
109 Dynamic Update is a method for adding, replacing or deleting
110 records in a master server by sending it a special form of DNS
111 messages. The format and meaning of these messages is specified
115 Dynamic update is enabled by including an
116 <span><strong class=
"command">allow-update
</strong></span> or an
<span><strong class=
"command">update-policy
</strong></span>
117 clause in the
<span><strong class=
"command">zone
</strong></span> statement.
120 If the zone's
<span><strong class=
"command">update-policy
</strong></span> is set to
121 <strong class=
"userinput"><code>local
</code></strong>, updates to the zone
122 will be permitted for the key
<code class=
"varname">local-ddns
</code>,
123 which will be generated by
<span><strong class=
"command">named
</strong></span> at startup.
124 See
<a href=
"Bv9ARM.ch06.html#dynamic_update_policies" title=
"Dynamic Update Policies">the section called
“Dynamic Update Policies
”</a> for more details.
127 The
<span><strong class=
"command">tkey-gssapi-credential
</strong></span> and
128 <span><strong class=
"command">tkey-domain
</strong></span> clauses in the
129 <span><strong class=
"command">options
</strong></span> statement enable the
130 server to negotiate keys that can be matched against those
131 in
<span><strong class=
"command">update-policy
</strong></span> or
132 <span><strong class=
"command">allow-update
</strong></span>.
135 Updating of secure zones (zones using DNSSEC) follows RFC
136 3007: RRSIG, NSEC and NSEC3 records affected by updates are
137 automatically regenerated by the server using an online
138 zone key. Update authorization is based on transaction
139 signatures and an explicit server policy.
141 <div class=
"sect2" lang=
"en">
142 <div class=
"titlepage"><div><div><h3 class=
"title">
143 <a name=
"journal"></a>The journal file
</h3></div></div></div>
145 All changes made to a zone using dynamic update are stored
146 in the zone's journal file. This file is automatically created
147 by the server when the first dynamic update takes place.
148 The name of the journal file is formed by appending the extension
149 <code class=
"filename">.jnl
</code> to the name of the
151 file unless specifically overridden. The journal file is in a
152 binary format and should not be edited manually.
155 The server will also occasionally write (
"dump")
156 the complete contents of the updated zone to its zone file.
157 This is not done immediately after
158 each dynamic update, because that would be too slow when a large
159 zone is updated frequently. Instead, the dump is delayed by
160 up to
15 minutes, allowing additional updates to take place.
161 During the dump process, transient files will be created
162 with the extensions
<code class=
"filename">.jnw
</code> and
163 <code class=
"filename">.jbk
</code>; under ordinary circumstances, these
164 will be removed when the dump is complete, and can be safely
168 When a server is restarted after a shutdown or crash, it will replay
169 the journal file to incorporate into the zone any updates that
171 place after the last zone dump.
174 Changes that result from incoming incremental zone transfers are
176 journalled in a similar way.
179 The zone files of dynamic zones cannot normally be edited by
180 hand because they are not guaranteed to contain the most recent
181 dynamic changes
— those are only in the journal file.
182 The only way to ensure that the zone file of a dynamic zone
183 is up to date is to run
<span><strong class=
"command">rndc stop
</strong></span>.
186 If you have to make changes to a dynamic zone
187 manually, the following procedure will work: Disable dynamic updates
189 <span><strong class=
"command">rndc freeze
<em class=
"replaceable"><code>zone
</code></em></strong></span>.
190 This will also remove the zone's
<code class=
"filename">.jnl
</code> file
191 and update the master file. Edit the zone file. Run
192 <span><strong class=
"command">rndc thaw
<em class=
"replaceable"><code>zone
</code></em></strong></span>
193 to reload the changed zone and re-enable dynamic updates.
197 <div class=
"sect1" lang=
"en">
198 <div class=
"titlepage"><div><div><h2 class=
"title" style=
"clear: both">
199 <a name=
"incremental_zone_transfers"></a>Incremental Zone Transfers (IXFR)
</h2></div></div></div>
201 The incremental zone transfer (IXFR) protocol is a way for
202 slave servers to transfer only changed data, instead of having to
203 transfer the entire zone. The IXFR protocol is specified in RFC
204 1995. See
<a href=
"Bv9ARM.ch09.html#proposed_standards">Proposed Standards
</a>.
207 When acting as a master,
<acronym class=
"acronym">BIND
</acronym> 9
208 supports IXFR for those zones
209 where the necessary change history information is available. These
210 include master zones maintained by dynamic update and slave zones
211 whose data was obtained by IXFR. For manually maintained master
212 zones, and for slave zones obtained by performing a full zone
213 transfer (AXFR), IXFR is supported only if the option
214 <span><strong class=
"command">ixfr-from-differences
</strong></span> is set
215 to
<strong class=
"userinput"><code>yes
</code></strong>.
218 When acting as a slave,
<acronym class=
"acronym">BIND
</acronym> 9 will
219 attempt to use IXFR unless
220 it is explicitly disabled. For more information about disabling
221 IXFR, see the description of the
<span><strong class=
"command">request-ixfr
</strong></span> clause
222 of the
<span><strong class=
"command">server
</strong></span> statement.
225 <div class=
"sect1" lang=
"en">
226 <div class=
"titlepage"><div><div><h2 class=
"title" style=
"clear: both">
227 <a name=
"id2570568"></a>Split DNS
</h2></div></div></div>
229 Setting up different views, or visibility, of the DNS space to
230 internal and external resolvers is usually referred to as a
231 <span class=
"emphasis"><em>Split DNS
</em></span> setup. There are several
232 reasons an organization would want to set up its DNS this way.
235 One common reason for setting up a DNS system this way is
236 to hide
"internal" DNS information from
"external" clients on the
237 Internet. There is some debate as to whether or not this is actually
239 Internal DNS information leaks out in many ways (via email headers,
240 for example) and most savvy
"attackers" can find the information
241 they need using other means.
242 However, since listing addresses of internal servers that
243 external clients cannot possibly reach can result in
244 connection delays and other annoyances, an organization may
245 choose to use a Split DNS to present a consistent view of itself
246 to the outside world.
249 Another common reason for setting up a Split DNS system is
250 to allow internal networks that are behind filters or in RFC
1918
251 space (reserved IP space, as documented in RFC
1918) to resolve DNS
252 on the Internet. Split DNS can also be used to allow mail from outside
253 back in to the internal network.
255 <div class=
"sect2" lang=
"en">
256 <div class=
"titlepage"><div><div><h3 class=
"title">
257 <a name=
"id2570654"></a>Example split DNS setup
</h3></div></div></div>
259 Let's say a company named
<span class=
"emphasis"><em>Example, Inc.
</em></span>
260 (
<code class=
"literal">example.com
</code>)
261 has several corporate sites that have an internal network with
263 Internet Protocol (IP) space and an external demilitarized zone (DMZ),
264 or
"outside" section of a network, that is available to the public.
267 <span class=
"emphasis"><em>Example, Inc.
</em></span> wants its internal clients
268 to be able to resolve external hostnames and to exchange mail with
269 people on the outside. The company also wants its internal resolvers
270 to have access to certain internal-only zones that are not available
271 at all outside of the internal network.
274 In order to accomplish this, the company will set up two sets
275 of name servers. One set will be on the inside network (in the
277 IP space) and the other set will be on bastion hosts, which are
279 hosts that can talk to both sides of its network, in the DMZ.
282 The internal servers will be configured to forward all queries,
283 except queries for
<code class=
"filename">site1.internal
</code>,
<code class=
"filename">site2.internal
</code>,
<code class=
"filename">site1.example.com
</code>,
284 and
<code class=
"filename">site2.example.com
</code>, to the servers
286 DMZ. These internal servers will have complete sets of information
287 for
<code class=
"filename">site1.example.com
</code>,
<code class=
"filename">site2.example.com
</code>,
<code class=
"filename">site1.internal
</code>,
288 and
<code class=
"filename">site2.internal
</code>.
291 To protect the
<code class=
"filename">site1.internal
</code> and
<code class=
"filename">site2.internal
</code> domains,
292 the internal name servers must be configured to disallow all queries
293 to these domains from any external hosts, including the bastion
297 The external servers, which are on the bastion hosts, will
298 be configured to serve the
"public" version of the
<code class=
"filename">site1
</code> and
<code class=
"filename">site2.example.com
</code> zones.
299 This could include things such as the host records for public servers
300 (
<code class=
"filename">www.example.com
</code> and
<code class=
"filename">ftp.example.com
</code>),
301 and mail exchange (MX) records (
<code class=
"filename">a.mx.example.com
</code> and
<code class=
"filename">b.mx.example.com
</code>).
304 In addition, the public
<code class=
"filename">site1
</code> and
<code class=
"filename">site2.example.com
</code> zones
305 should have special MX records that contain wildcard (`*') records
306 pointing to the bastion hosts. This is needed because external mail
307 servers do not have any other way of looking up how to deliver mail
308 to those internal hosts. With the wildcard records, the mail will
309 be delivered to the bastion host, which can then forward it on to
313 Here's an example of a wildcard MX record:
315 <pre class=
"programlisting">* IN MX
10 external1.example.com.
</pre>
317 Now that they accept mail on behalf of anything in the internal
318 network, the bastion hosts will need to know how to deliver mail
319 to internal hosts. In order for this to work properly, the resolvers
321 the bastion hosts will need to be configured to point to the internal
322 name servers for DNS resolution.
325 Queries for internal hostnames will be answered by the internal
326 servers, and queries for external hostnames will be forwarded back
327 out to the DNS servers on the bastion hosts.
330 In order for all this to work properly, internal clients will
331 need to be configured to query
<span class=
"emphasis"><em>only
</em></span> the internal
332 name servers for DNS queries. This could also be enforced via
334 filtering on the network.
337 If everything has been set properly,
<span class=
"emphasis"><em>Example, Inc.
</em></span>'s
338 internal clients will now be able to:
340 <div class=
"itemizedlist"><ul type=
"disc">
342 Look up any hostnames in the
<code class=
"literal">site1
</code>
344 <code class=
"literal">site2.example.com
</code> zones.
347 Look up any hostnames in the
<code class=
"literal">site1.internal
</code> and
348 <code class=
"literal">site2.internal
</code> domains.
350 <li>Look up any hostnames on the Internet.
</li>
351 <li>Exchange mail with both internal and external people.
</li>
354 Hosts on the Internet will be able to:
356 <div class=
"itemizedlist"><ul type=
"disc">
358 Look up any hostnames in the
<code class=
"literal">site1
</code>
360 <code class=
"literal">site2.example.com
</code> zones.
363 Exchange mail with anyone in the
<code class=
"literal">site1
</code> and
364 <code class=
"literal">site2.example.com
</code> zones.
368 Here is an example configuration for the setup we just
369 described above. Note that this is only configuration information;
370 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>.
373 Internal DNS server config:
375 <pre class=
"programlisting">
377 acl internals {
172.16.72.0/
24;
192.168.1.0/
24; };
379 acl externals {
<code class=
"varname">bastion-ips-go-here
</code>; };
385 // forward to external servers
387 <code class=
"varname">bastion-ips-go-here
</code>;
389 // sample allow-transfer (no one)
390 allow-transfer { none; };
391 // restrict query access
392 allow-query { internals; externals; };
393 // restrict recursion
394 allow-recursion { internals; };
399 // sample master zone
400 zone
"site1.example.com" {
402 file
"m/site1.example.com";
403 // do normal iterative resolution (do not forward)
405 allow-query { internals; externals; };
406 allow-transfer { internals; };
410 zone
"site2.example.com" {
412 file
"s/site2.example.com";
413 masters {
172.16.72.3; };
415 allow-query { internals; externals; };
416 allow-transfer { internals; };
419 zone
"site1.internal" {
421 file
"m/site1.internal";
423 allow-query { internals; };
424 allow-transfer { internals; }
427 zone
"site2.internal" {
429 file
"s/site2.internal";
430 masters {
172.16.72.3; };
432 allow-query { internals };
433 allow-transfer { internals; }
437 External (bastion host) DNS server config:
439 <pre class=
"programlisting">
440 acl internals {
172.16.72.0/
24;
192.168.1.0/
24; };
442 acl externals { bastion-ips-go-here; };
447 // sample allow-transfer (no one)
448 allow-transfer { none; };
449 // default query access
450 allow-query { any; };
451 // restrict cache access
452 allow-query-cache { internals; externals; };
453 // restrict recursion
454 allow-recursion { internals; externals; };
460 zone
"site1.example.com" {
462 file
"m/site1.foo.com";
463 allow-transfer { internals; externals; };
466 zone
"site2.example.com" {
468 file
"s/site2.foo.com";
469 masters { another_bastion_host_maybe; };
470 allow-transfer { internals; externals; }
474 In the
<code class=
"filename">resolv.conf
</code> (or equivalent) on
477 <pre class=
"programlisting">
479 nameserver
172.16.72.2
480 nameserver
172.16.72.3
481 nameserver
172.16.72.4
485 <div class=
"sect1" lang=
"en">
486 <div class=
"titlepage"><div><div><h2 class=
"title" style=
"clear: both">
487 <a name=
"tsig"></a>TSIG
</h2></div></div></div>
489 This is a short guide to setting up Transaction SIGnatures
490 (TSIG) based transaction security in
<acronym class=
"acronym">BIND
</acronym>. It describes changes
491 to the configuration file as well as what changes are required for
492 different features, including the process of creating transaction
493 keys and using transaction signatures with
<acronym class=
"acronym">BIND
</acronym>.
496 <acronym class=
"acronym">BIND
</acronym> primarily supports TSIG for server
497 to server communication.
498 This includes zone transfer, notify, and recursive query messages.
499 Resolvers based on newer versions of
<acronym class=
"acronym">BIND
</acronym> 8 have limited support
503 TSIG can also be useful for dynamic update. A primary
504 server for a dynamic zone should control access to the dynamic
505 update service, but IP-based access control is insufficient.
506 The cryptographic access control provided by TSIG
507 is far superior. The
<span><strong class=
"command">nsupdate
</strong></span>
508 program supports TSIG via the
<code class=
"option">-k
</code> and
509 <code class=
"option">-y
</code> command line options or inline by use
510 of the
<span><strong class=
"command">key
</strong></span>.
512 <div class=
"sect2" lang=
"en">
513 <div class=
"titlepage"><div><div><h3 class=
"title">
514 <a name=
"id2571088"></a>Generate Shared Keys for Each Pair of Hosts
</h3></div></div></div>
516 A shared secret is generated to be shared between
<span class=
"emphasis"><em>host1
</em></span> and
<span class=
"emphasis"><em>host2
</em></span>.
517 An arbitrary key name is chosen:
"host1-host2.". The key name must
518 be the same on both hosts.
520 <div class=
"sect3" lang=
"en">
521 <div class=
"titlepage"><div><div><h4 class=
"title">
522 <a name=
"id2571105"></a>Automatic Generation
</h4></div></div></div>
524 The following command will generate a
128-bit (
16 byte) HMAC-SHA256
525 key as described above. Longer keys are better, but shorter keys
526 are easier to read. Note that the maximum key length is the digest
527 length, here
256 bits.
530 <strong class=
"userinput"><code>dnssec-keygen -a hmac-sha256 -b
128 -n HOST host1-host2.
</code></strong>
533 The key is in the file
<code class=
"filename">Khost1-host2.+
163+
00000.private
</code>.
534 Nothing directly uses this file, but the base-
64 encoded string
535 following
"<code class="literal
">Key:</code>"
536 can be extracted from the file and used as a shared secret:
538 <pre class=
"programlisting">Key: La/E5CjG9O+os1jq0a2jdA==
</pre>
540 The string
"<code class="literal
">La/E5CjG9O+os1jq0a2jdA==</code>" can
541 be used as the shared secret.
544 <div class=
"sect3" lang=
"en">
545 <div class=
"titlepage"><div><div><h4 class=
"title">
546 <a name=
"id2571211"></a>Manual Generation
</h4></div></div></div>
548 The shared secret is simply a random sequence of bits, encoded
549 in base-
64. Most ASCII strings are valid base-
64 strings (assuming
550 the length is a multiple of
4 and only valid characters are used),
551 so the shared secret can be manually generated.
554 Also, a known string can be run through
<span><strong class=
"command">mmencode
</strong></span> or
555 a similar program to generate base-
64 encoded data.
559 <div class=
"sect2" lang=
"en">
560 <div class=
"titlepage"><div><div><h3 class=
"title">
561 <a name=
"id2571229"></a>Copying the Shared Secret to Both Machines
</h3></div></div></div>
563 This is beyond the scope of DNS. A secure transport mechanism
564 should be used. This could be secure FTP, ssh, telephone, etc.
567 <div class=
"sect2" lang=
"en">
568 <div class=
"titlepage"><div><div><h3 class=
"title">
569 <a name=
"id2571240"></a>Informing the Servers of the Key's Existence
</h3></div></div></div>
571 Imagine
<span class=
"emphasis"><em>host1
</em></span> and
<span class=
"emphasis"><em>host
2</em></span>
573 both servers. The following is added to each server's
<code class=
"filename">named.conf
</code> file:
575 <pre class=
"programlisting">
577 algorithm hmac-sha256;
578 secret
"La/E5CjG9O+os1jq0a2jdA==";
582 The secret is the one generated above. Since this is a secret, it
583 is recommended that either
<code class=
"filename">named.conf
</code> be
584 non-world readable, or the key directive be added to a non-world
585 readable file that is included by
<code class=
"filename">named.conf
</code>.
588 At this point, the key is recognized. This means that if the
589 server receives a message signed by this key, it can verify the
590 signature. If the signature is successfully verified, the
591 response is signed by the same key.
594 <div class=
"sect2" lang=
"en">
595 <div class=
"titlepage"><div><div><h3 class=
"title">
596 <a name=
"id2571345"></a>Instructing the Server to Use the Key
</h3></div></div></div>
598 Since keys are shared between two hosts only, the server must
599 be told when keys are to be used. The following is added to the
<code class=
"filename">named.conf
</code> file
600 for
<span class=
"emphasis"><em>host1
</em></span>, if the IP address of
<span class=
"emphasis"><em>host2
</em></span> is
603 <pre class=
"programlisting">
605 keys { host1-host2. ;};
609 Multiple keys may be present, but only the first is used.
610 This directive does not contain any secrets, so it may be in a
615 If
<span class=
"emphasis"><em>host1
</em></span> sends a message that is a request
616 to that address, the message will be signed with the specified key.
<span class=
"emphasis"><em>host1
</em></span> will
617 expect any responses to signed messages to be signed with the same
621 A similar statement must be present in
<span class=
"emphasis"><em>host2
</em></span>'s
622 configuration file (with
<span class=
"emphasis"><em>host1
</em></span>'s address) for
<span class=
"emphasis"><em>host2
</em></span> to
623 sign request messages to
<span class=
"emphasis"><em>host1
</em></span>.
626 <div class=
"sect2" lang=
"en">
627 <div class=
"titlepage"><div><div><h3 class=
"title">
628 <a name=
"id2571539"></a>TSIG Key Based Access Control
</h3></div></div></div>
630 <acronym class=
"acronym">BIND
</acronym> allows IP addresses and ranges
631 to be specified in ACL
633 <span><strong class=
"command">allow-{ query | transfer | update }
</strong></span>
635 This has been extended to allow TSIG keys also. The above key would
636 be denoted
<span><strong class=
"command">key host1-host2.
</strong></span>
639 An example of an
<span><strong class=
"command">allow-update
</strong></span> directive would be:
641 <pre class=
"programlisting">
642 allow-update { key host1-host2. ;};
645 This allows dynamic updates to succeed only if the request
646 was signed by a key named
"<span><strong class="command
">host1-host2.</strong></span>".
649 See
<a href=
"Bv9ARM.ch06.html#dynamic_update_policies" title=
"Dynamic Update Policies">the section called
“Dynamic Update Policies
”</a> for a discussion of
650 the more flexible
<span><strong class=
"command">update-policy
</strong></span> statement.
653 <div class=
"sect2" lang=
"en">
654 <div class=
"titlepage"><div><div><h3 class=
"title">
655 <a name=
"id2571588"></a>Errors
</h3></div></div></div>
657 The processing of TSIG signed messages can result in
658 several errors. If a signed message is sent to a non-TSIG aware
659 server, a FORMERR (format error) will be returned, since the server will not
660 understand the record. This is a result of misconfiguration,
661 since the server must be explicitly configured to send a TSIG
662 signed message to a specific server.
665 If a TSIG aware server receives a message signed by an
666 unknown key, the response will be unsigned with the TSIG
667 extended error code set to BADKEY. If a TSIG aware server
668 receives a message with a signature that does not validate, the
669 response will be unsigned with the TSIG extended error code set
670 to BADSIG. If a TSIG aware server receives a message with a time
671 outside of the allowed range, the response will be signed with
672 the TSIG extended error code set to BADTIME, and the time values
673 will be adjusted so that the response can be successfully
674 verified. In any of these cases, the message's rcode (response code) is set to
675 NOTAUTH (not authenticated).
679 <div class=
"sect1" lang=
"en">
680 <div class=
"titlepage"><div><div><h2 class=
"title" style=
"clear: both">
681 <a name=
"id2571602"></a>TKEY
</h2></div></div></div>
682 <p><span><strong class=
"command">TKEY
</strong></span>
683 is a mechanism for automatically generating a shared secret
684 between two hosts. There are several
"modes" of
685 <span><strong class=
"command">TKEY
</strong></span> that specify how the key is generated
686 or assigned.
<acronym class=
"acronym">BIND
</acronym> 9 implements only one of
687 these modes, the Diffie-Hellman key exchange. Both hosts are
688 required to have a Diffie-Hellman KEY record (although this
689 record is not required to be present in a zone). The
690 <span><strong class=
"command">TKEY
</strong></span> process must use signed messages,
691 signed either by TSIG or SIG(
0). The result of
692 <span><strong class=
"command">TKEY
</strong></span> is a shared secret that can be used to
693 sign messages with TSIG.
<span><strong class=
"command">TKEY
</strong></span> can also be
694 used to delete shared secrets that it had previously
698 The
<span><strong class=
"command">TKEY
</strong></span> process is initiated by a
700 or server by sending a signed
<span><strong class=
"command">TKEY
</strong></span>
702 (including any appropriate KEYs) to a TKEY-aware server. The
703 server response, if it indicates success, will contain a
704 <span><strong class=
"command">TKEY
</strong></span> record and any appropriate keys.
706 this exchange, both participants have enough information to
707 determine the shared secret; the exact process depends on the
708 <span><strong class=
"command">TKEY
</strong></span> mode. When using the
710 <span><strong class=
"command">TKEY
</strong></span> mode, Diffie-Hellman keys are
712 and the shared secret is derived by both participants.
715 <div class=
"sect1" lang=
"en">
716 <div class=
"titlepage"><div><div><h2 class=
"title" style=
"clear: both">
717 <a name=
"id2571651"></a>SIG(
0)
</h2></div></div></div>
719 <acronym class=
"acronym">BIND
</acronym> 9 partially supports DNSSEC SIG(
0)
720 transaction signatures as specified in RFC
2535 and RFC
2931.
722 uses public/private keys to authenticate messages. Access control
723 is performed in the same manner as TSIG keys; privileges can be
724 granted or denied based on the key name.
727 When a SIG(
0) signed message is received, it will only be
728 verified if the key is known and trusted by the server; the server
729 will not attempt to locate and/or validate the key.
732 SIG(
0) signing of multiple-message TCP streams is not
736 The only tool shipped with
<acronym class=
"acronym">BIND
</acronym> 9 that
737 generates SIG(
0) signed messages is
<span><strong class=
"command">nsupdate
</strong></span>.
740 <div class=
"sect1" lang=
"en">
741 <div class=
"titlepage"><div><div><h2 class=
"title" style=
"clear: both">
742 <a name=
"DNSSEC"></a>DNSSEC
</h2></div></div></div>
744 Cryptographic authentication of DNS information is possible
745 through the DNS Security (
<span class=
"emphasis"><em>DNSSEC-bis
</em></span>) extensions,
746 defined in RFC
4033, RFC
4034, and RFC
4035.
747 This section describes the creation and use of DNSSEC signed zones.
750 In order to set up a DNSSEC secure zone, there are a series
751 of steps which must be followed.
<acronym class=
"acronym">BIND
</acronym>
754 that are used in this process, which are explained in more detail
755 below. In all cases, the
<code class=
"option">-h
</code> option prints a
756 full list of parameters. Note that the DNSSEC tools require the
757 keyset files to be in the working directory or the
758 directory specified by the
<code class=
"option">-d
</code> option, and
759 that the tools shipped with BIND
9.2.x and earlier are not compatible
760 with the current ones.
763 There must also be communication with the administrators of
764 the parent and/or child zone to transmit keys. A zone's security
765 status must be indicated by the parent zone for a DNSSEC capable
766 resolver to trust its data. This is done through the presence
767 or absence of a
<code class=
"literal">DS
</code> record at the
772 For other servers to trust data in this zone, they must
773 either be statically configured with this zone's zone key or the
774 zone key of another zone above this one in the DNS tree.
776 <div class=
"sect2" lang=
"en">
777 <div class=
"titlepage"><div><div><h3 class=
"title">
778 <a name=
"id2571719"></a>Generating Keys
</h3></div></div></div>
780 The
<span><strong class=
"command">dnssec-keygen
</strong></span> program is used to
784 A secure zone must contain one or more zone keys. The
785 zone keys will sign all other records in the zone, as well as
786 the zone keys of any secure delegated zones. Zone keys must
787 have the same name as the zone, a name type of
788 <span><strong class=
"command">ZONE
</strong></span>, and must be usable for
790 It is recommended that zone keys use a cryptographic algorithm
791 designated as
"mandatory to implement" by the IETF; currently
792 the only one is RSASHA1.
795 The following command will generate a
768-bit RSASHA1 key for
796 the
<code class=
"filename">child.example
</code> zone:
799 <strong class=
"userinput"><code>dnssec-keygen -a RSASHA1 -b
768 -n ZONE child.example.
</code></strong>
802 Two output files will be produced:
803 <code class=
"filename">Kchild.example.+
005+
12345.key
</code> and
804 <code class=
"filename">Kchild.example.+
005+
12345.private
</code>
806 12345 is an example of a key tag). The key filenames contain
807 the key name (
<code class=
"filename">child.example.
</code>),
809 is DSA,
1 is RSAMD5,
5 is RSASHA1, etc.), and the key tag (
12345 in
811 The private key (in the
<code class=
"filename">.private
</code>
813 used to generate signatures, and the public key (in the
814 <code class=
"filename">.key
</code> file) is used for signature
818 To generate another key with the same properties (but with
819 a different key tag), repeat the above command.
822 The
<span><strong class=
"command">dnssec-keyfromlabel
</strong></span> program is used
823 to get a key pair from a crypto hardware and build the key
824 files. Its usage is similar to
<span><strong class=
"command">dnssec-keygen
</strong></span>.
827 The public keys should be inserted into the zone file by
828 including the
<code class=
"filename">.key
</code> files using
829 <span><strong class=
"command">$INCLUDE
</strong></span> statements.
832 <div class=
"sect2" lang=
"en">
833 <div class=
"titlepage"><div><div><h3 class=
"title">
834 <a name=
"id2571798"></a>Signing the Zone
</h3></div></div></div>
836 The
<span><strong class=
"command">dnssec-signzone
</strong></span> program is used
840 Any
<code class=
"filename">keyset
</code> files corresponding to
841 secure subzones should be present. The zone signer will
842 generate
<code class=
"literal">NSEC
</code>,
<code class=
"literal">NSEC3
</code>
843 and
<code class=
"literal">RRSIG
</code> records for the zone, as
844 well as
<code class=
"literal">DS
</code> for the child zones if
845 <code class=
"literal">'-g'
</code> is specified. If
<code class=
"literal">'-g'
</code>
846 is not specified, then DS RRsets for the secure child
847 zones need to be added manually.
850 The following command signs the zone, assuming it is in a
851 file called
<code class=
"filename">zone.child.example
</code>. By
852 default, all zone keys which have an available private key are
853 used to generate signatures.
856 <strong class=
"userinput"><code>dnssec-signzone -o child.example zone.child.example
</code></strong>
859 One output file is produced:
860 <code class=
"filename">zone.child.example.signed
</code>. This
862 should be referenced by
<code class=
"filename">named.conf
</code>
864 input file for the zone.
866 <p><span><strong class=
"command">dnssec-signzone
</strong></span>
867 will also produce a keyset and dsset files and optionally a
868 dlvset file. These are used to provide the parent zone
869 administrators with the
<code class=
"literal">DNSKEYs
</code> (or their
870 corresponding
<code class=
"literal">DS
</code> records) that are the
871 secure entry point to the zone.
874 <div class=
"sect2" lang=
"en">
875 <div class=
"titlepage"><div><div><h3 class=
"title">
876 <a name=
"id2571879"></a>Configuring Servers
</h3></div></div></div>
878 To enable
<span><strong class=
"command">named
</strong></span> to respond appropriately
879 to DNS requests from DNSSEC aware clients,
880 <span><strong class=
"command">dnssec-enable
</strong></span> must be set to yes.
881 (This is the default setting.)
884 To enable
<span><strong class=
"command">named
</strong></span> to validate answers from
885 other servers, the
<span><strong class=
"command">dnssec-enable
</strong></span> and
886 <span><strong class=
"command">dnssec-validation
</strong></span> options must both be
887 set to yes (the default setting in
<acronym class=
"acronym">BIND
</acronym> 9.5
888 and later), and at least one trust anchor must be configured
889 with a
<span><strong class=
"command">trusted-keys
</strong></span> or
890 <span><strong class=
"command">managed-keys
</strong></span> statement in
891 <code class=
"filename">named.conf
</code>.
894 <span><strong class=
"command">trusted-keys
</strong></span> are copies of DNSKEY RRs
895 for zones that are used to form the first link in the
896 cryptographic chain of trust. All keys listed in
897 <span><strong class=
"command">trusted-keys
</strong></span> (and corresponding zones)
898 are deemed to exist and only the listed keys will be used
899 to validated the DNSKEY RRset that they are from.
902 <span><strong class=
"command">managed-keys
</strong></span> are trusted keys which are
903 automatically kept up to date via RFC
5011 trust anchor
907 <span><strong class=
"command">trusted-keys
</strong></span> and
908 <span><strong class=
"command">managed-keys
</strong></span> are described in more detail
909 later in this document.
912 Unlike
<acronym class=
"acronym">BIND
</acronym> 8,
<acronym class=
"acronym">BIND
</acronym>
913 9 does not verify signatures on load, so zone keys for
914 authoritative zones do not need to be specified in the
918 After DNSSEC gets established, a typical DNSSEC configuration
919 will look something like the following. It has one or
920 more public keys for the root. This allows answers from
921 outside the organization to be validated. It will also
922 have several keys for parts of the namespace the organization
923 controls. These are here to ensure that
<span><strong class=
"command">named
</strong></span>
924 is immune to compromises in the DNSSEC components of the security
927 <pre class=
"programlisting">
930 "." initial-key
257 3 3 "BNY4wrWM1nCfJ+CXd0rVXyYmobt7sEEfK3clRbGaTwS
931 JxrGkxJWoZu6I7PzJu/E9gx4UC1zGAHlXKdE4zYIpRh
932 aBKnvcC2U9mZhkdUpd1Vso/HAdjNe8LmMlnzY3zy2Xy
933 4klWOADTPzSv9eamj8V18PHGjBLaVtYvk/ln5ZApjYg
934 hf+6fElrmLkdaz MQ2OCnACR817DF4BBa7UR/beDHyp
935 5iWTXWSi6XmoJLbG9Scqc7l70KDqlvXR3M/lUUVRbke
936 g1IPJSidmK3ZyCllh4XSKbje/45SKucHgnwU5jefMtq
937 66gKodQj+MiA21AfUVe7u99WzTLzY3qlxDhxYQQ20FQ
938 97S+LKUTpQcq27R7AT3/V5hRQxScINqwcz4jYqZD2fQ
939 dgxbcDTClU0CRBdiieyLMNzXG3";
943 /* Key for our organization's forward zone */
944 example.com.
257 3 5 "AwEAAaxPMcR2x0HbQV4WeZB6oEDX+r0QM6
945 5KbhTjrW1ZaARmPhEZZe3Y9ifgEuq7vZ/z
946 GZUdEGNWy+JZzus0lUptwgjGwhUS1558Hb
947 4JKUbbOTcM8pwXlj0EiX3oDFVmjHO444gL
948 kBOUKUf/mC7HvfwYH/Be22GnClrinKJp1O
949 g4ywzO9WglMk7jbfW33gUKvirTHr25GL7S
950 TQUzBb5Usxt8lgnyTUHs1t3JwCY5hKZ6Cq
951 FxmAVZP20igTixin/1LcrgX/KMEGd/biuv
952 F4qJCyduieHukuY3H4XMAcR+xia2nIUPvm
953 /oyWR8BW/hWdzOvnSCThlHf3xiYleDbt/o
956 /* Key for our reverse zone. */
957 2.0.192.IN-ADDRPA.NET.
257 3 5 "AQOnS4xn/IgOUpBPJ3bogzwc
958 xOdNax071L18QqZnQQQAVVr+i
959 LhGTnNGp3HoWQLUIzKrJVZ3zg
960 gy3WwNT6kZo6c0tszYqbtvchm
961 gQC8CzKojM/W16i6MG/eafGU3
962 siaOdS0yOI6BgPsw+YZdzlYMa
963 IJGf4M4dyoKIhzdZyQ2bYQrjy
964 Q4LB0lC7aOnsMyYKHHYeRvPxj
965 IQXmdqgOJGq+vsevG06zW+1xg
966 YJh9rCIfnm1GX/KMgxLPG2vXT
967 D/RnLX+D3T3UL7HJYHJhAZD5L
968 59VvjSPsZJHeDCUyWYrvPZesZ
969 DIRvhDD52SKvbheeTJUm6Ehkz
970 ytNN2SN96QRk8j/iI8ib";
976 dnssec-validation yes;
979 <div class=
"note" style=
"margin-left: 0.5in; margin-right: 0.5in;">
980 <h3 class=
"title">Note
</h3>
981 None of the keys listed in this example are valid. In particular,
982 the root key is not valid.
985 When DNSSEC validation is enabled and properly configured,
986 the resolver will reject any answers from signed, secure zones
987 which fail to validate, and will return SERVFAIL to the client.
990 Responses may fail to validate for any of several reasons,
991 including missing, expired, or invalid signatures, a key which
992 does not match the DS RRset in the parent zone, or an insecure
993 response from a zone which, according to its parent, should have
996 <div class=
"note" style=
"margin-left: 0.5in; margin-right: 0.5in;">
997 <h3 class=
"title">Note
</h3>
999 When the validator receives a response from an unsigned zone
1000 that has a signed parent, it must confirm with the parent
1001 that the zone was intentionally left unsigned. It does
1002 this by verifying, via signed and validated NSEC/NSEC3 records,
1003 that the parent zone contains no DS records for the child.
1006 If the validator
<span class=
"emphasis"><em>can
</em></span> prove that the zone
1007 is insecure, then the response is accepted. However, if it
1008 cannot, then it must assume an insecure response to be a
1009 forgery; it rejects the response and logs an error.
1012 The logged error reads
"insecurity proof failed" and
1013 "got insecure response; parent indicates it should be secure".
1014 (Prior to BIND
9.7, the logged error was
"not insecure".
1015 This referred to the zone, not the response.)
1020 <div class=
"sect1" lang=
"en">
1021 <div class=
"titlepage"><div><div><h2 class=
"title" style=
"clear: both">
1022 <a name=
"id2572061"></a>IPv6 Support in
<acronym class=
"acronym">BIND
</acronym> 9</h2></div></div></div>
1024 <acronym class=
"acronym">BIND
</acronym> 9 fully supports all currently
1025 defined forms of IPv6 name to address and address to name
1026 lookups. It will also use IPv6 addresses to make queries when
1027 running on an IPv6 capable system.
1030 For forward lookups,
<acronym class=
"acronym">BIND
</acronym> 9 supports
1031 only AAAA records. RFC
3363 deprecated the use of A6 records,
1032 and client-side support for A6 records was accordingly removed
1033 from
<acronym class=
"acronym">BIND
</acronym> 9.
1034 However, authoritative
<acronym class=
"acronym">BIND
</acronym> 9 name servers still
1035 load zone files containing A6 records correctly, answer queries
1036 for A6 records, and accept zone transfer for a zone containing A6
1040 For IPv6 reverse lookups,
<acronym class=
"acronym">BIND
</acronym> 9 supports
1041 the traditional
"nibble" format used in the
1042 <span class=
"emphasis"><em>ip6.arpa
</em></span> domain, as well as the older, deprecated
1043 <span class=
"emphasis"><em>ip6.int
</em></span> domain.
1044 Older versions of
<acronym class=
"acronym">BIND
</acronym> 9
1045 supported the
"binary label" (also known as
"bitstring") format,
1046 but support of binary labels has been completely removed per
1048 Many applications in
<acronym class=
"acronym">BIND
</acronym> 9 do not understand
1049 the binary label format at all any more, and will return an
1051 In particular, an authoritative
<acronym class=
"acronym">BIND
</acronym> 9
1052 name server will not load a zone file containing binary labels.
1055 For an overview of the format and structure of IPv6 addresses,
1056 see
<a href=
"Bv9ARM.ch09.html#ipv6addresses" title=
"IPv6 addresses (AAAA)">the section called
“IPv6 addresses (AAAA)
”</a>.
1058 <div class=
"sect2" lang=
"en">
1059 <div class=
"titlepage"><div><div><h3 class=
"title">
1060 <a name=
"id2572328"></a>Address Lookups Using AAAA Records
</h3></div></div></div>
1062 The IPv6 AAAA record is a parallel to the IPv4 A record,
1063 and, unlike the deprecated A6 record, specifies the entire
1064 IPv6 address in a single record. For example,
1066 <pre class=
"programlisting">
1067 $ORIGIN example.com.
1068 host
3600 IN AAAA
2001:db8::
1
1071 Use of IPv4-in-IPv6 mapped addresses is not recommended.
1072 If a host has an IPv4 address, use an A record, not
1073 a AAAA, with
<code class=
"literal">::ffff:
192.168.42.1</code> as
1077 <div class=
"sect2" lang=
"en">
1078 <div class=
"titlepage"><div><div><h3 class=
"title">
1079 <a name=
"id2572349"></a>Address to Name Lookups Using Nibble Format
</h3></div></div></div>
1081 When looking up an address in nibble format, the address
1082 components are simply reversed, just as in IPv4, and
1083 <code class=
"literal">ip6.arpa.
</code> is appended to the
1085 For example, the following would provide reverse name lookup for
1087 <code class=
"literal">2001:db8::
1</code>.
1089 <pre class=
"programlisting">
1090 $ORIGIN
0.0.0.0.0.0.0.0.8.b.d
.0.1.0.0.2.ip6.arpa.
1091 1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0 14400 IN PTR (
1097 <div class=
"navfooter">
1099 <table width=
"100%" summary=
"Navigation footer">
1101 <td width=
"40%" align=
"left">
1102 <a accesskey=
"p" href=
"Bv9ARM.ch03.html">Prev
</a> </td>
1103 <td width=
"20%" align=
"center"> </td>
1104 <td width=
"40%" align=
"right"> <a accesskey=
"n" href=
"Bv9ARM.ch05.html">Next
</a>
1108 <td width=
"40%" align=
"left" valign=
"top">Chapter
3. Name Server Configuration
</td>
1109 <td width=
"20%" align=
"center"><a accesskey=
"h" href=
"Bv9ARM.html">Home
</a></td>
1110 <td width=
"40%" align=
"right" valign=
"top"> Chapter
5. The
<acronym class=
"acronym">BIND
</acronym> 9 Lightweight Resolver
</td>