]> CyberLeo.Net >> Repos - FreeBSD/releng/10.3.git/blob - contrib/ntp/util/invoke-ntp-keygen.texi
Fix multiple vulnerabilities in ntp. [SA-18:02.ntp]
[FreeBSD/releng/10.3.git] / contrib / ntp / util / invoke-ntp-keygen.texi
1 @node ntp-keygen Invocation
2 @section Invoking ntp-keygen
3 @pindex ntp-keygen
4 @cindex Create a NTP host key
5 @ignore
6 #
7 # EDIT THIS FILE WITH CAUTION  (invoke-ntp-keygen.texi)
8 #
9 # It has been AutoGen-ed  February 27, 2018 at 05:15:57 PM by AutoGen 5.18.5
10 # From the definitions    ntp-keygen-opts.def
11 # and the template file   agtexi-cmd.tpl
12 @end ignore
13
14
15
16 This program generates cryptographic data files used by the NTPv4
17 authentication and identification schemes.
18 It can generate message digest keys used in symmetric key cryptography and,
19 if the OpenSSL software library has been installed, it can generate host keys,
20 signing keys, certificates, and identity keys and parameters used in Autokey
21 public key cryptography.
22 These files are used for cookie encryption,
23 digital signature, and challenge/response identification algorithms
24 compatible with the Internet standard security infrastructure.
25
26 The message digest symmetric keys file is generated in a format
27 compatible with NTPv3.
28 All other files are in PEM-encoded printable ASCII format,
29 so they can be embedded as MIME attachments in email to other sites
30 and certificate authorities.
31 By default, files are not encrypted.
32
33 When used to generate message digest symmetric keys, the program
34 produces a file containing ten pseudo-random printable ASCII strings
35 suitable for the MD5 message digest algorithm included in the
36 distribution.
37 If the OpenSSL library is installed, it produces an additional ten
38 hex-encoded random bit strings suitable for SHA1, AES-128-CMAC, and
39 other message digest algorithms.
40 The message digest symmetric keys file must be distributed and stored
41 using secure means beyond the scope of NTP itself.
42 Besides the keys used for ordinary NTP associations, additional keys
43 can be defined as passwords for the
44 @code{ntpq(1ntpqmdoc)}
45 and
46 @code{ntpdc(1ntpdcmdoc)}
47 utility programs.
48
49 The remaining generated files are compatible with other OpenSSL
50 applications and other Public Key Infrastructure (PKI) resources.
51 Certificates generated by this program are compatible with extant
52 industry practice, although some users might find the interpretation of
53 X509v3 extension fields somewhat liberal.
54 However, the identity keys are probably not compatible with anything
55 other than Autokey.
56
57 Some files used by this program are encrypted using a private password.
58 The
59 @code{-p}
60 option specifies the read password for local encrypted files and the
61 @code{-q}
62 option the write password for encrypted files sent to remote sites.
63 If no password is specified, the host name returned by the Unix
64 @code{hostname(1)}
65 command, normally the DNS name of the host, is used as the the default read
66 password, for convenience.
67 The
68 @code{ntp-keygen}
69 program prompts for the password if it reads an encrypted file
70 and the password is missing or incorrect.
71 If an encrypted file is read successfully and
72 no write password is specified, the read password is used
73 as the write password by default.
74
75 The
76 @code{pw}
77 option of the
78 @code{crypto}
79 @code{ntpd(1ntpdmdoc)}
80 configuration command specifies the read
81 password for previously encrypted local files.
82 This must match the local read password used by this program.
83 If not specified, the host name is used.
84 Thus, if files are generated by this program without an explicit password,
85 they can be read back by
86 @code{ntpd(1ntpdmdoc)}
87 without specifying an explicit password but only on the same host.
88 If the write password used for encryption is specified as the host name,
89 these files can be read by that host with no explicit password.
90
91 Normally, encrypted files for each host are generated by that host and
92 used only by that host, although exceptions exist as noted later on
93 this page.
94 The symmetric keys file, normally called
95 @file{ntp.keys},
96 is usually installed in
97 @file{/etc}.
98 Other files and links are usually installed in
99 @file{/usr/local/etc},
100 which is normally in a shared filesystem in
101 NFS-mounted networks and cannot be changed by shared clients.
102 In these cases, NFS clients can specify the files in another
103 directory such as
104 @file{/etc}
105 using the
106 @code{keysdir}
107 @code{ntpd(1ntpdmdoc)}
108 configuration file command.
109
110 This program directs commentary and error messages to the standard
111 error stream
112 @file{stderr}
113 and remote files to the standard output stream
114 @file{stdout}
115 where they can be piped to other applications or redirected to files.
116 The names used for generated files and links all begin with the
117 string
118 @file{ntpkey*}
119 and include the file type, generating host and filestamp,
120 as described in the
121 @ref{Cryptographic Data Files}
122 section below.
123
124 @subsubsection Running the Program
125 The safest way to run the
126 @code{ntp-keygen}
127 program is logged in directly as root.
128 The recommended procedure is change to the
129 @kbd{keys}
130 directory, usually
131 @file{/usr/local/etc},
132 then run the program.
133
134 To test and gain experience with Autokey concepts, log in as root and
135 change to the
136 @kbd{keys}
137 directory, usually
138 @file{/usr/local/etc}.
139 When run for the first time, or if all files with names beginning with
140 @file{ntpkey*}
141 have been removed, use the
142 @code{ntp-keygen}
143 command without arguments to generate a default
144 @code{RSA}
145 host key and matching
146 @code{RSA-MD5}
147 certificate file with expiration date one year hence,
148 which is all that is necessary in many cases.
149 The program also generates soft links from the generic names
150 to the respective files.
151 If run again without options, the program uses the
152 existing keys and parameters and generates a new certificate file with
153 new expiration date one year hence, and soft link.
154
155 The host key is used to encrypt the cookie when required and so must be
156 @code{RSA}
157 type.
158 By default, the host key is also the sign key used to encrypt signatures.
159 When necessary, a different sign key can be specified and this can be
160 either
161 @code{RSA}
162 or
163 @code{DSA}
164 type.
165 By default, the message digest type is
166 @code{MD5},
167 but any combination
168 of sign key type and message digest type supported by the OpenSSL library
169 can be specified, including those using the
170 @code{AES128CMAC}, @code{MD2}, @code{MD5}, @code{MDC2}, @code{SHA}, @code{SHA1}
171 and
172 @code{RIPE160}
173 message digest algorithms.
174 However, the scheme specified in the certificate must be compatible
175 with the sign key.
176 Certificates using any digest algorithm are compatible with
177 @code{RSA}
178 sign keys;
179 however, only
180 @code{SHA}
181 and
182 @code{SHA1}
183 certificates are compatible with
184 @code{DSA}
185 sign keys.
186
187 Private/public key files and certificates are compatible with
188 other OpenSSL applications and very likely other libraries as well.
189 Certificates or certificate requests derived from them should be compatible
190 with extant industry practice, although some users might find
191 the interpretation of X509v3 extension fields somewhat liberal.
192 However, the identification parameter files, although encoded
193 as the other files, are probably not compatible with anything other than Autokey.
194
195 Running the program as other than root and using the Unix
196 @code{su(1)}
197 command
198 to assume root may not work properly, since by default the OpenSSL library
199 looks for the random seed file
200 @file{.rnd}
201 in the user home directory.
202 However, there should be only one
203 @file{.rnd},
204 most conveniently
205 in the root directory, so it is convenient to define the
206 .Ev RANDFILE
207 environment variable used by the OpenSSL library as the path to
208 @file{.rnd}.
209
210 Installing the keys as root might not work in NFS-mounted
211 shared file systems, as NFS clients may not be able to write
212 to the shared keys directory, even as root.
213 In this case, NFS clients can specify the files in another
214 directory such as
215 @file{/etc}
216 using the
217 @code{keysdir}
218 @code{ntpd(1ntpdmdoc)}
219 configuration file command.
220 There is no need for one client to read the keys and certificates
221 of other clients or servers, as these data are obtained automatically
222 by the Autokey protocol.
223
224 Ordinarily, cryptographic files are generated by the host that uses them,
225 but it is possible for a trusted agent (TA) to generate these files
226 for other hosts; however, in such cases files should always be encrypted.
227 The subject name and trusted name default to the hostname
228 of the host generating the files, but can be changed by command line options.
229 It is convenient to designate the owner name and trusted name
230 as the subject and issuer fields, respectively, of the certificate.
231 The owner name is also used for the host and sign key files,
232 while the trusted name is used for the identity files.
233
234 All files are installed by default in the keys directory
235 @file{/usr/local/etc},
236 which is normally in a shared filesystem
237 in NFS-mounted networks.
238 The actual location of the keys directory
239 and each file can be overridden by configuration commands,
240 but this is not recommended.
241 Normally, the files for each host are generated by that host
242 and used only by that host, although exceptions exist
243 as noted later on this page.
244
245 Normally, files containing private values,
246 including the host key, sign key and identification parameters,
247 are permitted root read/write-only;
248 while others containing public values are permitted world readable.
249 Alternatively, files containing private values can be encrypted
250 and these files permitted world readable,
251 which simplifies maintenance in shared file systems.
252 Since uniqueness is insured by the
253 @kbd{hostname}
254 and
255 @kbd{filestamp}
256 file name extensions, the files for an NTP server and
257 dependent clients can all be installed in the same shared directory.
258
259 The recommended practice is to keep the file name extensions
260 when installing a file and to install a soft link
261 from the generic names specified elsewhere on this page
262 to the generated files.
263 This allows new file generations to be activated simply
264 by changing the link.
265 If a link is present,
266 @code{ntpd(1ntpdmdoc)}
267 follows it to the file name to extract the
268 @kbd{filestamp}.
269 If a link is not present,
270 @code{ntpd(1ntpdmdoc)}
271 extracts the
272 @kbd{filestamp}
273 from the file itself.
274 This allows clients to verify that the file and generation times
275 are always current.
276 The
277 @code{ntp-keygen}
278 program uses the same
279 @kbd{filestamp}
280 extension for all files generated
281 at one time, so each generation is distinct and can be readily
282 recognized in monitoring data.
283
284 Run the command on as many hosts as necessary.
285 Designate one of them as the trusted host (TH) using
286 @code{ntp-keygen}
287 with the
288 @code{-T}
289 option and configure it to synchronize from reliable Internet servers.
290 Then configure the other hosts to synchronize to the TH directly or
291 indirectly.
292 A certificate trail is created when Autokey asks the immediately
293 ascendant host towards the TH to sign its certificate, which is then
294 provided to the immediately descendant host on request.
295 All group hosts should have acyclic certificate trails ending on the TH.
296
297 The host key is used to encrypt the cookie when required and so must be
298 RSA type.
299 By default, the host key is also the sign key used to encrypt
300 signatures.
301 A different sign key can be assigned using the
302 @code{-S}
303 option and this can be either
304 @code{RSA}
305 or
306 @code{DSA}
307 type.
308 By default, the signature
309 message digest type is
310 @code{MD5},
311 but any combination of sign key type and
312 message digest type supported by the OpenSSL library can be specified
313 using the
314 @code{-c}
315 option.
316
317 The rules say cryptographic media should be generated with proventic
318 filestamps, which means the host should already be synchronized before
319 this program is run.
320 This of course creates a chicken-and-egg problem
321 when the host is started for the first time.
322 Accordingly, the host time
323 should be set by some other means, such as eyeball-and-wristwatch, at
324 least so that the certificate lifetime is within the current year.
325 After that and when the host is synchronized to a proventic source, the
326 certificate should be re-generated.
327
328 Additional information on trusted groups and identity schemes is on the
329 @quotedblleft{}Autokey Public-Key Authentication@quotedblright{}
330 page.
331
332 File names begin with the prefix
333 @file{ntpkey}_
334 and end with the suffix
335 @file{_}@kbd{hostname}. @kbd{filestamp},
336 where
337 @kbd{hostname}
338 is the owner name, usually the string returned
339 by the Unix
340 @code{hostname(1)}
341 command, and
342 @kbd{filestamp}
343 is the NTP seconds when the file was generated, in decimal digits.
344 This both guarantees uniqueness and simplifies maintenance
345 procedures, since all files can be quickly removed
346 by a
347 @code{rm} @file{ntpkey*}
348 command or all files generated
349 at a specific time can be removed by a
350 @code{rm} @file{*}@kbd{filestamp}
351 command.
352 To further reduce the risk of misconfiguration,
353 the first two lines of a file contain the file name
354 and generation date and time as comments.
355
356 @subsubsection Trusted Hosts and Groups
357 Each cryptographic configuration involves selection of a signature scheme
358 and identification scheme, called a cryptotype,
359 as explained in the
360 @ref{Authentication Options}
361 section of
362 @code{ntp.conf(5)}.
363 The default cryptotype uses
364 @code{RSA}
365 encryption,
366 @code{MD5}
367 message digest
368 and
369 @code{TC}
370 identification.
371 First, configure a NTP subnet including one or more low-stratum
372 trusted hosts from which all other hosts derive synchronization
373 directly or indirectly.
374 Trusted hosts have trusted certificates;
375 all other hosts have nontrusted certificates.
376 These hosts will automatically and dynamically build authoritative
377 certificate trails to one or more trusted hosts.
378 A trusted group is the set of all hosts that have, directly or indirectly,
379 a certificate trail ending at a trusted host.
380 The trail is defined by static configuration file entries
381 or dynamic means described on the
382 @ref{Automatic NTP Configuration Options}
383 section of
384 @code{ntp.conf(5)}.
385
386 On each trusted host as root, change to the keys directory.
387 To insure a fresh fileset, remove all
388 @file{ntpkey}
389 files.
390 Then run
391 @code{ntp-keygen}
392 @code{-T}
393 to generate keys and a trusted certificate.
394 On all other hosts do the same, but leave off the
395 @code{-T}
396 flag to generate keys and nontrusted certificates.
397 When complete, start the NTP daemons beginning at the lowest stratum
398 and working up the tree.
399 It may take some time for Autokey to instantiate the certificate trails
400 throughout the subnet, but setting up the environment is completely automatic.
401
402 If it is necessary to use a different sign key or different digest/signature
403 scheme than the default, run
404 @code{ntp-keygen}
405 with the
406 @code{-S} @kbd{type}
407 option, where
408 @kbd{type}
409 is either
410 @code{RSA}
411 or
412 @code{DSA}.
413 The most frequent need to do this is when a
414 @code{DSA}-signed
415 certificate is used.
416 If it is necessary to use a different certificate scheme than the default,
417 run
418 @code{ntp-keygen}
419 with the
420 @code{-c} @kbd{scheme}
421 option and selected
422 @kbd{scheme}
423 as needed.
424 If
425 @code{ntp-keygen}
426 is run again without these options, it generates a new certificate
427 using the same scheme and sign key, and soft link.
428
429 After setting up the environment it is advisable to update certificates
430 from time to time, if only to extend the validity interval.
431 Simply run
432 @code{ntp-keygen}
433 with the same flags as before to generate new certificates
434 using existing keys, and soft links.
435 However, if the host or sign key is changed,
436 @code{ntpd(1ntpdmdoc)}
437 should be restarted.
438 When
439 @code{ntpd(1ntpdmdoc)}
440 is restarted, it loads any new files and restarts the protocol.
441 Other dependent hosts will continue as usual until signatures are refreshed,
442 at which time the protocol is restarted.
443
444 @subsubsection Identity Schemes
445 As mentioned on the Autonomous Authentication page,
446 the default
447 @code{TC}
448 identity scheme is vulnerable to a middleman attack.
449 However, there are more secure identity schemes available,
450 including
451 @code{PC}, @code{IFF}, @code{GQ}
452 and
453 @code{MV}
454 schemes described below.
455 These schemes are based on a TA, one or more trusted hosts
456 and some number of nontrusted hosts.
457 Trusted hosts prove identity using values provided by the TA,
458 while the remaining hosts prove identity using values provided
459 by a trusted host and certificate trails that end on that host.
460 The name of a trusted host is also the name of its sugroup
461 and also the subject and issuer name on its trusted certificate.
462 The TA is not necessarily a trusted host in this sense, but often is.
463
464 In some schemes there are separate keys for servers and clients.
465 A server can also be a client of another server,
466 but a client can never be a server for another client.
467 In general, trusted hosts and nontrusted hosts that operate
468 as both server and client have parameter files that contain
469 both server and client keys.
470 Hosts that operate
471 only as clients have key files that contain only client keys.
472
473 The PC scheme supports only one trusted host in the group.
474 On trusted host alice run
475 @code{ntp-keygen}
476 @code{-P}
477 @code{-p} @kbd{password}
478 to generate the host key file
479 @file{ntpkey}_ @code{RSA} @file{key_alice.} @kbd{filestamp}
480 and trusted private certificate file
481 @file{ntpkey}_ @code{RSA-MD5} @code{_} @file{cert_alice.} @kbd{filestamp},
482 and soft links.
483 Copy both files to all group hosts;
484 they replace the files which would be generated in other schemes.
485 On each host
486 @kbd{bob}
487 install a soft link from the generic name
488 @file{ntpkey_host_}@kbd{bob}
489 to the host key file and soft link
490 @file{ntpkey_cert_}@kbd{bob}
491 to the private certificate file.
492 Note the generic links are on bob, but point to files generated
493 by trusted host alice.
494 In this scheme it is not possible to refresh
495 either the keys or certificates without copying them
496 to all other hosts in the group, and recreating the soft links.
497
498 For the
499 @code{IFF}
500 scheme proceed as in the
501 @code{TC}
502 scheme to generate keys
503 and certificates for all group hosts, then for every trusted host in the group,
504 generate the
505 @code{IFF}
506 parameter file.
507 On trusted host alice run
508 @code{ntp-keygen}
509 @code{-T}
510 @code{-I}
511 @code{-p} @kbd{password}
512 to produce her parameter file
513 @file{ntpkey_IFFpar_alice.}@kbd{filestamp},
514 which includes both server and client keys.
515 Copy this file to all group hosts that operate as both servers
516 and clients and install a soft link from the generic
517 @file{ntpkey_iff_alice}
518 to this file.
519 If there are no hosts restricted to operate only as clients,
520 there is nothing further to do.
521 As the
522 @code{IFF}
523 scheme is independent
524 of keys and certificates, these files can be refreshed as needed.
525
526 If a rogue client has the parameter file, it could masquerade
527 as a legitimate server and present a middleman threat.
528 To eliminate this threat, the client keys can be extracted
529 from the parameter file and distributed to all restricted clients.
530 After generating the parameter file, on alice run
531 @code{ntp-keygen}
532 @code{-e}
533 and pipe the output to a file or email program.
534 Copy or email this file to all restricted clients.
535 On these clients install a soft link from the generic
536 @file{ntpkey_iff_alice}
537 to this file.
538 To further protect the integrity of the keys,
539 each file can be encrypted with a secret password.
540
541 For the
542 @code{GQ}
543 scheme proceed as in the
544 @code{TC}
545 scheme to generate keys
546 and certificates for all group hosts, then for every trusted host
547 in the group, generate the
548 @code{IFF}
549 parameter file.
550 On trusted host alice run
551 @code{ntp-keygen}
552 @code{-T}
553 @code{-G}
554 @code{-p} @kbd{password}
555 to produce her parameter file
556 @file{ntpkey_GQpar_alice.}@kbd{filestamp},
557 which includes both server and client keys.
558 Copy this file to all group hosts and install a soft link
559 from the generic
560 @file{ntpkey_gq_alice}
561 to this file.
562 In addition, on each host
563 @kbd{bob}
564 install a soft link
565 from generic
566 @file{ntpkey_gq_}@kbd{bob}
567 to this file.
568 As the
569 @code{GQ}
570 scheme updates the
571 @code{GQ}
572 parameters file and certificate
573 at the same time, keys and certificates can be regenerated as needed.
574
575 For the
576 @code{MV}
577 scheme, proceed as in the
578 @code{TC}
579 scheme to generate keys
580 and certificates for all group hosts.
581 For illustration assume trish is the TA, alice one of several trusted hosts
582 and bob one of her clients.
583 On TA trish run
584 @code{ntp-keygen}
585 @code{-V} @kbd{n}
586 @code{-p} @kbd{password},
587 where
588 @kbd{n}
589 is the number of revokable keys (typically 5) to produce
590 the parameter file
591 @file{ntpkeys_MVpar_trish.}@kbd{filestamp}
592 and client key files
593 @file{ntpkeys_MVkey}@kbd{d} @kbd{_} @file{trish.} @kbd{filestamp}
594 where
595 @kbd{d}
596 is the key number (0 <
597 @kbd{d}
598 <
599 @kbd{n}).
600 Copy the parameter file to alice and install a soft link
601 from the generic
602 @file{ntpkey_mv_alice}
603 to this file.
604 Copy one of the client key files to alice for later distribution
605 to her clients.
606 It does not matter which client key file goes to alice,
607 since they all work the same way.
608 Alice copies the client key file to all of her clients.
609 On client bob install a soft link from generic
610 @file{ntpkey_mvkey_bob}
611 to the client key file.
612 As the
613 @code{MV}
614 scheme is independent of keys and certificates,
615 these files can be refreshed as needed.
616
617 @subsubsection Command Line Options
618 @table @asis
619 @item @code{-b} @code{--imbits}= @kbd{modulus}
620 Set the number of bits in the identity modulus for generating identity keys to
621 @kbd{modulus}
622 bits.
623 The number of bits in the identity modulus defaults to 256, but can be set to
624 values from 256 to 2048 (32 to 256 octets).
625 Use the larger moduli with caution, as this can consume considerable computing
626 resources and increases the size of authenticated packets.
627 @item @code{-c} @code{--certificate}= @kbd{scheme}
628 Select certificate signature encryption/message digest scheme.
629 The
630 @kbd{scheme}
631 can be one of the following:
632 @code{RSA-MD2}, @code{RSA-MD5}, @code{RSA-MDC2}, @code{RSA-SHA}, @code{RSA-SHA1}, @code{RSA-RIPEMD160}, @code{DSA-SHA},
633 or
634 @code{DSA-SHA1}.
635 Note that
636 @code{RSA}
637 schemes must be used with an
638 @code{RSA}
639 sign key and
640 @code{DSA}
641 schemes must be used with a
642 @code{DSA}
643 sign key.
644 The default without this option is
645 @code{RSA-MD5}.
646 If compatibility with FIPS 140-2 is required, either the
647 @code{DSA-SHA}
648 or
649 @code{DSA-SHA1}
650 scheme must be used.
651 @item @code{-C} @code{--cipher}= @kbd{cipher}
652 Select the OpenSSL cipher to encrypt the files containing private keys.
653 The default without this option is three-key triple DES in CBC mode,
654 @code{des-ede3-cbc}.
655 The
656 @code{openssl} @code{-h}
657 command provided with OpenSSL displays available ciphers.
658 @item @code{-d} @code{--debug-level}
659 Increase debugging verbosity level.
660 This option displays the cryptographic data produced in eye-friendly billboards.
661 @item @code{-D} @code{--set-debug-level}= @kbd{level}
662 Set the debugging verbosity to
663 @kbd{level}.
664 This option displays the cryptographic data produced in eye-friendly billboards.
665 @item @code{-e} @code{--id-key}
666 Write the
667 @code{IFF}
668 or
669 @code{GQ}
670 public parameters from the
671 @kbd{IFFkey} @kbd{or} @kbd{GQkey}
672 client keys file previously specified
673 as unencrypted data to the standard output stream
674 @file{stdout}.
675 This is intended for automatic key distribution by email.
676 @item @code{-G} @code{--gq-params}
677 Generate a new encrypted
678 @code{GQ}
679 parameters and key file for the Guillou-Quisquater (GQ) identity scheme.
680 This option is mutually exclusive with the
681 @code{-I}
682 and
683 @code{-V}
684 options.
685 @item @code{-H} @code{--host-key}
686 Generate a new encrypted
687 @code{RSA}
688 public/private host key file.
689 @item @code{-I} @code{--iffkey}
690 Generate a new encrypted
691 @code{IFF}
692 key file for the Schnorr (IFF) identity scheme.
693 This option is mutually exclusive with the
694 @code{-G}
695 and
696 Fl V
697 options.
698 @item @code{-i} @code{--ident}= @kbd{group}
699 Set the optional Autokey group name to
700 @kbd{group}.
701 This is used in the identity scheme parameter file names of
702 @code{IFF}, @code{GQ},
703 and
704 @code{MV}
705 client parameters files.
706 In that role, the default is the host name if no group is provided.
707 The group name, if specified using
708 @code{-i}
709 or
710 @code{-s}
711 following an
712 @quoteleft{}@@@quoteright{}
713 character, is also used in certificate subject and issuer names in the form
714 @kbd{host} @kbd{@@} @kbd{group}
715 and should match the group specified via
716 @code{crypto} @code{ident}
717 or
718 @code{server} @code{ident}
719 in the ntpd configuration file.
720 @item @code{-l} @code{--lifetime}= @kbd{days}
721 Set the lifetime for certificate expiration to
722 @kbd{days}.
723 The default lifetime is one year (365 days).
724 @item @code{-m} @code{--modulus}= @kbd{bits}
725 Set the number of bits in the prime modulus for generating files to
726 @kbd{bits}.
727 The modulus defaults to 512, but can be set from 256 to 2048 (32 to 256 octets).
728 Use the larger moduli with caution, as this can consume considerable computing
729 resources and increases the size of authenticated packets.
730 @item @code{-M} @code{--md5key}
731 Generate a new symmetric keys file containing 10
732 @code{MD5}
733 keys, and if OpenSSL is available, 10
734 @code{SHA}
735 keys.
736 An
737 @code{MD5}
738 key is a string of 20 random printable ASCII characters, while a
739 @code{SHA}
740 key is a string of 40 random hex digits.
741 The file can be edited using a text editor to change the key type or key content.
742 This option is mutually exclusive with all other options.
743 @item @code{-p} @code{--password}= @kbd{passwd}
744 Set the password for reading and writing encrypted files to
745 @kbd{passwd}.
746 These include the host, sign and identify key files.
747 By default, the password is the string returned by the Unix
748 @code{hostname}
749 command.
750 @item @code{-P} @code{--pvt-cert}
751 Generate a new private certificate used by the
752 @code{PC}
753 identity scheme.
754 By default, the program generates public certificates.
755 Note: the PC identity scheme is not recommended for new installations.
756 @item @code{-q} @code{--export-passwd}= @kbd{passwd}
757 Set the password for writing encrypted
758 @code{IFF}, @code{GQ} @code{and} @code{MV}
759 identity files redirected to
760 @file{stdout}
761 to
762 @kbd{passwd}.
763 In effect, these files are decrypted with the
764 @code{-p}
765 password, then encrypted with the
766 @code{-q}
767 password.
768 By default, the password is the string returned by the Unix
769 @code{hostname}
770 command.
771 @item @code{-s} @code{--subject-key}= @code{[host]} @code{[@@ @kbd{group}]}
772 Specify the Autokey host name, where
773 @kbd{host}
774 is the optional host name and
775 @kbd{group}
776 is the optional group name.
777 The host name, and if provided, group name are used in
778 @kbd{host} @kbd{@@} @kbd{group}
779 form as certificate subject and issuer.
780 Specifying
781 @code{-s} @code{-@@} @kbd{group}
782 is allowed, and results in leaving the host name unchanged, as with
783 @code{-i} @kbd{group}.
784 The group name, or if no group is provided, the host name are also used in the
785 file names of
786 @code{IFF}, @code{GQ},
787 and
788 @code{MV}
789 identity scheme client parameter files.
790 If
791 @kbd{host}
792 is not specified, the default host name is the string returned by the Unix
793 @code{hostname}
794 command.
795 @item @code{-S} @code{--sign-key}= @code{[@code{RSA} | @code{DSA}]}
796 Generate a new encrypted public/private sign key file of the specified type.
797 By default, the sign key is the host key and has the same type.
798 If compatibility with FIPS 140-2 is required, the sign key type must be
799 @code{DSA}.
800 @item @code{-T} @code{--trusted-cert}
801 Generate a trusted certificate.
802 By default, the program generates a non-trusted certificate.
803 @item @code{-V} @code{--mv-params} @kbd{nkeys}
804 Generate
805 @kbd{nkeys}
806 encrypted server keys and parameters for the Mu-Varadharajan (MV)
807 identity scheme.
808 This option is mutually exclusive with the
809 @code{-I}
810 and
811 @code{-G}
812 options.
813 Note: support for this option should be considered a work in progress.
814 @end table
815
816 @subsubsection Random Seed File
817 All cryptographically sound key generation schemes must have means
818 to randomize the entropy seed used to initialize
819 the internal pseudo-random number generator used
820 by the library routines.
821 The OpenSSL library uses a designated random seed file for this purpose.
822 The file must be available when starting the NTP daemon and
823 @code{ntp-keygen}
824 program.
825 If a site supports OpenSSL or its companion OpenSSH,
826 it is very likely that means to do this are already available.
827
828 It is important to understand that entropy must be evolved
829 for each generation, for otherwise the random number sequence
830 would be predictable.
831 Various means dependent on external events, such as keystroke intervals,
832 can be used to do this and some systems have built-in entropy sources.
833 Suitable means are described in the OpenSSL software documentation,
834 but are outside the scope of this page.
835
836 The entropy seed used by the OpenSSL library is contained in a file,
837 usually called
838 @file{.rnd},
839 which must be available when starting the NTP daemon
840 or the
841 @code{ntp-keygen}
842 program.
843 The NTP daemon will first look for the file
844 using the path specified by the
845 @code{randfile}
846 subcommand of the
847 @code{crypto}
848 configuration command.
849 If not specified in this way, or when starting the
850 @code{ntp-keygen}
851 program,
852 the OpenSSL library will look for the file using the path specified
853 by the
854 .Ev RANDFILE
855 environment variable in the user home directory,
856 whether root or some other user.
857 If the
858 .Ev RANDFILE
859 environment variable is not present,
860 the library will look for the
861 @file{.rnd}
862 file in the user home directory.
863 Since both the
864 @code{ntp-keygen}
865 program and
866 @code{ntpd(1ntpdmdoc)}
867 daemon must run as root, the logical place to put this file is in
868 @file{/.rnd}
869 or
870 @file{/root/.rnd}.
871 If the file is not available or cannot be written,
872 the daemon exits with a message to the system log and the program
873 exits with a suitable error message.
874
875 @subsubsection Cryptographic Data Files
876 All file formats begin with two nonencrypted lines.
877 The first line contains the file name, including the generated host name
878 and filestamp, in the format
879 @file{ntpkey_}@kbd{key} @kbd{_} @kbd{name}. @kbd{filestamp},
880 where
881 @kbd{key}
882 is the key or parameter type,
883 @kbd{name}
884 is the host or group name and
885 @kbd{filestamp}
886 is the filestamp (NTP seconds) when the file was created.
887 By convention,
888 @kbd{key}
889 names in generated file names include both upper and lower case
890 characters, while
891 @kbd{key}
892 names in generated link names include only lower case characters.
893 The filestamp is not used in generated link names.
894 The second line contains the datestamp in conventional Unix
895 @file{date}
896 format.
897 Lines beginning with
898 @quoteleft{}#@quoteright{}
899 are considered comments and ignored by the
900 @code{ntp-keygen}
901 program and
902 @code{ntpd(1ntpdmdoc)}
903 daemon.
904
905 The remainder of the file contains cryptographic data, encoded first using ASN.1
906 rules, then encrypted if necessary, and finally written in PEM-encoded
907 printable ASCII text, preceded and followed by MIME content identifier lines.
908
909 The format of the symmetric keys file, ordinarily named
910 @file{ntp.keys},
911 is somewhat different than the other files in the interest of backward compatibility.
912 Ordinarily, the file is generated by this program, but it can be constructed
913 and edited using an ordinary text editor.
914 @verbatim
915 # ntpkey_MD5key_bk.ntp.org.3595864945
916 # Thu Dec 12 19:22:25 2013
917
918 1  MD5 L";Nw<\`.I<f4U0)247"i  # MD5 key
919 2  MD5 &>l0%XXK9O'51VwV<xq~  # MD5 key
920 3  MD5 lb4zLW~d^!K:]RsD'qb6  # MD5 key
921 4  MD5 Yue:tL[+vR)M\`n~bY,'?  # MD5 key
922 5  MD5 B;fx'Kgr/&4ZTbL6=RxA  # MD5 key
923 6  MD5 4eYwa\`o@}3i@@@@V@@..R9!l  # MD5 key
924 7  MD5 \`A.([h+;wTQ|xfi%Sn_!  # MD5 key
925 8  MD5 45:V,r4]l6y^JH6"Sh?F  # MD5 key
926 9  MD5 3-5vcn*6l29DS?Xdsg)*  # MD5 key
927 10 MD5 2late4Me              # MD5 key
928 11 SHA1 a27872d3030a9025b8446c751b4551a7629af65c  # SHA1 key
929 12 SHA1 21bc3b4865dbb9e920902abdccb3e04ff97a5e74  # SHA1 key
930 13 SHA1 2b7736fe24fef5ba85ae11594132ab5d6f6daba9  # SHA1 key
931 14 SHA  a5332809c8878dd3a5b918819108a111509aeceb  # SHA  key
932 15 MD2  2fe16c88c760ff2f16d4267e36c1aa6c926e6964  # MD2  key
933 16 MD4  b2691811dc19cfc0e2f9bcacd74213f29812183d  # MD4  key
934 17 MD5  e4d6735b8bdad58ec5ffcb087300a17f7fef1f7c  # MD5  key
935 18 MDC2 a8d5e2315c025bf3a79174c87fbd10477de2eabc  # MDC2 key
936 19 RIPEMD160 77ca332cafb30e3cafb174dcd5b80ded7ba9b3d2  # RIPEMD160 key
937 20 AES128CMAC f92ff73eee86c1e7dc638d6489a04e4e555af878  # AES128CMAC key
938 @end verbatim
939 @example
940 Figure 1. Typical Symmetric Key File
941 @end example
942
943 Figure 1 shows a typical symmetric keys file used by the reference
944 implementation.
945 Following the header the keys are entered one per line in the format
946 @example
947 @kbd{keyno} @kbd{type} @kbd{key}
948 @end example
949 where
950 @kbd{keyno}
951 is a positive integer in the range 1-65534;
952 @kbd{type}
953 is the key type for the message digest algorithm, which in the absence of the
954 OpenSSL library must be
955 @code{MD5}
956 to designate the MD5 message digest algorithm;
957 if the OpenSSL library is installed, the key type can be any
958 message digest algorithm supported by that library;
959 however, if compatibility with FIPS 140-2 is required,
960 the key type must be either
961 @code{SHA}
962 or
963 @code{SHA1};
964 @kbd{key}
965 is the key itself,
966 which is a printable ASCII string 20 characters or less in length:
967 each character is chosen from the 93 printable characters
968 in the range 0x21 through 0x7e (
969 @quoteleft{}@quoteright{}!
970 through
971 @quoteleft{}~@quoteright{}
972 ) excluding space and the
973 @quoteleft{}#@quoteright{}
974 character, and terminated by whitespace or a
975 @quoteleft{}#@quoteright{}
976 character.
977 An OpenSSL key consists of a hex-encoded ASCII string of 40 characters, which
978 is truncated as necessary.
979
980 Note that the keys used by the
981 @code{ntpq(1ntpqmdoc)}
982 and
983 @code{ntpdc(1ntpdcmdoc)}
984 programs
985 are checked against passwords requested by the programs
986 and entered by hand, so it is generally appropriate to specify these keys
987 in human readable ASCII format.
988
989 The
990 @code{ntp-keygen}
991 program generates a symmetric keys file
992 @file{ntpkey_MD5key_}@kbd{hostname}. @kbd{filestamp}.
993 Since the file contains private shared keys,
994 it should be visible only to root and distributed by secure means
995 to other subnet hosts.
996 The NTP daemon loads the file
997 @file{ntp.keys},
998 so
999 @code{ntp-keygen}
1000 installs a soft link from this name to the generated file.
1001 Subsequently, similar soft links must be installed by manual
1002 or automated means on the other subnet hosts.
1003 While this file is not used with the Autokey Version 2 protocol,
1004 it is needed to authenticate some remote configuration commands
1005 used by the
1006 @code{ntpq(1ntpqmdoc)}
1007 and
1008 @code{ntpdc(1ntpdcmdoc)}
1009 utilities.
1010
1011 This section was generated by @strong{AutoGen},
1012 using the @code{agtexi-cmd} template and the option descriptions for the @code{ntp-keygen} program.
1013 This software is released under the NTP license, <http://ntp.org/license>.
1014
1015 @menu
1016 * ntp-keygen usage::                  ntp-keygen help/usage (@option{--help})
1017 * ntp-keygen imbits::                 imbits option (-b)
1018 * ntp-keygen certificate::            certificate option (-c)
1019 * ntp-keygen cipher::                 cipher option (-C)
1020 * ntp-keygen id-key::                 id-key option (-e)
1021 * ntp-keygen gq-params::              gq-params option (-G)
1022 * ntp-keygen host-key::               host-key option (-H)
1023 * ntp-keygen iffkey::                 iffkey option (-I)
1024 * ntp-keygen ident::                  ident option (-i)
1025 * ntp-keygen lifetime::               lifetime option (-l)
1026 * ntp-keygen modulus::                modulus option (-m)
1027 * ntp-keygen md5key::                 md5key option (-M)
1028 * ntp-keygen pvt-cert::               pvt-cert option (-P)
1029 * ntp-keygen password::               password option (-p)
1030 * ntp-keygen export-passwd::          export-passwd option (-q)
1031 * ntp-keygen subject-name::           subject-name option (-s)
1032 * ntp-keygen sign-key::               sign-key option (-S)
1033 * ntp-keygen trusted-cert::           trusted-cert option (-T)
1034 * ntp-keygen mv-params::              mv-params option (-V)
1035 * ntp-keygen mv-keys::                mv-keys option (-v)
1036 * ntp-keygen config::                 presetting/configuring ntp-keygen
1037 * ntp-keygen exit status::            exit status
1038 * ntp-keygen Usage::                  Usage
1039 * ntp-keygen Notes::                  Notes
1040 * ntp-keygen Bugs::                   Bugs
1041 @end menu
1042
1043 @node ntp-keygen usage
1044 @subsection ntp-keygen help/usage (@option{--help})
1045 @cindex ntp-keygen help
1046
1047 This is the automatically generated usage text for ntp-keygen.
1048
1049 The text printed is the same whether selected with the @code{help} option
1050 (@option{--help}) or the @code{more-help} option (@option{--more-help}).  @code{more-help} will print
1051 the usage text by passing it through a pager program.
1052 @code{more-help} is disabled on platforms without a working
1053 @code{fork(2)} function.  The @code{PAGER} environment variable is
1054 used to select the program, defaulting to @file{more}.  Both will exit
1055 with a status code of 0.
1056
1057 @exampleindent 0
1058 @example
1059 ntp-keygen (ntp) - Create a NTP host key - Ver. 4.2.7p245
1060 USAGE:  ntp-keygen [ -<flag> [<val>] | --<name>[@{=| @}<val>] ]...
1061   Flg Arg Option-Name    Description
1062    -c Str certificate    certificate scheme
1063    -C Str cipher         privatekey cipher
1064    -d no  debug-level    Increase debug verbosity level
1065                                 - may appear multiple times
1066    -D Str set-debug-level Set the debug verbosity level
1067                                 - may appear multiple times
1068    -e no  id-key         Write IFF or GQ identity keys
1069    -G no  gq-params      Generate GQ parameters and keys
1070    -H no  host-key       generate RSA host key
1071    -I no  iffkey         generate IFF parameters
1072    -i Str ident          set Autokey group name
1073    -l Num lifetime       set certificate lifetime
1074    -M no  md5key         generate MD5 keys
1075    -m Num modulus        modulus
1076                                 - It must be in the range:
1077                                   256 to 2048
1078    -P no  pvt-cert       generate PC private certificate
1079    -p Str pvt-passwd     output private password
1080    -q Str get-pvt-passwd input private password
1081    -S Str sign-key       generate sign key (RSA or DSA)
1082    -s Str subject-name   set host and optionally group name
1083    -T no  trusted-cert   trusted certificate (TC scheme)
1084    -V Num mv-params      generate <num> MV parameters
1085    -v Num mv-keys        update <num> MV keys
1086       opt version        Output version information and exit
1087    -? no  help           Display extended usage information and exit
1088    -! no  more-help      Extended usage information passed thru pager
1089    -> opt save-opts      Save the option state to a config file
1090    -< Str load-opts      Load options from a config file
1091                                 - disabled as --no-load-opts
1092                                 - may appear multiple times
1093
1094 Options are specified by doubled hyphens and their name or by a single
1095 hyphen and the flag character.
1096
1097
1098
1099 The following option preset mechanisms are supported:
1100  - reading file $HOME/.ntprc
1101  - reading file ./.ntprc
1102  - examining environment variables named NTP_KEYGEN_*
1103
1104 please send bug reports to:  http://bugs.ntp.org, bugs@@ntp.org
1105 @end example
1106 @exampleindent 4
1107
1108 @node ntp-keygen imbits
1109 @subsection imbits option (-b)
1110 @cindex ntp-keygen-imbits
1111
1112 This is the ``identity modulus bits'' option.
1113 This option takes a number argument @file{imbits}.
1114
1115 @noindent
1116 This option has some usage constraints.  It:
1117 @itemize @bullet
1118 @item
1119 must be compiled in by defining @code{AUTOKEY} during the compilation.
1120 @end itemize
1121
1122 The number of bits in the identity modulus.  The default is 256.
1123 @node ntp-keygen certificate
1124 @subsection certificate option (-c)
1125 @cindex ntp-keygen-certificate
1126
1127 This is the ``certificate scheme'' option.
1128 This option takes a string argument @file{scheme}.
1129
1130 @noindent
1131 This option has some usage constraints.  It:
1132 @itemize @bullet
1133 @item
1134 must be compiled in by defining @code{AUTOKEY} during the compilation.
1135 @end itemize
1136
1137 scheme is one of
1138 RSA-MD2, RSA-MD5, RSA-MDC2, RSA-SHA, RSA-SHA1, RSA-RIPEMD160,
1139 DSA-SHA, or DSA-SHA1.
1140
1141 Select the certificate signature encryption/message digest scheme.
1142 Note that RSA schemes must be used with a RSA sign key and DSA
1143 schemes must be used with a DSA sign key.  The default without
1144 this option is RSA-MD5.
1145 @node ntp-keygen cipher
1146 @subsection cipher option (-C)
1147 @cindex ntp-keygen-cipher
1148
1149 This is the ``privatekey cipher'' option.
1150 This option takes a string argument @file{cipher}.
1151
1152 @noindent
1153 This option has some usage constraints.  It:
1154 @itemize @bullet
1155 @item
1156 must be compiled in by defining @code{AUTOKEY} during the compilation.
1157 @end itemize
1158
1159 Select the cipher which is used to encrypt the files containing
1160 private keys.  The default is three-key triple DES in CBC mode,
1161 equivalent to "@code{-C des-ede3-cbc}".  The openssl tool lists ciphers
1162 available in "@code{openssl -h}" output.
1163 @node ntp-keygen id-key
1164 @subsection id-key option (-e)
1165 @cindex ntp-keygen-id-key
1166
1167 This is the ``write iff or gq identity keys'' option.
1168
1169 @noindent
1170 This option has some usage constraints.  It:
1171 @itemize @bullet
1172 @item
1173 must be compiled in by defining @code{AUTOKEY} during the compilation.
1174 @end itemize
1175
1176 Write the public parameters from the IFF or GQ client keys to
1177 the standard output.
1178 This is intended for automatic key distribution by email.
1179 @node ntp-keygen gq-params
1180 @subsection gq-params option (-G)
1181 @cindex ntp-keygen-gq-params
1182
1183 This is the ``generate gq parameters and keys'' option.
1184
1185 @noindent
1186 This option has some usage constraints.  It:
1187 @itemize @bullet
1188 @item
1189 must be compiled in by defining @code{AUTOKEY} during the compilation.
1190 @end itemize
1191
1192 Generate parameters and keys for the GQ identification scheme,
1193 obsoleting any that may exist.
1194 @node ntp-keygen host-key
1195 @subsection host-key option (-H)
1196 @cindex ntp-keygen-host-key
1197
1198 This is the ``generate rsa host key'' option.
1199
1200 @noindent
1201 This option has some usage constraints.  It:
1202 @itemize @bullet
1203 @item
1204 must be compiled in by defining @code{AUTOKEY} during the compilation.
1205 @end itemize
1206
1207 Generate new host keys, obsoleting any that may exist.
1208 @node ntp-keygen iffkey
1209 @subsection iffkey option (-I)
1210 @cindex ntp-keygen-iffkey
1211
1212 This is the ``generate iff parameters'' option.
1213
1214 @noindent
1215 This option has some usage constraints.  It:
1216 @itemize @bullet
1217 @item
1218 must be compiled in by defining @code{AUTOKEY} during the compilation.
1219 @end itemize
1220
1221 Generate parameters for the IFF identification scheme, obsoleting
1222 any that may exist.
1223 @node ntp-keygen ident
1224 @subsection ident option (-i)
1225 @cindex ntp-keygen-ident
1226
1227 This is the ``set autokey group name'' option.
1228 This option takes a string argument @file{group}.
1229
1230 @noindent
1231 This option has some usage constraints.  It:
1232 @itemize @bullet
1233 @item
1234 must be compiled in by defining @code{AUTOKEY} during the compilation.
1235 @end itemize
1236
1237 Set the optional Autokey group name to name.  This is used in
1238 the file name of IFF, GQ, and MV client parameters files.  In
1239 that role, the default is the host name if this option is not
1240 provided.  The group name, if specified using @code{-i/--ident} or
1241 using @code{-s/--subject-name} following an '@code{@@}' character,
1242 is also a part of the self-signed host certificate subject and
1243 issuer names in the form @code{host@@group} and should match the
1244 '@code{crypto ident}' or '@code{server ident}' configuration in the
1245 @code{ntpd} configuration file.
1246 @node ntp-keygen lifetime
1247 @subsection lifetime option (-l)
1248 @cindex ntp-keygen-lifetime
1249
1250 This is the ``set certificate lifetime'' option.
1251 This option takes a number argument @file{lifetime}.
1252
1253 @noindent
1254 This option has some usage constraints.  It:
1255 @itemize @bullet
1256 @item
1257 must be compiled in by defining @code{AUTOKEY} during the compilation.
1258 @end itemize
1259
1260 Set the certificate expiration to lifetime days from now.
1261 @node ntp-keygen modulus
1262 @subsection modulus option (-m)
1263 @cindex ntp-keygen-modulus
1264
1265 This is the ``prime modulus'' option.
1266 This option takes a number argument @file{modulus}.
1267
1268 @noindent
1269 This option has some usage constraints.  It:
1270 @itemize @bullet
1271 @item
1272 must be compiled in by defining @code{AUTOKEY} during the compilation.
1273 @end itemize
1274
1275 The number of bits in the prime modulus.  The default is 512.
1276 @node ntp-keygen md5key
1277 @subsection md5key option (-M)
1278 @cindex ntp-keygen-md5key
1279
1280 This is the ``generate symmetric keys'' option.
1281 Generate symmetric keys, obsoleting any that may exist.
1282 @node ntp-keygen pvt-cert
1283 @subsection pvt-cert option (-P)
1284 @cindex ntp-keygen-pvt-cert
1285
1286 This is the ``generate pc private certificate'' option.
1287
1288 @noindent
1289 This option has some usage constraints.  It:
1290 @itemize @bullet
1291 @item
1292 must be compiled in by defining @code{AUTOKEY} during the compilation.
1293 @end itemize
1294
1295 Generate a private certificate.  By default, the program generates
1296 public certificates.
1297 @node ntp-keygen password
1298 @subsection password option (-p)
1299 @cindex ntp-keygen-password
1300
1301 This is the ``local private password'' option.
1302 This option takes a string argument @file{passwd}.
1303
1304 @noindent
1305 This option has some usage constraints.  It:
1306 @itemize @bullet
1307 @item
1308 must be compiled in by defining @code{AUTOKEY} during the compilation.
1309 @end itemize
1310
1311 Local files containing private data are encrypted with the
1312 DES-CBC algorithm and the specified password.  The same password
1313 must be specified to the local ntpd via the "crypto pw password"
1314 configuration command.  The default password is the local
1315 hostname.
1316 @node ntp-keygen export-passwd
1317 @subsection export-passwd option (-q)
1318 @cindex ntp-keygen-export-passwd
1319
1320 This is the ``export iff or gq group keys with password'' option.
1321 This option takes a string argument @file{passwd}.
1322
1323 @noindent
1324 This option has some usage constraints.  It:
1325 @itemize @bullet
1326 @item
1327 must be compiled in by defining @code{AUTOKEY} during the compilation.
1328 @end itemize
1329
1330 Export IFF or GQ identity group keys to the standard output,
1331 encrypted with the DES-CBC algorithm and the specified password.
1332 The same password must be specified to the remote ntpd via the
1333 "crypto pw password" configuration command.  See also the option
1334 --id-key (-e) for unencrypted exports.
1335 @node ntp-keygen subject-name
1336 @subsection subject-name option (-s)
1337 @cindex ntp-keygen-subject-name
1338
1339 This is the ``set host and optionally group name'' option.
1340 This option takes a string argument @file{host@@group}.
1341
1342 @noindent
1343 This option has some usage constraints.  It:
1344 @itemize @bullet
1345 @item
1346 must be compiled in by defining @code{AUTOKEY} during the compilation.
1347 @end itemize
1348
1349 Set the Autokey host name, and optionally, group name specified
1350 following an '@code{@@}' character.  The host name is used in the file
1351 name of generated host and signing certificates, without the
1352 group name.  The host name, and if provided, group name are used
1353 in @code{host@@group} form for the host certificate subject and issuer
1354 fields.  Specifying '@code{-s @@group}' is allowed, and results in
1355 leaving the host name unchanged while appending @code{@@group} to the
1356 subject and issuer fields, as with @code{-i group}.  The group name, or
1357 if not provided, the host name are also used in the file names
1358 of IFF, GQ, and MV client parameter files.
1359 @node ntp-keygen sign-key
1360 @subsection sign-key option (-S)
1361 @cindex ntp-keygen-sign-key
1362
1363 This is the ``generate sign key (rsa or dsa)'' option.
1364 This option takes a string argument @file{sign}.
1365
1366 @noindent
1367 This option has some usage constraints.  It:
1368 @itemize @bullet
1369 @item
1370 must be compiled in by defining @code{AUTOKEY} during the compilation.
1371 @end itemize
1372
1373 Generate a new sign key of the designated type, obsoleting any
1374 that may exist.  By default, the program uses the host key as the
1375 sign key.
1376 @node ntp-keygen trusted-cert
1377 @subsection trusted-cert option (-T)
1378 @cindex ntp-keygen-trusted-cert
1379
1380 This is the ``trusted certificate (tc scheme)'' option.
1381
1382 @noindent
1383 This option has some usage constraints.  It:
1384 @itemize @bullet
1385 @item
1386 must be compiled in by defining @code{AUTOKEY} during the compilation.
1387 @end itemize
1388
1389 Generate a trusted certificate.  By default, the program generates
1390 a non-trusted certificate.
1391 @node ntp-keygen mv-params
1392 @subsection mv-params option (-V)
1393 @cindex ntp-keygen-mv-params
1394
1395 This is the ``generate <num> mv parameters'' option.
1396 This option takes a number argument @file{num}.
1397
1398 @noindent
1399 This option has some usage constraints.  It:
1400 @itemize @bullet
1401 @item
1402 must be compiled in by defining @code{AUTOKEY} during the compilation.
1403 @end itemize
1404
1405 Generate parameters and keys for the Mu-Varadharajan (MV)
1406 identification scheme.
1407 @node ntp-keygen mv-keys
1408 @subsection mv-keys option (-v)
1409 @cindex ntp-keygen-mv-keys
1410
1411 This is the ``update <num> mv keys'' option.
1412 This option takes a number argument @file{num}.
1413
1414 @noindent
1415 This option has some usage constraints.  It:
1416 @itemize @bullet
1417 @item
1418 must be compiled in by defining @code{AUTOKEY} during the compilation.
1419 @end itemize
1420
1421 This option has no @samp{doc} documentation.
1422
1423
1424 @node ntp-keygen config
1425 @subsection presetting/configuring ntp-keygen
1426
1427 Any option that is not marked as @i{not presettable} may be preset by
1428 loading values from configuration ("rc" or "ini") files, and values from environment variables named @code{NTP-KEYGEN} and @code{NTP-KEYGEN_<OPTION_NAME>}.  @code{<OPTION_NAME>} must be one of
1429 the options listed above in upper case and segmented with underscores.
1430 The @code{NTP-KEYGEN} variable will be tokenized and parsed like
1431 the command line.  The remaining variables are tested for existence and their
1432 values are treated like option arguments.
1433
1434
1435 @noindent
1436 @code{libopts} will search in 2 places for configuration files:
1437 @itemize @bullet
1438 @item
1439 $HOME
1440 @item
1441 $PWD
1442 @end itemize
1443 The environment variables @code{HOME}, and @code{PWD}
1444 are expanded and replaced when @file{ntp-keygen} runs.
1445 For any of these that are plain files, they are simply processed.
1446 For any that are directories, then a file named @file{.ntprc} is searched for
1447 within that directory and processed.
1448
1449 Configuration files may be in a wide variety of formats.
1450 The basic format is an option name followed by a value (argument) on the
1451 same line.  Values may be separated from the option name with a colon,
1452 equal sign or simply white space.  Values may be continued across multiple
1453 lines by escaping the newline with a backslash.
1454
1455 Multiple programs may also share the same initialization file.
1456 Common options are collected at the top, followed by program specific
1457 segments.  The segments are separated by lines like:
1458 @example
1459 [NTP-KEYGEN]
1460 @end example
1461 @noindent
1462 or by
1463 @example
1464 <?program ntp-keygen>
1465 @end example
1466 @noindent
1467 Do not mix these styles within one configuration file.
1468
1469 Compound values and carefully constructed string values may also be
1470 specified using XML syntax:
1471 @example
1472 <option-name>
1473    <sub-opt>...&lt;...&gt;...</sub-opt>
1474 </option-name>
1475 @end example
1476 @noindent
1477 yielding an @code{option-name.sub-opt} string value of
1478 @example
1479 "...<...>..."
1480 @end example
1481 @code{AutoOpts} does not track suboptions.  You simply note that it is a
1482 hierarchicly valued option.  @code{AutoOpts} does provide a means for searching
1483 the associated name/value pair list (see: optionFindValue).
1484
1485 The command line options relating to configuration and/or usage help are:
1486
1487 @subsubheading version (-)
1488
1489 Print the program version to standard out, optionally with licensing
1490 information, then exit 0.  The optional argument specifies how much licensing
1491 detail to provide.  The default is to print just the version.  The licensing infomation may be selected with an option argument.
1492 Only the first letter of the argument is examined:
1493
1494 @table @samp
1495 @item version
1496 Only print the version.  This is the default.
1497 @item copyright
1498 Name the copyright usage licensing terms.
1499 @item verbose
1500 Print the full copyright usage licensing terms.
1501 @end table
1502
1503 @node ntp-keygen exit status
1504 @subsection ntp-keygen exit status
1505
1506 One of the following exit values will be returned:
1507 @table @samp
1508 @item 0 (EXIT_SUCCESS)
1509 Successful program execution.
1510 @item 1 (EXIT_FAILURE)
1511 The operation failed or the command syntax was not valid.
1512 @item 66 (EX_NOINPUT)
1513 A specified configuration file could not be loaded.
1514 @item 70 (EX_SOFTWARE)
1515 libopts had an internal operational error.  Please report
1516 it to autogen-users@@lists.sourceforge.net.  Thank you.
1517 @end table
1518 @node ntp-keygen Usage
1519 @subsection ntp-keygen Usage
1520 @node ntp-keygen Notes
1521 @subsection ntp-keygen Notes
1522 @node ntp-keygen Bugs
1523 @subsection ntp-keygen Bugs