Main index | Section 8 | Options |
All arguments must be options.
The message digest symmetric keys file is generated in a format compatible with NTPv3. All other files are in PEM-encoded printable ASCII format, so they can be embedded as MIME attachments in email to other sites and certificate authorities. By default, files are not encrypted.
When used to generate message digest symmetric keys, the program produces a file containing ten pseudo-random printable ASCII strings suitable for the MD5 message digest algorithm included in the distribution. If the OpenSSL library is installed, it produces an additional ten hex-encoded random bit strings suitable for SHA1, AES-128-CMAC, and other message digest algorithms. The message digest symmetric keys file must be distributed and stored using secure means beyond the scope of NTP itself. Besides the keys used for ordinary NTP associations, additional keys can be defined as passwords for the ntpq(8) and ntpdc(8) utility programs.
The remaining generated files are compatible with other OpenSSL applications and other Public Key Infrastructure (PKI) resources. Certificates generated by this program are compatible with extant industry practice, although some users might find the interpretation of X509v3 extension fields somewhat liberal. However, the identity keys are probably not compatible with anything other than Autokey.
Some files used by this program are encrypted using a private password.
The
The pw option of the crypto ntpd(8) configuration command specifies the read password for previously encrypted local files. This must match the local read password used by this program. If not specified, the host name is used. Thus, if files are generated by this program without an explicit password, they can be read back by ntpd(8) without specifying an explicit password but only on the same host. If the write password used for encryption is specified as the host name, these files can be read by that host with no explicit password.
Normally, encrypted files for each host are generated by that host and used only by that host, although exceptions exist as noted later on this page. The symmetric keys file, normally called ntp.keys, is usually installed in /etc. Other files and links are usually installed in /usr/local/etc, which is normally in a shared filesystem in NFS-mounted networks and cannot be changed by shared clients. In these cases, NFS clients can specify the files in another directory such as /etc using the keysdir ntpd(8) configuration file command.
This program directs commentary and error messages to the standard error stream stderr and remote files to the standard output stream stdout where they can be piped to other applications or redirected to files. The names used for generated files and links all begin with the string ntpkeyamp;* and include the file type, generating host and filestamp, as described in the Cryptographic Data Files section below.
To test and gain experience with Autokey concepts, log in as root and change to the keys directory, usually /usr/local/etc. When run for the first time, or if all files with names beginning with ntpkeyamp;* have been removed, use the ntp-keygen command without arguments to generate a default RSA host key and matching RSA-MD5 certificate file with expiration date one year hence, which is all that is necessary in many cases. The program also generates soft links from the generic names to the respective files. If run again without options, the program uses the existing keys and parameters and generates a new certificate file with new expiration date one year hence, and soft link.
The host key is used to encrypt the cookie when required and so must be RSA type. By default, the host key is also the sign key used to encrypt signatures. When necessary, a different sign key can be specified and this can be either RSA or DSA type. By default, the message digest type is MD5, but any combination of sign key type and message digest type supported by the OpenSSL library can be specified, including those using the AES128CMAC, MD2, MD5, MDC2, SHA, SHA1 and RIPE160 message digest algorithms. However, the scheme specified in the certificate must be compatible with the sign key. Certificates using any digest algorithm are compatible with RSA sign keys; however, only SHA and SHA1 certificates are compatible with DSA sign keys.
Private/public key files and certificates are compatible with other OpenSSL applications and very likely other libraries as well. Certificates or certificate requests derived from them should be compatible with extant industry practice, although some users might find the interpretation of X509v3 extension fields somewhat liberal. However, the identification parameter files, although encoded as the other files, are probably not compatible with anything other than Autokey.
Running the program as other than root and using the Unix su(1) command to assume root may not work properly, since by default the OpenSSL library looks for the random seed file .rnd in the user home directory. However, there should be only one .rnd, most conveniently in the root directory, so it is convenient to define the RANDFILE environment variable used by the OpenSSL library as the path to .rnd.
Installing the keys as root might not work in NFS-mounted shared file systems, as NFS clients may not be able to write to the shared keys directory, even as root. In this case, NFS clients can specify the files in another directory such as /etc using the keysdir ntpd(8) configuration file command. There is no need for one client to read the keys and certificates of other clients or servers, as these data are obtained automatically by the Autokey protocol.
Ordinarily, cryptographic files are generated by the host that uses them, but it is possible for a trusted agent (TA) to generate these files for other hosts; however, in such cases files should always be encrypted. The subject name and trusted name default to the hostname of the host generating the files, but can be changed by command line options. It is convenient to designate the owner name and trusted name as the subject and issuer fields, respectively, of the certificate. The owner name is also used for the host and sign key files, while the trusted name is used for the identity files.
All files are installed by default in the keys directory /usr/local/etc, which is normally in a shared filesystem in NFS-mounted networks. The actual location of the keys directory and each file can be overridden by configuration commands, but this is not recommended. Normally, the files for each host are generated by that host and used only by that host, although exceptions exist as noted later on this page.
Normally, files containing private values, including the host key, sign key and identification parameters, are permitted root read/write-only; while others containing public values are permitted world readable. Alternatively, files containing private values can be encrypted and these files permitted world readable, which simplifies maintenance in shared file systems. Since uniqueness is insured by the hostname and filestamp file name extensions, the files for an NTP server and dependent clients can all be installed in the same shared directory.
The recommended practice is to keep the file name extensions when installing a file and to install a soft link from the generic names specified elsewhere on this page to the generated files. This allows new file generations to be activated simply by changing the link. If a link is present, ntpd(8) follows it to the file name to extract the filestamp. If a link is not present, ntpd(8) extracts the filestamp from the file itself. This allows clients to verify that the file and generation times are always current. The ntp-keygen program uses the same filestamp extension for all files generated at one time, so each generation is distinct and can be readily recognized in monitoring data.
Run the command on as many hosts as necessary.
Designate one of them as the trusted host (TH) using
ntp-keygen
with the
The host key is used to encrypt the cookie when required and so must be
RSA type.
By default, the host key is also the sign key used to encrypt
signatures.
A different sign key can be assigned using the
The rules say cryptographic media should be generated with proventic filestamps, which means the host should already be synchronized before this program is run. This of course creates a chicken-and-egg problem when the host is started for the first time. Accordingly, the host time should be set by some other means, such as eyeball-and-wristwatch, at least so that the certificate lifetime is within the current year. After that and when the host is synchronized to a proventic source, the certificate should be re-generated.
Additional information on trusted groups and identity schemes is on the "Autokey Public-Key Authentication" page.
File names begin with the prefix ntpkey_ and end with the suffix _hostname . filestamp, where hostname is the owner name, usually the string returned by the Unix hostname(1) command, and filestamp is the NTP seconds when the file was generated, in decimal digits. This both guarantees uniqueness and simplifies maintenance procedures, since all files can be quickly removed by a rm ntpkeyamp;* command or all files generated at a specific time can be removed by a rm amp;*filestamp command. To further reduce the risk of misconfiguration, the first two lines of a file contain the file name and generation date and time as comments.
On each trusted host as root, change to the keys directory.
To insure a fresh fileset, remove all
ntpkey
files.
Then run
ntp-keygen
If it is necessary to use a different sign key or different digest/signature
scheme than the default, run
ntp-keygen
with the
After setting up the environment it is advisable to update certificates from time to time, if only to extend the validity interval. Simply run ntp-keygen with the same flags as before to generate new certificates using existing keys, and soft links. However, if the host or sign key is changed, ntpd(8) should be restarted. When ntpd(8) is restarted, it loads any new files and restarts the protocol. Other dependent hosts will continue as usual until signatures are refreshed, at which time the protocol is restarted.
In some schemes there are separate keys for servers and clients. A server can also be a client of another server, but a client can never be a server for another client. In general, trusted hosts and nontrusted hosts that operate as both server and client have parameter files that contain both server and client keys. Hosts that operate only as clients have key files that contain only client keys.
The PC scheme supports only one trusted host in the group.
On trusted host alice run
ntp-keygen
For the
IFF
scheme proceed as in the
TC
scheme to generate keys
and certificates for all group hosts, then for every trusted host in the group,
generate the
IFF
parameter file.
On trusted host alice run
ntp-keygen
If a rogue client has the parameter file, it could masquerade
as a legitimate server and present a middleman threat.
To eliminate this threat, the client keys can be extracted
from the parameter file and distributed to all restricted clients.
After generating the parameter file, on alice run
ntp-keygen
For the
GQ
scheme proceed as in the
TC
scheme to generate keys
and certificates for all group hosts, then for every trusted host
in the group, generate the
IFF
parameter file.
On trusted host alice run
ntp-keygen
For the
MV
scheme, proceed as in the
TC
scheme to generate keys
and certificates for all group hosts.
For illustration assume trish is the TA, alice one of several trusted hosts
and bob one of her clients.
On TA trish run
ntp-keygen
| |
Set the number of bits in the identity modulus for generating identity keys to modulus bits. The number of bits in the identity modulus defaults to 256, but can be set to values from 256 to 2048 (32 to 256 octets). Use the larger moduli with caution, as this can consume considerable computing resources and increases the size of authenticated packets. | |
| |
Select certificate signature encryption/message digest scheme. The scheme can be one of the following: RSA-MD2, RSA-MD5, RSA-MDC2, RSA-SHA, RSA-SHA1, RSA-RIPEMD160, DSA-SHA, or DSA-SHA1. Note that RSA schemes must be used with an RSA sign key and DSA schemes must be used with a DSA sign key. The default without this option is RSA-MD5. If compatibility with FIPS 140-2 is required, either the DSA-SHA or DSA-SHA1 scheme must be used. | |
| |
Select the OpenSSL cipher to encrypt the files containing private keys.
The default without this option is three-key triple DES in CBC mode,
des-ede3-cbc.
The
openssl | |
| |
Increase debugging verbosity level. This option displays the cryptographic data produced in eye-friendly billboards. | |
| |
Set the debugging verbosity to level. This option displays the cryptographic data produced in eye-friendly billboards. | |
| |
Write the IFF or GQ public parameters from the IFFkey or GQkey client keys file previously specified as unencrypted data to the standard output stream stdout. This is intended for automatic key distribution by email. | |
| |
Generate a new encrypted
GQ
parameters and key file for the Guillou-Quisquater (GQ) identity scheme.
This option is mutually exclusive with the
| |
| |
Generate a new encrypted RSA public/private host key file. | |
| |
Generate a new encrypted
IFF
key file for the Schnorr (IFF) identity scheme.
This option is mutually exclusive with the
| |
| |
Set the optional Autokey group name to
group.
This is used in the identity scheme parameter file names of
IFF, GQ,
and
MV
client parameters files.
In that role, the default is the host name if no group is provided.
The group name, if specified using
| |
| |
Set the lifetime for certificate expiration to days. The default lifetime is one year (365 days). | |
| |
Set the number of bits in the prime modulus for generating files to bits. The modulus defaults to 512, but can be set from 256 to 2048 (32 to 256 octets). Use the larger moduli with caution, as this can consume considerable computing resources and increases the size of authenticated packets. | |
| |
Generate a new symmetric keys file containing 10 MD5 keys, and if OpenSSL is available, 10 SHA keys. An MD5 key is a string of 20 random printable ASCII characters, while a SHA key is a string of 40 random hex digits. The file can be edited using a text editor to change the key type or key content. This option is mutually exclusive with all other options. | |
| |
Set the password for reading and writing encrypted files to passwd. These include the host, sign and identify key files. By default, the password is the string returned by the Unix hostname command. | |
| |
Generate a new private certificate used by the PC identity scheme. By default, the program generates public certificates. Note: the PC identity scheme is not recommended for new installations. | |
| |
Set the password for writing encrypted
IFF, GQ and MV
identity files redirected to
stdout
to
passwd.
In effect, these files are decrypted with the
| |
| |
Specify the Autokey host name, where
host
is the optional host name and
group
is the optional group name.
The host name, and if provided, group name are used in
host @ group
form as certificate subject and issuer.
Specifying
| |
| |
Generate a new encrypted public/private sign key file of the specified type. By default, the sign key is the host key and has the same type. If compatibility with FIPS 140-2 is required, the sign key type must be DSA. | |
| |
Generate a trusted certificate. By default, the program generates a non-trusted certificate. | |
| |
Generate
nkeys
encrypted server keys and parameters for the Mu-Varadharajan (MV)
identity scheme.
This option is mutually exclusive with the
| |
It is important to understand that entropy must be evolved for each generation, for otherwise the random number sequence would be predictable. Various means dependent on external events, such as keystroke intervals, can be used to do this and some systems have built-in entropy sources. Suitable means are described in the OpenSSL software documentation, but are outside the scope of this page.
The entropy seed used by the OpenSSL library is contained in a file, usually called .rnd, which must be available when starting the NTP daemon or the ntp-keygen program. The NTP daemon will first look for the file using the path specified by the randfile subcommand of the crypto configuration command. If not specified in this way, or when starting the ntp-keygen program, the OpenSSL library will look for the file using the path specified by the RANDFILE environment variable in the user home directory, whether root or some other user. If the RANDFILE environment variable is not present, the library will look for the .rnd file in the user home directory. Since both the ntp-keygen program and ntpd(8) daemon must run as root, the logical place to put this file is in /.rnd or /root/.rnd. If the file is not available or cannot be written, the daemon exits with a message to the system log and the program exits with a suitable error message.
The remainder of the file contains cryptographic data, encoded first using ASN.1 rules, then encrypted if necessary, and finally written in PEM-encoded printable ASCII text, preceded and followed by MIME content identifier lines.
The format of the symmetric keys file, ordinarily named ntp.keys, is somewhat different than the other files in the interest of backward compatibility. Ordinarily, the file is generated by this program, but it can be constructed and edited using an ordinary text editor.
# ntpkey_MD5key_bk.ntp.org.3595864945 # Thu Dec 12 19:22:25 2013 1 MD5 L";Nw<.I<f4U0)247"i # MD5 key 2 MD5 &>l0%XXK9O'51VwV<xq~ # MD5 key 3 MD5 lb4zLW~d^!K:]RsD'qb6 # MD5 key 4 MD5 Yue:tL[+vR)Mn~bY,'? # MD5 key 5 MD5 B;fx'Kgr/&4ZTbL6=RxA # MD5 key 6 MD5 4eYwao}3i@@V@..R9!l # MD5 key 7 MD5 A.([h+;wTQ|xfi%Sn_! # MD5 key 8 MD5 45:V,r4]l6y^JH6"Sh?F # MD5 key 9 MD5 3-5vcn*6l29DS?Xdsg)* # MD5 key 10 MD5 2late4Me # MD5 key 11 SHA1 a27872d3030a9025b8446c751b4551a7629af65c # SHA1 key 12 SHA1 21bc3b4865dbb9e920902abdccb3e04ff97a5e74 # SHA1 key 13 SHA1 2b7736fe24fef5ba85ae11594132ab5d6f6daba9 # SHA1 key 14 SHA a5332809c8878dd3a5b918819108a111509aeceb # SHA key 15 MD2 2fe16c88c760ff2f16d4267e36c1aa6c926e6964 # MD2 key 16 MD4 b2691811dc19cfc0e2f9bcacd74213f29812183d # MD4 key 17 MD5 e4d6735b8bdad58ec5ffcb087300a17f7fef1f7c # MD5 key 18 MDC2 a8d5e2315c025bf3a79174c87fbd10477de2eabc # MDC2 key 19 RIPEMD160 77ca332cafb30e3cafb174dcd5b80ded7ba9b3d2 # RIPEMD160 key 20 AES128CMAC f92ff73eee86c1e7dc638d6489a04e4e555af878 # AES128CMAC key
Figure 1 shows a typical symmetric keys file used by the reference implementation. Following the header the keys are entered one per line in the format where keyno is a positive integer in the range 1-65535; type is the key type for the message digest algorithm, which in the absence of the OpenSSL library must be MD5 to designate the MD5 message digest algorithm; if the OpenSSL library is installed, the key type can be any message digest algorithm supported by that library; however, if compatibility with FIPS 140-2 is required, the key type must be either SHA or SHA1; key is the key itself, which is a printable ASCII string 20 characters or less in length: each character is chosen from the 93 printable characters in the range 0x21 through 0x7e ( ‘!’ through ‘~’ amp;) excluding space and the ‘#’ character, and terminated by whitespace or a ‘#’ character. An OpenSSL key consists of a hex-encoded ASCII string of 40 characters, which is truncated as necessary.
Note that the keys used by the ntpq(8) and ntpdc(8) programs are checked against passwords requested by the programs and entered by hand, so it is generally appropriate to specify these keys in human readable ASCII format.
The ntp-keygen program generates a symmetric keys file ntpkey_MD5key_hostname.filestamp. Since the file contains private shared keys, it should be visible only to root and distributed by secure means to other subnet hosts. The NTP daemon loads the file ntp.keys, so ntp-keygen installs a soft link from this name to the generated file. Subsequently, similar soft links must be installed by manual or automated means on the other subnet hosts. While this file is not used with the Autokey Version 2 protocol, it is needed to authenticate some remote configuration commands used by the ntpq(8) and ntpdc(8) utilities.
|
identity modulus bits.
This option takes an integer number as its argument.
The value of
imbits
is constrained to being:
in the range 256 through 2048 The number of bits in the identity modulus. The default is 256. |
|
certificate scheme.
scheme is one of RSA-MD2, RSA-MD5, RSA-MDC2, RSA-SHA, RSA-SHA1, RSA-RIPEMD160, DSA-SHA, or DSA-SHA1. Select the certificate signature encryption/message digest scheme. Note that RSA schemes must be used with a RSA sign key and DSA schemes must be used with a DSA sign key. The default without this option is RSA-MD5. |
|
privatekey cipher.
Select the cipher which is used to encrypt the files containing private keys. The default is three-key triple DES in CBC mode, equivalent to "-C des-ede3-cbc". The openssl tool lists ciphers available in "openssl -h" output. |
|
Increase debug verbosity level.
This option may appear an unlimited number of times.
|
|
Set the debug verbosity level.
This option may appear an unlimited number of times.
This option takes an integer number as its argument.
|
|
Write IFF or GQ identity keys.
Write the public parameters from the IFF or GQ client keys to the standard output. This is intended for automatic key distribution by email. |
|
Generate GQ parameters and keys.
Generate parameters and keys for the GQ identification scheme, obsoleting any that may exist. |
|
generate RSA host key.
Generate new host keys, obsoleting any that may exist. |
|
generate IFF parameters.
Generate parameters for the IFF identification scheme, obsoleting any that may exist. |
|
set Autokey group name.
Set the optional Autokey group name to name. This is used in the file name of IFF, GQ, and MV client parameters files. In that role, the default is the host name if this option is not provided. The group name, if specified using -i/--ident or using -s/--subject-name following an '@' character, is also a part of the self-signed host certificate subject and issuer names in the form host@group and should match the crypto ident' or 'server ident' configuration in the ntpd configuration file. |
|
set certificate lifetime.
This option takes an integer number as its argument.
Set the certificate expiration to lifetime days from now. |
|
prime modulus.
This option takes an integer number as its argument.
The value of
modulus
is constrained to being:
in the range 256 through 2048 The number of bits in the prime modulus. The default is 512. |
|
generate symmetric keys.
Generate symmetric keys, obsoleting any that may exist. |
|
generate PC private certificate.
Generate a private certificate. By default, the program generates public certificates. |
|
local private password.
Local files containing private data are encrypted with the DES-CBC algorithm and the specified password. The same password must be specified to the local ntpd via the "crypto pw password" configuration command. The default password is the local hostname. |
|
export IFF or GQ group keys with password.
Export IFF or GQ identity group keys to the standard output, encrypted with the DES-CBC algorithm and the specified password. The same password must be specified to the remote ntpd via the "crypto pw password" configuration command. See also the option --id-key (-e) for unencrypted exports. |
|
set host and optionally group name.
Set the Autokey host name, and optionally, group name specified following an '@' character. The host name is used in the file name of generated host and signing certificates, without the group name. The host name, and if provided, group name are used in host@group form for the host certificate subject and issuer fields. Specifying '-s @group' is allowed, and results in leaving the host name unchanged while appending @group to the subject and issuer fields, as with -i group. The group name, or if not provided, the host name are also used in the file names of IFF, GQ, and MV client parameter files. |
|
generate sign key (RSA or DSA).
Generate a new sign key of the designated type, obsoleting any that may exist. By default, the program uses the host key as the sign key. |
|
trusted certificate (TC scheme).
Generate a trusted certificate. By default, the program generates a non-trusted certificate. |
|
generate <num> MV parameters.
This option takes an integer number as its argument.
Generate parameters and keys for the Mu-Varadharajan (MV) identification scheme. |
|
update <num> MV keys.
This option takes an integer number as its argument.
This option has not been fully documented. |
| Display usage information and exit. |
| Pass the extended usage information through a pager. |
| Save the option state to cfgfile. The default is the last configuration file listed in the OPTION PRESETS section, below. The command will exit after updating the config file. |
| Load options from cfgfile. The no-load-opts form will disable the loading of earlier config/rc/ini files. --no-load-opts is handled early, out of order. |
| Output version of program and exit. The default mode is `v', a simple version. The `c' mode will print copyright information and `n' will print the full copyright notice. |
NTP_KEYGEN_<option-name> or NTP_KEYGENThe environmental presets take precedence (are processed later than) the configuration files. The homerc files are "$HOME", and ".". If any of these are directories, then the file .ntprc is searched for within those directories.
0 (EXIT_SUCCESS) | Successful program execution. |
1 (EXIT_FAILURE) | The operation failed or the command syntax was not valid. |
66 (EX_NOINPUT) | A specified configuration file could not be loaded. |
70 (EX_SOFTWARE) | libopts had an internal operational error. Please report it to autogen-users@lists.sourceforge.net. Thank you. |
Please report bugs to http://bugs.ntp.org .
Please send bug reports to: http://bugs.ntp.org, bugs@ntp.org
This manual page was AutoGen-erated from the ntp-keygen option definitions.
NTP_KEYGEN (8) | August 14 2018 |
Main index | Section 8 | Options |
Please direct any comments about this manual page service to Ben Bullock. Privacy policy.
“ | One of the advantages of using UNIX to teach an operating systems course is the sources and documentation will easily fit into a student's briefcase. | ” |
— John Lions |