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