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