]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/ntp/util/ntp-keygen.html
Fix multiple denial of service in ntpd.
[FreeBSD/FreeBSD.git] / contrib / ntp / util / ntp-keygen.html
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 <!--
17 a.summary-letter {text-decoration: none}
18 blockquote.indentedblock {margin-right: 0em}
19 blockquote.smallindentedblock {margin-right: 0em; font-size: smaller}
20 blockquote.smallquotation {font-size: smaller}
21 div.display {margin-left: 3.2em}
22 div.example {margin-left: 3.2em}
23 div.lisp {margin-left: 3.2em}
24 div.smalldisplay {margin-left: 3.2em}
25 div.smallexample {margin-left: 3.2em}
26 div.smalllisp {margin-left: 3.2em}
27 kbd {font-style: oblique}
28 pre.display {font-family: inherit}
29 pre.format {font-family: inherit}
30 pre.menu-comment {font-family: serif}
31 pre.menu-preformatted {font-family: serif}
32 pre.smalldisplay {font-family: inherit; font-size: smaller}
33 pre.smallexample {font-size: smaller}
34 pre.smallformat {font-family: inherit; font-size: smaller}
35 pre.smalllisp {font-size: smaller}
36 span.nolinebreak {white-space: nowrap}
37 span.roman {font-family: initial; font-weight: normal}
38 span.sansserif {font-family: sans-serif; font-weight: normal}
39 ul.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>
79 Next: <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>
85 program, that generates cryptographic data files used by the NTPv4
86 authentication and identity schemes.
87 It can generate message digest keys used in symmetric key cryptography and,
88 if the OpenSSL software
89 library has been installed, it can generate host keys, sign keys,
90 certificates, and identity keys and parameters used by the Autokey
91 public key cryptography.
92 The message digest keys file is generated in a
93 format compatible with NTPv3.
94 All other files are in PEM-encoded
95 printable ASCII format so they can be embedded as MIME attachments in
96 mail to other sites.
97 </p>
98 <p>This document applies to version 4.2.8p14 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>
109 Next: <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
115 authentication and identity schemes. It can generate message digest
116 keys used in symmetric key cryptography and, if the OpenSSL software
117 library has been installed, it can generate host keys, sign keys,
118 certificates, and identity keys and parameters used by the Autokey
119 public key cryptography. The message digest keys file is generated in a
120 format compatible with NTPv3. All other files are in PEM-encoded
121 printable ASCII format so they can be embedded as MIME attachments in
122 mail to other sites.
123 </p>
124 <p>When used to generate message digest keys, the program produces a file
125 containing ten pseudo-random printable ASCII strings suitable for the
126 MD5 message digest algorithm included in the distribution.
127 If the
128 OpenSSL library is installed, it produces an additional ten hex-encoded
129 random bit strings suitable for the SHA1 and other message digest
130 algorithms.
131 The message digest keys file must be distributed and stored
132 using secure means beyond the scope of NTP itself.
133 Besides the keys
134 used for ordinary NTP associations, additional keys can be defined as
135 passwords for the ntpq and ntpdc utility programs.
136 </p>
137 <p>The remaining generated files are compatible with other OpenSSL
138 applications and other Public Key Infrastructure (PKI) resources.
139 Certificates generated by this program are compatible with extant
140 industry practice, although some users might find the interpretation of
141 X509v3 extension fields somewhat liberal.
142 However, the identity keys
143 are probably not compatible with anything other than Autokey.
144 </p>
145 <p>Some files used by this program are encrypted using a private password.
146 The <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.
148 If 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
152 specifies the read password for previously encrypted local files.
153 This must match the local password used by this program.
154 If not specified, the host name is used.
155 Thus, if files are generated by this program without password,
156 they can be read back by ntpd without password, but only on the same
157 host.
158 </p>
159 <p>Normally, encrypted files for each host are generated by that host and
160 used only by that host, although exceptions exist as noted later on
161 this page.
162 The symmetric keys file, normally called <code>ntp.keys</code>, is
163 usually installed in <code>/etc</code>.
164 Other files and links are usually installed
165 in <code>/usr/local/etc</code>, which is normally in a shared filesystem in
166 NFS-mounted networks and cannot be changed by shared clients.
167 The location of the keys directory can be changed by the keysdir
168 configuration command in such cases.
169 Normally, this is in <code>/etc</code>.
170 </p>
171 <p>This program directs commentary and error messages to the standard
172 error 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
174 files.
175 The names used for generated files and links all begin with the
176 string <code>ntpkey</code> and include the file type,
177 generating host and filestamp,
178 as 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>
195 Next: <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
201 change to the keys directory, usually <code>/usr/local/etc</code>.
202 When run for the
203 first time, or if all files with names beginning <code>ntpkey</code>] have been
204 removed, use the <code>ntp-keygen</code> command without arguments to generate a
205 default RSA host key and matching RSA-MD5 certificate with expiration
206 date one year hence.
207 If run again without options, the program uses the
208 existing keys and parameters and generates only a new certificate with
209 new expiration date one year hence.
210 </p>
211 <p>Run the command on as many hosts as necessary.
212 Designate one of them as the trusted host (TH) using <code>ntp-keygen</code>
213 with the <code>-T</code> option and configure
214 it to synchronize from reliable Internet servers.
215 Then configure the other hosts to synchronize to the TH directly or indirectly.
216 A certificate trail is created when Autokey asks the immediately
217 ascendant host towards the TH to sign its certificate, which is then
218 provided to the immediately descendant host on request.
219 All 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
222 RSA type.
223 By default, the host key is also the sign key used to encrypt signatures.
224 A different sign key can be assigned using the <code>-S</code> option
225 and this can be either RSA or DSA type.
226 By default, the signature
227 message digest type is MD5, but any combination of sign key type and
228 message digest type supported by the OpenSSL library can be specified
229 using the <code>-c</code> option.
230 </p>
231 <p>The rules say cryptographic media should be generated with proventic
232 filestamps, which means the host should already be synchronized before
233 this program is run.
234 This of course creates a chicken-and-egg problem
235 when the host is started for the first time.
236 Accordingly, the host time
237 should be set by some other means, such as eyeball-and-wristwatch, at
238 least so that the certificate lifetime is within the current year.
239 After that and when the host is synchronized to a proventic source, the
240 certificate should be re-generated.
241 </p>
242 <p>Additional information on trusted groups and identity schemes is on the
243 Autokey Public-Key Authentication page.
244 </p>
245 <hr>
246 <a name="ntp_002dkeygen-Invocation"></a>
247 <div class="header">
248 <p>
249 Next: <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
259 authentication and identification schemes.
260 It can generate message digest keys used in symmetric key cryptography and,
261 if the OpenSSL software library has been installed, it can generate host keys,
262 signing keys, certificates, and identity keys and parameters used in Autokey
263 public key cryptography.
264 These files are used for cookie encryption,
265 digital signature, and challenge/response identification algorithms
266 compatible with the Internet standard security infrastructure.
267 </p>
268 <p>The message digest symmetric keys file is generated in a format
269 compatible with NTPv3.
270 All other files are in PEM-encoded printable ASCII format,
271 so they can be embedded as MIME attachments in email to other sites
272 and certificate authorities.
273 By default, files are not encrypted.
274 </p>
275 <p>When used to generate message digest symmetric keys, the program
276 produces a file containing ten pseudo-random printable ASCII strings
277 suitable for the MD5 message digest algorithm included in the
278 distribution.
279 If the OpenSSL library is installed, it produces an additional ten
280 hex-encoded random bit strings suitable for SHA1, AES-128-CMAC, and
281 other message digest algorithms.
282 The message digest symmetric keys file must be distributed and stored
283 using secure means beyond the scope of NTP itself.
284 Besides the keys used for ordinary NTP associations, additional keys
285 can be defined as passwords for the
286 <code>ntpq(1ntpqmdoc)</code>
287 and
288 <code>ntpdc(1ntpdcmdoc)</code>
289 utility programs.
290 </p>
291 <p>The remaining generated files are compatible with other OpenSSL
292 applications and other Public Key Infrastructure (PKI) resources.
293 Certificates generated by this program are compatible with extant
294 industry practice, although some users might find the interpretation of
295 X509v3 extension fields somewhat liberal.
296 However, the identity keys are probably not compatible with anything
297 other than Autokey.
298 </p>
299 <p>Some files used by this program are encrypted using a private password.
300 The
301 <code>-p</code>
302 option specifies the read password for local encrypted files and the
303 <code>-q</code>
304 option the write password for encrypted files sent to remote sites.
305 If no password is specified, the host name returned by the Unix
306 <code>hostname(1)</code>
307 command, normally the DNS name of the host, is used as the the default read
308 password, for convenience.
309 The
310 <code>ntp-keygen</code>
311 program prompts for the password if it reads an encrypted file
312 and the password is missing or incorrect.
313 If an encrypted file is read successfully and
314 no write password is specified, the read password is used
315 as the write password by default.
316 </p>
317 <p>The
318 <code>pw</code>
319 option of the
320 <code>crypto</code>
321 <code>ntpd(1ntpdmdoc)</code>
322 configuration command specifies the read
323 password for previously encrypted local files.
324 This must match the local read password used by this program.
325 If not specified, the host name is used.
326 Thus, if files are generated by this program without an explicit password,
327 they can be read back by
328 <code>ntpd(1ntpdmdoc)</code>
329 without specifying an explicit password but only on the same host.
330 If the write password used for encryption is specified as the host name,
331 these 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
334 used only by that host, although exceptions exist as noted later on
335 this page.
336 The symmetric keys file, normally called
337 <samp>ntp.keys</samp>,
338 is usually installed in
339 <samp>/etc</samp>.
340 Other files and links are usually installed in
341 <samp>/usr/local/etc</samp>,
342 which is normally in a shared filesystem in
343 NFS-mounted networks and cannot be changed by shared clients.
344 In these cases, NFS clients can specify the files in another
345 directory such as
346 <samp>/etc</samp>
347 using the
348 <code>keysdir</code>
349 <code>ntpd(1ntpdmdoc)</code>
350 configuration file command.
351 </p>
352 <p>This program directs commentary and error messages to the standard
353 error stream
354 <samp>stderr</samp>
355 and remote files to the standard output stream
356 <samp>stdout</samp>
357 where they can be piped to other applications or redirected to files.
358 The names used for generated files and links all begin with the
359 string
360 <samp>ntpkey*</samp>
361 and include the file type, generating host and filestamp,
362 as described in the
363 <a href="#Cryptographic-Data-Files">Cryptographic Data Files</a>
364 section 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>
423 program is logged in directly as root.
424 The recommended procedure is change to the
425 <kbd>keys</kbd>
426 directory, usually
427 <samp>/usr/local/etc</samp>,
428 then run the program.
429 </p>
430 <p>To test and gain experience with Autokey concepts, log in as root and
431 change to the
432 <kbd>keys</kbd>
433 directory, usually
434 <samp>/usr/local/etc</samp>.
435 When run for the first time, or if all files with names beginning with
436 <samp>ntpkey*</samp>
437 have been removed, use the
438 <code>ntp-keygen</code>
439 command without arguments to generate a default
440 <code>RSA</code>
441 host key and matching
442 <code>RSA-MD5</code>
443 certificate file with expiration date one year hence,
444 which is all that is necessary in many cases.
445 The program also generates soft links from the generic names
446 to the respective files.
447 If run again without options, the program uses the
448 existing keys and parameters and generates a new certificate file with
449 new 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>
453 type.
454 By default, the host key is also the sign key used to encrypt signatures.
455 When necessary, a different sign key can be specified and this can be
456 either
457 <code>RSA</code>
458 or
459 <code>DSA</code>
460 type.
461 By default, the message digest type is
462 <code>MD5</code>,
463 but any combination
464 of sign key type and message digest type supported by the OpenSSL library
465 can 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>
467 and
468 <code>RIPE160</code>
469 message digest algorithms.
470 However, the scheme specified in the certificate must be compatible
471 with the sign key.
472 Certificates using any digest algorithm are compatible with
473 <code>RSA</code>
474 sign keys;
475 however, only
476 <code>SHA</code>
477 and
478 <code>SHA1</code>
479 certificates are compatible with
480 <code>DSA</code>
481 sign keys.
482 </p>
483 <p>Private/public key files and certificates are compatible with
484 other OpenSSL applications and very likely other libraries as well.
485 Certificates or certificate requests derived from them should be compatible
486 with extant industry practice, although some users might find
487 the interpretation of X509v3 extension fields somewhat liberal.
488 However, the identification parameter files, although encoded
489 as 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>
493 command
494 to assume root may not work properly, since by default the OpenSSL library
495 looks for the random seed file
496 <samp>.rnd</samp>
497 in the user home directory.
498 However, there should be only one
499 <samp>.rnd</samp>,
500 most conveniently
501 in the root directory, so it is convenient to define the
502 .Ev RANDFILE
503 environment 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
507 shared file systems, as NFS clients may not be able to write
508 to the shared keys directory, even as root.
509 In this case, NFS clients can specify the files in another
510 directory such as
511 <samp>/etc</samp>
512 using the
513 <code>keysdir</code>
514 <code>ntpd(1ntpdmdoc)</code>
515 configuration file command.
516 There is no need for one client to read the keys and certificates
517 of other clients or servers, as these data are obtained automatically
518 by the Autokey protocol.
519 </p>
520 <p>Ordinarily, cryptographic files are generated by the host that uses them,
521 but it is possible for a trusted agent (TA) to generate these files
522 for other hosts; however, in such cases files should always be encrypted.
523 The subject name and trusted name default to the hostname
524 of the host generating the files, but can be changed by command line options.
525 It is convenient to designate the owner name and trusted name
526 as the subject and issuer fields, respectively, of the certificate.
527 The owner name is also used for the host and sign key files,
528 while 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>,
532 which is normally in a shared filesystem
533 in NFS-mounted networks.
534 The actual location of the keys directory
535 and each file can be overridden by configuration commands,
536 but this is not recommended.
537 Normally, the files for each host are generated by that host
538 and used only by that host, although exceptions exist
539 as noted later on this page.
540 </p>
541 <p>Normally, files containing private values,
542 including the host key, sign key and identification parameters,
543 are permitted root read/write-only;
544 while others containing public values are permitted world readable.
545 Alternatively, files containing private values can be encrypted
546 and these files permitted world readable,
547 which simplifies maintenance in shared file systems.
548 Since uniqueness is insured by the
549 <kbd>hostname</kbd>
550 and
551 <kbd>filestamp</kbd>
552 file name extensions, the files for an NTP server and
553 dependent clients can all be installed in the same shared directory.
554 </p>
555 <p>The recommended practice is to keep the file name extensions
556 when installing a file and to install a soft link
557 from the generic names specified elsewhere on this page
558 to the generated files.
559 This allows new file generations to be activated simply
560 by changing the link.
561 If a link is present,
562 <code>ntpd(1ntpdmdoc)</code>
563 follows it to the file name to extract the
564 <kbd>filestamp</kbd>.
565 If a link is not present,
566 <code>ntpd(1ntpdmdoc)</code>
567 extracts the
568 <kbd>filestamp</kbd>
569 from the file itself.
570 This allows clients to verify that the file and generation times
571 are always current.
572 The
573 <code>ntp-keygen</code>
574 program uses the same
575 <kbd>filestamp</kbd>
576 extension for all files generated
577 at one time, so each generation is distinct and can be readily
578 recognized in monitoring data.
579 </p>
580 <p>Run the command on as many hosts as necessary.
581 Designate one of them as the trusted host (TH) using
582 <code>ntp-keygen</code>
583 with the
584 <code>-T</code>
585 option and configure it to synchronize from reliable Internet servers.
586 Then configure the other hosts to synchronize to the TH directly or
587 indirectly.
588 A certificate trail is created when Autokey asks the immediately
589 ascendant host towards the TH to sign its certificate, which is then
590 provided to the immediately descendant host on request.
591 All 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
594 RSA type.
595 By default, the host key is also the sign key used to encrypt
596 signatures.
597 A different sign key can be assigned using the
598 <code>-S</code>
599 option and this can be either
600 <code>RSA</code>
601 or
602 <code>DSA</code>
603 type.
604 By default, the signature
605 message digest type is
606 <code>MD5</code>,
607 but any combination of sign key type and
608 message digest type supported by the OpenSSL library can be specified
609 using the
610 <code>-c</code>
611 option.
612 </p>
613 <p>The rules say cryptographic media should be generated with proventic
614 filestamps, which means the host should already be synchronized before
615 this program is run.
616 This of course creates a chicken-and-egg problem
617 when the host is started for the first time.
618 Accordingly, the host time
619 should be set by some other means, such as eyeball-and-wristwatch, at
620 least so that the certificate lifetime is within the current year.
621 After that and when the host is synchronized to a proventic source, the
622 certificate 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;
626 page.
627 </p>
628 <p>File names begin with the prefix
629 <samp>ntpkey</samp>_
630 and end with the suffix
631 <samp>_</samp><kbd>hostname</kbd>. <kbd>filestamp</kbd>,
632 where
633 <kbd>hostname</kbd>
634 is the owner name, usually the string returned
635 by the Unix
636 <code>hostname(1)</code>
637 command, and
638 <kbd>filestamp</kbd>
639 is the NTP seconds when the file was generated, in decimal digits.
640 This both guarantees uniqueness and simplifies maintenance
641 procedures, since all files can be quickly removed
642 by a
643 <code>rm</code> <samp>ntpkey*</samp>
644 command or all files generated
645 at a specific time can be removed by a
646 <code>rm</code> <samp>*</samp><kbd>filestamp</kbd>
647 command.
648 To further reduce the risk of misconfiguration,
649 the first two lines of a file contain the file name
650 and 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
655 and identification scheme, called a cryptotype,
656 as explained in the
657 &lsquo;Authentication Options&rsquo;
658 section of
659 <code>ntp.conf(5)</code>.
660 The default cryptotype uses
661 <code>RSA</code>
662 encryption,
663 <code>MD5</code>
664 message digest
665 and
666 <code>TC</code>
667 identification.
668 First, configure a NTP subnet including one or more low-stratum
669 trusted hosts from which all other hosts derive synchronization
670 directly or indirectly.
671 Trusted hosts have trusted certificates;
672 all other hosts have nontrusted certificates.
673 These hosts will automatically and dynamically build authoritative
674 certificate trails to one or more trusted hosts.
675 A trusted group is the set of all hosts that have, directly or indirectly,
676 a certificate trail ending at a trusted host.
677 The trail is defined by static configuration file entries
678 or dynamic means described on the
679 &lsquo;Automatic NTP Configuration Options&rsquo;
680 section of
681 <code>ntp.conf(5)</code>.
682 </p>
683 <p>On each trusted host as root, change to the keys directory.
684 To insure a fresh fileset, remove all
685 <samp>ntpkey</samp>
686 files.
687 Then run
688 <code>ntp-keygen</code>
689 <code>-T</code>
690 to generate keys and a trusted certificate.
691 On all other hosts do the same, but leave off the
692 <code>-T</code>
693 flag to generate keys and nontrusted certificates.
694 When complete, start the NTP daemons beginning at the lowest stratum
695 and working up the tree.
696 It may take some time for Autokey to instantiate the certificate trails
697 throughout 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
700 scheme than the default, run
701 <code>ntp-keygen</code>
702 with the
703 <code>-S</code> <kbd>type</kbd>
704 option, where
705 <kbd>type</kbd>
706 is either
707 <code>RSA</code>
708 or
709 <code>DSA</code>.
710 The most frequent need to do this is when a
711 <code>DSA</code>-signed
712 certificate is used.
713 If it is necessary to use a different certificate scheme than the default,
714 run
715 <code>ntp-keygen</code>
716 with the
717 <code>-c</code> <kbd>scheme</kbd>
718 option and selected
719 <kbd>scheme</kbd>
720 as needed.
721 If
722 <code>ntp-keygen</code>
723 is run again without these options, it generates a new certificate
724 using the same scheme and sign key, and soft link.
725 </p>
726 <p>After setting up the environment it is advisable to update certificates
727 from time to time, if only to extend the validity interval.
728 Simply run
729 <code>ntp-keygen</code>
730 with the same flags as before to generate new certificates
731 using existing keys, and soft links.
732 However, if the host or sign key is changed,
733 <code>ntpd(1ntpdmdoc)</code>
734 should be restarted.
735 When
736 <code>ntpd(1ntpdmdoc)</code>
737 is restarted, it loads any new files and restarts the protocol.
738 Other dependent hosts will continue as usual until signatures are refreshed,
739 at 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,
744 the default
745 <code>TC</code>
746 identity scheme is vulnerable to a middleman attack.
747 However, there are more secure identity schemes available,
748 including
749 <code>PC</code>, <code>IFF</code>, <code>GQ</code>
750 and
751 <code>MV</code>
752 schemes described below.
753 These schemes are based on a TA, one or more trusted hosts
754 and some number of nontrusted hosts.
755 Trusted hosts prove identity using values provided by the TA,
756 while the remaining hosts prove identity using values provided
757 by a trusted host and certificate trails that end on that host.
758 The name of a trusted host is also the name of its sugroup
759 and also the subject and issuer name on its trusted certificate.
760 The 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.
763 A server can also be a client of another server,
764 but a client can never be a server for another client.
765 In general, trusted hosts and nontrusted hosts that operate
766 as both server and client have parameter files that contain
767 both server and client keys.
768 Hosts that operate
769 only 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.
772 On trusted host alice run
773 <code>ntp-keygen</code>
774 <code>-P</code>
775 <code>-p</code> <kbd>password</kbd>
776 to generate the host key file
777 <samp>ntpkey</samp>_ <code>RSA</code> <samp>key_alice.</samp> <kbd>filestamp</kbd>
778 and trusted private certificate file
779 <samp>ntpkey</samp>_ <code>RSA-MD5</code> <code>_</code> <samp>cert_alice.</samp> <kbd>filestamp</kbd>,
780 and soft links.
781 Copy both files to all group hosts;
782 they replace the files which would be generated in other schemes.
783 On each host
784 <kbd>bob</kbd>
785 install a soft link from the generic name
786 <samp>ntpkey_host_</samp><kbd>bob</kbd>
787 to the host key file and soft link
788 <samp>ntpkey_cert_</samp><kbd>bob</kbd>
789 to the private certificate file.
790 Note the generic links are on bob, but point to files generated
791 by trusted host alice.
792 In this scheme it is not possible to refresh
793 either the keys or certificates without copying them
794 to all other hosts in the group, and recreating the soft links.
795 </p>
796 <p>For the
797 <code>IFF</code>
798 scheme proceed as in the
799 <code>TC</code>
800 scheme to generate keys
801 and certificates for all group hosts, then for every trusted host in the group,
802 generate the
803 <code>IFF</code>
804 parameter file.
805 On trusted host alice run
806 <code>ntp-keygen</code>
807 <code>-T</code>
808 <code>-I</code>
809 <code>-p</code> <kbd>password</kbd>
810 to produce her parameter file
811 <samp>ntpkey_IFFpar_alice.</samp><kbd>filestamp</kbd>,
812 which includes both server and client keys.
813 Copy this file to all group hosts that operate as both servers
814 and clients and install a soft link from the generic
815 <samp>ntpkey_iff_alice</samp>
816 to this file.
817 If there are no hosts restricted to operate only as clients,
818 there is nothing further to do.
819 As the
820 <code>IFF</code>
821 scheme is independent
822 of 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
825 as a legitimate server and present a middleman threat.
826 To eliminate this threat, the client keys can be extracted
827 from the parameter file and distributed to all restricted clients.
828 After generating the parameter file, on alice run
829 <code>ntp-keygen</code>
830 <code>-e</code>
831 and pipe the output to a file or email program.
832 Copy or email this file to all restricted clients.
833 On these clients install a soft link from the generic
834 <samp>ntpkey_iff_alice</samp>
835 to this file.
836 To further protect the integrity of the keys,
837 each file can be encrypted with a secret password.
838 </p>
839 <p>For the
840 <code>GQ</code>
841 scheme proceed as in the
842 <code>TC</code>
843 scheme to generate keys
844 and certificates for all group hosts, then for every trusted host
845 in the group, generate the
846 <code>IFF</code>
847 parameter file.
848 On trusted host alice run
849 <code>ntp-keygen</code>
850 <code>-T</code>
851 <code>-G</code>
852 <code>-p</code> <kbd>password</kbd>
853 to produce her parameter file
854 <samp>ntpkey_GQpar_alice.</samp><kbd>filestamp</kbd>,
855 which includes both server and client keys.
856 Copy this file to all group hosts and install a soft link
857 from the generic
858 <samp>ntpkey_gq_alice</samp>
859 to this file.
860 In addition, on each host
861 <kbd>bob</kbd>
862 install a soft link
863 from generic
864 <samp>ntpkey_gq_</samp><kbd>bob</kbd>
865 to this file.
866 As the
867 <code>GQ</code>
868 scheme updates the
869 <code>GQ</code>
870 parameters file and certificate
871 at the same time, keys and certificates can be regenerated as needed.
872 </p>
873 <p>For the
874 <code>MV</code>
875 scheme, proceed as in the
876 <code>TC</code>
877 scheme to generate keys
878 and certificates for all group hosts.
879 For illustration assume trish is the TA, alice one of several trusted hosts
880 and bob one of her clients.
881 On TA trish run
882 <code>ntp-keygen</code>
883 <code>-V</code> <kbd>n</kbd>
884 <code>-p</code> <kbd>password</kbd>,
885 where
886 <kbd>n</kbd>
887 is the number of revokable keys (typically 5) to produce
888 the parameter file
889 <samp>ntpkeys_MVpar_trish.</samp><kbd>filestamp</kbd>
890 and client key files
891 <samp>ntpkeys_MVkey</samp><kbd>d</kbd> <kbd>_</kbd> <samp>trish.</samp> <kbd>filestamp</kbd>
892 where
893 <kbd>d</kbd>
894 is the key number (0 &lt;
895 <kbd>d</kbd>
896 &lt;
897 <kbd>n</kbd>).
898 Copy the parameter file to alice and install a soft link
899 from the generic
900 <samp>ntpkey_mv_alice</samp>
901 to this file.
902 Copy one of the client key files to alice for later distribution
903 to her clients.
904 It does not matter which client key file goes to alice,
905 since they all work the same way.
906 Alice copies the client key file to all of her clients.
907 On client bob install a soft link from generic
908 <samp>ntpkey_mvkey_bob</samp>
909 to the client key file.
910 As the
911 <code>MV</code>
912 scheme is independent of keys and certificates,
913 these 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>
921 bits.
922 The number of bits in the identity modulus defaults to 256, but can be set to
923 values from 256 to 2048 (32 to 256 octets).
924 Use the larger moduli with caution, as this can consume considerable computing
925 resources 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.
929 The
930 <kbd>scheme</kbd>
931 can 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>,
933 or
934 <code>DSA-SHA1</code>.
935 Note that
936 <code>RSA</code>
937 schemes must be used with an
938 <code>RSA</code>
939 sign key and
940 <code>DSA</code>
941 schemes must be used with a
942 <code>DSA</code>
943 sign key.
944 The default without this option is
945 <code>RSA-MD5</code>.
946 If compatibility with FIPS 140-2 is required, either the
947 <code>DSA-SHA</code>
948 or
949 <code>DSA-SHA1</code>
950 scheme 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.
954 The default without this option is three-key triple DES in CBC mode,
955 <code>des-ede3-cbc</code>.
956 The
957 <code>openssl</code> <code>-h</code>
958 command 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.
962 This 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>.
967 This 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>
972 or
973 <code>GQ</code>
974 public parameters from the
975 <kbd>IFFkey</kbd> <kbd>or</kbd> <kbd>GQkey</kbd>
976 client keys file previously specified
977 as unencrypted data to the standard output stream
978 <samp>stdout</samp>.
979 This 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>
984 parameters and key file for the Guillou-Quisquater (GQ) identity scheme.
985 This option is mutually exclusive with the
986 <code>-I</code>
987 and
988 <code>-V</code>
989 options.
990 </p></dd>
991 <dt><code>-H</code> <code>--host-key</code></dt>
992 <dd><p>Generate a new encrypted
993 <code>RSA</code>
994 public/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>
999 key file for the Schnorr (IFF) identity scheme.
1000 This option is mutually exclusive with the
1001 <code>-G</code>
1002 and
1003 Fl V
1004 options.
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>.
1009 This is used in the identity scheme parameter file names of
1010 <code>IFF</code>, <code>GQ</code>,
1011 and
1012 <code>MV</code>
1013 client parameters files.
1014 In that role, the default is the host name if no group is provided.
1015 The group name, if specified using
1016 <code>-i</code>
1017 or
1018 <code>-s</code>
1019 following an
1020 &lsquo;@&rsquo;
1021 character, is also used in certificate subject and issuer names in the form
1022 <kbd>host</kbd> <kbd>@</kbd> <kbd>group</kbd>
1023 and should match the group specified via
1024 <code>crypto</code> <code>ident</code>
1025 or
1026 <code>server</code> <code>ident</code>
1027 in 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>.
1032 The 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>.
1037 The modulus defaults to 512, but can be set from 256 to 2048 (32 to 256 octets).
1038 Use the larger moduli with caution, as this can consume considerable computing
1039 resources 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>
1044 keys, and if OpenSSL is available, 10
1045 <code>SHA</code>
1046 keys.
1047 An
1048 <code>MD5</code>
1049 key is a string of 20 random printable ASCII characters, while a
1050 <code>SHA</code>
1051 key is a string of 40 random hex digits.
1052 The file can be edited using a text editor to change the key type or key content.
1053 This 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>.
1058 These include the host, sign and identify key files.
1059 By default, the password is the string returned by the Unix
1060 <code>hostname</code>
1061 command.
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>
1066 identity scheme.
1067 By default, the program generates public certificates.
1068 Note: 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>
1073 identity files redirected to
1074 <samp>stdout</samp>
1075 to
1076 <kbd>passwd</kbd>.
1077 In effect, these files are decrypted with the
1078 <code>-p</code>
1079 password, then encrypted with the
1080 <code>-q</code>
1081 password.
1082 By default, the password is the string returned by the Unix
1083 <code>hostname</code>
1084 command.
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>
1089 is the optional host name and
1090 <kbd>group</kbd>
1091 is the optional group name.
1092 The host name, and if provided, group name are used in
1093 <kbd>host</kbd> <kbd>@</kbd> <kbd>group</kbd>
1094 form as certificate subject and issuer.
1095 Specifying
1096 <code>-s</code> <code>-@</code> <kbd>group</kbd>
1097 is allowed, and results in leaving the host name unchanged, as with
1098 <code>-i</code> <kbd>group</kbd>.
1099 The group name, or if no group is provided, the host name are also used in the
1100 file names of
1101 <code>IFF</code>, <code>GQ</code>,
1102 and
1103 <code>MV</code>
1104 identity scheme client parameter files.
1105 If
1106 <kbd>host</kbd>
1107 is not specified, the default host name is the string returned by the Unix
1108 <code>hostname</code>
1109 command.
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.
1113 By default, the sign key is the host key and has the same type.
1114 If 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.
1119 By 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>
1124 encrypted server keys and parameters for the Mu-Varadharajan (MV)
1125 identity scheme.
1126 This option is mutually exclusive with the
1127 <code>-I</code>
1128 and
1129 <code>-G</code>
1130 options.
1131 Note: 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
1138 to randomize the entropy seed used to initialize
1139 the internal pseudo-random number generator used
1140 by the library routines.
1141 The OpenSSL library uses a designated random seed file for this purpose.
1142 The file must be available when starting the NTP daemon and
1143 <code>ntp-keygen</code>
1144 program.
1145 If a site supports OpenSSL or its companion OpenSSH,
1146 it 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
1149 for each generation, for otherwise the random number sequence
1150 would be predictable.
1151 Various means dependent on external events, such as keystroke intervals,
1152 can be used to do this and some systems have built-in entropy sources.
1153 Suitable means are described in the OpenSSL software documentation,
1154 but are outside the scope of this page.
1155 </p>
1156 <p>The entropy seed used by the OpenSSL library is contained in a file,
1157 usually called
1158 <samp>.rnd</samp>,
1159 which must be available when starting the NTP daemon
1160 or the
1161 <code>ntp-keygen</code>
1162 program.
1163 The NTP daemon will first look for the file
1164 using the path specified by the
1165 <code>randfile</code>
1166 subcommand of the
1167 <code>crypto</code>
1168 configuration command.
1169 If not specified in this way, or when starting the
1170 <code>ntp-keygen</code>
1171 program,
1172 the OpenSSL library will look for the file using the path specified
1173 by the
1174 .Ev RANDFILE
1175 environment variable in the user home directory,
1176 whether root or some other user.
1177 If the
1178 .Ev RANDFILE
1179 environment variable is not present,
1180 the library will look for the
1181 <samp>.rnd</samp>
1182 file in the user home directory.
1183 Since both the
1184 <code>ntp-keygen</code>
1185 program and
1186 <code>ntpd(1ntpdmdoc)</code>
1187 daemon must run as root, the logical place to put this file is in
1188 <samp>/.rnd</samp>
1189 or
1190 <samp>/root/.rnd</samp>.
1191 If the file is not available or cannot be written,
1192 the daemon exits with a message to the system log and the program
1193 exits 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.
1198 The first line contains the file name, including the generated host name
1199 and filestamp, in the format
1200 <samp>ntpkey_</samp><kbd>key</kbd> <kbd>_</kbd> <kbd>name</kbd>. <kbd>filestamp</kbd>,
1201 where
1202 <kbd>key</kbd>
1203 is the key or parameter type,
1204 <kbd>name</kbd>
1205 is the host or group name and
1206 <kbd>filestamp</kbd>
1207 is the filestamp (NTP seconds) when the file was created.
1208 By convention,
1209 <kbd>key</kbd>
1210 names in generated file names include both upper and lower case
1211 characters, while
1212 <kbd>key</kbd>
1213 names in generated link names include only lower case characters.
1214 The filestamp is not used in generated link names.
1215 The second line contains the datestamp in conventional Unix
1216 <samp>date</samp>
1217 format.
1218 Lines beginning with
1219 &lsquo;#&rsquo;
1220 are considered comments and ignored by the
1221 <code>ntp-keygen</code>
1222 program and
1223 <code>ntpd(1ntpdmdoc)</code>
1224 daemon.
1225 </p>
1226 <p>The remainder of the file contains cryptographic data, encoded first using ASN.1
1227 rules, then encrypted if necessary, and finally written in PEM-encoded
1228 printable 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>,
1232 is somewhat different than the other files in the interest of backward compatibility.
1233 Ordinarily, the file is generated by this program, but it can be constructed
1234 and 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
1238 1  MD5 L&quot;;Nw&lt;\`.I&lt;f4U0)247&quot;i  # MD5 key
1239 2  MD5 &amp;&gt;l0%XXK9O'51VwV&lt;xq~  # MD5 key
1240 3  MD5 lb4zLW~d^!K:]RsD'qb6  # MD5 key
1241 4  MD5 Yue:tL[+vR)M\`n~bY,'?  # MD5 key
1242 5  MD5 B;fx'Kgr/&amp;4ZTbL6=RxA  # MD5 key
1243 6  MD5 4eYwa\`o@}3i@@@@V@@..R9!l  # MD5 key
1244 7  MD5 \`A.([h+;wTQ|xfi%Sn_!  # MD5 key
1245 8  MD5 45:V,r4]l6y^JH6&quot;Sh?F  # MD5 key
1246 9  MD5 3-5vcn*6l29DS?Xdsg)*  # MD5 key
1247 10 MD5 2late4Me              # MD5 key
1248 11 SHA1 a27872d3030a9025b8446c751b4551a7629af65c  # SHA1 key
1249 12 SHA1 21bc3b4865dbb9e920902abdccb3e04ff97a5e74  # SHA1 key
1250 13 SHA1 2b7736fe24fef5ba85ae11594132ab5d6f6daba9  # SHA1 key
1251 14 SHA  a5332809c8878dd3a5b918819108a111509aeceb  # SHA  key
1252 15 MD2  2fe16c88c760ff2f16d4267e36c1aa6c926e6964  # MD2  key
1253 16 MD4  b2691811dc19cfc0e2f9bcacd74213f29812183d  # MD4  key
1254 17 MD5  e4d6735b8bdad58ec5ffcb087300a17f7fef1f7c  # MD5  key
1255 18 MDC2 a8d5e2315c025bf3a79174c87fbd10477de2eabc  # MDC2 key
1256 19 RIPEMD160 77ca332cafb30e3cafb174dcd5b80ded7ba9b3d2  # RIPEMD160 key
1257 20 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
1263 implementation.
1264 Following 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>
1270 is a positive integer in the range 1-65535;
1271 <kbd>type</kbd>
1272 is the key type for the message digest algorithm, which in the absence of the
1273 OpenSSL library must be
1274 <code>MD5</code>
1275 to designate the MD5 message digest algorithm;
1276 if the OpenSSL library is installed, the key type can be any
1277 message digest algorithm supported by that library;
1278 however, if compatibility with FIPS 140-2 is required,
1279 the key type must be either
1280 <code>SHA</code>
1281 or
1282 <code>SHA1</code>;
1283 <kbd>key</kbd>
1284 is the key itself,
1285 which is a printable ASCII string 20 characters or less in length:
1286 each character is chosen from the 93 printable characters
1287 in the range 0x21 through 0x7e (
1288 &lsquo;&rsquo;!
1289 through
1290 &lsquo;~&rsquo;
1291 ) excluding space and the
1292 &lsquo;#&rsquo;
1293 character, and terminated by whitespace or a
1294 &lsquo;#&rsquo;
1295 character.
1296 An OpenSSL key consists of a hex-encoded ASCII string of 40 characters, which
1297 is truncated as necessary.
1298 </p>
1299 <p>Note that the keys used by the
1300 <code>ntpq(1ntpqmdoc)</code>
1301 and
1302 <code>ntpdc(1ntpdcmdoc)</code>
1303 programs
1304 are checked against passwords requested by the programs
1305 and entered by hand, so it is generally appropriate to specify these keys
1306 in human readable ASCII format.
1307 </p>
1308 <p>The
1309 <code>ntp-keygen</code>
1310 program generates a symmetric keys file
1311 <samp>ntpkey_MD5key_</samp><kbd>hostname</kbd>. <kbd>filestamp</kbd>.
1312 Since the file contains private shared keys,
1313 it should be visible only to root and distributed by secure means
1314 to other subnet hosts.
1315 The NTP daemon loads the file
1316 <samp>ntp.keys</samp>,
1317 so
1318 <code>ntp-keygen</code>
1319 installs a soft link from this name to the generated file.
1320 Subsequently, similar soft links must be installed by manual
1321 or automated means on the other subnet hosts.
1322 While this file is not used with the Autokey Version 2 protocol,
1323 it is needed to authenticate some remote configuration commands
1324 used by the
1325 <code>ntpq(1ntpqmdoc)</code>
1326 and
1327 <code>ntpdc(1ntpdcmdoc)</code>
1328 utilities.
1329 </p>
1330 <p>This section was generated by <strong>AutoGen</strong>,
1331 using the <code>agtexi-cmd</code> template and the option descriptions for the <code>ntp-keygen</code> program.
1332 This 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>
1391 Next: <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
1401 the 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
1404 used to select the program, defaulting to <samp>more</samp>.  Both will exit
1405 with 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.8p13
1409 Usage:  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
1446 Options are specified by doubled hyphens and their name or by a single
1447 hyphen and the flag character.
1448
1449
1450 The following option preset mechanisms are supported:
1451  - reading file $HOME/.ntprc
1452  - reading file ./.ntprc
1453  - examining environment variables named NTP_KEYGEN_*
1454
1455 Please 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>
1462 Next: <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.
1469 This 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>
1481 Next: <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.
1488 This 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
1496 RSA-MD2, RSA-MD5, RSA-MDC2, RSA-SHA, RSA-SHA1, RSA-RIPEMD160,
1497 DSA-SHA, or DSA-SHA1.
1498 </p>
1499 <p>Select the certificate signature encryption/message digest scheme.
1500 Note that RSA schemes must be used with a RSA sign key and DSA
1501 schemes must be used with a DSA sign key.  The default without
1502 this option is RSA-MD5.
1503 </p><hr>
1504 <a name="ntp_002dkeygen-cipher"></a>
1505 <div class="header">
1506 <p>
1507 Next: <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.
1514 This 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
1522 private keys.  The default is three-key triple DES in CBC mode,
1523 equivalent to &quot;<code>-C des-ede3-cbc</code>&quot;.  The openssl tool lists ciphers
1524 available 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>
1529 Next: <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
1543 the standard output.
1544 This 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>
1549 Next: <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,
1563 obsoleting any that may exist.
1564 </p><hr>
1565 <a name="ntp_002dkeygen-host_002dkey"></a>
1566 <div class="header">
1567 <p>
1568 Next: <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>
1586 Next: <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
1600 any that may exist.
1601 </p><hr>
1602 <a name="ntp_002dkeygen-ident"></a>
1603 <div class="header">
1604 <p>
1605 Next: <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.
1612 This 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
1620 the file name of IFF, GQ, and MV client parameters files.  In
1621 that role, the default is the host name if this option is not
1622 provided.  The group name, if specified using <code>-i/--ident</code> or
1623 using <code>-s/--subject-name</code> following an &rsquo;<code>@</code>&rsquo; character,
1624 is also a part of the self-signed host certificate subject and
1625 issuer 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>
1632 Next: <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.
1639 This 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>
1651 Next: <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.
1658 This 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>
1670 Next: <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.
1677 Generate symmetric keys, obsoleting any that may exist.
1678 </p><hr>
1679 <a name="ntp_002dkeygen-pvt_002dcert"></a>
1680 <div class="header">
1681 <p>
1682 Next: <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
1696 public certificates.
1697 </p><hr>
1698 <a name="ntp_002dkeygen-password"></a>
1699 <div class="header">
1700 <p>
1701 Next: <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.
1708 This 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
1716 DES-CBC algorithm and the specified password.  The same password
1717 must be specified to the local ntpd via the &quot;crypto pw password&quot;
1718 configuration command.  The default password is the local
1719 hostname.
1720 </p><hr>
1721 <a name="ntp_002dkeygen-export_002dpasswd"></a>
1722 <div class="header">
1723 <p>
1724 Next: <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.
1731 This 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,
1739 encrypted with the DES-CBC algorithm and the specified password.
1740 The 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>
1747 Next: <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.
1754 This 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
1762 following an &rsquo;<code>@</code>&rsquo; character.  The host name is used in the file
1763 name of generated host and signing certificates, without the
1764 group name.  The host name, and if provided, group name are used
1765 in <code>host@group</code> form for the host certificate subject and issuer
1766 fields.  Specifying &rsquo;<code>-s @group</code>&rsquo; is allowed, and results in
1767 leaving the host name unchanged while appending <code>@group</code> to the
1768 subject and issuer fields, as with <code>-i group</code>.  The group name, or
1769 if not provided, the host name are also used in the file names
1770 of IFF, GQ, and MV client parameter files.
1771 </p><hr>
1772 <a name="ntp_002dkeygen-sign_002dkey"></a>
1773 <div class="header">
1774 <p>
1775 Next: <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.
1782 This 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
1790 that may exist.  By default, the program uses the host key as the
1791 sign key.
1792 </p><hr>
1793 <a name="ntp_002dkeygen-trusted_002dcert"></a>
1794 <div class="header">
1795 <p>
1796 Next: <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
1810 a non-trusted certificate.
1811 </p><hr>
1812 <a name="ntp_002dkeygen-mv_002dparams"></a>
1813 <div class="header">
1814 <p>
1815 Next: <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.
1822 This 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)
1830 identification scheme.
1831 </p><hr>
1832 <a name="ntp_002dkeygen-mv_002dkeys"></a>
1833 <div class="header">
1834 <p>
1835 Next: <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.
1842 This 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>
1856 Next: <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
1862 loading 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
1863 the options listed above in upper case and segmented with underscores.
1864 The <code>NTP-KEYGEN</code> variable will be tokenized and parsed like
1865 the command line.  The remaining variables are tested for existence and their
1866 values 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>
1875 are expanded and replaced when <samp>ntp-keygen</samp> runs.
1876 For any of these that are plain files, they are simply processed.
1877 For any that are directories, then a file named <samp>.ntprc</samp> is searched for
1878 within that directory and processed.
1879 </p>
1880 <p>Configuration files may be in a wide variety of formats.
1881 The basic format is an option name followed by a value (argument) on the
1882 same line.  Values may be separated from the option name with a colon,
1883 equal sign or simply white space.  Values may be continued across multiple
1884 lines by escaping the newline with a backslash.
1885 </p>
1886 <p>Multiple programs may also share the same initialization file.
1887 Common options are collected at the top, followed by program specific
1888 segments.  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
1899 specified 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
1910 hierarchicly valued option.  <code>AutoOpts</code> does provide a means for searching
1911 the 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
1919 information, then exit 0.  The optional argument specifies how much licensing
1920 detail to provide.  The default is to print just the version.  The licensing infomation may be selected with an option argument.
1921 Only 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>
1939 Next: <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
1957 it 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>
1964 Next: <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>
1972 Next: <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>
1980 Previous: <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>
1989 Next: <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
1995 randomize the entropy seed used to initialize the internal
1996 pseudo-random number generator used by the OpenSSL library routines.
1997 If a site supports ssh, it is very likely that means to do this are
1998 already available.
1999 The entropy seed used by the OpenSSL library is contained in a file,
2000 usually called <code>.rnd</code>, which must be available when
2001 starting 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
2005 or some other user.
2006 If the <code>RANDFILE</code> environment variable is not
2007 present, the library looks for the <code>.rnd</code> file in the user home
2008 directory.
2009 Since both the <code>ntp-keygen</code> program and <code>ntpd</code> daemon must run
2010 as root, the logical place to put this file is in <code>/.rnd</code> or
2011 <code>/root/.rnd</code>.
2012 If the file is not available or cannot be written, the program exits
2013 with a message to the system log.
2014 </p>
2015 <hr>
2016 <a name="Cryptographic-Data-Files"></a>
2017 <div class="header">
2018 <p>
2019 Previous: <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>,
2025 where <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).
2028 By convention, key names in generated file names include both upper and
2029 lower case characters, while key names in generated link names include
2030 only lower case characters. The filestamp is not used in generated link
2031 names.
2032 </p>
2033 <p>The key name is a string defining the cryptographic key type.
2034 Key types include public/private keys host and sign, certificate cert
2035 and several challenge/response key types.
2036 By convention, client files used for
2037 challenges have a par subtype, as in the IFF challenge IFFpar, while
2038 server files for responses have a key subtype, as in the GQ response
2039 GQkey.
2040 </p>
2041 <p>All files begin with two nonencrypted lines. The first line contains
2042 the file name in the format <code>ntpkey_key_host.fstamp</code>.
2043 The second line contains the datestamp in conventional Unix date format.
2044 Lines beginning with <code>#</code> are ignored.
2045 </p>
2046 <p>The remainder of the file contains cryptographic data encoded first
2047 using ASN.1 rules, then encrypted using the DES-CBC algorithm with
2048 given password and finally written in PEM-encoded printable ASCII text
2049 preceded and followed by MIME content identifier lines.
2050 </p>
2051 <p>The format of the symmetric keys file, ordinarily named <code>ntp.keys</code>,
2052 is somewhat different than the other files in the interest of backward
2053 compatibility.
2054 Ordinarily, the file is generated by this program, but
2055 it 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
2070 10 MD5 JVF/1=)=IFbHbJQz..Cd  # MD5 key
2071 11 SHA1 6dea311109529e436c2b4fccae9bc753c16d1b48  # SHA1 key
2072 12 SHA1 7076f373d86c4848c59ff8046e49cb7d614ec394  # SHA1 key
2073 13 SHA1 5f48b1b60591eb01b7cf1d33b7774f08d20262d3  # SHA1 key
2074 14 SHA1 eed5ab9d9497319ec60cf3781d52607e76720178  # SHA1 key
2075 15 SHA1 f283562611a04c964da8126296f5f8e58c3f85de  # SHA1 key
2076 16 SHA1 1930da171297dd63549af50b29449de17dcf341f  # SHA1 key
2077 17 SHA1 fee892110358cd4382322b889869e750db8e8a8f  # SHA1 key
2078 18 SHA1 b5520c9fadd7ad3fd8bfa061c8821b65d029bb37  # SHA1 key
2079 19 SHA1 8c74fb440ec80f453ec6aaa62b9baed0ab723b92  # SHA1 key
2080 20 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
2086 implementation.
2087 Each line of the file contains three fields, first an
2088 integer between 1 and 65535, inclusive, representing the key identifier
2089 used in the server and peer configuration commands.
2090 Next is the key type for the message digest algorithm,
2091 which in the absence of the
2092 OpenSSL library must be MD5 to designate the MD5 message digest
2093 algorithm.
2094 If the OpenSSL library is installed, the key type can be any
2095 message digest algorithm supported by that library.
2096 However, if
2097 compatibility with FIPS 140-2 is required, the key type must be either
2098 SHA or SHA1.
2099 The 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
2102 16 characters and terminated by whitespace or a # character.
2103 An OpenSSL
2104 key consists of a hex-encoded ASCII string of 40 characters, which is
2105 truncated as necessary.
2106 </p>
2107 <p>Note that the keys used by the <code>ntpq</code> and <code>ntpdc</code> programs are
2108 checked against passwords requested by the programs and entered by hand,
2109 so it
2110 is generally appropriate to specify these keys in human readable ASCII
2111 format.
2112 </p>
2113 <p>The <code>ntp-keygen</code> program generates a MD5 symmetric keys file
2114 <code>ntpkey_MD5key_hostname.filestamp</code>.
2115 Since the file contains private
2116 shared keys, it should be visible only to root and distributed by
2117 secure means to other subnet hosts.
2118 The NTP daemon loads the file <code>ntp.keys</code>, so <code>ntp-keygen</code>
2119 installs a soft link from this name to the generated file.
2120 Subsequently, similar soft links must be installed by
2121 manual or automated means on the other subnet hosts.
2122 While this file is
2123 not used with the Autokey Version 2 protocol, it is needed to
2124 authenticate 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>