1 1.1.1.15 christos .Dd May 25 2024 2 1.1 christos .Dt NTP_KEYGEN 1ntp-keygenmdoc User Commands 3 1.1.1.2 christos .Os 4 1.1 christos .\" EDIT THIS FILE WITH CAUTION (ntp-keygen-opts.mdoc) 5 1.1 christos .\" 6 1.1.1.15 christos .\" It has been AutoGen-ed May 25, 2024 at 12:04:46 AM by AutoGen 5.18.16 7 1.1 christos .\" From the definitions ntp-keygen-opts.def 8 1.1 christos .\" and the template file agmdoc-cmd.tpl 9 1.1 christos .Sh NAME 10 1.1 christos .Nm ntp-keygen 11 1.1 christos .Nd Create a NTP host key 12 1.1 christos .Sh SYNOPSIS 13 1.1 christos .Nm 14 1.1 christos .\" Mixture of short (flag) options and long options 15 1.1 christos .Op Fl flags 16 1.1 christos .Op Fl flag Op Ar value 17 1.1 christos .Op Fl \-option\-name Ns Oo Oo Ns "=| " Oc Ns Ar value Oc 18 1.1 christos .Pp 19 1.1 christos All arguments must be options. 20 1.1 christos .Pp 21 1.1 christos .Sh DESCRIPTION 22 1.1 christos This program generates cryptographic data files used by the NTPv4 23 1.1 christos authentication and identification schemes. 24 1.1.1.11 christos It can generate message digest keys used in symmetric key cryptography and, 25 1.1.1.11 christos if the OpenSSL software library has been installed, it can generate host keys, 26 1.1.1.11 christos signing keys, certificates, and identity keys and parameters used in Autokey 27 1.1.1.11 christos public key cryptography. 28 1.1 christos These files are used for cookie encryption, 29 1.1.1.11 christos digital signature, and challenge/response identification algorithms 30 1.1 christos compatible with the Internet standard security infrastructure. 31 1.1 christos .Pp 32 1.1.1.11 christos The message digest symmetric keys file is generated in a format 33 1.1.1.11 christos compatible with NTPv3. 34 1.1.1.11 christos All other files are in PEM\-encoded printable ASCII format, 35 1.1.1.11 christos so they can be embedded as MIME attachments in email to other sites 36 1.1 christos and certificate authorities. 37 1.1 christos By default, files are not encrypted. 38 1.1 christos .Pp 39 1.1.1.11 christos When used to generate message digest symmetric keys, the program 40 1.1.1.11 christos produces a file containing ten pseudo\-random printable ASCII strings 41 1.1.1.11 christos suitable for the MD5 message digest algorithm included in the 42 1.1.1.11 christos distribution. 43 1.1 christos If the OpenSSL library is installed, it produces an additional ten 44 1.1.1.11 christos hex\-encoded random bit strings suitable for SHA1, AES\-128\-CMAC, and 45 1.1.1.11 christos other message digest algorithms. 46 1.1.1.11 christos The message digest symmetric keys file must be distributed and stored 47 1.1 christos using secure means beyond the scope of NTP itself. 48 1.1 christos Besides the keys used for ordinary NTP associations, additional keys 49 1.1 christos can be defined as passwords for the 50 1.1 christos .Xr ntpq 1ntpqmdoc 51 1.1 christos and 52 1.1 christos .Xr ntpdc 1ntpdcmdoc 53 1.1 christos utility programs. 54 1.1 christos .Pp 55 1.1 christos The remaining generated files are compatible with other OpenSSL 56 1.1 christos applications and other Public Key Infrastructure (PKI) resources. 57 1.1 christos Certificates generated by this program are compatible with extant 58 1.1 christos industry practice, although some users might find the interpretation of 59 1.1 christos X509v3 extension fields somewhat liberal. 60 1.1 christos However, the identity keys are probably not compatible with anything 61 1.1 christos other than Autokey. 62 1.1 christos .Pp 63 1.1 christos Some files used by this program are encrypted using a private password. 64 1.1 christos The 65 1.1 christos .Fl p 66 1.1.1.11 christos option specifies the read password for local encrypted files and the 67 1.1 christos .Fl q 68 1.1.1.11 christos option the write password for encrypted files sent to remote sites. 69 1.1 christos If no password is specified, the host name returned by the Unix 70 1.1.1.11 christos .Xr hostname 1 71 1.1.1.11 christos command, normally the DNS name of the host, is used as the the default read 72 1.1.1.11 christos password, for convenience. 73 1.1.1.11 christos The 74 1.1.1.11 christos .Nm 75 1.1.1.11 christos program prompts for the password if it reads an encrypted file 76 1.1.1.11 christos and the password is missing or incorrect. 77 1.1.1.11 christos If an encrypted file is read successfully and 78 1.1.1.11 christos no write password is specified, the read password is used 79 1.1.1.11 christos as the write password by default. 80 1.1 christos .Pp 81 1.1 christos The 82 1.1.1.11 christos .Cm pw 83 1.1 christos option of the 84 1.1.1.11 christos .Ic crypto 85 1.1.1.11 christos .Xr ntpd 1ntpdmdoc 86 1.1 christos configuration command specifies the read 87 1.1 christos password for previously encrypted local files. 88 1.1.1.11 christos This must match the local read password used by this program. 89 1.1 christos If not specified, the host name is used. 90 1.1.1.11 christos Thus, if files are generated by this program without an explicit password, 91 1.1 christos they can be read back by 92 1.1.1.11 christos .Xr ntpd 1ntpdmdoc 93 1.1.1.11 christos without specifying an explicit password but only on the same host. 94 1.1.1.11 christos If the write password used for encryption is specified as the host name, 95 1.1.1.11 christos these files can be read by that host with no explicit password. 96 1.1 christos .Pp 97 1.1 christos Normally, encrypted files for each host are generated by that host and 98 1.1 christos used only by that host, although exceptions exist as noted later on 99 1.1 christos this page. 100 1.1 christos The symmetric keys file, normally called 101 1.1.1.11 christos .Pa ntp.keys , 102 1.1 christos is usually installed in 103 1.1 christos .Pa /etc . 104 1.1 christos Other files and links are usually installed in 105 1.1 christos .Pa /usr/local/etc , 106 1.1 christos which is normally in a shared filesystem in 107 1.1 christos NFS\-mounted networks and cannot be changed by shared clients. 108 1.1.1.11 christos In these cases, NFS clients can specify the files in another 109 1.1.1.11 christos directory such as 110 1.1.1.11 christos .Pa /etc 111 1.1.1.11 christos using the 112 1.1.1.11 christos .Ic keysdir 113 1.1.1.11 christos .Xr ntpd 1ntpdmdoc 114 1.1.1.11 christos configuration file command. 115 1.1 christos .Pp 116 1.1 christos This program directs commentary and error messages to the standard 117 1.1 christos error stream 118 1.1.1.11 christos .Pa stderr 119 1.1 christos and remote files to the standard output stream 120 1.1.1.11 christos .Pa stdout 121 1.1 christos where they can be piped to other applications or redirected to files. 122 1.1 christos The names used for generated files and links all begin with the 123 1.1 christos string 124 1.1.1.11 christos .Pa ntpkey\&* 125 1.1 christos and include the file type, generating host and filestamp, 126 1.1 christos as described in the 127 1.1.1.11 christos .Sx "Cryptographic Data Files" 128 1.1 christos section below. 129 1.1 christos .Ss Running the Program 130 1.1 christos The safest way to run the 131 1.1 christos .Nm 132 1.1 christos program is logged in directly as root. 133 1.1.1.11 christos The recommended procedure is change to the 134 1.1.1.11 christos .Ar keys 135 1.1.1.11 christos directory, usually 136 1.1 christos .Pa /usr/local/etc , 137 1.1 christos then run the program. 138 1.1.1.11 christos .Pp 139 1.1.1.11 christos To test and gain experience with Autokey concepts, log in as root and 140 1.1.1.11 christos change to the 141 1.1.1.11 christos .Ar keys 142 1.1.1.11 christos directory, usually 143 1.1.1.11 christos .Pa /usr/local/etc . 144 1.1.1.11 christos When run for the first time, or if all files with names beginning with 145 1.1.1.11 christos .Pa ntpkey\&* 146 1.1.1.11 christos have been removed, use the 147 1.1.1.11 christos .Nm 148 1.1.1.11 christos command without arguments to generate a default 149 1.1.1.11 christos .Cm RSA 150 1.1.1.11 christos host key and matching 151 1.1.1.11 christos .Cm RSA\-MD5 152 1.1.1.11 christos certificate file with expiration date one year hence, 153 1.1 christos which is all that is necessary in many cases. 154 1.1 christos The program also generates soft links from the generic names 155 1.1 christos to the respective files. 156 1.1.1.11 christos If run again without options, the program uses the 157 1.1.1.11 christos existing keys and parameters and generates a new certificate file with 158 1.1.1.11 christos new expiration date one year hence, and soft link. 159 1.1 christos .Pp 160 1.1.1.11 christos The host key is used to encrypt the cookie when required and so must be 161 1.1.1.11 christos .Cm RSA 162 1.1.1.11 christos type. 163 1.1 christos By default, the host key is also the sign key used to encrypt signatures. 164 1.1 christos When necessary, a different sign key can be specified and this can be 165 1.1.1.11 christos either 166 1.1.1.11 christos .Cm RSA 167 1.1.1.11 christos or 168 1.1.1.11 christos .Cm DSA 169 1.1.1.11 christos type. 170 1.1.1.11 christos By default, the message digest type is 171 1.1.1.11 christos .Cm MD5 , 172 1.1.1.11 christos but any combination 173 1.1 christos of sign key type and message digest type supported by the OpenSSL library 174 1.1.1.11 christos can be specified, including those using the 175 1.1.1.11 christos .Cm AES128CMAC , MD2 , MD5 , MDC2 , SHA , SHA1 176 1.1.1.11 christos and 177 1.1.1.11 christos .Cm RIPE160 178 1.1.1.11 christos message digest algorithms. 179 1.1 christos However, the scheme specified in the certificate must be compatible 180 1.1 christos with the sign key. 181 1.1.1.11 christos Certificates using any digest algorithm are compatible with 182 1.1.1.11 christos .Cm RSA 183 1.1.1.11 christos sign keys; 184 1.1.1.11 christos however, only 185 1.1.1.11 christos .Cm SHA 186 1.1.1.11 christos and 187 1.1.1.11 christos .Cm SHA1 188 1.1.1.11 christos certificates are compatible with 189 1.1.1.11 christos .Cm DSA 190 1.1.1.11 christos sign keys. 191 1.1 christos .Pp 192 1.1 christos Private/public key files and certificates are compatible with 193 1.1 christos other OpenSSL applications and very likely other libraries as well. 194 1.1 christos Certificates or certificate requests derived from them should be compatible 195 1.1 christos with extant industry practice, although some users might find 196 1.1 christos the interpretation of X509v3 extension fields somewhat liberal. 197 1.1 christos However, the identification parameter files, although encoded 198 1.1 christos as the other files, are probably not compatible with anything other than Autokey. 199 1.1 christos .Pp 200 1.1 christos Running the program as other than root and using the Unix 201 1.1.1.11 christos .Xr su 1 202 1.1 christos command 203 1.1 christos to assume root may not work properly, since by default the OpenSSL library 204 1.1 christos looks for the random seed file 205 1.1.1.11 christos .Pa .rnd 206 1.1 christos in the user home directory. 207 1.1 christos However, there should be only one 208 1.1.1.11 christos .Pa .rnd , 209 1.1 christos most conveniently 210 1.1 christos in the root directory, so it is convenient to define the 211 1.1.1.11 christos .Ev RANDFILE 212 1.1 christos environment variable used by the OpenSSL library as the path to 213 1.1.1.11 christos .Pa .rnd . 214 1.1 christos .Pp 215 1.1 christos Installing the keys as root might not work in NFS\-mounted 216 1.1 christos shared file systems, as NFS clients may not be able to write 217 1.1 christos to the shared keys directory, even as root. 218 1.1 christos In this case, NFS clients can specify the files in another 219 1.1 christos directory such as 220 1.1 christos .Pa /etc 221 1.1 christos using the 222 1.1 christos .Ic keysdir 223 1.1.1.11 christos .Xr ntpd 1ntpdmdoc 224 1.1.1.11 christos configuration file command. 225 1.1 christos There is no need for one client to read the keys and certificates 226 1.1 christos of other clients or servers, as these data are obtained automatically 227 1.1 christos by the Autokey protocol. 228 1.1 christos .Pp 229 1.1 christos Ordinarily, cryptographic files are generated by the host that uses them, 230 1.1 christos but it is possible for a trusted agent (TA) to generate these files 231 1.1 christos for other hosts; however, in such cases files should always be encrypted. 232 1.1 christos The subject name and trusted name default to the hostname 233 1.1 christos of the host generating the files, but can be changed by command line options. 234 1.1 christos It is convenient to designate the owner name and trusted name 235 1.1 christos as the subject and issuer fields, respectively, of the certificate. 236 1.1 christos The owner name is also used for the host and sign key files, 237 1.1 christos while the trusted name is used for the identity files. 238 1.1 christos .Pp 239 1.1 christos All files are installed by default in the keys directory 240 1.1 christos .Pa /usr/local/etc , 241 1.1 christos which is normally in a shared filesystem 242 1.1 christos in NFS\-mounted networks. 243 1.1 christos The actual location of the keys directory 244 1.1 christos and each file can be overridden by configuration commands, 245 1.1 christos but this is not recommended. 246 1.1 christos Normally, the files for each host are generated by that host 247 1.1 christos and used only by that host, although exceptions exist 248 1.1 christos as noted later on this page. 249 1.1 christos .Pp 250 1.1 christos Normally, files containing private values, 251 1.1 christos including the host key, sign key and identification parameters, 252 1.1 christos are permitted root read/write\-only; 253 1.1 christos while others containing public values are permitted world readable. 254 1.1 christos Alternatively, files containing private values can be encrypted 255 1.1 christos and these files permitted world readable, 256 1.1 christos which simplifies maintenance in shared file systems. 257 1.1.1.11 christos Since uniqueness is insured by the 258 1.1.1.11 christos .Ar hostname 259 1.1.1.11 christos and 260 1.1.1.11 christos .Ar filestamp 261 1.1.1.11 christos file name extensions, the files for an NTP server and 262 1.1 christos dependent clients can all be installed in the same shared directory. 263 1.1 christos .Pp 264 1.1 christos The recommended practice is to keep the file name extensions 265 1.1 christos when installing a file and to install a soft link 266 1.1 christos from the generic names specified elsewhere on this page 267 1.1 christos to the generated files. 268 1.1 christos This allows new file generations to be activated simply 269 1.1 christos by changing the link. 270 1.1.1.11 christos If a link is present, 271 1.1.1.11 christos .Xr ntpd 1ntpdmdoc 272 1.1.1.11 christos follows it to the file name to extract the 273 1.1.1.11 christos .Ar filestamp . 274 1.1 christos If a link is not present, 275 1.1 christos .Xr ntpd 1ntpdmdoc 276 1.1.1.11 christos extracts the 277 1.1.1.11 christos .Ar filestamp 278 1.1.1.11 christos from the file itself. 279 1.1 christos This allows clients to verify that the file and generation times 280 1.1 christos are always current. 281 1.1 christos The 282 1.1 christos .Nm 283 1.1.1.11 christos program uses the same 284 1.1.1.11 christos .Ar filestamp 285 1.1.1.11 christos extension for all files generated 286 1.1 christos at one time, so each generation is distinct and can be readily 287 1.1 christos recognized in monitoring data. 288 1.1.1.11 christos .Pp 289 1.1.1.11 christos Run the command on as many hosts as necessary. 290 1.1.1.11 christos Designate one of them as the trusted host (TH) using 291 1.1 christos .Nm 292 1.1.1.11 christos with the 293 1.1.1.11 christos .Fl T 294 1.1.1.11 christos option and configure it to synchronize from reliable Internet servers. 295 1.1.1.11 christos Then configure the other hosts to synchronize to the TH directly or 296 1.1.1.11 christos indirectly. 297 1.1.1.11 christos A certificate trail is created when Autokey asks the immediately 298 1.1.1.11 christos ascendant host towards the TH to sign its certificate, which is then 299 1.1.1.11 christos provided to the immediately descendant host on request. 300 1.1.1.11 christos All group hosts should have acyclic certificate trails ending on the TH. 301 1.1 christos .Pp 302 1.1.1.11 christos The host key is used to encrypt the cookie when required and so must be 303 1.1.1.11 christos RSA type. 304 1.1.1.11 christos By default, the host key is also the sign key used to encrypt 305 1.1.1.11 christos signatures. 306 1.1.1.11 christos A different sign key can be assigned using the 307 1.1.1.11 christos .Fl S 308 1.1.1.11 christos option and this can be either 309 1.1.1.11 christos .Cm RSA 310 1.1.1.11 christos or 311 1.1.1.11 christos .Cm DSA 312 1.1.1.11 christos type. 313 1.1.1.11 christos By default, the signature 314 1.1.1.11 christos message digest type is 315 1.1.1.11 christos .Cm MD5 , 316 1.1.1.11 christos but any combination of sign key type and 317 1.1.1.11 christos message digest type supported by the OpenSSL library can be specified 318 1.1.1.11 christos using the 319 1.1.1.11 christos .Fl c 320 1.1.1.11 christos option. 321 1.1 christos .Pp 322 1.1.1.11 christos The rules say cryptographic media should be generated with proventic 323 1.1.1.11 christos filestamps, which means the host should already be synchronized before 324 1.1.1.11 christos this program is run. 325 1.1.1.11 christos This of course creates a chicken\-and\-egg problem 326 1.1.1.11 christos when the host is started for the first time. 327 1.1.1.11 christos Accordingly, the host time 328 1.1.1.11 christos should be set by some other means, such as eyeball\-and\-wristwatch, at 329 1.1.1.11 christos least so that the certificate lifetime is within the current year. 330 1.1.1.11 christos After that and when the host is synchronized to a proventic source, the 331 1.1.1.11 christos certificate should be re\-generated. 332 1.1 christos .Pp 333 1.1.1.11 christos Additional information on trusted groups and identity schemes is on the 334 1.1.1.11 christos .Dq Autokey Public\-Key Authentication 335 1.1.1.11 christos page. 336 1.1 christos .Pp 337 1.1.1.11 christos File names begin with the prefix 338 1.1.1.11 christos .Pa ntpkey Ns _ 339 1.1.1.11 christos and end with the suffix 340 1.1.1.11 christos .Pa _ Ns Ar hostname . Ar filestamp , 341 1.1.1.11 christos where 342 1.1.1.11 christos .Ar hostname 343 1.1.1.11 christos is the owner name, usually the string returned 344 1.1.1.11 christos by the Unix 345 1.1.1.11 christos .Xr hostname 1 346 1.1.1.11 christos command, and 347 1.1.1.11 christos .Ar filestamp 348 1.1.1.11 christos is the NTP seconds when the file was generated, in decimal digits. 349 1.1.1.11 christos This both guarantees uniqueness and simplifies maintenance 350 1.1.1.11 christos procedures, since all files can be quickly removed 351 1.1.1.11 christos by a 352 1.1.1.11 christos .Ic rm Pa ntpkey\&* 353 1.1.1.11 christos command or all files generated 354 1.1.1.11 christos at a specific time can be removed by a 355 1.1.1.11 christos .Ic rm Pa \&* Ns Ar filestamp 356 1.1 christos command. 357 1.1.1.11 christos To further reduce the risk of misconfiguration, 358 1.1.1.11 christos the first two lines of a file contain the file name 359 1.1.1.11 christos and generation date and time as comments. 360 1.1.1.11 christos .Ss Trusted Hosts and Groups 361 1.1 christos Each cryptographic configuration involves selection of a signature scheme 362 1.1 christos and identification scheme, called a cryptotype, 363 1.1 christos as explained in the 364 1.1 christos .Sx Authentication Options 365 1.1 christos section of 366 1.1 christos .Xr ntp.conf 5 . 367 1.1.1.11 christos The default cryptotype uses 368 1.1.1.11 christos .Cm RSA 369 1.1.1.11 christos encryption, 370 1.1.1.11 christos .Cm MD5 371 1.1.1.11 christos message digest 372 1.1.1.11 christos and 373 1.1.1.11 christos .Cm TC 374 1.1.1.11 christos identification. 375 1.1 christos First, configure a NTP subnet including one or more low\-stratum 376 1.1 christos trusted hosts from which all other hosts derive synchronization 377 1.1 christos directly or indirectly. 378 1.1 christos Trusted hosts have trusted certificates; 379 1.1 christos all other hosts have nontrusted certificates. 380 1.1 christos These hosts will automatically and dynamically build authoritative 381 1.1 christos certificate trails to one or more trusted hosts. 382 1.1 christos A trusted group is the set of all hosts that have, directly or indirectly, 383 1.1 christos a certificate trail ending at a trusted host. 384 1.1 christos The trail is defined by static configuration file entries 385 1.1 christos or dynamic means described on the 386 1.1 christos .Sx Automatic NTP Configuration Options 387 1.1 christos section of 388 1.1 christos .Xr ntp.conf 5 . 389 1.1 christos .Pp 390 1.1 christos On each trusted host as root, change to the keys directory. 391 1.1 christos To insure a fresh fileset, remove all 392 1.1.1.11 christos .Pa ntpkey 393 1.1 christos files. 394 1.1 christos Then run 395 1.1 christos .Nm 396 1.1 christos .Fl T 397 1.1 christos to generate keys and a trusted certificate. 398 1.1 christos On all other hosts do the same, but leave off the 399 1.1 christos .Fl T 400 1.1 christos flag to generate keys and nontrusted certificates. 401 1.1 christos When complete, start the NTP daemons beginning at the lowest stratum 402 1.1 christos and working up the tree. 403 1.1 christos It may take some time for Autokey to instantiate the certificate trails 404 1.1 christos throughout the subnet, but setting up the environment is completely automatic. 405 1.1 christos .Pp 406 1.1 christos If it is necessary to use a different sign key or different digest/signature 407 1.1 christos scheme than the default, run 408 1.1 christos .Nm 409 1.1 christos with the 410 1.1 christos .Fl S Ar type 411 1.1 christos option, where 412 1.1 christos .Ar type 413 1.1 christos is either 414 1.1 christos .Cm RSA 415 1.1 christos or 416 1.1 christos .Cm DSA . 417 1.1.1.11 christos The most frequent need to do this is when a 418 1.1.1.11 christos .Cm DSA Ns \-signed 419 1.1.1.11 christos certificate is used. 420 1.1 christos If it is necessary to use a different certificate scheme than the default, 421 1.1 christos run 422 1.1 christos .Nm 423 1.1 christos with the 424 1.1 christos .Fl c Ar scheme 425 1.1 christos option and selected 426 1.1 christos .Ar scheme 427 1.1 christos as needed. 428 1.1.1.11 christos If 429 1.1 christos .Nm 430 1.1 christos is run again without these options, it generates a new certificate 431 1.1.1.11 christos using the same scheme and sign key, and soft link. 432 1.1 christos .Pp 433 1.1 christos After setting up the environment it is advisable to update certificates 434 1.1 christos from time to time, if only to extend the validity interval. 435 1.1 christos Simply run 436 1.1 christos .Nm 437 1.1 christos with the same flags as before to generate new certificates 438 1.1.1.11 christos using existing keys, and soft links. 439 1.1 christos However, if the host or sign key is changed, 440 1.1 christos .Xr ntpd 1ntpdmdoc 441 1.1 christos should be restarted. 442 1.1 christos When 443 1.1 christos .Xr ntpd 1ntpdmdoc 444 1.1 christos is restarted, it loads any new files and restarts the protocol. 445 1.1 christos Other dependent hosts will continue as usual until signatures are refreshed, 446 1.1 christos at which time the protocol is restarted. 447 1.1 christos .Ss Identity Schemes 448 1.1 christos As mentioned on the Autonomous Authentication page, 449 1.1.1.11 christos the default 450 1.1.1.11 christos .Cm TC 451 1.1.1.11 christos identity scheme is vulnerable to a middleman attack. 452 1.1 christos However, there are more secure identity schemes available, 453 1.1.1.11 christos including 454 1.1.1.11 christos .Cm PC , IFF , GQ 455 1.1.1.11 christos and 456 1.1.1.11 christos .Cm MV 457 1.1.1.11 christos schemes described below. 458 1.1 christos These schemes are based on a TA, one or more trusted hosts 459 1.1 christos and some number of nontrusted hosts. 460 1.1 christos Trusted hosts prove identity using values provided by the TA, 461 1.1 christos while the remaining hosts prove identity using values provided 462 1.1 christos by a trusted host and certificate trails that end on that host. 463 1.1 christos The name of a trusted host is also the name of its sugroup 464 1.1 christos and also the subject and issuer name on its trusted certificate. 465 1.1 christos The TA is not necessarily a trusted host in this sense, but often is. 466 1.1 christos .Pp 467 1.1 christos In some schemes there are separate keys for servers and clients. 468 1.1 christos A server can also be a client of another server, 469 1.1 christos but a client can never be a server for another client. 470 1.1 christos In general, trusted hosts and nontrusted hosts that operate 471 1.1 christos as both server and client have parameter files that contain 472 1.1 christos both server and client keys. 473 1.1 christos Hosts that operate 474 1.1 christos only as clients have key files that contain only client keys. 475 1.1 christos .Pp 476 1.1 christos The PC scheme supports only one trusted host in the group. 477 1.1 christos On trusted host alice run 478 1.1 christos .Nm 479 1.1 christos .Fl P 480 1.1 christos .Fl p Ar password 481 1.1 christos to generate the host key file 482 1.1.1.11 christos .Pa ntpkey Ns _ Cm RSA Pa key_alice. Ar filestamp 483 1.1 christos and trusted private certificate file 484 1.1.1.11 christos .Pa ntpkey Ns _ Cm RSA\-MD5 _ Pa cert_alice. Ar filestamp , 485 1.1.1.11 christos and soft links. 486 1.1 christos Copy both files to all group hosts; 487 1.1 christos they replace the files which would be generated in other schemes. 488 1.1.1.11 christos On each host 489 1.1.1.11 christos .Ar bob 490 1.1.1.11 christos install a soft link from the generic name 491 1.1 christos .Pa ntpkey_host_ Ns Ar bob 492 1.1 christos to the host key file and soft link 493 1.1 christos .Pa ntpkey_cert_ Ns Ar bob 494 1.1 christos to the private certificate file. 495 1.1 christos Note the generic links are on bob, but point to files generated 496 1.1 christos by trusted host alice. 497 1.1 christos In this scheme it is not possible to refresh 498 1.1 christos either the keys or certificates without copying them 499 1.1.1.11 christos to all other hosts in the group, and recreating the soft links. 500 1.1 christos .Pp 501 1.1.1.11 christos For the 502 1.1.1.11 christos .Cm IFF 503 1.1.1.11 christos scheme proceed as in the 504 1.1.1.11 christos .Cm TC 505 1.1.1.11 christos scheme to generate keys 506 1.1 christos and certificates for all group hosts, then for every trusted host in the group, 507 1.1.1.11 christos generate the 508 1.1.1.11 christos .Cm IFF 509 1.1.1.11 christos parameter file. 510 1.1 christos On trusted host alice run 511 1.1 christos .Nm 512 1.1 christos .Fl T 513 1.1 christos .Fl I 514 1.1 christos .Fl p Ar password 515 1.1 christos to produce her parameter file 516 1.1.1.11 christos .Pa ntpkey_IFFpar_alice. Ns Ar filestamp , 517 1.1 christos which includes both server and client keys. 518 1.1 christos Copy this file to all group hosts that operate as both servers 519 1.1 christos and clients and install a soft link from the generic 520 1.1.1.11 christos .Pa ntpkey_iff_alice 521 1.1 christos to this file. 522 1.1 christos If there are no hosts restricted to operate only as clients, 523 1.1 christos there is nothing further to do. 524 1.1.1.11 christos As the 525 1.1.1.11 christos .Cm IFF 526 1.1.1.11 christos scheme is independent 527 1.1 christos of keys and certificates, these files can be refreshed as needed. 528 1.1 christos .Pp 529 1.1 christos If a rogue client has the parameter file, it could masquerade 530 1.1 christos as a legitimate server and present a middleman threat. 531 1.1 christos To eliminate this threat, the client keys can be extracted 532 1.1 christos from the parameter file and distributed to all restricted clients. 533 1.1 christos After generating the parameter file, on alice run 534 1.1 christos .Nm 535 1.1 christos .Fl e 536 1.1.1.11 christos and pipe the output to a file or email program. 537 1.1.1.11 christos Copy or email this file to all restricted clients. 538 1.1 christos On these clients install a soft link from the generic 539 1.1.1.11 christos .Pa ntpkey_iff_alice 540 1.1 christos to this file. 541 1.1 christos To further protect the integrity of the keys, 542 1.1 christos each file can be encrypted with a secret password. 543 1.1 christos .Pp 544 1.1.1.11 christos For the 545 1.1.1.11 christos .Cm GQ 546 1.1.1.11 christos scheme proceed as in the 547 1.1.1.11 christos .Cm TC 548 1.1.1.11 christos scheme to generate keys 549 1.1 christos and certificates for all group hosts, then for every trusted host 550 1.1.1.11 christos in the group, generate the 551 1.1.1.11 christos .Cm IFF 552 1.1.1.11 christos parameter file. 553 1.1 christos On trusted host alice run 554 1.1 christos .Nm 555 1.1 christos .Fl T 556 1.1 christos .Fl G 557 1.1 christos .Fl p Ar password 558 1.1 christos to produce her parameter file 559 1.1.1.11 christos .Pa ntpkey_GQpar_alice. Ns Ar filestamp , 560 1.1 christos which includes both server and client keys. 561 1.1 christos Copy this file to all group hosts and install a soft link 562 1.1 christos from the generic 563 1.1.1.11 christos .Pa ntpkey_gq_alice 564 1.1 christos to this file. 565 1.1.1.11 christos In addition, on each host 566 1.1.1.11 christos .Ar bob 567 1.1.1.11 christos install a soft link 568 1.1 christos from generic 569 1.1 christos .Pa ntpkey_gq_ Ns Ar bob 570 1.1 christos to this file. 571 1.1.1.11 christos As the 572 1.1.1.11 christos .Cm GQ 573 1.1.1.11 christos scheme updates the 574 1.1.1.11 christos .Cm GQ 575 1.1.1.11 christos parameters file and certificate 576 1.1 christos at the same time, keys and certificates can be regenerated as needed. 577 1.1 christos .Pp 578 1.1.1.11 christos For the 579 1.1.1.11 christos .Cm MV 580 1.1.1.11 christos scheme, proceed as in the 581 1.1.1.11 christos .Cm TC 582 1.1.1.11 christos scheme to generate keys 583 1.1 christos and certificates for all group hosts. 584 1.1 christos For illustration assume trish is the TA, alice one of several trusted hosts 585 1.1 christos and bob one of her clients. 586 1.1 christos On TA trish run 587 1.1 christos .Nm 588 1.1 christos .Fl V Ar n 589 1.1 christos .Fl p Ar password , 590 1.1 christos where 591 1.1 christos .Ar n 592 1.1 christos is the number of revokable keys (typically 5) to produce 593 1.1 christos the parameter file 594 1.1.1.11 christos .Pa ntpkeys_MVpar_trish. Ns Ar filestamp 595 1.1 christos and client key files 596 1.1.1.11 christos .Pa ntpkeys_MVkey Ns Ar d _ Pa trish. Ar filestamp 597 1.1 christos where 598 1.1 christos .Ar d 599 1.1 christos is the key number (0 \&< 600 1.1 christos .Ar d 601 1.1 christos \&< 602 1.1 christos .Ar n ) . 603 1.1 christos Copy the parameter file to alice and install a soft link 604 1.1 christos from the generic 605 1.1.1.11 christos .Pa ntpkey_mv_alice 606 1.1 christos to this file. 607 1.1 christos Copy one of the client key files to alice for later distribution 608 1.1 christos to her clients. 609 1.1.1.11 christos It does not matter which client key file goes to alice, 610 1.1 christos since they all work the same way. 611 1.1.1.11 christos Alice copies the client key file to all of her clients. 612 1.1 christos On client bob install a soft link from generic 613 1.1.1.11 christos .Pa ntpkey_mvkey_bob 614 1.1 christos to the client key file. 615 1.1.1.11 christos As the 616 1.1.1.11 christos .Cm MV 617 1.1.1.11 christos scheme is independent of keys and certificates, 618 1.1 christos these files can be refreshed as needed. 619 1.1 christos .Ss Command Line Options 620 1.1 christos .Bl -tag -width indent 621 1.1.1.11 christos .It Fl b Fl \-imbits Ns = Ar modulus 622 1.1.1.11 christos Set the number of bits in the identity modulus for generating identity keys to 623 1.1.1.11 christos .Ar modulus 624 1.1.1.11 christos bits. 625 1.1.1.11 christos The number of bits in the identity modulus defaults to 256, but can be set to 626 1.1.1.11 christos values from 256 to 2048 (32 to 256 octets). 627 1.1.1.11 christos Use the larger moduli with caution, as this can consume considerable computing 628 1.1.1.11 christos resources and increases the size of authenticated packets. 629 1.1.1.11 christos .It Fl c Fl \-certificate Ns = Ar scheme 630 1.1.1.11 christos Select certificate signature encryption/message digest scheme. 631 1.1 christos The 632 1.1 christos .Ar scheme 633 1.1 christos can be one of the following: 634 1.1.1.11 christos .Cm RSA\-MD2 , RSA\-MD5 , RSA\-MDC2 , RSA\-SHA , RSA\-SHA1 , RSA\-RIPEMD160 , DSA\-SHA , 635 1.1 christos or 636 1.1 christos .Cm DSA\-SHA1 . 637 1.1.1.11 christos Note that 638 1.1.1.11 christos .Cm RSA 639 1.1.1.11 christos schemes must be used with an 640 1.1.1.11 christos .Cm RSA 641 1.1.1.11 christos sign key and 642 1.1.1.11 christos .Cm DSA 643 1.1.1.11 christos schemes must be used with a 644 1.1.1.11 christos .Cm DSA 645 1.1.1.11 christos sign key. 646 1.1 christos The default without this option is 647 1.1 christos .Cm RSA\-MD5 . 648 1.1.1.11 christos If compatibility with FIPS 140\-2 is required, either the 649 1.1.1.11 christos .Cm DSA\-SHA 650 1.1.1.11 christos or 651 1.1.1.11 christos .Cm DSA\-SHA1 652 1.1.1.11 christos scheme must be used. 653 1.1.1.11 christos .It Fl C Fl \-cipher Ns = Ar cipher 654 1.1.1.11 christos Select the OpenSSL cipher to encrypt the files containing private keys. 655 1.1.1.11 christos The default without this option is three\-key triple DES in CBC mode, 656 1.1.1.11 christos .Cm des\-ede3\-cbc . 657 1.1.1.11 christos The 658 1.1.1.11 christos .Ic openssl Fl h 659 1.1.1.11 christos command provided with OpenSSL displays available ciphers. 660 1.1.1.11 christos .It Fl d Fl \-debug\-level 661 1.1.1.11 christos Increase debugging verbosity level. 662 1.1 christos This option displays the cryptographic data produced in eye\-friendly billboards. 663 1.1.1.11 christos .It Fl D Fl \-set\-debug\-level Ns = Ar level 664 1.1.1.11 christos Set the debugging verbosity to 665 1.1.1.11 christos .Ar level . 666 1.1.1.11 christos This option displays the cryptographic data produced in eye\-friendly billboards. 667 1.1.1.11 christos .It Fl e Fl \-id\-key 668 1.1.1.11 christos Write the 669 1.1.1.11 christos .Cm IFF 670 1.1.1.11 christos or 671 1.1.1.11 christos .Cm GQ 672 1.1.1.11 christos public parameters from the 673 1.1.1.11 christos .Ar IFFkey or GQkey 674 1.1.1.11 christos client keys file previously specified 675 1.1.1.11 christos as unencrypted data to the standard output stream 676 1.1.1.11 christos .Pa stdout . 677 1.1.1.11 christos This is intended for automatic key distribution by email. 678 1.1.1.11 christos .It Fl G Fl \-gq\-params 679 1.1.1.11 christos Generate a new encrypted 680 1.1.1.11 christos .Cm GQ 681 1.1.1.11 christos parameters and key file for the Guillou\-Quisquater (GQ) identity scheme. 682 1.1.1.11 christos This option is mutually exclusive with the 683 1.1.1.11 christos .Fl I 684 1.1.1.11 christos and 685 1.1.1.11 christos .Fl V 686 1.1.1.11 christos options. 687 1.1.1.11 christos .It Fl H Fl \-host\-key 688 1.1.1.11 christos Generate a new encrypted 689 1.1.1.11 christos .Cm RSA 690 1.1.1.11 christos public/private host key file. 691 1.1.1.11 christos .It Fl I Fl \-iffkey 692 1.1.1.11 christos Generate a new encrypted 693 1.1.1.11 christos .Cm IFF 694 1.1.1.11 christos key file for the Schnorr (IFF) identity scheme. 695 1.1.1.11 christos This option is mutually exclusive with the 696 1.1.1.11 christos .Fl G 697 1.1.1.11 christos and 698 1.1.1.11 christos Fl V 699 1.1.1.11 christos options. 700 1.1.1.11 christos .It Fl i Fl \-ident Ns = Ar group 701 1.1.1.11 christos Set the optional Autokey group name to 702 1.1.1.11 christos .Ar group . 703 1.1.1.11 christos This is used in the identity scheme parameter file names of 704 1.1.1.11 christos .Cm IFF , GQ , 705 1.1.1.11 christos and 706 1.1.1.11 christos .Cm MV 707 1.1.1.11 christos client parameters files. 708 1.1.1.11 christos In that role, the default is the host name if no group is provided. 709 1.1.1.11 christos The group name, if specified using 710 1.1.1.11 christos .Fl i 711 1.1.1.11 christos or 712 1.1.1.11 christos .Fl s 713 1.1.1.11 christos following an 714 1.1.1.11 christos .Ql @ 715 1.1.1.11 christos character, is also used in certificate subject and issuer names in the form 716 1.1.1.11 christos .Ar host @ group 717 1.1.1.11 christos and should match the group specified via 718 1.1.1.11 christos .Ic crypto Cm ident 719 1.1.1.11 christos or 720 1.1.1.11 christos .Ic server Cm ident 721 1.1.1.11 christos in the ntpd configuration file. 722 1.1.1.11 christos .It Fl l Fl \-lifetime Ns = Ar days 723 1.1.1.11 christos Set the lifetime for certificate expiration to 724 1.1.1.11 christos .Ar days . 725 1.1.1.11 christos The default lifetime is one year (365 days). 726 1.1.1.11 christos .It Fl m Fl \-modulus Ns = Ar bits 727 1.1.1.11 christos Set the number of bits in the prime modulus for generating files to 728 1.1.1.11 christos .Ar bits . 729 1.1.1.11 christos The modulus defaults to 512, but can be set from 256 to 2048 (32 to 256 octets). 730 1.1.1.11 christos Use the larger moduli with caution, as this can consume considerable computing 731 1.1.1.11 christos resources and increases the size of authenticated packets. 732 1.1.1.11 christos .It Fl M Fl \-md5key 733 1.1.1.11 christos Generate a new symmetric keys file containing 10 734 1.1.1.11 christos .Cm MD5 735 1.1.1.11 christos keys, and if OpenSSL is available, 10 736 1.1.1.11 christos .Cm SHA 737 1.1.1.11 christos keys. 738 1.1.1.11 christos An 739 1.1.1.11 christos .Cm MD5 740 1.1.1.11 christos key is a string of 20 random printable ASCII characters, while a 741 1.1.1.11 christos .Cm SHA 742 1.1.1.11 christos key is a string of 40 random hex digits. 743 1.1.1.11 christos The file can be edited using a text editor to change the key type or key content. 744 1.1.1.11 christos This option is mutually exclusive with all other options. 745 1.1.1.11 christos .It Fl p Fl \-password Ns = Ar passwd 746 1.1.1.11 christos Set the password for reading and writing encrypted files to 747 1.1.1.11 christos .Ar passwd . 748 1.1.1.11 christos These include the host, sign and identify key files. 749 1.1.1.11 christos By default, the password is the string returned by the Unix 750 1.1.1.11 christos .Ic hostname 751 1.1.1.11 christos command. 752 1.1.1.11 christos .It Fl P Fl \-pvt\-cert 753 1.1.1.11 christos Generate a new private certificate used by the 754 1.1.1.11 christos .Cm PC 755 1.1.1.11 christos identity scheme. 756 1.1 christos By default, the program generates public certificates. 757 1.1.1.11 christos Note: the PC identity scheme is not recommended for new installations. 758 1.1.1.11 christos .It Fl q Fl \-export\-passwd Ns = Ar passwd 759 1.1.1.11 christos Set the password for writing encrypted 760 1.1.1.11 christos .Cm IFF , GQ and MV 761 1.1.1.11 christos identity files redirected to 762 1.1.1.11 christos .Pa stdout 763 1.1.1.11 christos to 764 1.1.1.11 christos .Ar passwd . 765 1.1.1.11 christos In effect, these files are decrypted with the 766 1.1.1.11 christos .Fl p 767 1.1.1.11 christos password, then encrypted with the 768 1.1.1.11 christos .Fl q 769 1.1.1.11 christos password. 770 1.1.1.11 christos By default, the password is the string returned by the Unix 771 1.1.1.11 christos .Ic hostname 772 1.1.1.11 christos command. 773 1.1.1.11 christos .It Fl s Fl \-subject\-key Ns = Ar Oo host Oc Op @ Ar group 774 1.1.1.11 christos Specify the Autokey host name, where 775 1.1.1.11 christos .Ar host 776 1.1.1.11 christos is the optional host name and 777 1.1.1.11 christos .Ar group 778 1.1.1.11 christos is the optional group name. 779 1.1.1.11 christos The host name, and if provided, group name are used in 780 1.1.1.11 christos .Ar host @ group 781 1.1.1.11 christos form as certificate subject and issuer. 782 1.1.1.11 christos Specifying 783 1.1.1.11 christos .Fl s @ Ar group 784 1.1.1.11 christos is allowed, and results in leaving the host name unchanged, as with 785 1.1.1.11 christos .Fl i Ar group . 786 1.1.1.11 christos The group name, or if no group is provided, the host name are also used in the 787 1.1.1.11 christos file names of 788 1.1.1.11 christos .Cm IFF , GQ , 789 1.1.1.11 christos and 790 1.1.1.11 christos .Cm MV 791 1.1.1.11 christos identity scheme client parameter files. 792 1.1.1.11 christos If 793 1.1.1.11 christos .Ar host 794 1.1.1.11 christos is not specified, the default host name is the string returned by the Unix 795 1.1.1.11 christos .Ic hostname 796 1.1.1.11 christos command. 797 1.1.1.11 christos .It Fl S Fl \-sign\-key Ns = Op Cm RSA | DSA 798 1.1.1.11 christos Generate a new encrypted public/private sign key file of the specified type. 799 1.1.1.11 christos By default, the sign key is the host key and has the same type. 800 1.1.1.11 christos If compatibility with FIPS 140\-2 is required, the sign key type must be 801 1.1.1.11 christos .Cm DSA . 802 1.1.1.11 christos .It Fl T Fl \-trusted\-cert 803 1.1 christos Generate a trusted certificate. 804 1.1 christos By default, the program generates a non\-trusted certificate. 805 1.1.1.11 christos .It Fl V Fl \-mv\-params Ar nkeys 806 1.1.1.11 christos Generate 807 1.1.1.11 christos .Ar nkeys 808 1.1.1.11 christos encrypted server keys and parameters for the Mu\-Varadharajan (MV) 809 1.1.1.11 christos identity scheme. 810 1.1.1.11 christos This option is mutually exclusive with the 811 1.1.1.11 christos .Fl I 812 1.1.1.11 christos and 813 1.1.1.11 christos .Fl G 814 1.1.1.11 christos options. 815 1.1.1.11 christos Note: support for this option should be considered a work in progress. 816 1.1 christos .El 817 1.1 christos .Ss Random Seed File 818 1.1 christos All cryptographically sound key generation schemes must have means 819 1.1 christos to randomize the entropy seed used to initialize 820 1.1 christos the internal pseudo\-random number generator used 821 1.1 christos by the library routines. 822 1.1 christos The OpenSSL library uses a designated random seed file for this purpose. 823 1.1 christos The file must be available when starting the NTP daemon and 824 1.1 christos .Nm 825 1.1 christos program. 826 1.1 christos If a site supports OpenSSL or its companion OpenSSH, 827 1.1 christos it is very likely that means to do this are already available. 828 1.1 christos .Pp 829 1.1 christos It is important to understand that entropy must be evolved 830 1.1 christos for each generation, for otherwise the random number sequence 831 1.1 christos would be predictable. 832 1.1 christos Various means dependent on external events, such as keystroke intervals, 833 1.1 christos can be used to do this and some systems have built\-in entropy sources. 834 1.1 christos Suitable means are described in the OpenSSL software documentation, 835 1.1 christos but are outside the scope of this page. 836 1.1 christos .Pp 837 1.1 christos The entropy seed used by the OpenSSL library is contained in a file, 838 1.1 christos usually called 839 1.1.1.11 christos .Pa .rnd , 840 1.1 christos which must be available when starting the NTP daemon 841 1.1 christos or the 842 1.1 christos .Nm 843 1.1 christos program. 844 1.1 christos The NTP daemon will first look for the file 845 1.1 christos using the path specified by the 846 1.1.1.11 christos .Cm randfile 847 1.1 christos subcommand of the 848 1.1 christos .Ic crypto 849 1.1 christos configuration command. 850 1.1 christos If not specified in this way, or when starting the 851 1.1 christos .Nm 852 1.1 christos program, 853 1.1 christos the OpenSSL library will look for the file using the path specified 854 1.1 christos by the 855 1.1 christos .Ev RANDFILE 856 1.1 christos environment variable in the user home directory, 857 1.1 christos whether root or some other user. 858 1.1 christos If the 859 1.1 christos .Ev RANDFILE 860 1.1 christos environment variable is not present, 861 1.1 christos the library will look for the 862 1.1.1.11 christos .Pa .rnd 863 1.1 christos file in the user home directory. 864 1.1.1.11 christos Since both the 865 1.1.1.11 christos .Nm 866 1.1.1.11 christos program and 867 1.1.1.11 christos .Xr ntpd 1ntpdmdoc 868 1.1.1.11 christos daemon must run as root, the logical place to put this file is in 869 1.1.1.11 christos .Pa /.rnd 870 1.1.1.11 christos or 871 1.1.1.11 christos .Pa /root/.rnd . 872 1.1 christos If the file is not available or cannot be written, 873 1.1 christos the daemon exits with a message to the system log and the program 874 1.1 christos exits with a suitable error message. 875 1.1 christos .Ss Cryptographic Data Files 876 1.1.1.11 christos All file formats begin with two nonencrypted lines. 877 1.1.1.11 christos The first line contains the file name, including the generated host name 878 1.1.1.11 christos and filestamp, in the format 879 1.1.1.11 christos .Pa ntpkey_ Ns Ar key _ Ar name . Ar filestamp , 880 1.1.1.11 christos where 881 1.1.1.11 christos .Ar key 882 1.1.1.11 christos is the key or parameter type, 883 1.1.1.11 christos .Ar name 884 1.1.1.11 christos is the host or group name and 885 1.1.1.11 christos .Ar filestamp 886 1.1.1.11 christos is the filestamp (NTP seconds) when the file was created. 887 1.1.1.11 christos By convention, 888 1.1.1.11 christos .Ar key 889 1.1.1.11 christos names in generated file names include both upper and lower case 890 1.1.1.11 christos characters, while 891 1.1.1.11 christos .Ar key 892 1.1.1.11 christos names in generated link names include only lower case characters. 893 1.1.1.11 christos The filestamp is not used in generated link names. 894 1.1.1.11 christos The second line contains the datestamp in conventional Unix 895 1.1.1.11 christos .Pa date 896 1.1.1.11 christos format. 897 1.1.1.11 christos Lines beginning with 898 1.1.1.11 christos .Ql # 899 1.1.1.11 christos are considered comments and ignored by the 900 1.1 christos .Nm 901 1.1 christos program and 902 1.1 christos .Xr ntpd 1ntpdmdoc 903 1.1 christos daemon. 904 1.1.1.11 christos .Pp 905 1.1.1.11 christos The remainder of the file contains cryptographic data, encoded first using ASN.1 906 1.1.1.11 christos rules, then encrypted if necessary, and finally written in PEM\-encoded 907 1.1.1.11 christos printable ASCII text, preceded and followed by MIME content identifier lines. 908 1.1.1.11 christos .Pp 909 1.1.1.11 christos The format of the symmetric keys file, ordinarily named 910 1.1.1.11 christos .Pa ntp.keys , 911 1.1.1.11 christos is somewhat different than the other files in the interest of backward compatibility. 912 1.1.1.11 christos Ordinarily, the file is generated by this program, but it can be constructed 913 1.1.1.11 christos and edited using an ordinary text editor. 914 1.1.1.11 christos .Bd -literal -unfilled -offset center 915 1.1.1.11 christos # ntpkey_MD5key_bk.ntp.org.3595864945 916 1.1.1.11 christos # Thu Dec 12 19:22:25 2013 917 1.1.1.11 christos 1 MD5 L";Nw<\`.I<f4U0)247"i # MD5 key 918 1.1.1.11 christos 2 MD5 &>l0%XXK9O'51VwV<xq~ # MD5 key 919 1.1.1.11 christos 3 MD5 lb4zLW~d^!K:]RsD'qb6 # MD5 key 920 1.1.1.11 christos 4 MD5 Yue:tL[+vR)M\`n~bY,'? # MD5 key 921 1.1.1.11 christos 5 MD5 B;fx'Kgr/&4ZTbL6=RxA # MD5 key 922 1.1.1.11 christos 6 MD5 4eYwa\`o}3i@@V (a] ..R9!l # MD5 key 923 1.1.1.11 christos 7 MD5 \`A.([h+;wTQ|xfi%Sn_! # MD5 key 924 1.1.1.11 christos 8 MD5 45:V,r4]l6y^JH6"Sh?F # MD5 key 925 1.1.1.11 christos 9 MD5 3\-5vcn*6l29DS?Xdsg)* # MD5 key 926 1.1.1.11 christos 10 MD5 2late4Me # MD5 key 927 1.1.1.11 christos 11 SHA1 a27872d3030a9025b8446c751b4551a7629af65c # SHA1 key 928 1.1.1.11 christos 12 SHA1 21bc3b4865dbb9e920902abdccb3e04ff97a5e74 # SHA1 key 929 1.1.1.11 christos 13 SHA1 2b7736fe24fef5ba85ae11594132ab5d6f6daba9 # SHA1 key 930 1.1.1.11 christos 14 SHA a5332809c8878dd3a5b918819108a111509aeceb # SHA key 931 1.1.1.11 christos 15 MD2 2fe16c88c760ff2f16d4267e36c1aa6c926e6964 # MD2 key 932 1.1.1.11 christos 16 MD4 b2691811dc19cfc0e2f9bcacd74213f29812183d # MD4 key 933 1.1.1.11 christos 17 MD5 e4d6735b8bdad58ec5ffcb087300a17f7fef1f7c # MD5 key 934 1.1.1.11 christos 18 MDC2 a8d5e2315c025bf3a79174c87fbd10477de2eabc # MDC2 key 935 1.1.1.11 christos 19 RIPEMD160 77ca332cafb30e3cafb174dcd5b80ded7ba9b3d2 # RIPEMD160 key 936 1.1.1.11 christos 20 AES128CMAC f92ff73eee86c1e7dc638d6489a04e4e555af878 # AES128CMAC key 937 1.1.1.11 christos .Ed 938 1.1.1.11 christos .D1 Figure 1. Typical Symmetric Key File 939 1.1.1.11 christos .Pp 940 1.1.1.11 christos Figure 1 shows a typical symmetric keys file used by the reference 941 1.1.1.11 christos implementation. 942 1.1.1.11 christos Following the header the keys are entered one per line in the format 943 1.1.1.11 christos .D1 Ar keyno Ar type Ar key 944 1.1 christos where 945 1.1 christos .Ar keyno 946 1.1.1.12 christos is a positive integer in the range 1\-65535; 947 1.1 christos .Ar type 948 1.1.1.11 christos is the key type for the message digest algorithm, which in the absence of the 949 1.1.1.11 christos OpenSSL library must be 950 1.1.1.11 christos .Cm MD5 951 1.1.1.11 christos to designate the MD5 message digest algorithm; 952 1.1.1.11 christos if the OpenSSL library is installed, the key type can be any 953 1.1.1.11 christos message digest algorithm supported by that library; 954 1.1.1.11 christos however, if compatibility with FIPS 140\-2 is required, 955 1.1.1.11 christos the key type must be either 956 1.1.1.11 christos .Cm SHA 957 1.1.1.11 christos or 958 1.1.1.11 christos .Cm SHA1 ; 959 1.1 christos .Ar key 960 1.1 christos is the key itself, 961 1.1.1.11 christos which is a printable ASCII string 20 characters or less in length: 962 1.1.1.11 christos each character is chosen from the 93 printable characters 963 1.1.1.11 christos in the range 0x21 through 0x7e ( 964 1.1.1.11 christos .Ql ! 965 1.1.1.11 christos through 966 1.1.1.11 christos .Ql ~ 967 1.1.1.11 christos \&) excluding space and the 968 1.1.1.11 christos .Ql # 969 1.1.1.11 christos character, and terminated by whitespace or a 970 1.1 christos .Ql # 971 1.1 christos character. 972 1.1.1.11 christos An OpenSSL key consists of a hex\-encoded ASCII string of 40 characters, which 973 1.1.1.11 christos is truncated as necessary. 974 1.1 christos .Pp 975 1.1 christos Note that the keys used by the 976 1.1 christos .Xr ntpq 1ntpqmdoc 977 1.1 christos and 978 1.1 christos .Xr ntpdc 1ntpdcmdoc 979 1.1 christos programs 980 1.1 christos are checked against passwords requested by the programs 981 1.1 christos and entered by hand, so it is generally appropriate to specify these keys 982 1.1 christos in human readable ASCII format. 983 1.1 christos .Pp 984 1.1 christos The 985 1.1 christos .Nm 986 1.1.1.11 christos program generates a symmetric keys file 987 1.1.1.11 christos .Pa ntpkey_MD5key_ Ns Ar hostname Ns . Ns Ar filestamp . 988 1.1 christos Since the file contains private shared keys, 989 1.1 christos it should be visible only to root and distributed by secure means 990 1.1 christos to other subnet hosts. 991 1.1 christos The NTP daemon loads the file 992 1.1 christos .Pa ntp.keys , 993 1.1 christos so 994 1.1 christos .Nm 995 1.1 christos installs a soft link from this name to the generated file. 996 1.1 christos Subsequently, similar soft links must be installed by manual 997 1.1 christos or automated means on the other subnet hosts. 998 1.1 christos While this file is not used with the Autokey Version 2 protocol, 999 1.1 christos it is needed to authenticate some remote configuration commands 1000 1.1 christos used by the 1001 1.1 christos .Xr ntpq 1ntpqmdoc 1002 1.1 christos and 1003 1.1 christos .Xr ntpdc 1ntpdcmdoc 1004 1.1 christos utilities. 1005 1.1 christos .Sh "OPTIONS" 1006 1.1 christos .Bl -tag 1007 1.1 christos .It Fl b Ar imbits , Fl \-imbits Ns = Ns Ar imbits 1008 1.1 christos identity modulus bits. 1009 1.1 christos This option takes an integer number as its argument. 1010 1.1 christos The value of 1011 1.1 christos .Ar imbits 1012 1.1 christos is constrained to being: 1013 1.1 christos .in +4 1014 1.1 christos .nf 1015 1.1 christos .na 1016 1.1 christos in the range 256 through 2048 1017 1.1 christos .fi 1018 1.1 christos .in -4 1019 1.1 christos .sp 1020 1.1.1.15 christos The number of bits in the identity modulus. The default is 512. 1021 1.1 christos .It Fl c Ar scheme , Fl \-certificate Ns = Ns Ar scheme 1022 1.1 christos certificate scheme. 1023 1.1 christos .sp 1024 1.1 christos scheme is one of 1025 1.1.1.11 christos RSA\-MD2, RSA\-MD5, RSA\-MDC2, RSA\-SHA, RSA\-SHA1, RSA\-RIPEMD160, 1026 1.1 christos DSA\-SHA, or DSA\-SHA1. 1027 1.1 christos .sp 1028 1.1.1.11 christos Select the certificate signature encryption/message digest scheme. 1029 1.1 christos Note that RSA schemes must be used with a RSA sign key and DSA 1030 1.1 christos schemes must be used with a DSA sign key. The default without 1031 1.1 christos this option is RSA\-MD5. 1032 1.1 christos .It Fl C Ar cipher , Fl \-cipher Ns = Ns Ar cipher 1033 1.1 christos privatekey cipher. 1034 1.1 christos .sp 1035 1.1 christos Select the cipher which is used to encrypt the files containing 1036 1.1 christos private keys. The default is three\-key triple DES in CBC mode, 1037 1.1.1.11 christos equivalent to "\fB\-C des\-ede3\-cbc\fP". The openssl tool lists ciphers 1038 1.1 christos available in "\fBopenssl \-h\fP" output. 1039 1.1 christos .It Fl d , Fl \-debug\-level 1040 1.1 christos Increase debug verbosity level. 1041 1.1 christos This option may appear an unlimited number of times. 1042 1.1 christos .sp 1043 1.1 christos .It Fl D Ar number , Fl \-set\-debug\-level Ns = Ns Ar number 1044 1.1 christos Set the debug verbosity level. 1045 1.1 christos This option may appear an unlimited number of times. 1046 1.1 christos This option takes an integer number as its argument. 1047 1.1 christos .sp 1048 1.1 christos .It Fl e , Fl \-id\-key 1049 1.1 christos Write IFF or GQ identity keys. 1050 1.1 christos .sp 1051 1.1.1.11 christos Write the public parameters from the IFF or GQ client keys to 1052 1.1.1.11 christos the standard output. 1053 1.1.1.11 christos This is intended for automatic key distribution by email. 1054 1.1 christos .It Fl G , Fl \-gq\-params 1055 1.1 christos Generate GQ parameters and keys. 1056 1.1 christos .sp 1057 1.1 christos Generate parameters and keys for the GQ identification scheme, 1058 1.1 christos obsoleting any that may exist. 1059 1.1 christos .It Fl H , Fl \-host\-key 1060 1.1 christos generate RSA host key. 1061 1.1 christos .sp 1062 1.1 christos Generate new host keys, obsoleting any that may exist. 1063 1.1 christos .It Fl I , Fl \-iffkey 1064 1.1 christos generate IFF parameters. 1065 1.1 christos .sp 1066 1.1 christos Generate parameters for the IFF identification scheme, obsoleting 1067 1.1 christos any that may exist. 1068 1.1 christos .It Fl i Ar group , Fl \-ident Ns = Ns Ar group 1069 1.1 christos set Autokey group name. 1070 1.1 christos .sp 1071 1.1 christos Set the optional Autokey group name to name. This is used in 1072 1.1 christos the file name of IFF, GQ, and MV client parameters files. In 1073 1.1 christos that role, the default is the host name if this option is not 1074 1.1 christos provided. The group name, if specified using \fB\-i/\-\-ident\fP or 1075 1.1 christos using \fB\-s/\-\-subject\-name\fP following an '\fB@\fP' character, 1076 1.1.1.11 christos is also a part of the self\-signed host certificate subject and 1077 1.1 christos issuer names in the form \fBhost@group\fP and should match the 1078 1.1.1.11 christos \'\fBcrypto ident\fP' or '\fBserver ident\fP' configuration in the 1079 1.1.1.11 christos \fBntpd\fP configuration file. 1080 1.1 christos .It Fl l Ar lifetime , Fl \-lifetime Ns = Ns Ar lifetime 1081 1.1 christos set certificate lifetime. 1082 1.1 christos This option takes an integer number as its argument. 1083 1.1 christos .sp 1084 1.1 christos Set the certificate expiration to lifetime days from now. 1085 1.1 christos .It Fl m Ar modulus , Fl \-modulus Ns = Ns Ar modulus 1086 1.1.1.11 christos prime modulus. 1087 1.1 christos This option takes an integer number as its argument. 1088 1.1 christos The value of 1089 1.1 christos .Ar modulus 1090 1.1 christos is constrained to being: 1091 1.1 christos .in +4 1092 1.1 christos .nf 1093 1.1 christos .na 1094 1.1 christos in the range 256 through 2048 1095 1.1 christos .fi 1096 1.1 christos .in -4 1097 1.1 christos .sp 1098 1.1 christos The number of bits in the prime modulus. The default is 512. 1099 1.1.1.11 christos .It Fl M , Fl \-md5key 1100 1.1.1.11 christos generate symmetric keys. 1101 1.1.1.11 christos .sp 1102 1.1.1.11 christos Generate symmetric keys, obsoleting any that may exist. 1103 1.1 christos .It Fl P , Fl \-pvt\-cert 1104 1.1 christos generate PC private certificate. 1105 1.1 christos .sp 1106 1.1 christos Generate a private certificate. By default, the program generates 1107 1.1 christos public certificates. 1108 1.1.1.2 christos .It Fl p Ar passwd , Fl \-password Ns = Ns Ar passwd 1109 1.1.1.2 christos local private password. 1110 1.1 christos .sp 1111 1.1.1.2 christos Local files containing private data are encrypted with the 1112 1.1.1.2 christos DES\-CBC algorithm and the specified password. The same password 1113 1.1.1.2 christos must be specified to the local ntpd via the "crypto pw password" 1114 1.1.1.2 christos configuration command. The default password is the local 1115 1.1.1.2 christos hostname. 1116 1.1.1.2 christos .It Fl q Ar passwd , Fl \-export\-passwd Ns = Ns Ar passwd 1117 1.1.1.2 christos export IFF or GQ group keys with password. 1118 1.1.1.2 christos .sp 1119 1.1.1.2 christos Export IFF or GQ identity group keys to the standard output, 1120 1.1.1.2 christos encrypted with the DES\-CBC algorithm and the specified password. 1121 1.1.1.2 christos The same password must be specified to the remote ntpd via the 1122 1.1.1.2 christos "crypto pw password" configuration command. See also the option 1123 1.1.1.2 christos -\-id\-key (\-e) for unencrypted exports. 1124 1.1 christos .It Fl s Ar host@group , Fl \-subject\-name Ns = Ns Ar host@group 1125 1.1 christos set host and optionally group name. 1126 1.1 christos .sp 1127 1.1 christos Set the Autokey host name, and optionally, group name specified 1128 1.1 christos following an '\fB@\fP' character. The host name is used in the file 1129 1.1 christos name of generated host and signing certificates, without the 1130 1.1 christos group name. The host name, and if provided, group name are used 1131 1.1.1.11 christos in \fBhost@group\fP form for the host certificate subject and issuer 1132 1.1 christos fields. Specifying '\fB\-s @group\fP' is allowed, and results in 1133 1.1 christos leaving the host name unchanged while appending \fB@group\fP to the 1134 1.1 christos subject and issuer fields, as with \fB\-i group\fP. The group name, or 1135 1.1 christos if not provided, the host name are also used in the file names 1136 1.1 christos of IFF, GQ, and MV client parameter files. 1137 1.1.1.11 christos .It Fl S Ar sign , Fl \-sign\-key Ns = Ns Ar sign 1138 1.1.1.11 christos generate sign key (RSA or DSA). 1139 1.1.1.11 christos .sp 1140 1.1.1.11 christos Generate a new sign key of the designated type, obsoleting any 1141 1.1.1.11 christos that may exist. By default, the program uses the host key as the 1142 1.1.1.11 christos sign key. 1143 1.1 christos .It Fl T , Fl \-trusted\-cert 1144 1.1 christos trusted certificate (TC scheme). 1145 1.1 christos .sp 1146 1.1 christos Generate a trusted certificate. By default, the program generates 1147 1.1 christos a non\-trusted certificate. 1148 1.1 christos .It Fl V Ar num , Fl \-mv\-params Ns = Ns Ar num 1149 1.1 christos generate <num> MV parameters. 1150 1.1 christos This option takes an integer number as its argument. 1151 1.1 christos .sp 1152 1.1 christos Generate parameters and keys for the Mu\-Varadharajan (MV) 1153 1.1 christos identification scheme. 1154 1.1 christos .It Fl v Ar num , Fl \-mv\-keys Ns = Ns Ar num 1155 1.1 christos update <num> MV keys. 1156 1.1 christos This option takes an integer number as its argument. 1157 1.1 christos .sp 1158 1.1 christos This option has not been fully documented. 1159 1.1 christos .It Fl \&? , Fl \-help 1160 1.1 christos Display usage information and exit. 1161 1.1 christos .It Fl \&! , Fl \-more\-help 1162 1.1 christos Pass the extended usage information through a pager. 1163 1.1 christos .It Fl > Oo Ar cfgfile Oc , Fl \-save\-opts Oo Ns = Ns Ar cfgfile Oc 1164 1.1 christos Save the option state to \fIcfgfile\fP. The default is the \fIlast\fP 1165 1.1 christos configuration file listed in the \fBOPTION PRESETS\fP section, below. 1166 1.1 christos The command will exit after updating the config file. 1167 1.1 christos .It Fl < Ar cfgfile , Fl \-load\-opts Ns = Ns Ar cfgfile , Fl \-no\-load\-opts 1168 1.1 christos Load options from \fIcfgfile\fP. 1169 1.1 christos The \fIno\-load\-opts\fP form will disable the loading 1170 1.1 christos of earlier config/rc/ini files. \fI\-\-no\-load\-opts\fP is handled early, 1171 1.1 christos out of order. 1172 1.1 christos .It Fl \-version Op Brq Ar v|c|n 1173 1.1 christos Output version of program and exit. The default mode is `v', a simple 1174 1.1 christos version. The `c' mode will print copyright information and `n' will 1175 1.1 christos print the full copyright notice. 1176 1.1 christos .El 1177 1.1 christos .Sh "OPTION PRESETS" 1178 1.1 christos Any option that is not marked as \fInot presettable\fP may be preset 1179 1.1 christos by loading values from configuration ("RC" or ".INI") file(s) and values from 1180 1.1 christos environment variables named: 1181 1.1 christos .nf 1182 1.1 christos \fBNTP_KEYGEN_<option\-name>\fP or \fBNTP_KEYGEN\fP 1183 1.1 christos .fi 1184 1.1 christos .ad 1185 1.1 christos The environmental presets take precedence (are processed later than) 1186 1.1 christos the configuration files. 1187 1.1 christos The \fIhomerc\fP files are "\fI$HOME\fP", and "\fI.\fP". 1188 1.1 christos If any of these are directories, then the file \fI.ntprc\fP 1189 1.1 christos is searched for within those directories. 1190 1.1 christos .Sh USAGE 1191 1.1 christos .Sh "ENVIRONMENT" 1192 1.1 christos See \fBOPTION PRESETS\fP for configuration environment variables. 1193 1.1 christos .Sh "FILES" 1194 1.1 christos See \fBOPTION PRESETS\fP for configuration files. 1195 1.1 christos .Sh "EXIT STATUS" 1196 1.1 christos One of the following exit values will be returned: 1197 1.1 christos .Bl -tag 1198 1.1 christos .It 0 " (EXIT_SUCCESS)" 1199 1.1 christos Successful program execution. 1200 1.1 christos .It 1 " (EXIT_FAILURE)" 1201 1.1 christos The operation failed or the command syntax was not valid. 1202 1.1 christos .It 66 " (EX_NOINPUT)" 1203 1.1 christos A specified configuration file could not be loaded. 1204 1.1 christos .It 70 " (EX_SOFTWARE)" 1205 1.1 christos libopts had an internal operational error. Please report 1206 1.1 christos it to autogen\-users (a] lists.sourceforge.net. Thank you. 1207 1.1 christos .El 1208 1.1 christos .Sh "AUTHORS" 1209 1.1.1.3 christos The University of Delaware and Network Time Foundation 1210 1.1 christos .Sh "COPYRIGHT" 1211 1.1.1.15 christos Copyright (C) 1992\-2024 The University of Delaware and Network Time Foundation all rights reserved. 1212 1.1 christos This program is released under the terms of the NTP license, <http://ntp.org/license>. 1213 1.1 christos .Sh BUGS 1214 1.1.1.11 christos It can take quite a while to generate some cryptographic values. 1215 1.1 christos .Pp 1216 1.1 christos Please report bugs to http://bugs.ntp.org . 1217 1.1 christos .Pp 1218 1.1.1.15 christos Please send bug reports to: https://bugs.ntp.org, bugs (a] ntp.org 1219 1.1 christos .Sh NOTES 1220 1.1 christos Portions of this document came from FreeBSD. 1221 1.1 christos .Pp 1222 1.1 christos This manual page was \fIAutoGen\fP\-erated from the \fBntp\-keygen\fP 1223 1.1 christos option definitions. 1224