1 @node ntp-keygen Invocation
2 @section Invoking ntp-keygen
4 @cindex Create a NTP host key
7 # EDIT THIS FILE WITH CAUTION (invoke-ntp-keygen.texi)
9 # It has been AutoGen-ed February 20, 2019 at 09:57:13 AM by AutoGen 5.18.5
10 # From the definitions ntp-keygen-opts.def
11 # and the template file agtexi-cmd.tpl
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.
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.
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
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)}
46 @code{ntpdc(1ntpdcmdoc)}
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
57 Some files used by this program are encrypted using a private password.
60 option specifies the read password for local encrypted files and the
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
65 command, normally the DNS name of the host, is used as the the default read
66 password, for convenience.
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.
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.
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
94 The symmetric keys file, normally called
96 is usually installed in
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
107 @code{ntpd(1ntpdmdoc)}
108 configuration file command.
110 This program directs commentary and error messages to the standard
113 and remote files to the standard output stream
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
119 and include the file type, generating host and filestamp,
121 @ref{Cryptographic Data Files}
124 @subsubsection Running the Program
125 The safest way to run the
127 program is logged in directly as root.
128 The recommended procedure is change to the
131 @file{/usr/local/etc},
132 then run the program.
134 To test and gain experience with Autokey concepts, log in as root and
138 @file{/usr/local/etc}.
139 When run for the first time, or if all files with names beginning with
141 have been removed, use the
143 command without arguments to generate a default
145 host key and matching
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.
155 The host key is used to encrypt the cookie when required and so must be
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
165 By default, the message digest type is
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}
173 message digest algorithms.
174 However, the scheme specified in the certificate must be compatible
176 Certificates using any digest algorithm are compatible with
183 certificates are compatible with
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.
195 Running the program as other than root and using the Unix
198 to assume root may not work properly, since by default the OpenSSL library
199 looks for the random seed file
201 in the user home directory.
202 However, there should be only one
205 in the root directory, so it is convenient to define the
207 environment variable used by the OpenSSL library as the path to
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
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.
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.
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.
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
256 file name extensions, the files for an NTP server and
257 dependent clients can all be installed in the same shared directory.
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
269 If a link is not present,
270 @code{ntpd(1ntpdmdoc)}
273 from the file itself.
274 This allows clients to verify that the file and generation times
278 program uses the same
280 extension for all files generated
281 at one time, so each generation is distinct and can be readily
282 recognized in monitoring data.
284 Run the command on as many hosts as necessary.
285 Designate one of them as the trusted host (TH) using
289 option and configure it to synchronize from reliable Internet servers.
290 Then configure the other hosts to synchronize to the TH directly or
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.
297 The host key is used to encrypt the cookie when required and so must be
299 By default, the host key is also the sign key used to encrypt
301 A different sign key can be assigned using the
303 option and this can be either
308 By default, the signature
309 message digest type is
311 but any combination of sign key type and
312 message digest type supported by the OpenSSL library can be specified
317 The rules say cryptographic media should be generated with proventic
318 filestamps, which means the host should already be synchronized before
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.
328 Additional information on trusted groups and identity schemes is on the
329 @quotedblleft{}Autokey Public-Key Authentication@quotedblright{}
332 File names begin with the prefix
334 and end with the suffix
335 @file{_}@kbd{hostname}. @kbd{filestamp},
338 is the owner name, usually the string returned
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
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}
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.
356 @subsubsection Trusted Hosts and Groups
357 Each cryptographic configuration involves selection of a signature scheme
358 and identification scheme, called a cryptotype,
360 @ref{Authentication Options}
363 The default cryptotype uses
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}
386 On each trusted host as root, change to the keys directory.
387 To insure a fresh fileset, remove all
393 to generate keys and a trusted certificate.
394 On all other hosts do the same, but leave off the
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.
402 If it is necessary to use a different sign key or different digest/signature
403 scheme than the default, run
413 The most frequent need to do this is when a
416 If it is necessary to use a different certificate scheme than the default,
420 @code{-c} @kbd{scheme}
426 is run again without these options, it generates a new certificate
427 using the same scheme and sign key, and soft link.
429 After setting up the environment it is advisable to update certificates
430 from time to time, if only to extend the validity interval.
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)}
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.
444 @subsubsection Identity Schemes
445 As mentioned on the Autonomous Authentication page,
448 identity scheme is vulnerable to a middleman attack.
449 However, there are more secure identity schemes available,
451 @code{PC}, @code{IFF}, @code{GQ}
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.
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.
471 only as clients have key files that contain only client keys.
473 The PC scheme supports only one trusted host in the group.
474 On trusted host alice run
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},
483 Copy both files to all group hosts;
484 they replace the files which would be generated in other schemes.
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.
500 scheme proceed as in the
502 scheme to generate keys
503 and certificates for all group hosts, then for every trusted host in the group,
507 On trusted host alice run
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}
519 If there are no hosts restricted to operate only as clients,
520 there is nothing further to do.
523 scheme is independent
524 of keys and certificates, these files can be refreshed as needed.
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
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}
538 To further protect the integrity of the keys,
539 each file can be encrypted with a secret password.
543 scheme proceed as in the
545 scheme to generate keys
546 and certificates for all group hosts, then for every trusted host
547 in the group, generate the
550 On trusted host alice run
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
560 @file{ntpkey_gq_alice}
562 In addition, on each host
566 @file{ntpkey_gq_}@kbd{bob}
572 parameters file and certificate
573 at the same time, keys and certificates can be regenerated as needed.
577 scheme, proceed as in the
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.
586 @code{-p} @kbd{password},
589 is the number of revokable keys (typically 5) to produce
591 @file{ntpkeys_MVpar_trish.}@kbd{filestamp}
593 @file{ntpkeys_MVkey}@kbd{d} @kbd{_} @file{trish.} @kbd{filestamp}
596 is the key number (0 <
600 Copy the parameter file to alice and install a soft link
602 @file{ntpkey_mv_alice}
604 Copy one of the client key files to alice for later distribution
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.
614 scheme is independent of keys and certificates,
615 these files can be refreshed as needed.
617 @subsubsection Command Line Options
619 @item @code{-b} @code{--imbits}= @kbd{modulus}
620 Set the number of bits in the identity modulus for generating identity keys to
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.
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},
637 schemes must be used with an
641 schemes must be used with a
644 The default without this option is
646 If compatibility with FIPS 140-2 is required, either the
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,
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
664 This option displays the cryptographic data produced in eye-friendly billboards.
665 @item @code{-e} @code{--id-key}
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
675 This is intended for automatic key distribution by email.
676 @item @code{-G} @code{--gq-params}
677 Generate a new encrypted
679 parameters and key file for the Guillou-Quisquater (GQ) identity scheme.
680 This option is mutually exclusive with the
685 @item @code{-H} @code{--host-key}
686 Generate a new encrypted
688 public/private host key file.
689 @item @code{-I} @code{--iffkey}
690 Generate a new encrypted
692 key file for the Schnorr (IFF) identity scheme.
693 This option is mutually exclusive with the
698 @item @code{-i} @code{--ident}= @kbd{group}
699 Set the optional Autokey group name to
701 This is used in the identity scheme parameter file names of
702 @code{IFF}, @code{GQ},
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
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}
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
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
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
733 keys, and if OpenSSL is available, 10
738 key is a string of 20 random printable ASCII characters, while a
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
746 These include the host, sign and identify key files.
747 By default, the password is the string returned by the Unix
750 @item @code{-P} @code{--pvt-cert}
751 Generate a new private certificate used by the
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
763 In effect, these files are decrypted with the
765 password, then encrypted with the
768 By default, the password is the string returned by the Unix
771 @item @code{-s} @code{--subject-key}= @code{[host]} @code{[@@ @kbd{group}]}
772 Specify the Autokey host name, where
774 is the optional host name and
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.
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
786 @code{IFF}, @code{GQ},
789 identity scheme client parameter files.
792 is not specified, the default host name is the string returned by the Unix
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
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}
806 encrypted server keys and parameters for the Mu-Varadharajan (MV)
808 This option is mutually exclusive with the
813 Note: support for this option should be considered a work in progress.
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
825 If a site supports OpenSSL or its companion OpenSSH,
826 it is very likely that means to do this are already available.
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.
836 The entropy seed used by the OpenSSL library is contained in a file,
839 which must be available when starting the NTP daemon
843 The NTP daemon will first look for the file
844 using the path specified by the
848 configuration command.
849 If not specified in this way, or when starting the
852 the OpenSSL library will look for the file using the path specified
855 environment variable in the user home directory,
856 whether root or some other user.
859 environment variable is not present,
860 the library will look for the
862 file in the user home directory.
866 @code{ntpd(1ntpdmdoc)}
867 daemon must run as root, the logical place to put this file is in
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.
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},
882 is the key or parameter type,
884 is the host or group name and
886 is the filestamp (NTP seconds) when the file was created.
889 names in generated file names include both upper and lower case
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
898 @quoteleft{}#@quoteright{}
899 are considered comments and ignored by the
902 @code{ntpd(1ntpdmdoc)}
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.
909 The format of the symmetric keys file, ordinarily named
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.
915 # ntpkey_MD5key_bk.ntp.org.3595864945
916 # Thu Dec 12 19:22:25 2013
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
940 Figure 1. Typical Symmetric Key File
943 Figure 1 shows a typical symmetric keys file used by the reference
945 Following the header the keys are entered one per line in the format
947 @kbd{keyno} @kbd{type} @kbd{key}
951 is a positive integer in the range 1-65535;
953 is the key type for the message digest algorithm, which in the absence of the
954 OpenSSL library must be
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
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{}!
971 @quoteleft{}~@quoteright{}
972 ) excluding space and the
973 @quoteleft{}#@quoteright{}
974 character, and terminated by whitespace or a
975 @quoteleft{}#@quoteright{}
977 An OpenSSL key consists of a hex-encoded ASCII string of 40 characters, which
978 is truncated as necessary.
980 Note that the keys used by the
981 @code{ntpq(1ntpqmdoc)}
983 @code{ntpdc(1ntpdcmdoc)}
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.
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
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
1006 @code{ntpq(1ntpqmdoc)}
1008 @code{ntpdc(1ntpdcmdoc)}
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>.
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
1043 @node ntp-keygen usage
1044 @subsection ntp-keygen help/usage (@option{--help})
1045 @cindex ntp-keygen help
1047 This is the automatically generated usage text for ntp-keygen.
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.
1059 ntp-keygen (ntp) - Create a NTP host key - Ver. 4.2.8p13
1060 Usage: ntp-keygen [ -<flag> [<val>] | --<name>[@{=| @}<val>] ]...
1061 Flg Arg Option-Name Description
1062 -b Num imbits identity modulus bits
1063 - it must be in the range:
1065 -c Str certificate certificate scheme
1066 -C Str cipher privatekey cipher
1067 -d no debug-level Increase debug verbosity level
1068 - may appear multiple times
1069 -D Num set-debug-level Set the debug verbosity level
1070 - may appear multiple times
1071 -e no id-key Write IFF or GQ identity keys
1072 -G no gq-params Generate GQ parameters and keys
1073 -H no host-key generate RSA host key
1074 -I no iffkey generate IFF parameters
1075 -i Str ident set Autokey group name
1076 -l Num lifetime set certificate lifetime
1077 -m Num modulus prime modulus
1078 - it must be in the range:
1080 -M no md5key generate symmetric keys
1081 -P no pvt-cert generate PC private certificate
1082 -p Str password local private password
1083 -q Str export-passwd export IFF or GQ group keys with password
1084 -s Str subject-name set host and optionally group name
1085 -S Str sign-key generate sign key (RSA or DSA)
1086 -T no trusted-cert trusted certificate (TC scheme)
1087 -V Num mv-params generate <num> MV parameters
1088 -v Num mv-keys update <num> MV keys
1089 opt version output version information and exit
1090 -? no help display extended usage information and exit
1091 -! no more-help extended usage information passed thru pager
1092 -> opt save-opts save the option state to a config file
1093 -< Str load-opts load options from a config file
1094 - disabled as '--no-load-opts'
1095 - may appear multiple times
1097 Options are specified by doubled hyphens and their name or by a single
1098 hyphen and the flag character.
1101 The following option preset mechanisms are supported:
1102 - reading file $HOME/.ntprc
1103 - reading file ./.ntprc
1104 - examining environment variables named NTP_KEYGEN_*
1106 Please send bug reports to: <http://bugs.ntp.org, bugs@@ntp.org>
1110 @node ntp-keygen imbits
1111 @subsection imbits option (-b)
1112 @cindex ntp-keygen-imbits
1114 This is the ``identity modulus bits'' option.
1115 This option takes a number argument @file{imbits}.
1118 This option has some usage constraints. It:
1121 must be compiled in by defining @code{AUTOKEY} during the compilation.
1124 The number of bits in the identity modulus. The default is 256.
1125 @node ntp-keygen certificate
1126 @subsection certificate option (-c)
1127 @cindex ntp-keygen-certificate
1129 This is the ``certificate scheme'' option.
1130 This option takes a string argument @file{scheme}.
1133 This option has some usage constraints. It:
1136 must be compiled in by defining @code{AUTOKEY} during the compilation.
1140 RSA-MD2, RSA-MD5, RSA-MDC2, RSA-SHA, RSA-SHA1, RSA-RIPEMD160,
1141 DSA-SHA, or DSA-SHA1.
1143 Select the certificate signature encryption/message digest scheme.
1144 Note that RSA schemes must be used with a RSA sign key and DSA
1145 schemes must be used with a DSA sign key. The default without
1146 this option is RSA-MD5.
1147 @node ntp-keygen cipher
1148 @subsection cipher option (-C)
1149 @cindex ntp-keygen-cipher
1151 This is the ``privatekey cipher'' option.
1152 This option takes a string argument @file{cipher}.
1155 This option has some usage constraints. It:
1158 must be compiled in by defining @code{AUTOKEY} during the compilation.
1161 Select the cipher which is used to encrypt the files containing
1162 private keys. The default is three-key triple DES in CBC mode,
1163 equivalent to "@code{-C des-ede3-cbc}". The openssl tool lists ciphers
1164 available in "@code{openssl -h}" output.
1165 @node ntp-keygen id-key
1166 @subsection id-key option (-e)
1167 @cindex ntp-keygen-id-key
1169 This is the ``write iff or gq identity keys'' option.
1172 This option has some usage constraints. It:
1175 must be compiled in by defining @code{AUTOKEY} during the compilation.
1178 Write the public parameters from the IFF or GQ client keys to
1179 the standard output.
1180 This is intended for automatic key distribution by email.
1181 @node ntp-keygen gq-params
1182 @subsection gq-params option (-G)
1183 @cindex ntp-keygen-gq-params
1185 This is the ``generate gq parameters and keys'' option.
1188 This option has some usage constraints. It:
1191 must be compiled in by defining @code{AUTOKEY} during the compilation.
1194 Generate parameters and keys for the GQ identification scheme,
1195 obsoleting any that may exist.
1196 @node ntp-keygen host-key
1197 @subsection host-key option (-H)
1198 @cindex ntp-keygen-host-key
1200 This is the ``generate rsa host key'' option.
1203 This option has some usage constraints. It:
1206 must be compiled in by defining @code{AUTOKEY} during the compilation.
1209 Generate new host keys, obsoleting any that may exist.
1210 @node ntp-keygen iffkey
1211 @subsection iffkey option (-I)
1212 @cindex ntp-keygen-iffkey
1214 This is the ``generate iff parameters'' option.
1217 This option has some usage constraints. It:
1220 must be compiled in by defining @code{AUTOKEY} during the compilation.
1223 Generate parameters for the IFF identification scheme, obsoleting
1225 @node ntp-keygen ident
1226 @subsection ident option (-i)
1227 @cindex ntp-keygen-ident
1229 This is the ``set autokey group name'' option.
1230 This option takes a string argument @file{group}.
1233 This option has some usage constraints. It:
1236 must be compiled in by defining @code{AUTOKEY} during the compilation.
1239 Set the optional Autokey group name to name. This is used in
1240 the file name of IFF, GQ, and MV client parameters files. In
1241 that role, the default is the host name if this option is not
1242 provided. The group name, if specified using @code{-i/--ident} or
1243 using @code{-s/--subject-name} following an '@code{@@}' character,
1244 is also a part of the self-signed host certificate subject and
1245 issuer names in the form @code{host@@group} and should match the
1246 '@code{crypto ident}' or '@code{server ident}' configuration in the
1247 @code{ntpd} configuration file.
1248 @node ntp-keygen lifetime
1249 @subsection lifetime option (-l)
1250 @cindex ntp-keygen-lifetime
1252 This is the ``set certificate lifetime'' option.
1253 This option takes a number argument @file{lifetime}.
1256 This option has some usage constraints. It:
1259 must be compiled in by defining @code{AUTOKEY} during the compilation.
1262 Set the certificate expiration to lifetime days from now.
1263 @node ntp-keygen modulus
1264 @subsection modulus option (-m)
1265 @cindex ntp-keygen-modulus
1267 This is the ``prime modulus'' option.
1268 This option takes a number argument @file{modulus}.
1271 This option has some usage constraints. It:
1274 must be compiled in by defining @code{AUTOKEY} during the compilation.
1277 The number of bits in the prime modulus. The default is 512.
1278 @node ntp-keygen md5key
1279 @subsection md5key option (-M)
1280 @cindex ntp-keygen-md5key
1282 This is the ``generate symmetric keys'' option.
1283 Generate symmetric keys, obsoleting any that may exist.
1284 @node ntp-keygen pvt-cert
1285 @subsection pvt-cert option (-P)
1286 @cindex ntp-keygen-pvt-cert
1288 This is the ``generate pc private certificate'' option.
1291 This option has some usage constraints. It:
1294 must be compiled in by defining @code{AUTOKEY} during the compilation.
1297 Generate a private certificate. By default, the program generates
1298 public certificates.
1299 @node ntp-keygen password
1300 @subsection password option (-p)
1301 @cindex ntp-keygen-password
1303 This is the ``local private password'' option.
1304 This option takes a string argument @file{passwd}.
1307 This option has some usage constraints. It:
1310 must be compiled in by defining @code{AUTOKEY} during the compilation.
1313 Local files containing private data are encrypted with the
1314 DES-CBC algorithm and the specified password. The same password
1315 must be specified to the local ntpd via the "crypto pw password"
1316 configuration command. The default password is the local
1318 @node ntp-keygen export-passwd
1319 @subsection export-passwd option (-q)
1320 @cindex ntp-keygen-export-passwd
1322 This is the ``export iff or gq group keys with password'' option.
1323 This option takes a string argument @file{passwd}.
1326 This option has some usage constraints. It:
1329 must be compiled in by defining @code{AUTOKEY} during the compilation.
1332 Export IFF or GQ identity group keys to the standard output,
1333 encrypted with the DES-CBC algorithm and the specified password.
1334 The same password must be specified to the remote ntpd via the
1335 "crypto pw password" configuration command. See also the option
1336 --id-key (-e) for unencrypted exports.
1337 @node ntp-keygen subject-name
1338 @subsection subject-name option (-s)
1339 @cindex ntp-keygen-subject-name
1341 This is the ``set host and optionally group name'' option.
1342 This option takes a string argument @file{host@@group}.
1345 This option has some usage constraints. It:
1348 must be compiled in by defining @code{AUTOKEY} during the compilation.
1351 Set the Autokey host name, and optionally, group name specified
1352 following an '@code{@@}' character. The host name is used in the file
1353 name of generated host and signing certificates, without the
1354 group name. The host name, and if provided, group name are used
1355 in @code{host@@group} form for the host certificate subject and issuer
1356 fields. Specifying '@code{-s @@group}' is allowed, and results in
1357 leaving the host name unchanged while appending @code{@@group} to the
1358 subject and issuer fields, as with @code{-i group}. The group name, or
1359 if not provided, the host name are also used in the file names
1360 of IFF, GQ, and MV client parameter files.
1361 @node ntp-keygen sign-key
1362 @subsection sign-key option (-S)
1363 @cindex ntp-keygen-sign-key
1365 This is the ``generate sign key (rsa or dsa)'' option.
1366 This option takes a string argument @file{sign}.
1369 This option has some usage constraints. It:
1372 must be compiled in by defining @code{AUTOKEY} during the compilation.
1375 Generate a new sign key of the designated type, obsoleting any
1376 that may exist. By default, the program uses the host key as the
1378 @node ntp-keygen trusted-cert
1379 @subsection trusted-cert option (-T)
1380 @cindex ntp-keygen-trusted-cert
1382 This is the ``trusted certificate (tc scheme)'' option.
1385 This option has some usage constraints. It:
1388 must be compiled in by defining @code{AUTOKEY} during the compilation.
1391 Generate a trusted certificate. By default, the program generates
1392 a non-trusted certificate.
1393 @node ntp-keygen mv-params
1394 @subsection mv-params option (-V)
1395 @cindex ntp-keygen-mv-params
1397 This is the ``generate <num> mv parameters'' option.
1398 This option takes a number argument @file{num}.
1401 This option has some usage constraints. It:
1404 must be compiled in by defining @code{AUTOKEY} during the compilation.
1407 Generate parameters and keys for the Mu-Varadharajan (MV)
1408 identification scheme.
1409 @node ntp-keygen mv-keys
1410 @subsection mv-keys option (-v)
1411 @cindex ntp-keygen-mv-keys
1413 This is the ``update <num> mv keys'' option.
1414 This option takes a number argument @file{num}.
1417 This option has some usage constraints. It:
1420 must be compiled in by defining @code{AUTOKEY} during the compilation.
1423 This option has no @samp{doc} documentation.
1426 @node ntp-keygen config
1427 @subsection presetting/configuring ntp-keygen
1429 Any option that is not marked as @i{not presettable} may be preset by
1430 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
1431 the options listed above in upper case and segmented with underscores.
1432 The @code{NTP-KEYGEN} variable will be tokenized and parsed like
1433 the command line. The remaining variables are tested for existence and their
1434 values are treated like option arguments.
1438 @code{libopts} will search in 2 places for configuration files:
1445 The environment variables @code{HOME}, and @code{PWD}
1446 are expanded and replaced when @file{ntp-keygen} runs.
1447 For any of these that are plain files, they are simply processed.
1448 For any that are directories, then a file named @file{.ntprc} is searched for
1449 within that directory and processed.
1451 Configuration files may be in a wide variety of formats.
1452 The basic format is an option name followed by a value (argument) on the
1453 same line. Values may be separated from the option name with a colon,
1454 equal sign or simply white space. Values may be continued across multiple
1455 lines by escaping the newline with a backslash.
1457 Multiple programs may also share the same initialization file.
1458 Common options are collected at the top, followed by program specific
1459 segments. The segments are separated by lines like:
1466 <?program ntp-keygen>
1469 Do not mix these styles within one configuration file.
1471 Compound values and carefully constructed string values may also be
1472 specified using XML syntax:
1475 <sub-opt>...<...>...</sub-opt>
1479 yielding an @code{option-name.sub-opt} string value of
1483 @code{AutoOpts} does not track suboptions. You simply note that it is a
1484 hierarchicly valued option. @code{AutoOpts} does provide a means for searching
1485 the associated name/value pair list (see: optionFindValue).
1487 The command line options relating to configuration and/or usage help are:
1489 @subsubheading version (-)
1491 Print the program version to standard out, optionally with licensing
1492 information, then exit 0. The optional argument specifies how much licensing
1493 detail to provide. The default is to print just the version. The licensing infomation may be selected with an option argument.
1494 Only the first letter of the argument is examined:
1498 Only print the version. This is the default.
1500 Name the copyright usage licensing terms.
1502 Print the full copyright usage licensing terms.
1505 @node ntp-keygen exit status
1506 @subsection ntp-keygen exit status
1508 One of the following exit values will be returned:
1510 @item 0 (EXIT_SUCCESS)
1511 Successful program execution.
1512 @item 1 (EXIT_FAILURE)
1513 The operation failed or the command syntax was not valid.
1514 @item 66 (EX_NOINPUT)
1515 A specified configuration file could not be loaded.
1516 @item 70 (EX_SOFTWARE)
1517 libopts had an internal operational error. Please report
1518 it to autogen-users@@lists.sourceforge.net. Thank you.
1520 @node ntp-keygen Usage
1521 @subsection ntp-keygen Usage
1522 @node ntp-keygen Notes
1523 @subsection ntp-keygen Notes
1524 @node ntp-keygen Bugs
1525 @subsection ntp-keygen Bugs