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