]> CyberLeo.Net >> Repos - FreeBSD/releng/9.2.git/blob - contrib/bind9/bin/dnssec/dnssec-keygen.docbook
- Copy stable/9 to releng/9.2 as part of the 9.2-RELEASE cycle.
[FreeBSD/releng/9.2.git] / contrib / bind9 / bin / dnssec / dnssec-keygen.docbook
1 <!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
2                "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd"
3                [<!ENTITY mdash "&#8212;">]>
4 <!--
5  - Copyright (C) 2004, 2005, 2007-2010, 2012  Internet Systems Consortium, Inc. ("ISC")
6  - Copyright (C) 2000-2003  Internet Software Consortium.
7  -
8  - Permission to use, copy, modify, and/or distribute this software for any
9  - purpose with or without fee is hereby granted, provided that the above
10  - copyright notice and this permission notice appear in all copies.
11  -
12  - THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
13  - REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
14  - AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
15  - INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
16  - LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
17  - OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
18  - PERFORMANCE OF THIS SOFTWARE.
19 -->
20
21 <!-- $Id: dnssec-keygen.docbook,v 1.36 2010/12/23 04:07:59 marka Exp $ -->
22 <refentry id="man.dnssec-keygen">
23   <refentryinfo>
24     <date>June 30, 2000</date>
25   </refentryinfo>
26
27   <refmeta>
28     <refentrytitle><application>dnssec-keygen</application></refentrytitle>
29     <manvolnum>8</manvolnum>
30     <refmiscinfo>BIND9</refmiscinfo>
31   </refmeta>
32
33   <refnamediv>
34     <refname><application>dnssec-keygen</application></refname>
35     <refpurpose>DNSSEC key generation tool</refpurpose>
36   </refnamediv>
37
38   <docinfo>
39     <copyright>
40       <year>2004</year>
41       <year>2005</year>
42       <year>2007</year>
43       <year>2008</year>
44       <year>2009</year>
45       <year>2010</year>
46       <year>2012</year>
47       <holder>Internet Systems Consortium, Inc. ("ISC")</holder>
48     </copyright>
49     <copyright>
50       <year>2000</year>
51       <year>2001</year>
52       <year>2002</year>
53       <year>2003</year>
54       <holder>Internet Software Consortium.</holder>
55     </copyright>
56   </docinfo>
57
58   <refsynopsisdiv>
59     <cmdsynopsis>
60       <command>dnssec-keygen</command>
61       <arg><option>-a <replaceable class="parameter">algorithm</replaceable></option></arg>
62       <arg ><option>-b <replaceable class="parameter">keysize</replaceable></option></arg>
63       <arg><option>-n <replaceable class="parameter">nametype</replaceable></option></arg>
64       <arg><option>-3</option></arg>
65       <arg><option>-A <replaceable class="parameter">date/offset</replaceable></option></arg>
66       <arg><option>-C</option></arg>
67       <arg><option>-c <replaceable class="parameter">class</replaceable></option></arg>
68       <arg><option>-D <replaceable class="parameter">date/offset</replaceable></option></arg>
69       <arg><option>-E <replaceable class="parameter">engine</replaceable></option></arg>
70       <arg><option>-e</option></arg>
71       <arg><option>-f <replaceable class="parameter">flag</replaceable></option></arg>
72       <arg><option>-G</option></arg>
73       <arg><option>-g <replaceable class="parameter">generator</replaceable></option></arg>
74       <arg><option>-h</option></arg>
75       <arg><option>-I <replaceable class="parameter">date/offset</replaceable></option></arg>
76       <arg><option>-i <replaceable class="parameter">interval</replaceable></option></arg>
77       <arg><option>-K <replaceable class="parameter">directory</replaceable></option></arg>
78       <arg><option>-k</option></arg>
79       <arg><option>-P <replaceable class="parameter">date/offset</replaceable></option></arg>
80       <arg><option>-p <replaceable class="parameter">protocol</replaceable></option></arg>
81       <arg><option>-q</option></arg>
82       <arg><option>-R <replaceable class="parameter">date/offset</replaceable></option></arg>
83       <arg><option>-r <replaceable class="parameter">randomdev</replaceable></option></arg>
84       <arg><option>-S <replaceable class="parameter">key</replaceable></option></arg>
85       <arg><option>-s <replaceable class="parameter">strength</replaceable></option></arg>
86       <arg><option>-t <replaceable class="parameter">type</replaceable></option></arg>
87       <arg><option>-v <replaceable class="parameter">level</replaceable></option></arg>
88       <arg><option>-z</option></arg>
89       <arg choice="req">name</arg>
90     </cmdsynopsis>
91   </refsynopsisdiv>
92
93   <refsect1>
94     <title>DESCRIPTION</title>
95     <para><command>dnssec-keygen</command>
96       generates keys for DNSSEC (Secure DNS), as defined in RFC 2535
97       and RFC 4034.  It can also generate keys for use with
98       TSIG (Transaction Signatures) as defined in RFC 2845, or TKEY
99       (Transaction Key) as defined in RFC 2930.
100     </para>
101     <para>
102       The <option>name</option> of the key is specified on the command
103       line.  For DNSSEC keys, this must match the name of the zone for
104       which the key is being generated.
105     </para>
106   </refsect1>
107
108   <refsect1>
109     <title>OPTIONS</title>
110
111     <variablelist>
112       <varlistentry>
113         <term>-a <replaceable class="parameter">algorithm</replaceable></term>
114         <listitem>
115           <para>
116             Selects the cryptographic algorithm.  For DNSSEC keys, the value
117             of <option>algorithm</option> must be one of RSAMD5, RSASHA1,
118             DSA, NSEC3RSASHA1, NSEC3DSA, RSASHA256, RSASHA512, ECCGOST,
119             ECDSAP256SHA256 or ECDSAP384SHA384.
120             For TSIG/TKEY, the value must
121             be DH (Diffie Hellman), HMAC-MD5, HMAC-SHA1, HMAC-SHA224,
122             HMAC-SHA256, HMAC-SHA384, or HMAC-SHA512.  These values are
123             case insensitive.
124           </para>
125           <para>
126             If no algorithm is specified, then RSASHA1 will be used by
127             default, unless the <option>-3</option> option is specified,
128             in which case NSEC3RSASHA1 will be used instead.  (If
129             <option>-3</option> is used and an algorithm is specified,
130             that algorithm will be checked for compatibility with NSEC3.)
131           </para>
132           <para>
133             Note 1: that for DNSSEC, RSASHA1 is a mandatory to implement
134             algorithm, and DSA is recommended.  For TSIG, HMAC-MD5 is
135             mandatory.
136           </para>
137           <para>
138             Note 2: DH, HMAC-MD5, and HMAC-SHA1 through HMAC-SHA512
139             automatically set the -T KEY option.
140           </para>
141         </listitem>
142       </varlistentry>
143
144       <varlistentry>
145         <term>-b <replaceable class="parameter">keysize</replaceable></term>
146         <listitem>
147           <para>
148             Specifies the number of bits in the key.  The choice of key
149             size depends on the algorithm used.  RSA keys must be
150             between 512 and 2048 bits.  Diffie Hellman keys must be between
151             128 and 4096 bits.  DSA keys must be between 512 and 1024
152             bits and an exact multiple of 64.  HMAC keys must be
153             between 1 and 512 bits. Elliptic curve algorithms don't need
154             this parameter.
155           </para>
156           <para>
157             The key size does not need to be specified if using a default
158             algorithm.  The default key size is 1024 bits for zone signing
159             keys (ZSK's) and 2048 bits for key signing keys (KSK's,
160             generated with <option>-f KSK</option>).  However, if an
161             algorithm is explicitly specified with the <option>-a</option>,
162             then there is no default key size, and the <option>-b</option>
163             must be used.
164           </para>
165         </listitem>
166       </varlistentry>
167
168       <varlistentry>
169         <term>-n <replaceable class="parameter">nametype</replaceable></term>
170         <listitem>
171           <para>
172             Specifies the owner type of the key.  The value of
173             <option>nametype</option> must either be ZONE (for a DNSSEC
174             zone key (KEY/DNSKEY)), HOST or ENTITY (for a key associated with
175             a host (KEY)),
176             USER (for a key associated with a user(KEY)) or OTHER (DNSKEY).
177             These values are case insensitive.  Defaults to ZONE for DNSKEY
178             generation.
179           </para>
180         </listitem>
181       </varlistentry>
182
183       <varlistentry>
184         <term>-3</term>
185         <listitem>
186           <para>
187             Use an NSEC3-capable algorithm to generate a DNSSEC key.
188             If this option is used and no algorithm is explicitly
189             set on the command line, NSEC3RSASHA1 will be used by
190             default. Note that RSASHA256, RSASHA512, ECCGOST,
191             ECDSAP256SHA256 and ECDSAP384SHA384 algorithms
192             are NSEC3-capable.
193           </para>
194         </listitem>
195       </varlistentry>
196
197       <varlistentry>
198         <term>-C</term>
199         <listitem>
200           <para>
201             Compatibility mode:  generates an old-style key, without
202             any metadata.  By default, <command>dnssec-keygen</command>
203             will include the key's creation date in the metadata stored
204             with the private key, and other dates may be set there as well
205             (publication date, activation date, etc).  Keys that include
206             this data may be incompatible with older versions of BIND; the
207             <option>-C</option> option suppresses them.
208           </para>
209         </listitem>
210       </varlistentry>
211
212       <varlistentry>
213         <term>-c <replaceable class="parameter">class</replaceable></term>
214         <listitem>
215           <para>
216             Indicates that the DNS record containing the key should have
217             the specified class.  If not specified, class IN is used.
218           </para>
219         </listitem>
220       </varlistentry>
221
222       <varlistentry>
223         <term>-E <replaceable class="parameter">engine</replaceable></term>
224         <listitem>
225           <para>
226             Uses a crypto hardware (OpenSSL engine) for random number
227             and, when supported, key generation. When compiled with PKCS#11
228             support it defaults to pkcs11; the empty name resets it to
229             no engine.
230           </para>
231         </listitem>
232       </varlistentry>
233
234       <varlistentry>
235         <term>-e</term>
236         <listitem>
237           <para>
238             If generating an RSAMD5/RSASHA1 key, use a large exponent.
239           </para>
240         </listitem>
241       </varlistentry>
242
243       <varlistentry>
244         <term>-f <replaceable class="parameter">flag</replaceable></term>
245         <listitem>
246           <para>
247             Set the specified flag in the flag field of the KEY/DNSKEY record.
248             The only recognized flags are KSK (Key Signing Key) and REVOKE.
249           </para>
250         </listitem>
251       </varlistentry>
252
253       <varlistentry>
254         <term>-G</term>
255         <listitem>
256           <para>
257             Generate a key, but do not publish it or sign with it.  This
258             option is incompatible with -P and -A.
259           </para>
260         </listitem>
261       </varlistentry>
262
263       <varlistentry>
264         <term>-g <replaceable class="parameter">generator</replaceable></term>
265         <listitem>
266           <para>
267             If generating a Diffie Hellman key, use this generator.
268             Allowed values are 2 and 5.  If no generator
269             is specified, a known prime from RFC 2539 will be used
270             if possible; otherwise the default is 2.
271           </para>
272         </listitem>
273       </varlistentry>
274
275       <varlistentry>
276         <term>-h</term>
277         <listitem>
278           <para>
279             Prints a short summary of the options and arguments to
280             <command>dnssec-keygen</command>.
281           </para>
282         </listitem>
283       </varlistentry>
284
285       <varlistentry>
286         <term>-K <replaceable class="parameter">directory</replaceable></term>
287         <listitem>
288           <para>
289             Sets the directory in which the key files are to be written.
290           </para>
291         </listitem>
292       </varlistentry>
293
294       <varlistentry>
295         <term>-k</term>
296         <listitem>
297           <para>
298             Deprecated in favor of -T KEY.
299           </para>
300         </listitem>
301       </varlistentry>
302
303       <varlistentry>
304         <term>-p <replaceable class="parameter">protocol</replaceable></term>
305         <listitem>
306           <para>
307             Sets the protocol value for the generated key.  The protocol
308             is a number between 0 and 255.  The default is 3 (DNSSEC).
309             Other possible values for this argument are listed in
310             RFC 2535 and its successors.
311           </para>
312         </listitem>
313       </varlistentry>
314
315       <varlistentry>
316         <term>-q</term>
317         <listitem>
318           <para>
319             Quiet mode: Suppresses unnecessary output, including
320             progress indication.  Without this option, when
321             <command>dnssec-keygen</command> is run interactively
322             to generate an RSA or DSA key pair, it will print a string
323             of symbols to <filename>stderr</filename> indicating the
324             progress of the key generation.  A '.' indicates that a
325             random number has been found which passed an initial
326             sieve test; '+' means a number has passed a single
327             round of the Miller-Rabin primality test; a space
328             means that the number has passed all the tests and is
329             a satisfactory key.
330           </para>
331         </listitem>
332       </varlistentry>
333
334       <varlistentry>
335         <term>-r <replaceable class="parameter">randomdev</replaceable></term>
336         <listitem>
337           <para>
338             Specifies the source of randomness.  If the operating
339             system does not provide a <filename>/dev/random</filename>
340             or equivalent device, the default source of randomness
341             is keyboard input.  <filename>randomdev</filename>
342             specifies
343             the name of a character device or file containing random
344             data to be used instead of the default.  The special value
345             <filename>keyboard</filename> indicates that keyboard
346             input should be used.
347           </para>
348         </listitem>
349       </varlistentry>
350
351       <varlistentry>
352         <term>-S <replaceable class="parameter">key</replaceable></term>
353         <listitem>
354           <para>
355             Create a new key which is an explicit successor to an
356             existing key.  The name, algorithm, size, and type of the
357             key will be set to match the existing key.  The activation
358             date of the new key will be set to the inactivation date of
359             the existing one.  The publication date will be set to the
360             activation date minus the prepublication interval, which
361             defaults to 30 days.
362           </para>
363         </listitem>
364       </varlistentry>
365
366       <varlistentry>
367         <term>-s <replaceable class="parameter">strength</replaceable></term>
368         <listitem>
369           <para>
370             Specifies the strength value of the key.  The strength is
371             a number between 0 and 15, and currently has no defined
372             purpose in DNSSEC.
373           </para>
374         </listitem>
375       </varlistentry>
376
377       <varlistentry>
378         <term>-T <replaceable class="parameter">rrtype</replaceable></term>
379         <listitem>
380           <para>
381             Specifies the resource record type to use for the key.
382             <option>rrtype</option> must be either DNSKEY or KEY.  The
383             default is DNSKEY when using a DNSSEC algorithm, but it can be
384             overridden to KEY for use with SIG(0).
385           <para>
386           </para>
387             Using any TSIG algorithm (HMAC-* or DH) forces this option
388             to KEY.
389           </para>
390         </listitem>
391       </varlistentry>
392
393       <varlistentry>
394         <term>-t <replaceable class="parameter">type</replaceable></term>
395         <listitem>
396           <para>
397             Indicates the use of the key.  <option>type</option> must be
398             one of AUTHCONF, NOAUTHCONF, NOAUTH, or NOCONF.  The default
399             is AUTHCONF.  AUTH refers to the ability to authenticate
400             data, and CONF the ability to encrypt data.
401           </para>
402         </listitem>
403       </varlistentry>
404
405       <varlistentry>
406         <term>-v <replaceable class="parameter">level</replaceable></term>
407         <listitem>
408           <para>
409             Sets the debugging level.
410           </para>
411         </listitem>
412       </varlistentry>
413
414     </variablelist>
415   </refsect1>
416
417   <refsect1>
418     <title>TIMING OPTIONS</title>
419
420     <para>
421       Dates can be expressed in the format YYYYMMDD or YYYYMMDDHHMMSS.
422       If the argument begins with a '+' or '-', it is interpreted as
423       an offset from the present time.  For convenience, if such an offset
424       is followed by one of the suffixes 'y', 'mo', 'w', 'd', 'h', or 'mi',
425       then the offset is computed in years (defined as 365 24-hour days,
426       ignoring leap years), months (defined as 30 24-hour days), weeks,
427       days, hours, or minutes, respectively.  Without a suffix, the offset
428       is computed in seconds.
429     </para>
430
431     <variablelist>
432       <varlistentry>
433         <term>-P <replaceable class="parameter">date/offset</replaceable></term>
434         <listitem>
435           <para>
436             Sets the date on which a key is to be published to the zone.
437             After that date, the key will be included in the zone but will
438             not be used to sign it.  If not set, and if the -G option has
439             not been used, the default is "now".
440           </para>
441         </listitem>
442       </varlistentry>
443
444       <varlistentry>
445         <term>-A <replaceable class="parameter">date/offset</replaceable></term>
446         <listitem>
447           <para>
448             Sets the date on which the key is to be activated.  After that
449             date, the key will be included in the zone and used to sign
450             it.  If not set, and if the -G option has not been used, the
451             default is "now".
452           </para>
453         </listitem>
454       </varlistentry>
455
456       <varlistentry>
457         <term>-R <replaceable class="parameter">date/offset</replaceable></term>
458         <listitem>
459           <para>
460             Sets the date on which the key is to be revoked.  After that
461             date, the key will be flagged as revoked.  It will be included
462             in the zone and will be used to sign it.
463           </para>
464         </listitem>
465       </varlistentry>
466
467       <varlistentry>
468         <term>-I <replaceable class="parameter">date/offset</replaceable></term>
469         <listitem>
470           <para>
471             Sets the date on which the key is to be retired.  After that
472             date, the key will still be included in the zone, but it
473             will not be used to sign it.
474           </para>
475         </listitem>
476       </varlistentry>
477
478       <varlistentry>
479         <term>-D <replaceable class="parameter">date/offset</replaceable></term>
480         <listitem>
481           <para>
482             Sets the date on which the key is to be deleted.  After that
483             date, the key will no longer be included in the zone.  (It
484             may remain in the key repository, however.)
485           </para>
486         </listitem>
487       </varlistentry>
488
489       <varlistentry>
490         <term>-i <replaceable class="parameter">interval</replaceable></term>
491         <listitem>
492           <para>
493             Sets the prepublication interval for a key.  If set, then
494             the publication and activation dates must be separated by at least
495             this much time.  If the activation date is specified but the
496             publication date isn't, then the publication date will default
497             to this much time before the activation date; conversely, if
498             the publication date is specified but activation date isn't,
499             then activation will be set to this much time after publication.
500           </para>
501           <para>
502             If the key is being created as an explicit successor to another
503             key, then the default prepublication interval is 30 days; 
504             otherwise it is zero.
505           </para>
506           <para>
507             As with date offsets, if the argument is followed by one of
508             the suffixes 'y', 'mo', 'w', 'd', 'h', or 'mi', then the
509             interval is measured in years, months, weeks, days, hours,
510             or minutes, respectively.  Without a suffix, the interval is
511             measured in seconds.
512           </para>
513         </listitem>
514       </varlistentry>
515
516     </variablelist>
517   </refsect1>
518
519
520   <refsect1>
521     <title>GENERATED KEYS</title>
522     <para>
523       When <command>dnssec-keygen</command> completes
524       successfully,
525       it prints a string of the form <filename>Knnnn.+aaa+iiiii</filename>
526       to the standard output.  This is an identification string for
527       the key it has generated.
528     </para>
529     <itemizedlist>
530       <listitem>
531         <para><filename>nnnn</filename> is the key name.
532         </para>
533       </listitem>
534       <listitem>
535         <para><filename>aaa</filename> is the numeric representation
536           of the
537           algorithm.
538         </para>
539       </listitem>
540       <listitem>
541         <para><filename>iiiii</filename> is the key identifier (or
542           footprint).
543         </para>
544       </listitem>
545     </itemizedlist>
546     <para><command>dnssec-keygen</command> 
547       creates two files, with names based
548       on the printed string.  <filename>Knnnn.+aaa+iiiii.key</filename>
549       contains the public key, and
550       <filename>Knnnn.+aaa+iiiii.private</filename> contains the
551       private
552       key.
553     </para>
554     <para>
555       The <filename>.key</filename> file contains a DNS KEY record
556       that
557       can be inserted into a zone file (directly or with a $INCLUDE
558       statement).
559     </para>
560     <para>
561       The <filename>.private</filename> file contains
562       algorithm-specific
563       fields.  For obvious security reasons, this file does not have
564       general read permission.
565     </para>
566     <para>
567       Both <filename>.key</filename> and <filename>.private</filename>
568       files are generated for symmetric encryption algorithms such as
569       HMAC-MD5, even though the public and private key are equivalent.
570     </para>
571   </refsect1>
572
573   <refsect1>
574     <title>EXAMPLE</title>
575     <para>
576       To generate a 768-bit DSA key for the domain
577       <userinput>example.com</userinput>, the following command would be
578       issued:
579     </para>
580     <para><userinput>dnssec-keygen -a DSA -b 768 -n ZONE example.com</userinput>
581     </para>
582     <para>
583       The command would print a string of the form:
584     </para>
585     <para><userinput>Kexample.com.+003+26160</userinput>
586     </para>
587     <para>
588       In this example, <command>dnssec-keygen</command> creates
589       the files <filename>Kexample.com.+003+26160.key</filename>
590       and
591       <filename>Kexample.com.+003+26160.private</filename>.
592     </para>
593   </refsect1>
594
595   <refsect1>
596     <title>SEE ALSO</title>
597     <para><citerefentry>
598         <refentrytitle>dnssec-signzone</refentrytitle><manvolnum>8</manvolnum>
599       </citerefentry>,
600       <citetitle>BIND 9 Administrator Reference Manual</citetitle>,
601       <citetitle>RFC 2539</citetitle>,
602       <citetitle>RFC 2845</citetitle>,
603       <citetitle>RFC 4034</citetitle>.
604     </para>
605   </refsect1>
606
607   <refsect1>
608     <title>AUTHOR</title>
609     <para><corpauthor>Internet Systems Consortium</corpauthor>
610     </para>
611   </refsect1>
612
613 </refentry><!--
614  - Local variables:
615  - mode: sgml
616  - End:
617 -->