Deleted Added
full compact
ntp-keygen.mdoc.in (316068) ntp-keygen.mdoc.in (330106)
1.Dd March 21 2017
1.Dd February 27 2018
2.Dt NTP_KEYGEN @NTP_KEYGEN_MS@ User Commands
3.Os
4.\" EDIT THIS FILE WITH CAUTION (ntp-keygen-opts.mdoc)
5.\"
2.Dt NTP_KEYGEN @NTP_KEYGEN_MS@ User Commands
3.Os
4.\" EDIT THIS FILE WITH CAUTION (ntp-keygen-opts.mdoc)
5.\"
6.\" It has been AutoGen-ed March 21, 2017 at 10:45:59 AM by AutoGen 5.18.5
6.\" It has been AutoGen-ed February 27, 2018 at 05:16:00 PM by AutoGen 5.18.5
7.\" From the definitions ntp-keygen-opts.def
8.\" and the template file agmdoc-cmd.tpl
9.Sh NAME
10.Nm ntp-keygen
11.Nd Create a NTP host key
12.Sh SYNOPSIS
13.Nm
14.\" Mixture of short (flag) options and long options
15.Op Fl flags
16.Op Fl flag Op Ar value
17.Op Fl \-option\-name Ns Oo Oo Ns "=| " Oc Ns Ar value Oc
18.Pp
19All arguments must be options.
20.Pp
21.Sh DESCRIPTION
22This program generates cryptographic data files used by the NTPv4
23authentication and identification schemes.
7.\" From the definitions ntp-keygen-opts.def
8.\" and the template file agmdoc-cmd.tpl
9.Sh NAME
10.Nm ntp-keygen
11.Nd Create a NTP host key
12.Sh SYNOPSIS
13.Nm
14.\" Mixture of short (flag) options and long options
15.Op Fl flags
16.Op Fl flag Op Ar value
17.Op Fl \-option\-name Ns Oo Oo Ns "=| " Oc Ns Ar value Oc
18.Pp
19All arguments must be options.
20.Pp
21.Sh DESCRIPTION
22This program generates cryptographic data files used by the NTPv4
23authentication and identification schemes.
24It generates MD5 key files used in symmetric key cryptography.
25In addition, if the OpenSSL software library has been installed,
26it generates keys, certificate and identity files used in public key
27cryptography.
24It can generate message digest keys used in symmetric key cryptography and,
25if the OpenSSL software library has been installed, it can generate host keys,
26signing keys, certificates, and identity keys and parameters used in Autokey
27public key cryptography.
28These files are used for cookie encryption,
28These files are used for cookie encryption,
29digital signature and challenge/response identification algorithms
29digital signature, and challenge/response identification algorithms
30compatible with the Internet standard security infrastructure.
31.Pp
30compatible with the Internet standard security infrastructure.
31.Pp
32All files are in PEM\-encoded printable ASCII format,
33so they can be embedded as MIME attachments in mail to other sites
32The message digest symmetric keys file is generated in a format
33compatible with NTPv3.
34All other files are in PEM\-encoded printable ASCII format,
35so they can be embedded as MIME attachments in email to other sites
34and certificate authorities.
35By default, files are not encrypted.
36.Pp
36and certificate authorities.
37By default, files are not encrypted.
38.Pp
37When used to generate message digest keys, the program produces a file
38containing ten pseudo\-random printable ASCII strings suitable for the
39MD5 message digest algorithm included in the distribution.
39When used to generate message digest symmetric keys, the program
40produces a file containing ten pseudo\-random printable ASCII strings
41suitable for the MD5 message digest algorithm included in the
42distribution.
40If the OpenSSL library is installed, it produces an additional ten
43If the OpenSSL library is installed, it produces an additional ten
41hex\-encoded random bit strings suitable for the SHA1 and other message
42digest algorithms.
43The message digest keys file must be distributed and stored
44hex\-encoded random bit strings suitable for SHA1, AES\-128\-CMAC, and
45other message digest algorithms.
46The message digest symmetric keys file must be distributed and stored
44using secure means beyond the scope of NTP itself.
45Besides the keys used for ordinary NTP associations, additional keys
46can be defined as passwords for the
47.Xr ntpq @NTPQ_MS@
48and
49.Xr ntpdc @NTPDC_MS@
50utility programs.
51.Pp
52The remaining generated files are compatible with other OpenSSL
53applications and other Public Key Infrastructure (PKI) resources.
54Certificates generated by this program are compatible with extant
55industry practice, although some users might find the interpretation of
56X509v3 extension fields somewhat liberal.
57However, the identity keys are probably not compatible with anything
58other than Autokey.
59.Pp
60Some files used by this program are encrypted using a private password.
61The
62.Fl p
47using secure means beyond the scope of NTP itself.
48Besides the keys used for ordinary NTP associations, additional keys
49can be defined as passwords for the
50.Xr ntpq @NTPQ_MS@
51and
52.Xr ntpdc @NTPDC_MS@
53utility programs.
54.Pp
55The remaining generated files are compatible with other OpenSSL
56applications and other Public Key Infrastructure (PKI) resources.
57Certificates generated by this program are compatible with extant
58industry practice, although some users might find the interpretation of
59X509v3 extension fields somewhat liberal.
60However, the identity keys are probably not compatible with anything
61other than Autokey.
62.Pp
63Some files used by this program are encrypted using a private password.
64The
65.Fl p
63option specifies the password for local encrypted files and the
66option specifies the read password for local encrypted files and the
64.Fl q
67.Fl q
65option the password for encrypted files sent to remote sites.
68option the write password for encrypted files sent to remote sites.
66If no password is specified, the host name returned by the Unix
69If no password is specified, the host name returned by the Unix
67.Fn gethostname
68function, normally the DNS name of the host is used.
70.Xr hostname 1
71command, normally the DNS name of the host, is used as the the default read
72password, for convenience.
73The
74.Nm
75program prompts for the password if it reads an encrypted file
76and the password is missing or incorrect.
77If an encrypted file is read successfully and
78no write password is specified, the read password is used
79as the write password by default.
69.Pp
70The
80.Pp
81The
71.Ar pw
82.Cm pw
72option of the
83option of the
73.Ar crypto
84.Ic crypto
85.Xr ntpd @NTPD_MS@
74configuration command specifies the read
75password for previously encrypted local files.
86configuration command specifies the read
87password for previously encrypted local files.
76This must match the local password used by this program.
88This must match the local read password used by this program.
77If not specified, the host name is used.
89If not specified, the host name is used.
78Thus, if files are generated by this program without password,
90Thus, if files are generated by this program without an explicit password,
79they can be read back by
91they can be read back by
80.Ar ntpd
81without password but only on the same host.
92.Xr ntpd @NTPD_MS@
93without specifying an explicit password but only on the same host.
94If the write password used for encryption is specified as the host name,
95these files can be read by that host with no explicit password.
82.Pp
83Normally, encrypted files for each host are generated by that host and
84used only by that host, although exceptions exist as noted later on
85this page.
86The symmetric keys file, normally called
96.Pp
97Normally, encrypted files for each host are generated by that host and
98used only by that host, although exceptions exist as noted later on
99this page.
100The symmetric keys file, normally called
87.Ar ntp.keys ,
101.Pa ntp.keys ,
88is usually installed in
89.Pa /etc .
90Other files and links are usually installed in
91.Pa /usr/local/etc ,
92which is normally in a shared filesystem in
93NFS\-mounted networks and cannot be changed by shared clients.
102is usually installed in
103.Pa /etc .
104Other files and links are usually installed in
105.Pa /usr/local/etc ,
106which is normally in a shared filesystem in
107NFS\-mounted networks and cannot be changed by shared clients.
94The location of the keys directory can be changed by the
95.Ar keysdir
96configuration command in such cases.
97Normally, this is in
98.Pa /etc .
108In these cases, NFS clients can specify the files in another
109directory such as
110.Pa /etc
111using the
112.Ic keysdir
113.Xr ntpd @NTPD_MS@
114configuration file command.
99.Pp
100This program directs commentary and error messages to the standard
101error stream
115.Pp
116This program directs commentary and error messages to the standard
117error stream
102.Ar stderr
118.Pa stderr
103and remote files to the standard output stream
119and remote files to the standard output stream
104.Ar stdout
120.Pa stdout
105where they can be piped to other applications or redirected to files.
106The names used for generated files and links all begin with the
107string
121where they can be piped to other applications or redirected to files.
122The names used for generated files and links all begin with the
123string
108.Ar ntpkey
124.Pa ntpkey\&*
109and include the file type, generating host and filestamp,
110as described in the
125and include the file type, generating host and filestamp,
126as described in the
111.Dq Cryptographic Data Files
127.Sx "Cryptographic Data Files"
112section below.
113.Ss Running the Program
128section below.
129.Ss Running the Program
114To test and gain experience with Autokey concepts, log in as root and
115change to the keys directory, usually
116.Pa /usr/local/etc
117When run for the first time, or if all files with names beginning with
118.Ar ntpkey
119have been removed, use the
120.Nm
121command without arguments to generate a
122default RSA host key and matching RSA\-MD5 certificate with expiration
123date one year hence.
124If run again without options, the program uses the
125existing keys and parameters and generates only a new certificate with
126new expiration date one year hence.
127.Pp
128Run the command on as many hosts as necessary.
129Designate one of them as the trusted host (TH) using
130.Nm
131with the
132.Fl T
133option and configure it to synchronize from reliable Internet servers.
134Then configure the other hosts to synchronize to the TH directly or
135indirectly.
136A certificate trail is created when Autokey asks the immediately
137ascendant host towards the TH to sign its certificate, which is then
138provided to the immediately descendant host on request.
139All group hosts should have acyclic certificate trails ending on the TH.
140.Pp
141The host key is used to encrypt the cookie when required and so must be
142RSA type.
143By default, the host key is also the sign key used to encrypt
144signatures.
145A different sign key can be assigned using the
146.Fl S
147option and this can be either RSA or DSA type.
148By default, the signature
149message digest type is MD5, but any combination of sign key type and
150message digest type supported by the OpenSSL library can be specified
151using the
152.Fl c
153option.
154The rules say cryptographic media should be generated with proventic
155filestamps, which means the host should already be synchronized before
156this program is run.
157This of course creates a chicken\-and\-egg problem
158when the host is started for the first time.
159Accordingly, the host time
160should be set by some other means, such as eyeball\-and\-wristwatch, at
161least so that the certificate lifetime is within the current year.
162After that and when the host is synchronized to a proventic source, the
163certificate should be re\-generated.
164.Pp
165Additional information on trusted groups and identity schemes is on the
166.Dq Autokey Public\-Key Authentication
167page.
168.Pp
169The
170.Xr ntpd @NTPD_MS@
171configuration command
172.Ic crypto pw Ar password
173specifies the read password for previously encrypted files.
174The daemon expires on the spot if the password is missing
175or incorrect.
176For convenience, if a file has been previously encrypted,
177the default read password is the name of the host running
178the program.
179If the previous write password is specified as the host name,
180these files can be read by that host with no explicit password.
181.Pp
182File names begin with the prefix
183.Cm ntpkey_
184and end with the postfix
185.Ar _hostname.filestamp ,
186where
187.Ar hostname
188is the owner name, usually the string returned
189by the Unix gethostname() routine, and
190.Ar filestamp
191is the NTP seconds when the file was generated, in decimal digits.
192This both guarantees uniqueness and simplifies maintenance
193procedures, since all files can be quickly removed
194by a
195.Ic rm ntpkey\&*
196command or all files generated
197at a specific time can be removed by a
198.Ic rm
199.Ar \&*filestamp
200command.
201To further reduce the risk of misconfiguration,
202the first two lines of a file contain the file name
203and generation date and time as comments.
204.Pp
205All files are installed by default in the keys directory
206.Pa /usr/local/etc ,
207which is normally in a shared filesystem
208in NFS\-mounted networks.
209The actual location of the keys directory
210and each file can be overridden by configuration commands,
211but this is not recommended.
212Normally, the files for each host are generated by that host
213and used only by that host, although exceptions exist
214as noted later on this page.
215.Pp
216Normally, files containing private values,
217including the host key, sign key and identification parameters,
218are permitted root read/write\-only;
219while others containing public values are permitted world readable.
220Alternatively, files containing private values can be encrypted
221and these files permitted world readable,
222which simplifies maintenance in shared file systems.
223Since uniqueness is insured by the hostname and
224file name extensions, the files for a NFS server and
225dependent clients can all be installed in the same shared directory.
226.Pp
227The recommended practice is to keep the file name extensions
228when installing a file and to install a soft link
229from the generic names specified elsewhere on this page
230to the generated files.
231This allows new file generations to be activated simply
232by changing the link.
233If a link is present, ntpd follows it to the file name
234to extract the filestamp.
235If a link is not present,
236.Xr ntpd @NTPD_MS@
237extracts the filestamp from the file itself.
238This allows clients to verify that the file and generation times
239are always current.
240The
241.Nm
242program uses the same timestamp extension for all files generated
243at one time, so each generation is distinct and can be readily
244recognized in monitoring data.
245.Ss Running the program
246The safest way to run the
247.Nm
248program is logged in directly as root.
130The safest way to run the
131.Nm
132program is logged in directly as root.
249The recommended procedure is change to the keys directory,
250usually
133The recommended procedure is change to the
134.Ar keys
135directory, usually
251.Pa /usr/local/etc ,
252then run the program.
136.Pa /usr/local/etc ,
137then run the program.
253When run for the first time,
254or if all
255.Cm ntpkey
256files have been removed,
257the program generates a RSA host key file and matching RSA\-MD5 certificate file,
138.Pp
139To test and gain experience with Autokey concepts, log in as root and
140change to the
141.Ar keys
142directory, usually
143.Pa /usr/local/etc .
144When run for the first time, or if all files with names beginning with
145.Pa ntpkey\&*
146have been removed, use the
147.Nm
148command without arguments to generate a default
149.Cm RSA
150host key and matching
151.Cm RSA\-MD5
152certificate file with expiration date one year hence,
258which is all that is necessary in many cases.
259The program also generates soft links from the generic names
260to the respective files.
153which is all that is necessary in many cases.
154The program also generates soft links from the generic names
155to the respective files.
261If run again, the program uses the same host key file,
262but generates a new certificate file and link.
156If run again without options, the program uses the
157existing keys and parameters and generates a new certificate file with
158new expiration date one year hence, and soft link.
263.Pp
159.Pp
264The host key is used to encrypt the cookie when required and so must be RSA type.
160The host key is used to encrypt the cookie when required and so must be
161.Cm RSA
162type.
265By default, the host key is also the sign key used to encrypt signatures.
266When necessary, a different sign key can be specified and this can be
163By default, the host key is also the sign key used to encrypt signatures.
164When necessary, a different sign key can be specified and this can be
267either RSA or DSA type.
268By default, the message digest type is MD5, but any combination
165either
166.Cm RSA
167or
168.Cm DSA
169type.
170By default, the message digest type is
171.Cm MD5 ,
172but any combination
269of sign key type and message digest type supported by the OpenSSL library
173of sign key type and message digest type supported by the OpenSSL library
270can be specified, including those using the MD2, MD5, SHA, SHA1, MDC2
271and RIPE160 message digest algorithms.
174can be specified, including those using the
175.Cm AES128CMAC , MD2 , MD5 , MDC2 , SHA , SHA1
176and
177.Cm RIPE160
178message digest algorithms.
272However, the scheme specified in the certificate must be compatible
273with the sign key.
179However, the scheme specified in the certificate must be compatible
180with the sign key.
274Certificates using any digest algorithm are compatible with RSA sign keys;
275however, only SHA and SHA1 certificates are compatible with DSA sign keys.
181Certificates using any digest algorithm are compatible with
182.Cm RSA
183sign keys;
184however, only
185.Cm SHA
186and
187.Cm SHA1
188certificates are compatible with
189.Cm DSA
190sign keys.
276.Pp
277Private/public key files and certificates are compatible with
278other OpenSSL applications and very likely other libraries as well.
279Certificates or certificate requests derived from them should be compatible
280with extant industry practice, although some users might find
281the interpretation of X509v3 extension fields somewhat liberal.
282However, the identification parameter files, although encoded
283as the other files, are probably not compatible with anything other than Autokey.
284.Pp
285Running the program as other than root and using the Unix
191.Pp
192Private/public key files and certificates are compatible with
193other OpenSSL applications and very likely other libraries as well.
194Certificates or certificate requests derived from them should be compatible
195with extant industry practice, although some users might find
196the interpretation of X509v3 extension fields somewhat liberal.
197However, the identification parameter files, although encoded
198as the other files, are probably not compatible with anything other than Autokey.
199.Pp
200Running the program as other than root and using the Unix
286.Ic su
201.Xr su 1
287command
288to assume root may not work properly, since by default the OpenSSL library
289looks for the random seed file
202command
203to assume root may not work properly, since by default the OpenSSL library
204looks for the random seed file
290.Cm .rnd
205.Pa .rnd
291in the user home directory.
292However, there should be only one
206in the user home directory.
207However, there should be only one
293.Cm .rnd ,
208.Pa .rnd ,
294most conveniently
295in the root directory, so it is convenient to define the
209most conveniently
210in the root directory, so it is convenient to define the
296.Cm $RANDFILE
211.Ev RANDFILE
297environment variable used by the OpenSSL library as the path to
212environment variable used by the OpenSSL library as the path to
298.Cm /.rnd .
213.Pa .rnd .
299.Pp
300Installing the keys as root might not work in NFS\-mounted
301shared file systems, as NFS clients may not be able to write
302to the shared keys directory, even as root.
303In this case, NFS clients can specify the files in another
304directory such as
305.Pa /etc
306using the
307.Ic keysdir
214.Pp
215Installing the keys as root might not work in NFS\-mounted
216shared file systems, as NFS clients may not be able to write
217to the shared keys directory, even as root.
218In this case, NFS clients can specify the files in another
219directory such as
220.Pa /etc
221using the
222.Ic keysdir
308command.
223.Xr ntpd @NTPD_MS@
224configuration file command.
309There is no need for one client to read the keys and certificates
310of other clients or servers, as these data are obtained automatically
311by the Autokey protocol.
312.Pp
313Ordinarily, cryptographic files are generated by the host that uses them,
314but it is possible for a trusted agent (TA) to generate these files
315for other hosts; however, in such cases files should always be encrypted.
316The subject name and trusted name default to the hostname

--- 16 unchanged lines hidden (view full) ---

333.Pp
334Normally, files containing private values,
335including the host key, sign key and identification parameters,
336are permitted root read/write\-only;
337while others containing public values are permitted world readable.
338Alternatively, files containing private values can be encrypted
339and these files permitted world readable,
340which simplifies maintenance in shared file systems.
225There is no need for one client to read the keys and certificates
226of other clients or servers, as these data are obtained automatically
227by the Autokey protocol.
228.Pp
229Ordinarily, cryptographic files are generated by the host that uses them,
230but it is possible for a trusted agent (TA) to generate these files
231for other hosts; however, in such cases files should always be encrypted.
232The subject name and trusted name default to the hostname

--- 16 unchanged lines hidden (view full) ---

249.Pp
250Normally, files containing private values,
251including the host key, sign key and identification parameters,
252are permitted root read/write\-only;
253while others containing public values are permitted world readable.
254Alternatively, files containing private values can be encrypted
255and these files permitted world readable,
256which simplifies maintenance in shared file systems.
341Since uniqueness is insured by the hostname and
342file name extensions, the files for a NFS server and
257Since uniqueness is insured by the
258.Ar hostname
259and
260.Ar filestamp
261file name extensions, the files for an NTP server and
343dependent clients can all be installed in the same shared directory.
344.Pp
345The recommended practice is to keep the file name extensions
346when installing a file and to install a soft link
347from the generic names specified elsewhere on this page
348to the generated files.
349This allows new file generations to be activated simply
350by changing the link.
262dependent clients can all be installed in the same shared directory.
263.Pp
264The recommended practice is to keep the file name extensions
265when installing a file and to install a soft link
266from the generic names specified elsewhere on this page
267to the generated files.
268This allows new file generations to be activated simply
269by changing the link.
351If a link is present, ntpd follows it to the file name
352to extract the filestamp.
270If a link is present,
271.Xr ntpd @NTPD_MS@
272follows it to the file name to extract the
273.Ar filestamp .
353If a link is not present,
354.Xr ntpd @NTPD_MS@
274If a link is not present,
275.Xr ntpd @NTPD_MS@
355extracts the filestamp from the file itself.
276extracts the
277.Ar filestamp
278from the file itself.
356This allows clients to verify that the file and generation times
357are always current.
358The
359.Nm
279This allows clients to verify that the file and generation times
280are always current.
281The
282.Nm
360program uses the same timestamp extension for all files generated
283program uses the same
284.Ar filestamp
285extension for all files generated
361at one time, so each generation is distinct and can be readily
362recognized in monitoring data.
286at one time, so each generation is distinct and can be readily
287recognized in monitoring data.
363.Ss Running the program
364The safest way to run the
288.Pp
289Run the command on as many hosts as necessary.
290Designate one of them as the trusted host (TH) using
365.Nm
291.Nm
366program is logged in directly as root.
367The recommended procedure is change to the keys directory,
368usually
369.Pa /usr/local/etc ,
370then run the program.
371When run for the first time,
372or if all
373.Cm ntpkey
374files have been removed,
375the program generates a RSA host key file and matching RSA\-MD5 certificate file,
376which is all that is necessary in many cases.
377The program also generates soft links from the generic names
378to the respective files.
379If run again, the program uses the same host key file,
380but generates a new certificate file and link.
292with the
293.Fl T
294option and configure it to synchronize from reliable Internet servers.
295Then configure the other hosts to synchronize to the TH directly or
296indirectly.
297A certificate trail is created when Autokey asks the immediately
298ascendant host towards the TH to sign its certificate, which is then
299provided to the immediately descendant host on request.
300All group hosts should have acyclic certificate trails ending on the TH.
381.Pp
301.Pp
382The host key is used to encrypt the cookie when required and so must be RSA type.
383By default, the host key is also the sign key used to encrypt signatures.
384When necessary, a different sign key can be specified and this can be
385either RSA or DSA type.
386By default, the message digest type is MD5, but any combination
387of sign key type and message digest type supported by the OpenSSL library
388can be specified, including those using the MD2, MD5, SHA, SHA1, MDC2
389and RIPE160 message digest algorithms.
390However, the scheme specified in the certificate must be compatible
391with the sign key.
392Certificates using any digest algorithm are compatible with RSA sign keys;
393however, only SHA and SHA1 certificates are compatible with DSA sign keys.
302The host key is used to encrypt the cookie when required and so must be
303RSA type.
304By default, the host key is also the sign key used to encrypt
305signatures.
306A different sign key can be assigned using the
307.Fl S
308option and this can be either
309.Cm RSA
310or
311.Cm DSA
312type.
313By default, the signature
314message digest type is
315.Cm MD5 ,
316but any combination of sign key type and
317message digest type supported by the OpenSSL library can be specified
318using the
319.Fl c
320option.
394.Pp
321.Pp
395Private/public key files and certificates are compatible with
396other OpenSSL applications and very likely other libraries as well.
397Certificates or certificate requests derived from them should be compatible
398with extant industry practice, although some users might find
399the interpretation of X509v3 extension fields somewhat liberal.
400However, the identification parameter files, although encoded
401as the other files, are probably not compatible with anything other than Autokey.
322The rules say cryptographic media should be generated with proventic
323filestamps, which means the host should already be synchronized before
324this program is run.
325This of course creates a chicken\-and\-egg problem
326when the host is started for the first time.
327Accordingly, the host time
328should be set by some other means, such as eyeball\-and\-wristwatch, at
329least so that the certificate lifetime is within the current year.
330After that and when the host is synchronized to a proventic source, the
331certificate should be re\-generated.
402.Pp
332.Pp
403Running the program as other than root and using the Unix
404.Ic su
405command
406to assume root may not work properly, since by default the OpenSSL library
407looks for the random seed file
408.Cm .rnd
409in the user home directory.
410However, there should be only one
411.Cm .rnd ,
412most conveniently
413in the root directory, so it is convenient to define the
414.Cm $RANDFILE
415environment variable used by the OpenSSL library as the path to
416.Cm /.rnd .
333Additional information on trusted groups and identity schemes is on the
334.Dq Autokey Public\-Key Authentication
335page.
417.Pp
336.Pp
418Installing the keys as root might not work in NFS\-mounted
419shared file systems, as NFS clients may not be able to write
420to the shared keys directory, even as root.
421In this case, NFS clients can specify the files in another
422directory such as
423.Pa /etc
424using the
425.Ic keysdir
337File names begin with the prefix
338.Pa ntpkey Ns _
339and end with the suffix
340.Pa _ Ns Ar hostname . Ar filestamp ,
341where
342.Ar hostname
343is the owner name, usually the string returned
344by the Unix
345.Xr hostname 1
346command, and
347.Ar filestamp
348is the NTP seconds when the file was generated, in decimal digits.
349This both guarantees uniqueness and simplifies maintenance
350procedures, since all files can be quickly removed
351by a
352.Ic rm Pa ntpkey\&*
353command or all files generated
354at a specific time can be removed by a
355.Ic rm Pa \&* Ns Ar filestamp
426command.
356command.
427There is no need for one client to read the keys and certificates
428of other clients or servers, as these data are obtained automatically
429by the Autokey protocol.
430.Pp
431Ordinarily, cryptographic files are generated by the host that uses them,
432but it is possible for a trusted agent (TA) to generate these files
433for other hosts; however, in such cases files should always be encrypted.
434The subject name and trusted name default to the hostname
435of the host generating the files, but can be changed by command line options.
436It is convenient to designate the owner name and trusted name
437as the subject and issuer fields, respectively, of the certificate.
438The owner name is also used for the host and sign key files,
439while the trusted name is used for the identity files.
440seconds.
441seconds.
442s Trusted Hosts and Groups
357To further reduce the risk of misconfiguration,
358the first two lines of a file contain the file name
359and generation date and time as comments.
360.Ss Trusted Hosts and Groups
443Each cryptographic configuration involves selection of a signature scheme
444and identification scheme, called a cryptotype,
445as explained in the
446.Sx Authentication Options
447section of
448.Xr ntp.conf 5 .
361Each cryptographic configuration involves selection of a signature scheme
362and identification scheme, called a cryptotype,
363as explained in the
364.Sx Authentication Options
365section of
366.Xr ntp.conf 5 .
449The default cryptotype uses RSA encryption, MD5 message digest
450and TC identification.
367The default cryptotype uses
368.Cm RSA
369encryption,
370.Cm MD5
371message digest
372and
373.Cm TC
374identification.
451First, configure a NTP subnet including one or more low\-stratum
452trusted hosts from which all other hosts derive synchronization
453directly or indirectly.
454Trusted hosts have trusted certificates;
455all other hosts have nontrusted certificates.
456These hosts will automatically and dynamically build authoritative
457certificate trails to one or more trusted hosts.
458A trusted group is the set of all hosts that have, directly or indirectly,
459a certificate trail ending at a trusted host.
460The trail is defined by static configuration file entries
461or dynamic means described on the
462.Sx Automatic NTP Configuration Options
463section of
464.Xr ntp.conf 5 .
465.Pp
466On each trusted host as root, change to the keys directory.
467To insure a fresh fileset, remove all
375First, configure a NTP subnet including one or more low\-stratum
376trusted hosts from which all other hosts derive synchronization
377directly or indirectly.
378Trusted hosts have trusted certificates;
379all other hosts have nontrusted certificates.
380These hosts will automatically and dynamically build authoritative
381certificate trails to one or more trusted hosts.
382A trusted group is the set of all hosts that have, directly or indirectly,
383a certificate trail ending at a trusted host.
384The trail is defined by static configuration file entries
385or dynamic means described on the
386.Sx Automatic NTP Configuration Options
387section of
388.Xr ntp.conf 5 .
389.Pp
390On each trusted host as root, change to the keys directory.
391To insure a fresh fileset, remove all
468.Cm ntpkey
392.Pa ntpkey
469files.
470Then run
471.Nm
472.Fl T
473to generate keys and a trusted certificate.
474On all other hosts do the same, but leave off the
475.Fl T
476flag to generate keys and nontrusted certificates.

--- 8 unchanged lines hidden (view full) ---

485with the
486.Fl S Ar type
487option, where
488.Ar type
489is either
490.Cm RSA
491or
492.Cm DSA .
393files.
394Then run
395.Nm
396.Fl T
397to generate keys and a trusted certificate.
398On all other hosts do the same, but leave off the
399.Fl T
400flag to generate keys and nontrusted certificates.

--- 8 unchanged lines hidden (view full) ---

409with the
410.Fl S Ar type
411option, where
412.Ar type
413is either
414.Cm RSA
415or
416.Cm DSA .
493The most often need to do this is when a DSA\-signed certificate is used.
417The most frequent need to do this is when a
418.Cm DSA Ns \-signed
419certificate is used.
494If it is necessary to use a different certificate scheme than the default,
495run
496.Nm
497with the
498.Fl c Ar scheme
499option and selected
500.Ar scheme
501as needed.
420If it is necessary to use a different certificate scheme than the default,
421run
422.Nm
423with the
424.Fl c Ar scheme
425option and selected
426.Ar scheme
427as needed.
502f
428If
503.Nm
504is run again without these options, it generates a new certificate
429.Nm
430is run again without these options, it generates a new certificate
505using the same scheme and sign key.
431using the same scheme and sign key, and soft link.
506.Pp
507After setting up the environment it is advisable to update certificates
508from time to time, if only to extend the validity interval.
509Simply run
510.Nm
511with the same flags as before to generate new certificates
432.Pp
433After setting up the environment it is advisable to update certificates
434from time to time, if only to extend the validity interval.
435Simply run
436.Nm
437with the same flags as before to generate new certificates
512using existing keys.
438using existing keys, and soft links.
513However, if the host or sign key is changed,
514.Xr ntpd @NTPD_MS@
515should be restarted.
516When
517.Xr ntpd @NTPD_MS@
518is restarted, it loads any new files and restarts the protocol.
519Other dependent hosts will continue as usual until signatures are refreshed,
520at which time the protocol is restarted.
521.Ss Identity Schemes
522As mentioned on the Autonomous Authentication page,
439However, if the host or sign key is changed,
440.Xr ntpd @NTPD_MS@
441should be restarted.
442When
443.Xr ntpd @NTPD_MS@
444is restarted, it loads any new files and restarts the protocol.
445Other dependent hosts will continue as usual until signatures are refreshed,
446at which time the protocol is restarted.
447.Ss Identity Schemes
448As mentioned on the Autonomous Authentication page,
523the default TC identity scheme is vulnerable to a middleman attack.
449the default
450.Cm TC
451identity scheme is vulnerable to a middleman attack.
524However, there are more secure identity schemes available,
452However, there are more secure identity schemes available,
525including PC, IFF, GQ and MV described on the
526.Qq Identification Schemes
527page
528(maybe available at
529.Li http://www.eecis.udel.edu/%7emills/keygen.html ) .
453including
454.Cm PC , IFF , GQ
455and
456.Cm MV
457schemes described below.
530These schemes are based on a TA, one or more trusted hosts
531and some number of nontrusted hosts.
532Trusted hosts prove identity using values provided by the TA,
533while the remaining hosts prove identity using values provided
534by a trusted host and certificate trails that end on that host.
535The name of a trusted host is also the name of its sugroup
536and also the subject and issuer name on its trusted certificate.
537The TA is not necessarily a trusted host in this sense, but often is.

--- 8 unchanged lines hidden (view full) ---

546only as clients have key files that contain only client keys.
547.Pp
548The PC scheme supports only one trusted host in the group.
549On trusted host alice run
550.Nm
551.Fl P
552.Fl p Ar password
553to generate the host key file
458These schemes are based on a TA, one or more trusted hosts
459and some number of nontrusted hosts.
460Trusted hosts prove identity using values provided by the TA,
461while the remaining hosts prove identity using values provided
462by a trusted host and certificate trails that end on that host.
463The name of a trusted host is also the name of its sugroup
464and also the subject and issuer name on its trusted certificate.
465The TA is not necessarily a trusted host in this sense, but often is.

--- 8 unchanged lines hidden (view full) ---

474only as clients have key files that contain only client keys.
475.Pp
476The PC scheme supports only one trusted host in the group.
477On trusted host alice run
478.Nm
479.Fl P
480.Fl p Ar password
481to generate the host key file
554.Pa ntpkey_RSAkey_ Ns Ar alice.filestamp
482.Pa ntpkey Ns _ Cm RSA Pa key_alice. Ar filestamp
555and trusted private certificate file
483and trusted private certificate file
556.Pa ntpkey_RSA\-MD5_cert_ Ns Ar alice.filestamp .
484.Pa ntpkey Ns _ Cm RSA\-MD5 _ Pa cert_alice. Ar filestamp ,
485and soft links.
557Copy both files to all group hosts;
558they replace the files which would be generated in other schemes.
486Copy both files to all group hosts;
487they replace the files which would be generated in other schemes.
559On each host bob install a soft link from the generic name
488On each host
489.Ar bob
490install a soft link from the generic name
560.Pa ntpkey_host_ Ns Ar bob
561to the host key file and soft link
562.Pa ntpkey_cert_ Ns Ar bob
563to the private certificate file.
564Note the generic links are on bob, but point to files generated
565by trusted host alice.
566In this scheme it is not possible to refresh
567either the keys or certificates without copying them
491.Pa ntpkey_host_ Ns Ar bob
492to the host key file and soft link
493.Pa ntpkey_cert_ Ns Ar bob
494to the private certificate file.
495Note the generic links are on bob, but point to files generated
496by trusted host alice.
497In this scheme it is not possible to refresh
498either the keys or certificates without copying them
568to all other hosts in the group.
499to all other hosts in the group, and recreating the soft links.
569.Pp
500.Pp
570For the IFF scheme proceed as in the TC scheme to generate keys
501For the
502.Cm IFF
503scheme proceed as in the
504.Cm TC
505scheme to generate keys
571and certificates for all group hosts, then for every trusted host in the group,
506and certificates for all group hosts, then for every trusted host in the group,
572generate the IFF parameter file.
507generate the
508.Cm IFF
509parameter file.
573On trusted host alice run
574.Nm
575.Fl T
576.Fl I
577.Fl p Ar password
578to produce her parameter file
510On trusted host alice run
511.Nm
512.Fl T
513.Fl I
514.Fl p Ar password
515to produce her parameter file
579.Pa ntpkey_IFFpar_ Ns Ar alice.filestamp ,
516.Pa ntpkey_IFFpar_alice. Ns Ar filestamp ,
580which includes both server and client keys.
581Copy this file to all group hosts that operate as both servers
582and clients and install a soft link from the generic
517which includes both server and client keys.
518Copy this file to all group hosts that operate as both servers
519and clients and install a soft link from the generic
583.Pa ntpkey_iff_ Ns Ar alice
520.Pa ntpkey_iff_alice
584to this file.
585If there are no hosts restricted to operate only as clients,
586there is nothing further to do.
521to this file.
522If there are no hosts restricted to operate only as clients,
523there is nothing further to do.
587As the IFF scheme is independent
524As the
525.Cm IFF
526scheme is independent
588of keys and certificates, these files can be refreshed as needed.
589.Pp
590If a rogue client has the parameter file, it could masquerade
591as a legitimate server and present a middleman threat.
592To eliminate this threat, the client keys can be extracted
593from the parameter file and distributed to all restricted clients.
594After generating the parameter file, on alice run
595.Nm
596.Fl e
527of keys and certificates, these files can be refreshed as needed.
528.Pp
529If a rogue client has the parameter file, it could masquerade
530as a legitimate server and present a middleman threat.
531To eliminate this threat, the client keys can be extracted
532from the parameter file and distributed to all restricted clients.
533After generating the parameter file, on alice run
534.Nm
535.Fl e
597and pipe the output to a file or mail program.
598Copy or mail this file to all restricted clients.
536and pipe the output to a file or email program.
537Copy or email this file to all restricted clients.
599On these clients install a soft link from the generic
538On these clients install a soft link from the generic
600.Pa ntpkey_iff_ Ns Ar alice
539.Pa ntpkey_iff_alice
601to this file.
602To further protect the integrity of the keys,
603each file can be encrypted with a secret password.
604.Pp
540to this file.
541To further protect the integrity of the keys,
542each file can be encrypted with a secret password.
543.Pp
605For the GQ scheme proceed as in the TC scheme to generate keys
544For the
545.Cm GQ
546scheme proceed as in the
547.Cm TC
548scheme to generate keys
606and certificates for all group hosts, then for every trusted host
549and certificates for all group hosts, then for every trusted host
607in the group, generate the IFF parameter file.
550in the group, generate the
551.Cm IFF
552parameter file.
608On trusted host alice run
609.Nm
610.Fl T
611.Fl G
612.Fl p Ar password
613to produce her parameter file
553On trusted host alice run
554.Nm
555.Fl T
556.Fl G
557.Fl p Ar password
558to produce her parameter file
614.Pa ntpkey_GQpar_ Ns Ar alice.filestamp ,
559.Pa ntpkey_GQpar_alice. Ns Ar filestamp ,
615which includes both server and client keys.
616Copy this file to all group hosts and install a soft link
617from the generic
560which includes both server and client keys.
561Copy this file to all group hosts and install a soft link
562from the generic
618.Pa ntpkey_gq_ Ns Ar alice
563.Pa ntpkey_gq_alice
619to this file.
564to this file.
620In addition, on each host bob install a soft link
565In addition, on each host
566.Ar bob
567install a soft link
621from generic
622.Pa ntpkey_gq_ Ns Ar bob
623to this file.
568from generic
569.Pa ntpkey_gq_ Ns Ar bob
570to this file.
624As the GQ scheme updates the GQ parameters file and certificate
571As the
572.Cm GQ
573scheme updates the
574.Cm GQ
575parameters file and certificate
625at the same time, keys and certificates can be regenerated as needed.
626.Pp
576at the same time, keys and certificates can be regenerated as needed.
577.Pp
627For the MV scheme, proceed as in the TC scheme to generate keys
578For the
579.Cm MV
580scheme, proceed as in the
581.Cm TC
582scheme to generate keys
628and certificates for all group hosts.
629For illustration assume trish is the TA, alice one of several trusted hosts
630and bob one of her clients.
631On TA trish run
632.Nm
633.Fl V Ar n
634.Fl p Ar password ,
635where
636.Ar n
637is the number of revokable keys (typically 5) to produce
638the parameter file
583and certificates for all group hosts.
584For illustration assume trish is the TA, alice one of several trusted hosts
585and bob one of her clients.
586On TA trish run
587.Nm
588.Fl V Ar n
589.Fl p Ar password ,
590where
591.Ar n
592is the number of revokable keys (typically 5) to produce
593the parameter file
639.Pa ntpkeys_MVpar_ Ns Ar trish.filestamp
594.Pa ntpkeys_MVpar_trish. Ns Ar filestamp
640and client key files
595and client key files
641.Pa ntpkeys_MVkeyd_ Ns Ar trish.filestamp
596.Pa ntpkeys_MVkey Ns Ar d _ Pa trish. Ar filestamp
642where
643.Ar d
644is the key number (0 \&<
645.Ar d
646\&<
647.Ar n ) .
648Copy the parameter file to alice and install a soft link
649from the generic
597where
598.Ar d
599is the key number (0 \&<
600.Ar d
601\&<
602.Ar n ) .
603Copy the parameter file to alice and install a soft link
604from the generic
650.Pa ntpkey_mv_ Ns Ar alice
605.Pa ntpkey_mv_alice
651to this file.
652Copy one of the client key files to alice for later distribution
653to her clients.
606to this file.
607Copy one of the client key files to alice for later distribution
608to her clients.
654It doesn't matter which client key file goes to alice,
609It does not matter which client key file goes to alice,
655since they all work the same way.
610since they all work the same way.
656Alice copies the client key file to all of her cliens.
611Alice copies the client key file to all of her clients.
657On client bob install a soft link from generic
612On client bob install a soft link from generic
658.Pa ntpkey_mvkey_ Ns Ar bob
613.Pa ntpkey_mvkey_bob
659to the client key file.
614to the client key file.
660As the MV scheme is independent of keys and certificates,
615As the
616.Cm MV
617scheme is independent of keys and certificates,
661these files can be refreshed as needed.
662.Ss Command Line Options
663.Bl -tag -width indent
618these files can be refreshed as needed.
619.Ss Command Line Options
620.Bl -tag -width indent
664.It Fl c Ar scheme
665Select certificate message digest/signature encryption scheme.
621.It Fl b Fl \-imbits Ns = Ar modulus
622Set the number of bits in the identity modulus for generating identity keys to
623.Ar modulus
624bits.
625The number of bits in the identity modulus defaults to 256, but can be set to
626values from 256 to 2048 (32 to 256 octets).
627Use the larger moduli with caution, as this can consume considerable computing
628resources and increases the size of authenticated packets.
629.It Fl c Fl \-certificate Ns = Ar scheme
630Select certificate signature encryption/message digest scheme.
666The
667.Ar scheme
668can be one of the following:
631The
632.Ar scheme
633can be one of the following:
669. Cm RSA\-MD2 , RSA\-MD5 , RSA\-SHA , RSA\-SHA1 , RSA\-MDC2 , RSA\-RIPEMD160 , DSA\-SHA ,
634.Cm RSA\-MD2 , RSA\-MD5 , RSA\-MDC2 , RSA\-SHA , RSA\-SHA1 , RSA\-RIPEMD160 , DSA\-SHA ,
670or
671.Cm DSA\-SHA1 .
635or
636.Cm DSA\-SHA1 .
672Note that RSA schemes must be used with a RSA sign key and DSA
673schemes must be used with a DSA sign key.
637Note that
638.Cm RSA
639schemes must be used with an
640.Cm RSA
641sign key and
642.Cm DSA
643schemes must be used with a
644.Cm DSA
645sign key.
674The default without this option is
675.Cm RSA\-MD5 .
646The default without this option is
647.Cm RSA\-MD5 .
676.It Fl d
677Enable debugging.
648If compatibility with FIPS 140\-2 is required, either the
649.Cm DSA\-SHA
650or
651.Cm DSA\-SHA1
652scheme must be used.
653.It Fl C Fl \-cipher Ns = Ar cipher
654Select the OpenSSL cipher to encrypt the files containing private keys.
655The default without this option is three\-key triple DES in CBC mode,
656.Cm des\-ede3\-cbc .
657The
658.Ic openssl Fl h
659command provided with OpenSSL displays available ciphers.
660.It Fl d Fl \-debug\-level
661Increase debugging verbosity level.
678This option displays the cryptographic data produced in eye\-friendly billboards.
662This option displays the cryptographic data produced in eye\-friendly billboards.
679.It Fl e
680Write the IFF client keys to the standard output.
681This is intended for automatic key distribution by mail.
682.It Fl G
683Generate parameters and keys for the GQ identification scheme,
684obsoleting any that may exist.
685.It Fl g
686Generate keys for the GQ identification scheme
687using the existing GQ parameters.
688If the GQ parameters do not yet exist, create them first.
689.It Fl H
690Generate new host keys, obsoleting any that may exist.
691.It Fl I
692Generate parameters for the IFF identification scheme,
693obsoleting any that may exist.
694.It Fl i Ar name
695Set the suject name to
696.Ar name .
697This is used as the subject field in certificates
698and in the file name for host and sign keys.
699.It Fl M
700Generate MD5 keys, obsoleting any that may exist.
701.It Fl P
702Generate a private certificate.
663.It Fl D Fl \-set\-debug\-level Ns = Ar level
664Set the debugging verbosity to
665.Ar level .
666This option displays the cryptographic data produced in eye\-friendly billboards.
667.It Fl e Fl \-id\-key
668Write the
669.Cm IFF
670or
671.Cm GQ
672public parameters from the
673.Ar IFFkey or GQkey
674client keys file previously specified
675as unencrypted data to the standard output stream
676.Pa stdout .
677This is intended for automatic key distribution by email.
678.It Fl G Fl \-gq\-params
679Generate a new encrypted
680.Cm GQ
681parameters and key file for the Guillou\-Quisquater (GQ) identity scheme.
682This option is mutually exclusive with the
683.Fl I
684and
685.Fl V
686options.
687.It Fl H Fl \-host\-key
688Generate a new encrypted
689.Cm RSA
690public/private host key file.
691.It Fl I Fl \-iffkey
692Generate a new encrypted
693.Cm IFF
694key file for the Schnorr (IFF) identity scheme.
695This option is mutually exclusive with the
696.Fl G
697and
698Fl V
699options.
700.It Fl i Fl \-ident Ns = Ar group
701Set the optional Autokey group name to
702.Ar group .
703This is used in the identity scheme parameter file names of
704.Cm IFF , GQ ,
705and
706.Cm MV
707client parameters files.
708In that role, the default is the host name if no group is provided.
709The group name, if specified using
710.Fl i
711or
712.Fl s
713following an
714.Ql @
715character, is also used in certificate subject and issuer names in the form
716.Ar host @ group
717and should match the group specified via
718.Ic crypto Cm ident
719or
720.Ic server Cm ident
721in the ntpd configuration file.
722.It Fl l Fl \-lifetime Ns = Ar days
723Set the lifetime for certificate expiration to
724.Ar days .
725The default lifetime is one year (365 days).
726.It Fl m Fl \-modulus Ns = Ar bits
727Set the number of bits in the prime modulus for generating files to
728.Ar bits .
729The modulus defaults to 512, but can be set from 256 to 2048 (32 to 256 octets).
730Use the larger moduli with caution, as this can consume considerable computing
731resources and increases the size of authenticated packets.
732.It Fl M Fl \-md5key
733Generate a new symmetric keys file containing 10
734.Cm MD5
735keys, and if OpenSSL is available, 10
736.Cm SHA
737keys.
738An
739.Cm MD5
740key is a string of 20 random printable ASCII characters, while a
741.Cm SHA
742key is a string of 40 random hex digits.
743The file can be edited using a text editor to change the key type or key content.
744This option is mutually exclusive with all other options.
745.It Fl p Fl \-password Ns = Ar passwd
746Set the password for reading and writing encrypted files to
747.Ar passwd .
748These include the host, sign and identify key files.
749By default, the password is the string returned by the Unix
750.Ic hostname
751command.
752.It Fl P Fl \-pvt\-cert
753Generate a new private certificate used by the
754.Cm PC
755identity scheme.
703By default, the program generates public certificates.
756By default, the program generates public certificates.
704.It Fl p Ar password
705Encrypt generated files containing private data with
706.Ar password
707and the DES\-CBC algorithm.
708.It Fl q
709Set the password for reading files to password.
710.It Fl S Oo Cm RSA | DSA Oc
711Generate a new sign key of the designated type,
712obsoleting any that may exist.
713By default, the program uses the host key as the sign key.
714.It Fl s Ar name
715Set the issuer name to
716.Ar name .
717This is used for the issuer field in certificates
718and in the file name for identity files.
719.It Fl T
757Note: the PC identity scheme is not recommended for new installations.
758.It Fl q Fl \-export\-passwd Ns = Ar passwd
759Set the password for writing encrypted
760.Cm IFF , GQ and MV
761identity files redirected to
762.Pa stdout
763to
764.Ar passwd .
765In effect, these files are decrypted with the
766.Fl p
767password, then encrypted with the
768.Fl q
769password.
770By default, the password is the string returned by the Unix
771.Ic hostname
772command.
773.It Fl s Fl \-subject\-key Ns = Ar Oo host Oc Op @ Ar group
774Specify the Autokey host name, where
775.Ar host
776is the optional host name and
777.Ar group
778is the optional group name.
779The host name, and if provided, group name are used in
780.Ar host @ group
781form as certificate subject and issuer.
782Specifying
783.Fl s @ Ar group
784is allowed, and results in leaving the host name unchanged, as with
785.Fl i Ar group .
786The group name, or if no group is provided, the host name are also used in the
787file names of
788.Cm IFF , GQ ,
789and
790.Cm MV
791identity scheme client parameter files.
792If
793.Ar host
794is not specified, the default host name is the string returned by the Unix
795.Ic hostname
796command.
797.It Fl S Fl \-sign\-key Ns = Op Cm RSA | DSA
798Generate a new encrypted public/private sign key file of the specified type.
799By default, the sign key is the host key and has the same type.
800If compatibility with FIPS 140\-2 is required, the sign key type must be
801.Cm DSA .
802.It Fl T Fl \-trusted\-cert
720Generate a trusted certificate.
721By default, the program generates a non\-trusted certificate.
803Generate a trusted certificate.
804By default, the program generates a non\-trusted certificate.
722.It Fl V Ar nkeys
723Generate parameters and keys for the Mu\-Varadharajan (MV) identification scheme.
805.It Fl V Fl \-mv\-params Ar nkeys
806Generate
807.Ar nkeys
808encrypted server keys and parameters for the Mu\-Varadharajan (MV)
809identity scheme.
810This option is mutually exclusive with the
811.Fl I
812and
813.Fl G
814options.
815Note: support for this option should be considered a work in progress.
724.El
725.Ss Random Seed File
726All cryptographically sound key generation schemes must have means
727to randomize the entropy seed used to initialize
728the internal pseudo\-random number generator used
729by the library routines.
730The OpenSSL library uses a designated random seed file for this purpose.
731The file must be available when starting the NTP daemon and

--- 7 unchanged lines hidden (view full) ---

739would be predictable.
740Various means dependent on external events, such as keystroke intervals,
741can be used to do this and some systems have built\-in entropy sources.
742Suitable means are described in the OpenSSL software documentation,
743but are outside the scope of this page.
744.Pp
745The entropy seed used by the OpenSSL library is contained in a file,
746usually called
816.El
817.Ss Random Seed File
818All cryptographically sound key generation schemes must have means
819to randomize the entropy seed used to initialize
820the internal pseudo\-random number generator used
821by the library routines.
822The OpenSSL library uses a designated random seed file for this purpose.
823The file must be available when starting the NTP daemon and

--- 7 unchanged lines hidden (view full) ---

831would be predictable.
832Various means dependent on external events, such as keystroke intervals,
833can be used to do this and some systems have built\-in entropy sources.
834Suitable means are described in the OpenSSL software documentation,
835but are outside the scope of this page.
836.Pp
837The entropy seed used by the OpenSSL library is contained in a file,
838usually called
747.Cm .rnd ,
839.Pa .rnd ,
748which must be available when starting the NTP daemon
749or the
750.Nm
751program.
752The NTP daemon will first look for the file
753using the path specified by the
840which must be available when starting the NTP daemon
841or the
842.Nm
843program.
844The NTP daemon will first look for the file
845using the path specified by the
754.Ic randfile
846.Cm randfile
755subcommand of the
756.Ic crypto
757configuration command.
758If not specified in this way, or when starting the
759.Nm
760program,
761the OpenSSL library will look for the file using the path specified
762by the
763.Ev RANDFILE
764environment variable in the user home directory,
765whether root or some other user.
766If the
767.Ev RANDFILE
768environment variable is not present,
769the library will look for the
847subcommand of the
848.Ic crypto
849configuration command.
850If not specified in this way, or when starting the
851.Nm
852program,
853the OpenSSL library will look for the file using the path specified
854by the
855.Ev RANDFILE
856environment variable in the user home directory,
857whether root or some other user.
858If the
859.Ev RANDFILE
860environment variable is not present,
861the library will look for the
770.Cm .rnd
862.Pa .rnd
771file in the user home directory.
863file in the user home directory.
864Since both the
865.Nm
866program and
867.Xr ntpd @NTPD_MS@
868daemon must run as root, the logical place to put this file is in
869.Pa /.rnd
870or
871.Pa /root/.rnd .
772If the file is not available or cannot be written,
773the daemon exits with a message to the system log and the program
774exits with a suitable error message.
775.Ss Cryptographic Data Files
872If the file is not available or cannot be written,
873the daemon exits with a message to the system log and the program
874exits with a suitable error message.
875.Ss Cryptographic Data Files
776All other file formats begin with two lines.
777The first contains the file name, including the generated host name
778and filestamp.
779The second contains the datestamp in conventional Unix date format.
780Lines beginning with # are considered comments and ignored by the
876All file formats begin with two nonencrypted lines.
877The first line contains the file name, including the generated host name
878and filestamp, in the format
879.Pa ntpkey_ Ns Ar key _ Ar name . Ar filestamp ,
880where
881.Ar key
882is the key or parameter type,
883.Ar name
884is the host or group name and
885.Ar filestamp
886is the filestamp (NTP seconds) when the file was created.
887By convention,
888.Ar key
889names in generated file names include both upper and lower case
890characters, while
891.Ar key
892names in generated link names include only lower case characters.
893The filestamp is not used in generated link names.
894The second line contains the datestamp in conventional Unix
895.Pa date
896format.
897Lines beginning with
898.Ql #
899are considered comments and ignored by the
781.Nm
782program and
783.Xr ntpd @NTPD_MS@
784daemon.
900.Nm
901program and
902.Xr ntpd @NTPD_MS@
903daemon.
785Cryptographic values are encoded first using ASN.1 rules,
786then encrypted if necessary, and finally written PEM\-encoded
787printable ASCII format preceded and followed by MIME content identifier lines.
788.Pp
904.Pp
789The format of the symmetric keys file is somewhat different
790than the other files in the interest of backward compatibility.
791Since DES\-CBC is deprecated in NTPv4, the only key format of interest
792is MD5 alphanumeric strings.
793Following hte heard the keys are
794entered one per line in the format
795.D1 Ar keyno type key
905The remainder of the file contains cryptographic data, encoded first using ASN.1
906rules, then encrypted if necessary, and finally written in PEM\-encoded
907printable ASCII text, preceded and followed by MIME content identifier lines.
908.Pp
909The format of the symmetric keys file, ordinarily named
910.Pa ntp.keys ,
911is somewhat different than the other files in the interest of backward compatibility.
912Ordinarily, the file is generated by this program, but it can be constructed
913and edited using an ordinary text editor.
914.Bd -literal -unfilled -offset center
915# ntpkey_MD5key_bk.ntp.org.3595864945
916# Thu Dec 12 19:22:25 2013
9171 MD5 L";Nw<\`.I<f4U0)247"i # MD5 key
9182 MD5 &>l0%XXK9O'51VwV<xq~ # MD5 key
9193 MD5 lb4zLW~d^!K:]RsD'qb6 # MD5 key
9204 MD5 Yue:tL[+vR)M\`n~bY,'? # MD5 key
9215 MD5 B;fx'Kgr/&4ZTbL6=RxA # MD5 key
9226 MD5 4eYwa\`o}3i@@V@..R9!l # MD5 key
9237 MD5 \`A.([h+;wTQ|xfi%Sn_! # MD5 key
9248 MD5 45:V,r4]l6y^JH6"Sh?F # MD5 key
9259 MD5 3\-5vcn*6l29DS?Xdsg)* # MD5 key
92610 MD5 2late4Me # MD5 key
92711 SHA1 a27872d3030a9025b8446c751b4551a7629af65c # SHA1 key
92812 SHA1 21bc3b4865dbb9e920902abdccb3e04ff97a5e74 # SHA1 key
92913 SHA1 2b7736fe24fef5ba85ae11594132ab5d6f6daba9 # SHA1 key
93014 SHA a5332809c8878dd3a5b918819108a111509aeceb # SHA key
93115 MD2 2fe16c88c760ff2f16d4267e36c1aa6c926e6964 # MD2 key
93216 MD4 b2691811dc19cfc0e2f9bcacd74213f29812183d # MD4 key
93317 MD5 e4d6735b8bdad58ec5ffcb087300a17f7fef1f7c # MD5 key
93418 MDC2 a8d5e2315c025bf3a79174c87fbd10477de2eabc # MDC2 key
93519 RIPEMD160 77ca332cafb30e3cafb174dcd5b80ded7ba9b3d2 # RIPEMD160 key
93620 AES128CMAC f92ff73eee86c1e7dc638d6489a04e4e555af878 # AES128CMAC key
937.Ed
938.D1 Figure 1. Typical Symmetric Key File
939.Pp
940Figure 1 shows a typical symmetric keys file used by the reference
941implementation.
942Following the header the keys are entered one per line in the format
943.D1 Ar keyno Ar type Ar key
796where
797.Ar keyno
944where
945.Ar keyno
798is a positive integer in the range 1\-65,535,
946is a positive integer in the range 1\-65534;
799.Ar type
947.Ar type
800is the string MD5 defining the key format and
948is the key type for the message digest algorithm, which in the absence of the
949OpenSSL library must be
950.Cm MD5
951to designate the MD5 message digest algorithm;
952if the OpenSSL library is installed, the key type can be any
953message digest algorithm supported by that library;
954however, if compatibility with FIPS 140\-2 is required,
955the key type must be either
956.Cm SHA
957or
958.Cm SHA1 ;
801.Ar key
802is the key itself,
959.Ar key
960is the key itself,
803which is a printable ASCII string 16 characters or less in length.
804Each character is chosen from the 93 printable characters
805in the range 0x21 through 0x7f excluding space and the
961which is a printable ASCII string 20 characters or less in length:
962each character is chosen from the 93 printable characters
963in the range 0x21 through 0x7e (
964.Ql !
965through
966.Ql ~
967\&) excluding space and the
806.Ql #
968.Ql #
969character, and terminated by whitespace or a
970.Ql #
807character.
971character.
972An OpenSSL key consists of a hex\-encoded ASCII string of 40 characters, which
973is truncated as necessary.
808.Pp
809Note that the keys used by the
810.Xr ntpq @NTPQ_MS@
811and
812.Xr ntpdc @NTPDC_MS@
813programs
814are checked against passwords requested by the programs
815and entered by hand, so it is generally appropriate to specify these keys
816in human readable ASCII format.
817.Pp
818The
819.Nm
974.Pp
975Note that the keys used by the
976.Xr ntpq @NTPQ_MS@
977and
978.Xr ntpdc @NTPDC_MS@
979programs
980are checked against passwords requested by the programs
981and entered by hand, so it is generally appropriate to specify these keys
982in human readable ASCII format.
983.Pp
984The
985.Nm
820program generates a MD5 symmetric keys file
821.Pa ntpkey_MD5key_ Ns Ar hostname.filestamp .
986program generates a symmetric keys file
987.Pa ntpkey_MD5key_ Ns Ar hostname Ns . Ns Ar filestamp .
822Since the file contains private shared keys,
823it should be visible only to root and distributed by secure means
824to other subnet hosts.
825The NTP daemon loads the file
826.Pa ntp.keys ,
827so
828.Nm
829installs a soft link from this name to the generated file.

--- 21 unchanged lines hidden (view full) ---

851.fi
852.in -4
853.sp
854The number of bits in the identity modulus. The default is 256.
855.It Fl c Ar scheme , Fl \-certificate Ns = Ns Ar scheme
856certificate scheme.
857.sp
858scheme is one of
988Since the file contains private shared keys,
989it should be visible only to root and distributed by secure means
990to other subnet hosts.
991The NTP daemon loads the file
992.Pa ntp.keys ,
993so
994.Nm
995installs a soft link from this name to the generated file.

--- 21 unchanged lines hidden (view full) ---

1017.fi
1018.in -4
1019.sp
1020The number of bits in the identity modulus. The default is 256.
1021.It Fl c Ar scheme , Fl \-certificate Ns = Ns Ar scheme
1022certificate scheme.
1023.sp
1024scheme is one of
859RSA\-MD2, RSA\-MD5, RSA\-SHA, RSA\-SHA1, RSA\-MDC2, RSA\-RIPEMD160,
1025RSA\-MD2, RSA\-MD5, RSA\-MDC2, RSA\-SHA, RSA\-SHA1, RSA\-RIPEMD160,
860DSA\-SHA, or DSA\-SHA1.
861.sp
1026DSA\-SHA, or DSA\-SHA1.
1027.sp
862Select the certificate message digest/signature encryption scheme.
1028Select the certificate signature encryption/message digest scheme.
863Note that RSA schemes must be used with a RSA sign key and DSA
864schemes must be used with a DSA sign key. The default without
865this option is RSA\-MD5.
866.It Fl C Ar cipher , Fl \-cipher Ns = Ns Ar cipher
867privatekey cipher.
868.sp
869Select the cipher which is used to encrypt the files containing
870private keys. The default is three\-key triple DES in CBC mode,
1029Note that RSA schemes must be used with a RSA sign key and DSA
1030schemes must be used with a DSA sign key. The default without
1031this option is RSA\-MD5.
1032.It Fl C Ar cipher , Fl \-cipher Ns = Ns Ar cipher
1033privatekey cipher.
1034.sp
1035Select the cipher which is used to encrypt the files containing
1036private keys. The default is three\-key triple DES in CBC mode,
871equivalent to "@code{\-C des\-ede3\-cbc". The openssl tool lists ciphers
1037equivalent to "\fB\-C des\-ede3\-cbc\fP". The openssl tool lists ciphers
872available in "\fBopenssl \-h\fP" output.
873.It Fl d , Fl \-debug\-level
874Increase debug verbosity level.
875This option may appear an unlimited number of times.
876.sp
877.It Fl D Ar number , Fl \-set\-debug\-level Ns = Ns Ar number
878Set the debug verbosity level.
879This option may appear an unlimited number of times.
880This option takes an integer number as its argument.
881.sp
882.It Fl e , Fl \-id\-key
883Write IFF or GQ identity keys.
884.sp
1038available in "\fBopenssl \-h\fP" output.
1039.It Fl d , Fl \-debug\-level
1040Increase debug verbosity level.
1041This option may appear an unlimited number of times.
1042.sp
1043.It Fl D Ar number , Fl \-set\-debug\-level Ns = Ns Ar number
1044Set the debug verbosity level.
1045This option may appear an unlimited number of times.
1046This option takes an integer number as its argument.
1047.sp
1048.It Fl e , Fl \-id\-key
1049Write IFF or GQ identity keys.
1050.sp
885Write the IFF or GQ client keys to the standard output. This is
886intended for automatic key distribution by mail.
1051Write the public parameters from the IFF or GQ client keys to
1052the standard output.
1053This is intended for automatic key distribution by email.
887.It Fl G , Fl \-gq\-params
888Generate GQ parameters and keys.
889.sp
890Generate parameters and keys for the GQ identification scheme,
891obsoleting any that may exist.
892.It Fl H , Fl \-host\-key
893generate RSA host key.
894.sp

--- 6 unchanged lines hidden (view full) ---

901.It Fl i Ar group , Fl \-ident Ns = Ns Ar group
902set Autokey group name.
903.sp
904Set the optional Autokey group name to name. This is used in
905the file name of IFF, GQ, and MV client parameters files. In
906that role, the default is the host name if this option is not
907provided. The group name, if specified using \fB\-i/\-\-ident\fP or
908using \fB\-s/\-\-subject\-name\fP following an '\fB@\fP' character,
1054.It Fl G , Fl \-gq\-params
1055Generate GQ parameters and keys.
1056.sp
1057Generate parameters and keys for the GQ identification scheme,
1058obsoleting any that may exist.
1059.It Fl H , Fl \-host\-key
1060generate RSA host key.
1061.sp

--- 6 unchanged lines hidden (view full) ---

1068.It Fl i Ar group , Fl \-ident Ns = Ns Ar group
1069set Autokey group name.
1070.sp
1071Set the optional Autokey group name to name. This is used in
1072the file name of IFF, GQ, and MV client parameters files. In
1073that role, the default is the host name if this option is not
1074provided. The group name, if specified using \fB\-i/\-\-ident\fP or
1075using \fB\-s/\-\-subject\-name\fP following an '\fB@\fP' character,
909is also a part of the self\-signed host certificate's subject and
1076is also a part of the self\-signed host certificate subject and
910issuer names in the form \fBhost@group\fP and should match the
1077issuer names in the form \fBhost@group\fP and should match the
911\'\fBcrypto ident\fP' or '\fBserver ident\fP' configuration in
912\fBntpd\fP's configuration file.
1078\'\fBcrypto ident\fP' or '\fBserver ident\fP' configuration in the
1079\fBntpd\fP configuration file.
913.It Fl l Ar lifetime , Fl \-lifetime Ns = Ns Ar lifetime
914set certificate lifetime.
915This option takes an integer number as its argument.
916.sp
917Set the certificate expiration to lifetime days from now.
1080.It Fl l Ar lifetime , Fl \-lifetime Ns = Ns Ar lifetime
1081set certificate lifetime.
1082This option takes an integer number as its argument.
1083.sp
1084Set the certificate expiration to lifetime days from now.
918.It Fl M , Fl \-md5key
919generate MD5 keys.
920.sp
921Generate MD5 keys, obsoleting any that may exist.
922.It Fl m Ar modulus , Fl \-modulus Ns = Ns Ar modulus
1085.It Fl m Ar modulus , Fl \-modulus Ns = Ns Ar modulus
923modulus.
1086prime modulus.
924This option takes an integer number as its argument.
925The value of
926.Ar modulus
927is constrained to being:
928.in +4
929.nf
930.na
931in the range 256 through 2048
932.fi
933.in -4
934.sp
935The number of bits in the prime modulus. The default is 512.
1087This option takes an integer number as its argument.
1088The value of
1089.Ar modulus
1090is constrained to being:
1091.in +4
1092.nf
1093.na
1094in the range 256 through 2048
1095.fi
1096.in -4
1097.sp
1098The number of bits in the prime modulus. The default is 512.
1099.It Fl M , Fl \-md5key
1100generate symmetric keys.
1101.sp
1102Generate symmetric keys, obsoleting any that may exist.
936.It Fl P , Fl \-pvt\-cert
937generate PC private certificate.
938.sp
939Generate a private certificate. By default, the program generates
940public certificates.
941.It Fl p Ar passwd , Fl \-password Ns = Ns Ar passwd
942local private password.
943.sp

--- 5 unchanged lines hidden (view full) ---

949.It Fl q Ar passwd , Fl \-export\-passwd Ns = Ns Ar passwd
950export IFF or GQ group keys with password.
951.sp
952Export IFF or GQ identity group keys to the standard output,
953encrypted with the DES\-CBC algorithm and the specified password.
954The same password must be specified to the remote ntpd via the
955"crypto pw password" configuration command. See also the option
956-\-id\-key (\-e) for unencrypted exports.
1103.It Fl P , Fl \-pvt\-cert
1104generate PC private certificate.
1105.sp
1106Generate a private certificate. By default, the program generates
1107public certificates.
1108.It Fl p Ar passwd , Fl \-password Ns = Ns Ar passwd
1109local private password.
1110.sp

--- 5 unchanged lines hidden (view full) ---

1116.It Fl q Ar passwd , Fl \-export\-passwd Ns = Ns Ar passwd
1117export IFF or GQ group keys with password.
1118.sp
1119Export IFF or GQ identity group keys to the standard output,
1120encrypted with the DES\-CBC algorithm and the specified password.
1121The same password must be specified to the remote ntpd via the
1122"crypto pw password" configuration command. See also the option
1123-\-id\-key (\-e) for unencrypted exports.
957.It Fl S Ar sign , Fl \-sign\-key Ns = Ns Ar sign
958generate sign key (RSA or DSA).
959.sp
960Generate a new sign key of the designated type, obsoleting any
961that may exist. By default, the program uses the host key as the
962sign key.
963.It Fl s Ar host@group , Fl \-subject\-name Ns = Ns Ar host@group
964set host and optionally group name.
965.sp
966Set the Autokey host name, and optionally, group name specified
967following an '\fB@\fP' character. The host name is used in the file
968name of generated host and signing certificates, without the
969group name. The host name, and if provided, group name are used
1124.It Fl s Ar host@group , Fl \-subject\-name Ns = Ns Ar host@group
1125set host and optionally group name.
1126.sp
1127Set the Autokey host name, and optionally, group name specified
1128following an '\fB@\fP' character. The host name is used in the file
1129name of generated host and signing certificates, without the
1130group name. The host name, and if provided, group name are used
970in \fBhost@group\fP form for the host certificate's subject and issuer
1131in \fBhost@group\fP form for the host certificate subject and issuer
971fields. Specifying '\fB\-s @group\fP' is allowed, and results in
972leaving the host name unchanged while appending \fB@group\fP to the
973subject and issuer fields, as with \fB\-i group\fP. The group name, or
974if not provided, the host name are also used in the file names
975of IFF, GQ, and MV client parameter files.
1132fields. Specifying '\fB\-s @group\fP' is allowed, and results in
1133leaving the host name unchanged while appending \fB@group\fP to the
1134subject and issuer fields, as with \fB\-i group\fP. The group name, or
1135if not provided, the host name are also used in the file names
1136of IFF, GQ, and MV client parameter files.
1137.It Fl S Ar sign , Fl \-sign\-key Ns = Ns Ar sign
1138generate sign key (RSA or DSA).
1139.sp
1140Generate a new sign key of the designated type, obsoleting any
1141that may exist. By default, the program uses the host key as the
1142sign key.
976.It Fl T , Fl \-trusted\-cert
977trusted certificate (TC scheme).
978.sp
979Generate a trusted certificate. By default, the program generates
980a non\-trusted certificate.
981.It Fl V Ar num , Fl \-mv\-params Ns = Ns Ar num
982generate <num> MV parameters.
983This option takes an integer number as its argument.

--- 32 unchanged lines hidden (view full) ---

1016.fi
1017.ad
1018The environmental presets take precedence (are processed later than)
1019the configuration files.
1020The \fIhomerc\fP files are "\fI$HOME\fP", and "\fI.\fP".
1021If any of these are directories, then the file \fI.ntprc\fP
1022is searched for within those directories.
1023.Sh USAGE
1143.It Fl T , Fl \-trusted\-cert
1144trusted certificate (TC scheme).
1145.sp
1146Generate a trusted certificate. By default, the program generates
1147a non\-trusted certificate.
1148.It Fl V Ar num , Fl \-mv\-params Ns = Ns Ar num
1149generate <num> MV parameters.
1150This option takes an integer number as its argument.

--- 32 unchanged lines hidden (view full) ---

1183.fi
1184.ad
1185The environmental presets take precedence (are processed later than)
1186the configuration files.
1187The \fIhomerc\fP files are "\fI$HOME\fP", and "\fI.\fP".
1188If any of these are directories, then the file \fI.ntprc\fP
1189is searched for within those directories.
1190.Sh USAGE
1024The
1025.Fl p Ar password
1026option specifies the write password and
1027.Fl q Ar password
1028option the read password for previously encrypted files.
1029The
1030.Nm
1031program prompts for the password if it reads an encrypted file
1032and the password is missing or incorrect.
1033If an encrypted file is read successfully and
1034no write password is specified, the read password is used
1035as the write password by default.
1036.Sh "ENVIRONMENT"
1037See \fBOPTION PRESETS\fP for configuration environment variables.
1038.Sh "FILES"
1039See \fBOPTION PRESETS\fP for configuration files.
1040.Sh "EXIT STATUS"
1041One of the following exit values will be returned:
1042.Bl -tag
1043.It 0 " (EXIT_SUCCESS)"

--- 7 unchanged lines hidden (view full) ---

1051it to autogen\-users@lists.sourceforge.net. Thank you.
1052.El
1053.Sh "AUTHORS"
1054The University of Delaware and Network Time Foundation
1055.Sh "COPYRIGHT"
1056Copyright (C) 1992\-2017 The University of Delaware and Network Time Foundation all rights reserved.
1057This program is released under the terms of the NTP license, <http://ntp.org/license>.
1058.Sh BUGS
1191.Sh "ENVIRONMENT"
1192See \fBOPTION PRESETS\fP for configuration environment variables.
1193.Sh "FILES"
1194See \fBOPTION PRESETS\fP for configuration files.
1195.Sh "EXIT STATUS"
1196One of the following exit values will be returned:
1197.Bl -tag
1198.It 0 " (EXIT_SUCCESS)"

--- 7 unchanged lines hidden (view full) ---

1206it to autogen\-users@lists.sourceforge.net. Thank you.
1207.El
1208.Sh "AUTHORS"
1209The University of Delaware and Network Time Foundation
1210.Sh "COPYRIGHT"
1211Copyright (C) 1992\-2017 The University of Delaware and Network Time Foundation all rights reserved.
1212This program is released under the terms of the NTP license, <http://ntp.org/license>.
1213.Sh BUGS
1059It can take quite a while to generate some cryptographic values,
1060from one to several minutes with modern architectures
1061such as UltraSPARC and up to tens of minutes to an hour
1062with older architectures such as SPARC IPC.
1214It can take quite a while to generate some cryptographic values.
1063.Pp
1064Please report bugs to http://bugs.ntp.org .
1065.Pp
1066Please send bug reports to: http://bugs.ntp.org, bugs@ntp.org
1067.Sh NOTES
1068Portions of this document came from FreeBSD.
1069.Pp
1070This manual page was \fIAutoGen\fP\-erated from the \fBntp\-keygen\fP
1071option definitions.
1215.Pp
1216Please report bugs to http://bugs.ntp.org .
1217.Pp
1218Please send bug reports to: http://bugs.ntp.org, bugs@ntp.org
1219.Sh NOTES
1220Portions of this document came from FreeBSD.
1221.Pp
1222This manual page was \fIAutoGen\fP\-erated from the \fBntp\-keygen\fP
1223option definitions.