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