ignore some files
[tridge/bind9.git] / doc / arm / Bv9ARM.ch04.html
1 <!--
2  - Copyright (C) 2004-2009 Internet Systems Consortium, Inc. ("ISC")
3  - Copyright (C) 2000-2003 Internet Software Consortium.
4  - 
5  - Permission to use, copy, modify, and 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.
8  - 
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.
16 -->
17 <!-- $Id: Bv9ARM.ch04.html,v 1.87.48.2 2009/04/03 01:52:21 tbox Exp $ -->
18 <html>
19 <head>
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">
27 </head>
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>
32 <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>
37 </td>
38 </tr>
39 </table>
40 <hr>
41 </div>
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>
45 <div class="toc">
46 <p><b>Table of Contents</b></p>
47 <dl>
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#id2564066">Split DNS</a></span></dt>
53 <dd><dl><dt><span class="sect2"><a href="Bv9ARM.ch04.html#id2564084">Example split DNS setup</a></span></dt></dl></dd>
54 <dt><span class="sect1"><a href="Bv9ARM.ch04.html#tsig">TSIG</a></span></dt>
55 <dd><dl>
56 <dt><span class="sect2"><a href="Bv9ARM.ch04.html#id2571141">Generate Shared Keys for Each Pair of Hosts</a></span></dt>
57 <dt><span class="sect2"><a href="Bv9ARM.ch04.html#id2571214">Copying the Shared Secret to Both Machines</a></span></dt>
58 <dt><span class="sect2"><a href="Bv9ARM.ch04.html#id2571225">Informing the Servers of the Key's Existence</a></span></dt>
59 <dt><span class="sect2"><a href="Bv9ARM.ch04.html#id2571268">Instructing the Server to Use the Key</a></span></dt>
60 <dt><span class="sect2"><a href="Bv9ARM.ch04.html#id2571325">TSIG Key Based Access Control</a></span></dt>
61 <dt><span class="sect2"><a href="Bv9ARM.ch04.html#id2571510">Errors</a></span></dt>
62 </dl></dd>
63 <dt><span class="sect1"><a href="Bv9ARM.ch04.html#id2571524">TKEY</a></span></dt>
64 <dt><span class="sect1"><a href="Bv9ARM.ch04.html#id2571709">SIG(0)</a></span></dt>
65 <dt><span class="sect1"><a href="Bv9ARM.ch04.html#DNSSEC">DNSSEC</a></span></dt>
66 <dd><dl>
67 <dt><span class="sect2"><a href="Bv9ARM.ch04.html#id2571778">Generating Keys</a></span></dt>
68 <dt><span class="sect2"><a href="Bv9ARM.ch04.html#id2571925">Signing the Zone</a></span></dt>
69 <dt><span class="sect2"><a href="Bv9ARM.ch04.html#id2572006">Configuring Servers</a></span></dt>
70 </dl></dd>
71 <dt><span class="sect1"><a href="Bv9ARM.ch04.html#id2572220">IPv6 Support in <acronym class="acronym">BIND</acronym> 9</a></span></dt>
72 <dd><dl>
73 <dt><span class="sect2"><a href="Bv9ARM.ch04.html#id2572282">Address Lookups Using AAAA Records</a></span></dt>
74 <dt><span class="sect2"><a href="Bv9ARM.ch04.html#id2572304">Address to Name Lookups Using Nibble Format</a></span></dt>
75 </dl></dd>
76 </dl>
77 </div>
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>
81 <p>
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.
87       </p>
88 <p>
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 &#8220;Boolean Options&#8221;</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 &#8220;Zone Transfers&#8221;</a>.  The <span><strong class="command">NOTIFY</strong></span>
94         protocol is specified in RFC 1996.
95       </p>
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
102         zones that it loads.
103       </div>
104 </div>
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>
108 <p>
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
112         in RFC 2136.
113       </p>
114 <p>
115         Dynamic update is enabled by including an
116         <span><strong class="command">allow-update</strong></span> or <span><strong class="command">update-policy</strong></span>
117         clause in the <span><strong class="command">zone</strong></span> statement.  The
118         <span><strong class="command">tkey-gssapi-credential</strong></span> and
119         <span><strong class="command">tkey-domain</strong></span> clauses in the
120         <span><strong class="command">options</strong></span>        statement enable the
121         server to negotiate keys that can be matched against those
122         in <span><strong class="command">update-policy</strong></span> or
123         <span><strong class="command">allow-update</strong></span>.
124       </p>
125 <p>
126         Updating of secure zones (zones using DNSSEC) follows RFC
127         3007: RRSIG, NSEC and NSEC3 records affected by updates are
128         automatically regenerated by the server using an online
129         zone key.  Update authorization is based on transaction
130         signatures and an explicit server policy.
131       </p>
132 <div class="sect2" lang="en">
133 <div class="titlepage"><div><div><h3 class="title">
134 <a name="journal"></a>The journal file</h3></div></div></div>
135 <p>
136           All changes made to a zone using dynamic update are stored
137           in the zone's journal file.  This file is automatically created
138           by the server when the first dynamic update takes place.
139           The name of the journal file is formed by appending the extension
140           <code class="filename">.jnl</code> to the name of the
141           corresponding zone
142           file unless specifically overridden.  The journal file is in a
143           binary format and should not be edited manually.
144         </p>
145 <p>
146           The server will also occasionally write ("dump")
147           the complete contents of the updated zone to its zone file.
148           This is not done immediately after
149           each dynamic update, because that would be too slow when a large
150           zone is updated frequently.  Instead, the dump is delayed by
151           up to 15 minutes, allowing additional updates to take place.
152         </p>
153 <p>
154           When a server is restarted after a shutdown or crash, it will replay
155               the journal file to incorporate into the zone any updates that
156           took
157           place after the last zone dump.
158         </p>
159 <p>
160           Changes that result from incoming incremental zone transfers are
161           also
162           journalled in a similar way.
163         </p>
164 <p>
165           The zone files of dynamic zones cannot normally be edited by
166           hand because they are not guaranteed to contain the most recent
167           dynamic changes &#8212; those are only in the journal file.
168           The only way to ensure that the zone file of a dynamic zone
169           is up to date is to run <span><strong class="command">rndc stop</strong></span>.
170         </p>
171 <p>
172           If you have to make changes to a dynamic zone
173           manually, the following procedure will work: Disable dynamic updates
174               to the zone using
175           <span><strong class="command">rndc freeze <em class="replaceable"><code>zone</code></em></strong></span>.
176           This will also remove the zone's <code class="filename">.jnl</code> file
177           and update the master file.  Edit the zone file.  Run
178           <span><strong class="command">rndc thaw <em class="replaceable"><code>zone</code></em></strong></span>
179           to reload the changed zone and re-enable dynamic updates.
180         </p>
181 </div>
182 </div>
183 <div class="sect1" lang="en">
184 <div class="titlepage"><div><div><h2 class="title" style="clear: both">
185 <a name="incremental_zone_transfers"></a>Incremental Zone Transfers (IXFR)</h2></div></div></div>
186 <p>
187         The incremental zone transfer (IXFR) protocol is a way for
188         slave servers to transfer only changed data, instead of having to
189         transfer the entire zone. The IXFR protocol is specified in RFC
190         1995. See <a href="Bv9ARM.ch09.html#proposed_standards">Proposed Standards</a>.
191       </p>
192 <p>
193         When acting as a master, <acronym class="acronym">BIND</acronym> 9
194         supports IXFR for those zones
195         where the necessary change history information is available. These
196         include master zones maintained by dynamic update and slave zones
197         whose data was obtained by IXFR.  For manually maintained master
198         zones, and for slave zones obtained by performing a full zone
199         transfer (AXFR), IXFR is supported only if the option
200         <span><strong class="command">ixfr-from-differences</strong></span> is set
201         to <strong class="userinput"><code>yes</code></strong>.
202       </p>
203 <p>
204         When acting as a slave, <acronym class="acronym">BIND</acronym> 9 will
205         attempt to use IXFR unless
206         it is explicitly disabled. For more information about disabling
207         IXFR, see the description of the <span><strong class="command">request-ixfr</strong></span> clause
208         of the <span><strong class="command">server</strong></span> statement.
209       </p>
210 </div>
211 <div class="sect1" lang="en">
212 <div class="titlepage"><div><div><h2 class="title" style="clear: both">
213 <a name="id2564066"></a>Split DNS</h2></div></div></div>
214 <p>
215         Setting up different views, or visibility, of the DNS space to
216         internal and external resolvers is usually referred to as a
217         <span class="emphasis"><em>Split DNS</em></span> setup. There are several
218         reasons an organization would want to set up its DNS this way.
219       </p>
220 <p>
221         One common reason for setting up a DNS system this way is
222         to hide "internal" DNS information from "external" clients on the
223         Internet. There is some debate as to whether or not this is actually
224         useful.
225         Internal DNS information leaks out in many ways (via email headers,
226         for example) and most savvy "attackers" can find the information
227         they need using other means.
228         However, since listing addresses of internal servers that
229         external clients cannot possibly reach can result in
230         connection delays and other annoyances, an organization may
231         choose to use a Split DNS to present a consistent view of itself
232         to the outside world.
233       </p>
234 <p>
235         Another common reason for setting up a Split DNS system is
236         to allow internal networks that are behind filters or in RFC 1918
237         space (reserved IP space, as documented in RFC 1918) to resolve DNS
238         on the Internet. Split DNS can also be used to allow mail from outside
239         back in to the internal network.
240       </p>
241 <div class="sect2" lang="en">
242 <div class="titlepage"><div><div><h3 class="title">
243 <a name="id2564084"></a>Example split DNS setup</h3></div></div></div>
244 <p>
245         Let's say a company named <span class="emphasis"><em>Example, Inc.</em></span>
246         (<code class="literal">example.com</code>)
247         has several corporate sites that have an internal network with
248         reserved
249         Internet Protocol (IP) space and an external demilitarized zone (DMZ),
250         or "outside" section of a network, that is available to the public.
251       </p>
252 <p>
253         <span class="emphasis"><em>Example, Inc.</em></span> wants its internal clients
254         to be able to resolve external hostnames and to exchange mail with
255         people on the outside. The company also wants its internal resolvers
256         to have access to certain internal-only zones that are not available
257         at all outside of the internal network.
258       </p>
259 <p>
260         In order to accomplish this, the company will set up two sets
261         of name servers. One set will be on the inside network (in the
262         reserved
263         IP space) and the other set will be on bastion hosts, which are
264         "proxy"
265         hosts that can talk to both sides of its network, in the DMZ.
266       </p>
267 <p>
268         The internal servers will be configured to forward all queries,
269         except queries for <code class="filename">site1.internal</code>, <code class="filename">site2.internal</code>, <code class="filename">site1.example.com</code>,
270         and <code class="filename">site2.example.com</code>, to the servers
271         in the
272         DMZ. These internal servers will have complete sets of information
273         for <code class="filename">site1.example.com</code>, <code class="filename">site2.example.com</code>,<span class="emphasis"><em></em></span> <code class="filename">site1.internal</code>,
274         and <code class="filename">site2.internal</code>.
275       </p>
276 <p>
277         To protect the <code class="filename">site1.internal</code> and <code class="filename">site2.internal</code> domains,
278         the internal name servers must be configured to disallow all queries
279         to these domains from any external hosts, including the bastion
280         hosts.
281       </p>
282 <p>
283         The external servers, which are on the bastion hosts, will
284         be configured to serve the "public" version of the <code class="filename">site1</code> and <code class="filename">site2.example.com</code> zones.
285         This could include things such as the host records for public servers
286         (<code class="filename">www.example.com</code> and <code class="filename">ftp.example.com</code>),
287         and mail exchange (MX)  records (<code class="filename">a.mx.example.com</code> and <code class="filename">b.mx.example.com</code>).
288       </p>
289 <p>
290         In addition, the public <code class="filename">site1</code> and <code class="filename">site2.example.com</code> zones
291         should have special MX records that contain wildcard (`*') records
292         pointing to the bastion hosts. This is needed because external mail
293         servers do not have any other way of looking up how to deliver mail
294         to those internal hosts. With the wildcard records, the mail will
295         be delivered to the bastion host, which can then forward it on to
296         internal hosts.
297       </p>
298 <p>
299         Here's an example of a wildcard MX record:
300       </p>
301 <pre class="programlisting">*   IN MX 10 external1.example.com.</pre>
302 <p>
303         Now that they accept mail on behalf of anything in the internal
304         network, the bastion hosts will need to know how to deliver mail
305         to internal hosts. In order for this to work properly, the resolvers
306         on
307         the bastion hosts will need to be configured to point to the internal
308         name servers for DNS resolution.
309       </p>
310 <p>
311         Queries for internal hostnames will be answered by the internal
312         servers, and queries for external hostnames will be forwarded back
313         out to the DNS servers on the bastion hosts.
314       </p>
315 <p>
316         In order for all this to work properly, internal clients will
317         need to be configured to query <span class="emphasis"><em>only</em></span> the internal
318         name servers for DNS queries. This could also be enforced via
319         selective
320         filtering on the network.
321       </p>
322 <p>
323         If everything has been set properly, <span class="emphasis"><em>Example, Inc.</em></span>'s
324         internal clients will now be able to:
325       </p>
326 <div class="itemizedlist"><ul type="disc">
327 <li>
328             Look up any hostnames in the <code class="literal">site1</code>
329             and
330             <code class="literal">site2.example.com</code> zones.
331           </li>
332 <li>
333             Look up any hostnames in the <code class="literal">site1.internal</code> and
334             <code class="literal">site2.internal</code> domains.
335           </li>
336 <li>Look up any hostnames on the Internet.</li>
337 <li>Exchange mail with both internal and external people.</li>
338 </ul></div>
339 <p>
340         Hosts on the Internet will be able to:
341       </p>
342 <div class="itemizedlist"><ul type="disc">
343 <li>
344             Look up any hostnames in the <code class="literal">site1</code>
345             and
346             <code class="literal">site2.example.com</code> zones.
347           </li>
348 <li>
349             Exchange mail with anyone in the <code class="literal">site1</code> and
350             <code class="literal">site2.example.com</code> zones.
351           </li>
352 </ul></div>
353 <p>
354         Here is an example configuration for the setup we just
355         described above. Note that this is only configuration information;
356         for information on how to configure your zone files, see <a href="Bv9ARM.ch03.html#sample_configuration" title="Sample Configurations">the section called &#8220;Sample Configurations&#8221;</a>.
357       </p>
358 <p>
359         Internal DNS server config:
360       </p>
361 <pre class="programlisting">
362
363 acl internals { 172.16.72.0/24; 192.168.1.0/24; };
364
365 acl externals { <code class="varname">bastion-ips-go-here</code>; };
366
367 options {
368     ...
369     ...
370     forward only;
371     forwarders {                                // forward to external servers
372         <code class="varname">bastion-ips-go-here</code>;
373     };
374     allow-transfer { none; };                   // sample allow-transfer (no one)
375     allow-query { internals; externals; };      // restrict query access
376     allow-recursion { internals; };             // restrict recursion
377     ...
378     ...
379 };
380
381 zone "site1.example.com" {                      // sample master zone
382   type master;
383   file "m/site1.example.com";
384   forwarders { };                               // do normal iterative
385                                                 // resolution (do not forward)
386   allow-query { internals; externals; };
387   allow-transfer { internals; };
388 };
389
390 zone "site2.example.com" {                      // sample slave zone
391   type slave;
392   file "s/site2.example.com";
393   masters { 172.16.72.3; };
394   forwarders { };
395   allow-query { internals; externals; };
396   allow-transfer { internals; };
397 };
398
399 zone "site1.internal" {
400   type master;
401   file "m/site1.internal";
402   forwarders { };
403   allow-query { internals; };
404   allow-transfer { internals; }
405 };
406
407 zone "site2.internal" {
408   type slave;
409   file "s/site2.internal";
410   masters { 172.16.72.3; };
411   forwarders { };
412   allow-query { internals };
413   allow-transfer { internals; }
414 };
415 </pre>
416 <p>
417         External (bastion host) DNS server config:
418       </p>
419 <pre class="programlisting">
420 acl internals { 172.16.72.0/24; 192.168.1.0/24; };
421
422 acl externals { bastion-ips-go-here; };
423
424 options {
425   ...
426   ...
427   allow-transfer { none; };                     // sample allow-transfer (no one)
428   allow-query { any; };                         // default query access
429   allow-query-cache { internals; externals; };  // restrict cache access
430   allow-recursion { internals; externals; };    // restrict recursion
431   ...
432   ...
433 };
434
435 zone "site1.example.com" {                      // sample slave zone
436   type master;
437   file "m/site1.foo.com";
438   allow-transfer { internals; externals; };
439 };
440
441 zone "site2.example.com" {
442   type slave;
443   file "s/site2.foo.com";
444   masters { another_bastion_host_maybe; };
445   allow-transfer { internals; externals; }
446 };
447 </pre>
448 <p>
449         In the <code class="filename">resolv.conf</code> (or equivalent) on
450         the bastion host(s):
451       </p>
452 <pre class="programlisting">
453 search ...
454 nameserver 172.16.72.2
455 nameserver 172.16.72.3
456 nameserver 172.16.72.4
457 </pre>
458 </div>
459 </div>
460 <div class="sect1" lang="en">
461 <div class="titlepage"><div><div><h2 class="title" style="clear: both">
462 <a name="tsig"></a>TSIG</h2></div></div></div>
463 <p>
464         This is a short guide to setting up Transaction SIGnatures
465         (TSIG) based transaction security in <acronym class="acronym">BIND</acronym>. It describes changes
466         to the configuration file as well as what changes are required for
467         different features, including the process of creating transaction
468         keys and using transaction signatures with <acronym class="acronym">BIND</acronym>.
469       </p>
470 <p>
471         <acronym class="acronym">BIND</acronym> primarily supports TSIG for server
472         to server communication.
473         This includes zone transfer, notify, and recursive query messages.
474         Resolvers based on newer versions of <acronym class="acronym">BIND</acronym> 8 have limited support
475         for TSIG.
476       </p>
477 <p>
478         TSIG can also be useful for dynamic update. A primary
479         server for a dynamic zone should control access to the dynamic
480         update service, but IP-based access control is insufficient.
481         The cryptographic access control provided by TSIG
482         is far superior. The <span><strong class="command">nsupdate</strong></span>
483         program supports TSIG via the <code class="option">-k</code> and
484         <code class="option">-y</code> command line options or inline by use
485         of the <span><strong class="command">key</strong></span>.
486       </p>
487 <div class="sect2" lang="en">
488 <div class="titlepage"><div><div><h3 class="title">
489 <a name="id2571141"></a>Generate Shared Keys for Each Pair of Hosts</h3></div></div></div>
490 <p>
491           A shared secret is generated to be shared between <span class="emphasis"><em>host1</em></span> and <span class="emphasis"><em>host2</em></span>.
492           An arbitrary key name is chosen: "host1-host2.". The key name must
493           be the same on both hosts.
494         </p>
495 <div class="sect3" lang="en">
496 <div class="titlepage"><div><div><h4 class="title">
497 <a name="id2571158"></a>Automatic Generation</h4></div></div></div>
498 <p>
499             The following command will generate a 128-bit (16 byte) HMAC-MD5
500             key as described above. Longer keys are better, but shorter keys
501             are easier to read. Note that the maximum key length is 512 bits;
502             keys longer than that will be digested with MD5 to produce a
503             128-bit key.
504           </p>
505 <p>
506             <strong class="userinput"><code>dnssec-keygen -a hmac-md5 -b 128 -n HOST host1-host2.</code></strong>
507           </p>
508 <p>
509             The key is in the file <code class="filename">Khost1-host2.+157+00000.private</code>.
510             Nothing directly uses this file, but the base-64 encoded string
511             following "<code class="literal">Key:</code>"
512             can be extracted from the file and used as a shared secret:
513           </p>
514 <pre class="programlisting">Key: La/E5CjG9O+os1jq0a2jdA==</pre>
515 <p>
516             The string "<code class="literal">La/E5CjG9O+os1jq0a2jdA==</code>" can
517             be used as the shared secret.
518           </p>
519 </div>
520 <div class="sect3" lang="en">
521 <div class="titlepage"><div><div><h4 class="title">
522 <a name="id2571196"></a>Manual Generation</h4></div></div></div>
523 <p>
524             The shared secret is simply a random sequence of bits, encoded
525             in base-64. Most ASCII strings are valid base-64 strings (assuming
526             the length is a multiple of 4 and only valid characters are used),
527             so the shared secret can be manually generated.
528           </p>
529 <p>
530             Also, a known string can be run through <span><strong class="command">mmencode</strong></span> or
531             a similar program to generate base-64 encoded data.
532           </p>
533 </div>
534 </div>
535 <div class="sect2" lang="en">
536 <div class="titlepage"><div><div><h3 class="title">
537 <a name="id2571214"></a>Copying the Shared Secret to Both Machines</h3></div></div></div>
538 <p>
539           This is beyond the scope of DNS. A secure transport mechanism
540           should be used. This could be secure FTP, ssh, telephone, etc.
541         </p>
542 </div>
543 <div class="sect2" lang="en">
544 <div class="titlepage"><div><div><h3 class="title">
545 <a name="id2571225"></a>Informing the Servers of the Key's Existence</h3></div></div></div>
546 <p>
547           Imagine <span class="emphasis"><em>host1</em></span> and <span class="emphasis"><em>host 2</em></span>
548           are
549           both servers. The following is added to each server's <code class="filename">named.conf</code> file:
550         </p>
551 <pre class="programlisting">
552 key host1-host2. {
553   algorithm hmac-md5;
554   secret "La/E5CjG9O+os1jq0a2jdA==";
555 };
556 </pre>
557 <p>
558           The algorithm, <code class="literal">hmac-md5</code>, is the only one supported by <acronym class="acronym">BIND</acronym>.
559           The secret is the one generated above. Since this is a secret, it
560           is recommended that either <code class="filename">named.conf</code> be non-world
561           readable, or the key directive be added to a non-world readable
562           file that is included by
563           <code class="filename">named.conf</code>.
564         </p>
565 <p>
566           At this point, the key is recognized. This means that if the
567           server receives a message signed by this key, it can verify the
568           signature. If the signature is successfully verified, the
569           response is signed by the same key.
570         </p>
571 </div>
572 <div class="sect2" lang="en">
573 <div class="titlepage"><div><div><h3 class="title">
574 <a name="id2571268"></a>Instructing the Server to Use the Key</h3></div></div></div>
575 <p>
576           Since keys are shared between two hosts only, the server must
577           be told when keys are to be used. The following is added to the <code class="filename">named.conf</code> file
578           for <span class="emphasis"><em>host1</em></span>, if the IP address of <span class="emphasis"><em>host2</em></span> is
579           10.1.2.3:
580         </p>
581 <pre class="programlisting">
582 server 10.1.2.3 {
583   keys { host1-host2. ;};
584 };
585 </pre>
586 <p>
587           Multiple keys may be present, but only the first is used.
588           This directive does not contain any secrets, so it may be in a
589           world-readable
590           file.
591         </p>
592 <p>
593           If <span class="emphasis"><em>host1</em></span> sends a message that is a request
594           to that address, the message will be signed with the specified key. <span class="emphasis"><em>host1</em></span> will
595           expect any responses to signed messages to be signed with the same
596           key.
597         </p>
598 <p>
599           A similar statement must be present in <span class="emphasis"><em>host2</em></span>'s
600           configuration file (with <span class="emphasis"><em>host1</em></span>'s address) for <span class="emphasis"><em>host2</em></span> to
601           sign request messages to <span class="emphasis"><em>host1</em></span>.
602         </p>
603 </div>
604 <div class="sect2" lang="en">
605 <div class="titlepage"><div><div><h3 class="title">
606 <a name="id2571325"></a>TSIG Key Based Access Control</h3></div></div></div>
607 <p>
608           <acronym class="acronym">BIND</acronym> allows IP addresses and ranges
609           to be specified in ACL
610           definitions and
611           <span><strong class="command">allow-{ query | transfer | update }</strong></span>
612           directives.
613           This has been extended to allow TSIG keys also. The above key would
614           be denoted <span><strong class="command">key host1-host2.</strong></span>
615         </p>
616 <p>
617           An example of an <span><strong class="command">allow-update</strong></span> directive would be:
618         </p>
619 <pre class="programlisting">
620 allow-update { key host1-host2. ;};
621 </pre>
622 <p>
623           This allows dynamic updates to succeed only if the request
624           was signed by a key named "<span><strong class="command">host1-host2.</strong></span>".
625         </p>
626 <p>
627           You may want to read about the more powerful
628           <span><strong class="command">update-policy</strong></span> statement in
629           <a href="Bv9ARM.ch06.html#dynamic_update_policies" title="Dynamic Update Policies">the section called &#8220;Dynamic Update Policies&#8221;</a>.
630         </p>
631 </div>
632 <div class="sect2" lang="en">
633 <div class="titlepage"><div><div><h3 class="title">
634 <a name="id2571510"></a>Errors</h3></div></div></div>
635 <p>
636           The processing of TSIG signed messages can result in
637           several errors. If a signed message is sent to a non-TSIG aware
638           server, a FORMERR (format error) will be returned, since the server will not
639           understand the record. This is a result of misconfiguration,
640           since the server must be explicitly configured to send a TSIG
641           signed message to a specific server.
642         </p>
643 <p>
644           If a TSIG aware server receives a message signed by an
645           unknown key, the response will be unsigned with the TSIG
646           extended error code set to BADKEY. If a TSIG aware server
647           receives a message with a signature that does not validate, the
648           response will be unsigned with the TSIG extended error code set
649           to BADSIG. If a TSIG aware server receives a message with a time
650           outside of the allowed range, the response will be signed with
651           the TSIG extended error code set to BADTIME, and the time values
652           will be adjusted so that the response can be successfully
653           verified. In any of these cases, the message's rcode (response code) is set to
654           NOTAUTH (not authenticated).
655         </p>
656 </div>
657 </div>
658 <div class="sect1" lang="en">
659 <div class="titlepage"><div><div><h2 class="title" style="clear: both">
660 <a name="id2571524"></a>TKEY</h2></div></div></div>
661 <p><span><strong class="command">TKEY</strong></span>
662         is a mechanism for automatically generating a shared secret
663         between two hosts.  There are several "modes" of
664         <span><strong class="command">TKEY</strong></span> that specify how the key is generated
665         or assigned.  <acronym class="acronym">BIND</acronym> 9 implements only one of
666         these modes, the Diffie-Hellman key exchange.  Both hosts are
667         required to have a Diffie-Hellman KEY record (although this
668         record is not required to be present in a zone).  The
669         <span><strong class="command">TKEY</strong></span> process must use signed messages,
670         signed either by TSIG or SIG(0).  The result of
671         <span><strong class="command">TKEY</strong></span> is a shared secret that can be used to
672         sign messages with TSIG.  <span><strong class="command">TKEY</strong></span> can also be
673         used to delete shared secrets that it had previously
674         generated.
675       </p>
676 <p>
677         The <span><strong class="command">TKEY</strong></span> process is initiated by a
678         client
679         or server by sending a signed <span><strong class="command">TKEY</strong></span>
680         query
681         (including any appropriate KEYs) to a TKEY-aware server.  The
682         server response, if it indicates success, will contain a
683         <span><strong class="command">TKEY</strong></span> record and any appropriate keys.
684         After
685         this exchange, both participants have enough information to
686         determine the shared secret; the exact process depends on the
687         <span><strong class="command">TKEY</strong></span> mode.  When using the
688         Diffie-Hellman
689         <span><strong class="command">TKEY</strong></span> mode, Diffie-Hellman keys are
690         exchanged,
691         and the shared secret is derived by both participants.
692       </p>
693 </div>
694 <div class="sect1" lang="en">
695 <div class="titlepage"><div><div><h2 class="title" style="clear: both">
696 <a name="id2571709"></a>SIG(0)</h2></div></div></div>
697 <p>
698         <acronym class="acronym">BIND</acronym> 9 partially supports DNSSEC SIG(0)
699             transaction signatures as specified in RFC 2535 and RFC 2931.
700         SIG(0)
701         uses public/private keys to authenticate messages.  Access control
702         is performed in the same manner as TSIG keys; privileges can be
703         granted or denied based on the key name.
704       </p>
705 <p>
706         When a SIG(0) signed message is received, it will only be
707         verified if the key is known and trusted by the server; the server
708         will not attempt to locate and/or validate the key.
709       </p>
710 <p>
711         SIG(0) signing of multiple-message TCP streams is not
712         supported.
713       </p>
714 <p>
715         The only tool shipped with <acronym class="acronym">BIND</acronym> 9 that
716         generates SIG(0) signed messages is <span><strong class="command">nsupdate</strong></span>.
717       </p>
718 </div>
719 <div class="sect1" lang="en">
720 <div class="titlepage"><div><div><h2 class="title" style="clear: both">
721 <a name="DNSSEC"></a>DNSSEC</h2></div></div></div>
722 <p>
723         Cryptographic authentication of DNS information is possible
724         through the DNS Security (<span class="emphasis"><em>DNSSEC-bis</em></span>) extensions,
725         defined in RFC 4033, RFC 4034, and RFC 4035.
726         This section describes the creation and use of DNSSEC signed zones.
727       </p>
728 <p>
729         In order to set up a DNSSEC secure zone, there are a series
730         of steps which must be followed.  <acronym class="acronym">BIND</acronym>
731         9 ships
732         with several tools
733         that are used in this process, which are explained in more detail
734         below.  In all cases, the <code class="option">-h</code> option prints a
735         full list of parameters.  Note that the DNSSEC tools require the
736         keyset files to be in the working directory or the
737         directory specified by the <code class="option">-d</code> option, and
738         that the tools shipped with BIND 9.2.x and earlier are not compatible
739         with the current ones.
740       </p>
741 <p>
742         There must also be communication with the administrators of
743         the parent and/or child zone to transmit keys.  A zone's security
744         status must be indicated by the parent zone for a DNSSEC capable
745         resolver to trust its data.  This is done through the presence
746         or absence of a <code class="literal">DS</code> record at the
747         delegation
748         point.
749       </p>
750 <p>
751         For other servers to trust data in this zone, they must
752         either be statically configured with this zone's zone key or the
753         zone key of another zone above this one in the DNS tree.
754       </p>
755 <div class="sect2" lang="en">
756 <div class="titlepage"><div><div><h3 class="title">
757 <a name="id2571778"></a>Generating Keys</h3></div></div></div>
758 <p>
759           The <span><strong class="command">dnssec-keygen</strong></span> program is used to
760           generate keys.
761         </p>
762 <p>
763           A secure zone must contain one or more zone keys.  The
764           zone keys will sign all other records in the zone, as well as
765           the zone keys of any secure delegated zones.  Zone keys must
766           have the same name as the zone, a name type of
767           <span><strong class="command">ZONE</strong></span>, and must be usable for
768           authentication.
769           It is recommended that zone keys use a cryptographic algorithm
770           designated as "mandatory to implement" by the IETF; currently
771           the only one is RSASHA1.
772         </p>
773 <p>
774           The following command will generate a 768-bit RSASHA1 key for
775           the <code class="filename">child.example</code> zone:
776         </p>
777 <p>
778           <strong class="userinput"><code>dnssec-keygen -a RSASHA1 -b 768 -n ZONE child.example.</code></strong>
779         </p>
780 <p>
781           Two output files will be produced:
782           <code class="filename">Kchild.example.+005+12345.key</code> and
783           <code class="filename">Kchild.example.+005+12345.private</code>
784           (where
785           12345 is an example of a key tag).  The key filenames contain
786           the key name (<code class="filename">child.example.</code>),
787           algorithm (3
788           is DSA, 1 is RSAMD5, 5 is RSASHA1, etc.), and the key tag (12345 in
789           this case).
790           The private key (in the <code class="filename">.private</code>
791           file) is
792           used to generate signatures, and the public key (in the
793           <code class="filename">.key</code> file) is used for signature
794           verification.
795         </p>
796 <p>
797           To generate another key with the same properties (but with
798           a different key tag), repeat the above command.
799         </p>
800 <p>
801           The <span><strong class="command">dnssec-keyfromlabel</strong></span> program is used
802           to get a key pair from a crypto hardware and build the key
803           files. Its usage is similar to <span><strong class="command">dnssec-keygen</strong></span>.
804         </p>
805 <p>
806           The public keys should be inserted into the zone file by
807           including the <code class="filename">.key</code> files using
808           <span><strong class="command">$INCLUDE</strong></span> statements.
809         </p>
810 </div>
811 <div class="sect2" lang="en">
812 <div class="titlepage"><div><div><h3 class="title">
813 <a name="id2571925"></a>Signing the Zone</h3></div></div></div>
814 <p>
815           The <span><strong class="command">dnssec-signzone</strong></span> program is used
816           to sign a zone.
817         </p>
818 <p>
819           Any <code class="filename">keyset</code> files corresponding to
820           secure subzones should be present.  The zone signer will
821           generate <code class="literal">NSEC</code>, <code class="literal">NSEC3</code>
822           and <code class="literal">RRSIG</code> records for the zone, as
823           well as <code class="literal">DS</code> for the child zones if
824           <code class="literal">'-g'</code> is specified.  If <code class="literal">'-g'</code>
825           is not specified, then DS RRsets for the secure child
826           zones need to be added manually.
827         </p>
828 <p>
829           The following command signs the zone, assuming it is in a
830           file called <code class="filename">zone.child.example</code>.  By
831                 default, all zone keys which have an available private key are
832                 used to generate signatures.
833         </p>
834 <p>
835           <strong class="userinput"><code>dnssec-signzone -o child.example zone.child.example</code></strong>
836         </p>
837 <p>
838           One output file is produced:
839           <code class="filename">zone.child.example.signed</code>.  This
840           file
841           should be referenced by <code class="filename">named.conf</code>
842           as the
843           input file for the zone.
844         </p>
845 <p><span><strong class="command">dnssec-signzone</strong></span>
846           will also produce a keyset and dsset files and optionally a
847           dlvset file.  These are used to provide the parent zone
848           administrators with the <code class="literal">DNSKEYs</code> (or their
849           corresponding <code class="literal">DS</code> records) that are the
850           secure entry point to the zone.
851         </p>
852 </div>
853 <div class="sect2" lang="en">
854 <div class="titlepage"><div><div><h3 class="title">
855 <a name="id2572006"></a>Configuring Servers</h3></div></div></div>
856 <p>
857           To enable <span><strong class="command">named</strong></span> to respond appropriately
858           to DNS requests from DNSSEC aware clients,
859           <span><strong class="command">dnssec-enable</strong></span> must be set to yes.
860         </p>
861 <p>
862           To enable <span><strong class="command">named</strong></span> to validate answers from
863           other servers both <span><strong class="command">dnssec-enable</strong></span> and
864           <span><strong class="command">dnssec-validation</strong></span> must be set and some
865           <span><strong class="command">trusted-keys</strong></span> must be configured
866           into <code class="filename">named.conf</code>.
867         </p>
868 <p>
869           <span><strong class="command">trusted-keys</strong></span> are copies of DNSKEY RRs
870           for zones that are used to form the first link in the
871           cryptographic chain of trust.  All keys listed in
872           <span><strong class="command">trusted-keys</strong></span> (and corresponding zones)
873           are deemed to exist and only the listed keys will be used
874           to validated the DNSKEY RRset that they are from.
875         </p>
876 <p>
877           <span><strong class="command">trusted-keys</strong></span> are described in more detail
878           later in this document.
879         </p>
880 <p>
881           Unlike <acronym class="acronym">BIND</acronym> 8, <acronym class="acronym">BIND</acronym>
882           9 does not verify signatures on load, so zone keys for
883           authoritative zones do not need to be specified in the
884           configuration file.
885         </p>
886 <p>
887           After DNSSEC gets established, a typical DNSSEC configuration
888           will look something like the following.  It has a one or
889           more public keys for the root.  This allows answers from
890           outside the organization to be validated.  It will also
891           have several keys for parts of the namespace the organization
892           controls.  These are here to ensure that <span><strong class="command">named</strong></span> is immune
893           to compromises in the DNSSEC components of the security
894           of parent zones.
895         </p>
896 <pre class="programlisting">
897 trusted-keys {
898
899         /* Root Key */
900 "." 257 3 3 "BNY4wrWM1nCfJ+CXd0rVXyYmobt7sEEfK3clRbGaTwSJxrGkxJWoZu6I7PzJu/
901              E9gx4UC1zGAHlXKdE4zYIpRhaBKnvcC2U9mZhkdUpd1Vso/HAdjNe8LmMlnzY3
902              zy2Xy4klWOADTPzSv9eamj8V18PHGjBLaVtYvk/ln5ZApjYghf+6fElrmLkdaz
903              MQ2OCnACR817DF4BBa7UR/beDHyp5iWTXWSi6XmoJLbG9Scqc7l70KDqlvXR3M
904              /lUUVRbkeg1IPJSidmK3ZyCllh4XSKbje/45SKucHgnwU5jefMtq66gKodQj+M
905              iA21AfUVe7u99WzTLzY3qlxDhxYQQ20FQ97S+LKUTpQcq27R7AT3/V5hRQxScI
906              Nqwcz4jYqZD2fQdgxbcDTClU0CRBdiieyLMNzXG3";
907
908 /* Key for our organization's forward zone */
909 example.com. 257 3 5 "AwEAAaxPMcR2x0HbQV4WeZB6oEDX+r0QM65KbhTjrW1ZaARmPhEZZe
910                       3Y9ifgEuq7vZ/zGZUdEGNWy+JZzus0lUptwgjGwhUS1558Hb4JKUbb
911                       OTcM8pwXlj0EiX3oDFVmjHO444gLkBO UKUf/mC7HvfwYH/Be22GnC
912                       lrinKJp1Og4ywzO9WglMk7jbfW33gUKvirTHr25GL7STQUzBb5Usxt
913                       8lgnyTUHs1t3JwCY5hKZ6CqFxmAVZP20igTixin/1LcrgX/KMEGd/b
914                       iuvF4qJCyduieHukuY3H4XMAcR+xia2 nIUPvm/oyWR8BW/hWdzOvn
915                       SCThlHf3xiYleDbt/o1OTQ09A0=";
916
917 /* Key for our reverse zone. */
918 2.0.192.IN-ADDRPA.NET. 257 3 5 "AQOnS4xn/IgOUpBPJ3bogzwcxOdNax071L18QqZnQQQA
919                                 VVr+iLhGTnNGp3HoWQLUIzKrJVZ3zggy3WwNT6kZo6c0
920                                 tszYqbtvchmgQC8CzKojM/W16i6MG/ea fGU3siaOdS0
921                                 yOI6BgPsw+YZdzlYMaIJGf4M4dyoKIhzdZyQ2bYQrjyQ
922                                 4LB0lC7aOnsMyYKHHYeRv PxjIQXmdqgOJGq+vsevG06
923                                 zW+1xgYJh9rCIfnm1GX/KMgxLPG2vXTD/RnLX+D3T3UL
924                                 7HJYHJhAZD5L59VvjSPsZJHeDCUyWYrvPZesZDIRvhDD
925                                 52SKvbheeTJUm6EhkzytNN2SN96QRk8j/iI8ib";
926 };
927
928 options {
929         ...
930         dnssec-enable yes;
931         dnssec-validation yes;
932 };
933 </pre>
934 <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
935 <h3 class="title">Note</h3>
936           None of the keys listed in this example are valid.  In particular,
937           the root key is not valid.
938         </div>
939 </div>
940 </div>
941 <div class="sect1" lang="en">
942 <div class="titlepage"><div><div><h2 class="title" style="clear: both">
943 <a name="id2572220"></a>IPv6 Support in <acronym class="acronym">BIND</acronym> 9</h2></div></div></div>
944 <p>
945         <acronym class="acronym">BIND</acronym> 9 fully supports all currently
946         defined forms of IPv6
947         name to address and address to name lookups.  It will also use
948         IPv6 addresses to make queries when running on an IPv6 capable
949         system.
950       </p>
951 <p>
952         For forward lookups, <acronym class="acronym">BIND</acronym> 9 supports
953         only AAAA records.  RFC 3363 deprecated the use of A6 records,
954         and client-side support for A6 records was accordingly removed
955         from <acronym class="acronym">BIND</acronym> 9.
956         However, authoritative <acronym class="acronym">BIND</acronym> 9 name servers still
957         load zone files containing A6 records correctly, answer queries
958         for A6 records, and accept zone transfer for a zone containing A6
959         records.
960       </p>
961 <p>
962         For IPv6 reverse lookups, <acronym class="acronym">BIND</acronym> 9 supports
963         the traditional "nibble" format used in the
964         <span class="emphasis"><em>ip6.arpa</em></span> domain, as well as the older, deprecated
965         <span class="emphasis"><em>ip6.int</em></span> domain.
966         Older versions of <acronym class="acronym">BIND</acronym> 9 
967         supported the "binary label" (also known as "bitstring") format,
968         but support of binary labels has been completely removed per
969         RFC 3363.
970         Many applications in <acronym class="acronym">BIND</acronym> 9 do not understand
971         the binary label format at all any more, and will return an
972         error if given.
973         In particular, an authoritative <acronym class="acronym">BIND</acronym> 9
974         name server will not load a zone file containing binary labels.
975       </p>
976 <p>
977         For an overview of the format and structure of IPv6 addresses,
978         see <a href="Bv9ARM.ch09.html#ipv6addresses" title="IPv6 addresses (AAAA)">the section called &#8220;IPv6 addresses (AAAA)&#8221;</a>.
979       </p>
980 <div class="sect2" lang="en">
981 <div class="titlepage"><div><div><h3 class="title">
982 <a name="id2572282"></a>Address Lookups Using AAAA Records</h3></div></div></div>
983 <p>
984           The IPv6 AAAA record is a parallel to the IPv4 A record,
985           and, unlike the deprecated A6 record, specifies the entire
986           IPv6 address in a single record.  For example,
987         </p>
988 <pre class="programlisting">
989 $ORIGIN example.com.
990 host            3600    IN      AAAA    2001:db8::1
991 </pre>
992 <p>
993           Use of IPv4-in-IPv6 mapped addresses is not recommended.
994           If a host has an IPv4 address, use an A record, not
995           a AAAA, with <code class="literal">::ffff:192.168.42.1</code> as
996           the address.
997         </p>
998 </div>
999 <div class="sect2" lang="en">
1000 <div class="titlepage"><div><div><h3 class="title">
1001 <a name="id2572304"></a>Address to Name Lookups Using Nibble Format</h3></div></div></div>
1002 <p>
1003           When looking up an address in nibble format, the address
1004           components are simply reversed, just as in IPv4, and
1005           <code class="literal">ip6.arpa.</code> is appended to the
1006           resulting name.
1007           For example, the following would provide reverse name lookup for
1008           a host with address
1009           <code class="literal">2001:db8::1</code>.
1010         </p>
1011 <pre class="programlisting">
1012 $ORIGIN 0.0.0.0.0.0.0.0.8.b.d.0.1.0.0.2.ip6.arpa.
1013 1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0   14400 IN      PTR     host.example.com.
1014 </pre>
1015 </div>
1016 </div>
1017 </div>
1018 <div class="navfooter">
1019 <hr>
1020 <table width="100%" summary="Navigation footer">
1021 <tr>
1022 <td width="40%" align="left">
1023 <a accesskey="p" href="Bv9ARM.ch03.html">Prev</a> </td>
1024 <td width="20%" align="center"> </td>
1025 <td width="40%" align="right"> <a accesskey="n" href="Bv9ARM.ch05.html">Next</a>
1026 </td>
1027 </tr>
1028 <tr>
1029 <td width="40%" align="left" valign="top">Chapter 3. Name Server Configuration </td>
1030 <td width="20%" align="center"><a accesskey="h" href="Bv9ARM.html">Home</a></td>
1031 <td width="40%" align="right" valign="top"> Chapter 5. The <acronym class="acronym">BIND</acronym> 9 Lightweight Resolver</td>
1032 </tr>
1033 </table>
1034 </div>
1035 </body>
1036 </html>