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