ntp-keygen.html revision 294905
125537Sdfr<html lang="en"> 259603Sdfr<head> 325537Sdfr<title>Ntp-keygen User's Manual</title> 425537Sdfr<meta http-equiv="Content-Type" content="text/html"> 525537Sdfr<meta name="description" content="Ntp-keygen User's Manual"> 625537Sdfr<meta name="generator" content="makeinfo 4.7"> 725537Sdfr<link title="Top" rel="top" href="#Top"> 825537Sdfr<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage"> 925537Sdfr<meta http-equiv="Content-Style-Type" content="text/css"> 1025537Sdfr<style type="text/css"><!-- 1125537Sdfr pre.display { font-family:inherit } 1225537Sdfr pre.format { font-family:inherit } 1325537Sdfr pre.smalldisplay { font-family:inherit; font-size:smaller } 1425537Sdfr pre.smallformat { font-family:inherit; font-size:smaller } 1525537Sdfr pre.smallexample { font-size:smaller } 1625537Sdfr pre.smalllisp { font-size:smaller } 1725537Sdfr span.sc { font-variant:small-caps } 1825537Sdfr span.roman { font-family: serif; font-weight: normal; } 1925537Sdfr--></style> 2025537Sdfr</head> 2125537Sdfr<body> 2225537Sdfr<h1 class="settitle">Ntp-keygen User's Manual</h1> 2325537Sdfr <div class="shortcontents"> 2425537Sdfr<h2>Short Contents</h2> 2525537Sdfr<ul> 2625537Sdfr<a href="#Top">Top</a> 27116182Sobrien<a href="#Top">NTP Key Generation Program User Manual</a> 28116182Sobrien</ul> 29116182Sobrien</div> 3040159Speter 31157144Sjkoshy 32107089Srwatson 3340159Speter<div class="node"> 3425537Sdfr<p><hr> 3525537Sdfr<a name="Top"></a>Up: <a rel="up" accesskey="u" href="#dir">(dir)</a> 3625537Sdfr<br> 3725537Sdfr</div> 3825537Sdfr 3925537Sdfr<h2 class="unnumbered">Top</h2> 40164033Srwatson 4125537Sdfr<ul class="menu"> 4225537Sdfr<li><a accesskey="1" href="#Description">Description</a> 4382749Sdillon<li><a accesskey="2" href="#ntp_002dkeygen-Invocation">ntp-keygen Invocation</a>: Invoking ntp-keygen 4492547Sarr<li><a accesskey="3" href="#Running-the-Program">Running the Program</a> 4525537Sdfr<li><a accesskey="4" href="#Random-Seed-File">Random Seed File</a> 46159808Sjhb<li><a accesskey="5" href="#Cryptographic-Data-Files">Cryptographic Data Files</a> 4725537Sdfr</ul> 4840159Speter 4940159Speter<div class="node"> 5040159Speter<p><hr> 5140159Speter<a name="Top"></a>Next: <a rel="next" accesskey="n" href="#Description">Description</a>, 52159588SjhbPrevious: <a rel="previous" accesskey="p" href="#dir">(dir)</a>, 5340159SpeterUp: <a rel="up" accesskey="u" href="#dir">(dir)</a> 54185895Szec<br> 5525537Sdfr</div> 56163606Srwatson 57163606Srwatson<h2 class="unnumbered">NTP Key Generation Program User Manual</h2> 5859603Sdfr 5959603Sdfr<p>This document describes the use of the NTP Project's <code>ntp-keygen</code> 60157144Sjkoshyprogram, that generates cryptographic data files used by the NTPv4 61157144Sjkoshyauthentication and identity schemes. 62157144SjkoshyIt can generate message digest keys used in symmetric key cryptography and, 63157144Sjkoshyif the OpenSSL software 6440961Speterlibrary has been installed, it can generate host keys, sign keys, 6540961Spetercertificates, and identity keys and parameters used by the Autokey 6640961Speterpublic key cryptography. 6740961SpeterThe message digest keys file is generated in a 68160142Sjhbformat compatible with NTPv3. 69160142SjhbAll other files are in PEM-encoded 70159845Sjhbprintable ASCII format so they can be embedded as MIME attachments in 71160142Sjhbmail to other sites. 72160142Sjhb 73160142Sjhb <p>This document applies to version 4.2.8p6 of <code>ntp-keygen</code>. 74160142Sjhb 75159845Sjhb<div class="node"> 7691040Sarr<p><hr> 7791040Sarr<a name="Description"></a>Next: <a rel="next" accesskey="n" href="#Running-the-Program">Running the Program</a>, 7891040SarrPrevious: <a rel="previous" accesskey="p" href="#Top">Top</a>, 7991040SarrUp: <a rel="up" accesskey="u" href="#Top">Top</a> 8091040Sarr<br> 8159751Speter</div> 82159800Sjhb 83159800Sjhb<!-- node-name, next, previous, up --> 84159800Sjhb<h3 class="section">Description</h3> 85159800Sjhb 86159800Sjhb<p>This program generates cryptographic data files used by the NTPv4 87159800Sjhbauthentication and identity schemes. It can generate message digest 88159800Sjhbkeys used in symmetric key cryptography and, if the OpenSSL software 89159800Sjhblibrary has been installed, it can generate host keys, sign keys, 90159800Sjhbcertificates, and identity keys and parameters used by the Autokey 91159800Sjhbpublic key cryptography. The message digest keys file is generated in a 9278161Speterformat compatible with NTPv3. All other files are in PEM-encoded 9378161Speterprintable ASCII format so they can be embedded as MIME attachments in 9478161Spetermail to other sites. 9559751Speter 9659751Speter <p>When used to generate message digest keys, the program produces a file 9740906Spetercontaining ten pseudo-random printable ASCII strings suitable for the 9831324SbdeMD5 message digest algorithm included in the distribution. 99159845SjhbIf the 10098452SarrOpenSSL library is installed, it produces an additional ten hex-encoded 101172862Sjbrandom bit strings suitable for the SHA1 and other message digest 102172862Sjbalgorithms. 103172862SjbThe message digest keys file must be distributed and stored 104172862Sjbusing secure means beyond the scope of NTP itself. 105172862SjbBesides the keys 106172862Sjbused for ordinary NTP associations, additional keys can be defined as 10725537Sdfrpasswords for the ntpq and ntpdc utility programs. 10850068Sgrog 10925537Sdfr <p>The remaining generated files are compatible with other OpenSSL 11098452Sarrapplications and other Public Key Infrastructure (PKI) resources. 11125537SdfrCertificates generated by this program are compatible with extant 11286553Sarrindustry practice, although some users might find the interpretation of 11391040SarrX509v3 extension fields somewhat liberal. 11486553SarrHowever, the identity keys 115159845Sjhbare probably not compatible with anything other than Autokey. 11686553Sarr 11791040Sarr <p>Some files used by this program are encrypted using a private password. 11891040SarrThe <code>-p</code> option specifies the password for local encrypted files and the 11991040Sarr<code>-q</code> option the password for encrypted files sent to remote sites. 12091040SarrIf no password is specified, the host name returned by the Unix 12191040Sarr<code>gethostname()</code> function, normally the DNS name of the host, is used. 12291040Sarr 12391040Sarr <p>The <kbd>pw</kbd> option of the <code>crypto</code> configuration command 12486553Sarrspecifies the read password for previously encrypted local files. 12586553SarrThis must match the local password used by this program. 12686553SarrIf not specified, the host name is used. 12759751SpeterThus, if files are generated by this program without password, 12860938Sjakethey can be read back by ntpd without password, but only on the same 12959751Speterhost. 13091040Sarr 13191040Sarr <p>Normally, encrypted files for each host are generated by that host and 13291040Sarrused only by that host, although exceptions exist as noted later on 13391040Sarrthis page. 13459751SpeterThe symmetric keys file, normally called <code>ntp.keys</code>, is 13591040Sarrusually installed in <code>/etc</code>. 13691040SarrOther files and links are usually installed 13759751Speterin <code>/usr/local/etc</code>, which is normally in a shared filesystem in 138159796SjhbNFS-mounted networks and cannot be changed by shared clients. 139159796SjhbThe location of the keys directory can be changed by the keysdir 140159845Sjhbconfiguration command in such cases. 141159845SjhbNormally, this is in <code>/etc</code>. 142159796Sjhb 143159796Sjhb <p>This program directs commentary and error messages to the standard 144159796Sjhberror stream <code>stderr</code> and remote files to the standard output stream 145159796Sjhb<code>stdout</code> where they can be piped to other applications or redirected to 14694321Sbrianfiles. 14759603SdfrThe names used for generated files and links all begin with the 14859603Sdfrstring <code>ntpkey</code> and include the file type, 14959603Sdfrgenerating host and filestamp, 15091040Sarras described in the <a href="#Cryptographic-Data-Files">Cryptographic Data Files</a> section below. 15159603Sdfr 152111119Simp<div class="node"> 15391040Sarr<p><hr> 15491040Sarr<a name="Running-the-Program"></a>Next: <a rel="next" accesskey="n" href="#Random-Seed-File">Random Seed File</a>, 15559603SdfrPrevious: <a rel="previous" accesskey="p" href="#Description">Description</a>, 15659603SdfrUp: <a rel="up" accesskey="u" href="#Top">Top</a> 15725537Sdfr<br> 15891040Sarr</div> 15925537Sdfr 16091040Sarr<!-- node-name, next, previous, up --> 161159845Sjhb<h3 class="section">Running the Program</h3> 16291040Sarr 16391040Sarr<p>To test and gain experience with Autokey concepts, log in as root and 16425537Sdfrchange to the keys directory, usually <code>/usr/local/etc</code>. 16525537SdfrWhen run for the 166177253Srwatsonfirst time, or if all files with names beginning <code>ntpkey</code>] have been 16725537Sdfrremoved, use the <code>ntp-keygen</code> command without arguments to generate a 16898452Sarrdefault RSA host key and matching RSA-MD5 certificate with expiration 16998452Sarrdate one year hence. 17098452SarrIf run again without options, the program uses the 17198452Sarrexisting keys and parameters and generates only a new certificate with 17298452Sarrnew expiration date one year hence. 17398452Sarr 17498452Sarr <p>Run the command on as many hosts as necessary. 175177253SrwatsonDesignate one of them as the trusted host (TH) using <code>ntp-keygen</code> 17698452Sarrwith the <code>-T</code> option and configure 17725537Sdfrit to synchronize from reliable Internet servers. 17859603SdfrThen configure the other hosts to synchronize to the TH directly or indirectly. 17925537SdfrA certificate trail is created when Autokey asks the immediately 18091040Sarrascendant host towards the TH to sign its certificate, which is then 18198452Sarrprovided to the immediately descendant host on request. 182144443SjhbAll group hosts should have acyclic certificate trails ending on the TH. 183144443Sjhb 184144443Sjhb <p>The host key is used to encrypt the cookie when required and so must be 18598452SarrRSA type. 18698452SarrBy default, the host key is also the sign key used to encrypt signatures. 18798452SarrA different sign key can be assigned using the <code>-S</code> option 18891040Sarrand this can be either RSA or DSA type. 189144443SjhbBy default, the signature 19091040Sarrmessage digest type is MD5, but any combination of sign key type and 19191040Sarrmessage digest type supported by the OpenSSL library can be specified 19225537Sdfrusing the <code>-c</code> option. 19325537Sdfr 19425537Sdfr <p>The rules say cryptographic media should be generated with proventic 19525537Sdfrfilestamps, which means the host should already be synchronized before 19625537Sdfrthis program is run. 19791040SarrThis of course creates a chicken-and-egg problem 19825537Sdfrwhen the host is started for the first time. 19991040SarrAccordingly, the host time 20091040Sarrshould be set by some other means, such as eyeball-and-wristwatch, at 20125537Sdfrleast so that the certificate lifetime is within the current year. 20291040SarrAfter that and when the host is synchronized to a proventic source, the 20391040Sarrcertificate should be re-generated. 20491040Sarr 20591040Sarr <p>Additional information on trusted groups and identity schemes is on the 20691040SarrAutokey Public-Key Authentication page. 207159840Sjhb 20891040Sarr<div class="node"> 20991040Sarr<p><hr> 21091040Sarr<a name="ntp_002dkeygen-Invocation"></a> 21191040Sarr<br> 21291040Sarr</div> 21391040Sarr 21491040Sarr<h3 class="section">Invoking ntp-keygen</h3> 21591040Sarr 21691040Sarr<p><a name="index-ntp_002dkeygen-1"></a><a name="index-Create-a-NTP-host-key-2"></a> 21791040Sarr 21891040Sarr <p>This program generates cryptographic data files used by the NTPv4 21991040Sarrauthentication and identification schemes. 22091040SarrIt generates MD5 key files used in symmetric key cryptography. 22125537SdfrIn addition, if the OpenSSL software library has been installed, 22225537Sdfrit generates keys, certificate and identity files used in public key 22391040Sarrcryptography. 22491040SarrThese files are used for cookie encryption, 22591040Sarrdigital signature and challenge/response identification algorithms 22691040Sarrcompatible with the Internet standard security infrastructure. 227160142Sjhb 22891040Sarr <p>All files are in PEM-encoded printable ASCII format, 22991040Sarrso they can be embedded as MIME attachments in mail to other sites 23091040Sarrand certificate authorities. 23125537SdfrBy default, files are not encrypted. 23291040Sarr 23391040Sarr <p>When used to generate message digest keys, the program produces a file 23491040Sarrcontaining ten pseudo-random printable ASCII strings suitable for the 235160142SjhbMD5 message digest algorithm included in the distribution. 23625537SdfrIf the OpenSSL library is installed, it produces an additional ten 23725537Sdfrhex-encoded random bit strings suitable for the SHA1 and other message 23841055Speterdigest algorithms. 23941055SpeterThe message digest keys file must be distributed and stored 24041055Speterusing secure means beyond the scope of NTP itself. 24191040SarrBesides the keys used for ordinary NTP associations, additional keys 24241055Spetercan be defined as passwords for the 24391040Sarr<code>ntpq(1ntpqmdoc)</code> 24491040Sarrand 24541055Speter<code>ntpdc(1ntpdcmdoc)</code> 24691068Sarrutility programs. 24791040Sarr 24891040Sarr <p>The remaining generated files are compatible with other OpenSSL 24941055Speterapplications and other Public Key Infrastructure (PKI) resources. 25091040SarrCertificates generated by this program are compatible with extant 25191040Sarrindustry practice, although some users might find the interpretation of 25291040SarrX509v3 extension fields somewhat liberal. 253159840SjhbHowever, the identity keys are probably not compatible with anything 25491040Sarrother than Autokey. 25591040Sarr 25691040Sarr <p>Some files used by this program are encrypted using a private password. 25791040SarrThe 25891040Sarr<code>-p</code> 25991040Sarroption specifies the password for local encrypted files and the 26091040Sarr<code>-q</code> 26191040Sarroption the password for encrypted files sent to remote sites. 26291040SarrIf no password is specified, the host name returned by the Unix 26391040Sarr<code>gethostname()</code> 26491040Sarrfunction, normally the DNS name of the host is used. 26591040Sarr 26691040Sarr <p>The 26741055Speter<kbd>pw</kbd> 26841055Speteroption of the 26991040Sarr<kbd>crypto</kbd> 27091040Sarrconfiguration command specifies the read 27191040Sarrpassword for previously encrypted local files. 27291040SarrThis must match the local password used by this program. 273160142SjhbIf not specified, the host name is used. 27491040SarrThus, if files are generated by this program without password, 27591040Sarrthey can be read back by 27691040Sarr<kbd>ntpd</kbd> 27741055Speterwithout password but only on the same host. 27891040Sarr 27991040Sarr <p>Normally, encrypted files for each host are generated by that host and 28091040Sarrused only by that host, although exceptions exist as noted later on 281160142Sjhbthis page. 28241055SpeterThe symmetric keys file, normally called 28341055Speter<kbd>ntp.keys</kbd>, 28444078Sdfris usually installed in 28544078Sdfr<span class="file">/etc</span>. 28644078SdfrOther files and links are usually installed in 28791040Sarr<span class="file">/usr/local/etc</span>, 28844078Sdfrwhich is normally in a shared filesystem in 28991040SarrNFS-mounted networks and cannot be changed by shared clients. 29091040SarrThe location of the keys directory can be changed by the 29191040Sarr<kbd>keysdir</kbd> 29244078Sdfrconfiguration command in such cases. 29391040SarrNormally, this is in 29491040Sarr<span class="file">/etc</span>. 29544078Sdfr 296188232Sjhb <p>This program directs commentary and error messages to the standard 29791040Sarrerror stream 29891040Sarr<kbd>stderr</kbd> 299188232Sjhband remote files to the standard output stream 30044078Sdfr<kbd>stdout</kbd> 30144078Sdfrwhere they can be piped to other applications or redirected to files. 30244078SdfrThe names used for generated files and links all begin with the 30344078Sdfrstring 30444078Sdfr<kbd>ntpkey</kbd> 30591040Sarrand include the file type, generating host and filestamp, 30644078Sdfras described in the 30791040SarrCryptographic Data Files 30891040Sarrsection below. 30944078Sdfr 31091040Sarr<h5 class="subsubsection">Running the Program</h5> 31191040Sarr 31244078Sdfr<p>To test and gain experience with Autokey concepts, log in as root and 313188232Sjhbchange to the keys directory, usually 31491040Sarr<span class="file">/usr/local/etc</span> 31591040SarrWhen run for the first time, or if all files with names beginning with 316188232Sjhb<kbd>ntpkey</kbd> 31744078Sdfrhave been removed, use the 31844078Sdfr<code>ntp-keygen</code> 31959751Spetercommand without arguments to generate a 32059751Speterdefault RSA host key and matching RSA-MD5 certificate with expiration 32159751Speterdate one year hence. 32291040SarrIf run again without options, the program uses the 32391040Sarrexisting keys and parameters and generates only a new certificate with 324146733Spjdnew expiration date one year hence. 32559751Speter 32691040Sarr <p>Run the command on as many hosts as necessary. 32791040SarrDesignate one of them as the trusted host (TH) using 32859751Speter<code>ntp-keygen</code> 32991068Sarrwith the 330159841Sjhb<code>-T</code> 33191040Sarroption and configure it to synchronize from reliable Internet servers. 33291040SarrThen configure the other hosts to synchronize to the TH directly or 33391040Sarrindirectly. 33491040SarrA certificate trail is created when Autokey asks the immediately 33591040Sarrascendant host towards the TH to sign its certificate, which is then 33691040Sarrprovided to the immediately descendant host on request. 33791040SarrAll group hosts should have acyclic certificate trails ending on the TH. 33891040Sarr 33991040Sarr <p>The host key is used to encrypt the cookie when required and so must be 34091040SarrRSA type. 34178161SpeterBy default, the host key is also the sign key used to encrypt 342146733Spjdsignatures. 34391040SarrA different sign key can be assigned using the 34491040Sarr<code>-S</code> 34591040Sarroption and this can be either RSA or DSA type. 34691040SarrBy default, the signature 34791040Sarrmessage digest type is MD5, but any combination of sign key type and 34891040Sarrmessage digest type supported by the OpenSSL library can be specified 34991040Sarrusing the 350146730Spjd<code>-c</code> 35191068Sarroption. 35291040SarrThe rules say cryptographic media should be generated with proventic 353146733Spjdfilestamps, which means the host should already be synchronized before 354146733Spjdthis program is run. 355146730SpjdThis of course creates a chicken-and-egg problem 35659751Speterwhen the host is started for the first time. 357146733SpjdAccordingly, the host time 35859751Spetershould be set by some other means, such as eyeball-and-wristwatch, at 35959751Speterleast so that the certificate lifetime is within the current year. 36059751SpeterAfter that and when the host is synchronized to a proventic source, the 36159751Spetercertificate should be re-generated. 36259751Speter 36391040Sarr <p>Additional information on trusted groups and identity schemes is on the 36491040SarrAutokey Public-Key Authentication 36559751Speterpage. 36659751Speter 367177253Srwatson <p>The 368177253Srwatson<code>ntpd(1ntpdmdoc)</code> 36959751Speterconfiguration command 370101241Smux<code>crypto</code> <code>pw</code> <kbd>password</kbd> 37191040Sarrspecifies the read password for previously encrypted files. 37225537SdfrThe daemon expires on the spot if the password is missing 37391040Sarror incorrect. 37491040SarrFor convenience, if a file has been previously encrypted, 375159585Sjhbthe default read password is the name of the host running 37625537Sdfrthe program. 37791040SarrIf the previous write password is specified as the host name, 37891040Sarrthese files can be read by that host with no explicit password. 37991040Sarr 38062261Sarchie <p>File names begin with the prefix 381159845Sjhb<code>ntpkey_</code> 38291040Sarrand end with the postfix 38391040Sarr<kbd>_hostname.filestamp</kbd>, 38491040Sarrwhere 38591040Sarr<kbd>hostname</kbd> 38691040Sarris the owner name, usually the string returned 38791040Sarrby the Unix gethostname() routine, and 388159585Sjhb<kbd>filestamp</kbd> 38991040Sarris the NTP seconds when the file was generated, in decimal digits. 39091040SarrThis both guarantees uniqueness and simplifies maintenance 391159585Sjhbprocedures, since all files can be quickly removed 39298452Sarrby a 39398452Sarr<code>rm</code> <code>ntpkey*</code> 39498452Sarrcommand or all files generated 39598452Sarrat a specific time can be removed by a 39698452Sarr<code>rm</code> 39798452Sarr<kbd>*filestamp</kbd> 39891040Sarrcommand. 39991040SarrTo further reduce the risk of misconfiguration, 40091040Sarrthe first two lines of a file contain the file name 40191040Sarrand generation date and time as comments. 40291040Sarr 40391040Sarr <p>All files are installed by default in the keys directory 40491040Sarr<span class="file">/usr/local/etc</span>, 40591040Sarrwhich is normally in a shared filesystem 40691040Sarrin NFS-mounted networks. 40791040SarrThe actual location of the keys directory 40891040Sarrand each file can be overridden by configuration commands, 409146730Spjdbut this is not recommended. 410146730SpjdNormally, the files for each host are generated by that host 411146730Spjdand used only by that host, although exceptions exist 412159585Sjhbas noted later on this page. 413146730Spjd 414166921Sjhb <p>Normally, files containing private values, 41591040Sarrincluding the host key, sign key and identification parameters, 41691040Sarrare permitted root read/write-only; 417166921Sjhbwhile others containing public values are permitted world readable. 41891040SarrAlternatively, files containing private values can be encrypted 41991040Sarrand these files permitted world readable, 420159585Sjhbwhich simplifies maintenance in shared file systems. 42191040SarrSince uniqueness is insured by the hostname and 42291040Sarrfile name extensions, the files for a NFS server and 42342755Speterdependent clients can all be installed in the same shared directory. 42491040Sarr 42591040Sarr <p>The recommended practice is to keep the file name extensions 42642755Speterwhen installing a file and to install a soft link 427105337Ssamfrom the generic names specified elsewhere on this page 428105337Ssamto the generated files. 429105337SsamThis allows new file generations to be activated simply 430105337Ssamby changing the link. 431105337SsamIf a link is present, ntpd follows it to the file name 432105337Ssamto extract the filestamp. 433105337SsamIf a link is not present, 434105337Ssam<code>ntpd(1ntpdmdoc)</code> 435105337Ssamextracts the filestamp from the file itself. 436105337SsamThis allows clients to verify that the file and generation times 437105337Ssamare always current. 438105337SsamThe 43991068Sarr<code>ntp-keygen</code> 44091040Sarrprogram uses the same timestamp extension for all files generated 44125537Sdfrat one time, so each generation is distinct and can be readily 44225537Sdfrrecognized in monitoring data. 44378413Sbrian 44494321Sbrian<h5 class="subsubsection">Running the program</h5> 44594321Sbrian 44678413Sbrian<p>The safest way to run the 44794321Sbrian<code>ntp-keygen</code> 448159804Sjhbprogram is logged in directly as root. 44994321SbrianThe recommended procedure is change to the keys directory, 450159845Sjhbusually 45194321Sbrian<span class="file">/usr/local/etc</span>, 45294321Sbrianthen run the program. 45394321SbrianWhen run for the first time, 454159845Sjhbor if all 45594321Sbrian<code>ntpkey</code> 45694321Sbrianfiles have been removed, 45794321Sbrianthe program generates a RSA host key file and matching RSA-MD5 certificate file, 458159804Sjhbwhich is all that is necessary in many cases. 459159845SjhbThe program also generates soft links from the generic names 460159804Sjhbto the respective files. 46178413SbrianIf run again, the program uses the same host key file, 46278413Sbrianbut generates a new certificate file and link. 463159804Sjhb 464159804Sjhb <p>The host key is used to encrypt the cookie when required and so must be RSA type. 465159804SjhbBy default, the host key is also the sign key used to encrypt signatures. 466159804SjhbWhen necessary, a different sign key can be specified and this can be 467159804Sjhbeither RSA or DSA type. 468159804SjhbBy default, the message digest type is MD5, but any combination 469159804Sjhbof sign key type and message digest type supported by the OpenSSL library 470159845Sjhbcan be specified, including those using the MD2, MD5, SHA, SHA1, MDC2 471159804Sjhband RIPE160 message digest algorithms. 472159804SjhbHowever, the scheme specified in the certificate must be compatible 473159804Sjhbwith the sign key. 474159804SjhbCertificates using any digest algorithm are compatible with RSA sign keys; 475159804Sjhbhowever, only SHA and SHA1 certificates are compatible with DSA sign keys. 476159845Sjhb 477159804Sjhb <p>Private/public key files and certificates are compatible with 478159804Sjhbother OpenSSL applications and very likely other libraries as well. 479159804SjhbCertificates or certificate requests derived from them should be compatible 480159804Sjhbwith extant industry practice, although some users might find 481159804Sjhbthe interpretation of X509v3 extension fields somewhat liberal. 482159804SjhbHowever, the identification parameter files, although encoded 483159804Sjhbas the other files, are probably not compatible with anything other than Autokey. 484159845Sjhb 485159804Sjhb <p>Running the program as other than root and using the Unix 486159804Sjhb<code>su</code> 487159804Sjhbcommand 488159800Sjhbto assume root may not work properly, since by default the OpenSSL library 48991040Sarrlooks for the random seed file 49025537Sdfr<code>.rnd</code> 491159585Sjhbin the user home directory. 49291040SarrHowever, there should be only one 49325537Sdfr<code>.rnd</code>, 494111119Simpmost conveniently 49591040Sarrin the root directory, so it is convenient to define the 49640861Speter<code>$RANDFILE</code> 497159845Sjhbenvironment variable used by the OpenSSL library as the path to 49891040Sarr<code>/.rnd</code>. 49992032Sdwmalone 50091040Sarr <p>Installing the keys as root might not work in NFS-mounted 50192032Sdwmaloneshared file systems, as NFS clients may not be able to write 50291040Sarrto the shared keys directory, even as root. 50391040SarrIn this case, NFS clients can specify the files in another 504159585Sjhbdirectory such as 50591040Sarr<span class="file">/etc</span> 50625537Sdfrusing the 50725537Sdfr<code>keysdir</code> 508159800Sjhbcommand. 50925537SdfrThere is no need for one client to read the keys and certificates 51025537Sdfrof other clients or servers, as these data are obtained automatically 511159585Sjhbby the Autokey protocol. 512159845Sjhb 513159845Sjhb <p>Ordinarily, cryptographic files are generated by the host that uses them, 51491040Sarrbut it is possible for a trusted agent (TA) to generate these files 515166921Sjhbfor other hosts; however, in such cases files should always be encrypted. 51691040SarrThe subject name and trusted name default to the hostname 51791040Sarrof the host generating the files, but can be changed by command line options. 51825537SdfrIt is convenient to designate the owner name and trusted name 51925537Sdfras the subject and issuer fields, respectively, of the certificate. 520159797SjhbThe owner name is also used for the host and sign key files, 521159797Sjhbwhile the trusted name is used for the identity files. 522159797Sjhb 523159797Sjhb <p>All files are installed by default in the keys directory 524159797Sjhb<span class="file">/usr/local/etc</span>, 525159797Sjhbwhich is normally in a shared filesystem 526159845Sjhbin NFS-mounted networks. 527159797SjhbThe actual location of the keys directory 528159797Sjhband each file can be overridden by configuration commands, 529159797Sjhbbut this is not recommended. 530159797SjhbNormally, the files for each host are generated by that host 531159797Sjhband used only by that host, although exceptions exist 532159845Sjhbas noted later on this page. 533159797Sjhb 534159797Sjhb <p>Normally, files containing private values, 535159797Sjhbincluding the host key, sign key and identification parameters, 53625537Sdfrare permitted root read/write-only; 53791040Sarrwhile others containing public values are permitted world readable. 53825537SdfrAlternatively, files containing private values can be encrypted 53991040Sarrand these files permitted world readable, 54091040Sarrwhich simplifies maintenance in shared file systems. 54125537SdfrSince uniqueness is insured by the hostname and 542159845Sjhbfile name extensions, the files for a NFS server and 54391040Sarrdependent clients can all be installed in the same shared directory. 54440159Speter 545172862Sjb <p>The recommended practice is to keep the file name extensions 546111119Simpwhen installing a file and to install a soft link 54791040Sarrfrom the generic names specified elsewhere on this page 548159585Sjhbto the generated files. 54991040SarrThis allows new file generations to be activated simply 55091040Sarrby changing the link. 55191040SarrIf a link is present, ntpd follows it to the file name 55291040Sarrto extract the filestamp. 553172862SjbIf a link is not present, 55491040Sarr<code>ntpd(1ntpdmdoc)</code> 55591040Sarrextracts the filestamp from the file itself. 55691040SarrThis allows clients to verify that the file and generation times 557172862Sjbare always current. 558172862SjbThe 559172862Sjb<code>ntp-keygen</code> 56091040Sarrprogram uses the same timestamp extension for all files generated 56191040Sarrat one time, so each generation is distinct and can be readily 56291040Sarrrecognized in monitoring data. 56391040Sarr 56425537Sdfr<h5 class="subsubsection">Running the program</h5> 56525537Sdfr 56625537Sdfr<p>The safest way to run the 567132117Sphk<code>ntp-keygen</code> 56825537Sdfrprogram is logged in directly as root. 56991040SarrThe recommended procedure is change to the keys directory, 57091040Sarrusually 57191040Sarr<span class="file">/usr/local/etc</span>, 57291040Sarrthen run the program. 57325537SdfrWhen run for the first time, 57491040Sarror if all 57591040Sarr<code>ntpkey</code> 57691040Sarrfiles have been removed, 57725537Sdfrthe program generates a RSA host key file and matching RSA-MD5 certificate file, 578159845Sjhbwhich is all that is necessary in many cases. 57991040SarrThe program also generates soft links from the generic names 58091040Sarrto the respective files. 581159584SjhbIf run again, the program uses the same host key file, 582159584Sjhbbut generates a new certificate file and link. 583159584Sjhb 584159584Sjhb <p>The host key is used to encrypt the cookie when required and so must be RSA type. 585159584SjhbBy default, the host key is also the sign key used to encrypt signatures. 586159584SjhbWhen necessary, a different sign key can be specified and this can be 587159584Sjhbeither RSA or DSA type. 588159584SjhbBy default, the message digest type is MD5, but any combination 589159584Sjhbof sign key type and message digest type supported by the OpenSSL library 590159584Sjhbcan be specified, including those using the MD2, MD5, SHA, SHA1, MDC2 591185635Sjhband RIPE160 message digest algorithms. 592159584SjhbHowever, the scheme specified in the certificate must be compatible 593185635Sjhbwith the sign key. 594185635SjhbCertificates using any digest algorithm are compatible with RSA sign keys; 595185635Sjhbhowever, only SHA and SHA1 certificates are compatible with DSA sign keys. 596185635Sjhb 597185635Sjhb <p>Private/public key files and certificates are compatible with 598185635Sjhbother OpenSSL applications and very likely other libraries as well. 599185635SjhbCertificates or certificate requests derived from them should be compatible 600185635Sjhbwith extant industry practice, although some users might find 601185635Sjhbthe interpretation of X509v3 extension fields somewhat liberal. 602185635SjhbHowever, the identification parameter files, although encoded 603185635Sjhbas the other files, are probably not compatible with anything other than Autokey. 604185635Sjhb 605185635Sjhb <p>Running the program as other than root and using the Unix 606185635Sjhb<code>su</code> 607185635Sjhbcommand 608185635Sjhbto assume root may not work properly, since by default the OpenSSL library 609185635Sjhblooks for the random seed file 610185635Sjhb<code>.rnd</code> 611185635Sjhbin the user home directory. 612185635SjhbHowever, there should be only one 613185635Sjhb<code>.rnd</code>, 614185635Sjhbmost conveniently 615185635Sjhbin the root directory, so it is convenient to define the 616159584Sjhb<code>$RANDFILE</code> 617159584Sjhbenvironment variable used by the OpenSSL library as the path to 618159584Sjhb<code>/.rnd</code>. 619159584Sjhb 620159584Sjhb <p>Installing the keys as root might not work in NFS-mounted 62191040Sarrshared file systems, as NFS clients may not be able to write 622159584Sjhbto the shared keys directory, even as root. 62391040SarrIn this case, NFS clients can specify the files in another 624185635Sjhbdirectory such as 625185635Sjhb<span class="file">/etc</span> 626185635Sjhbusing the 627159584Sjhb<code>keysdir</code> 628159584Sjhbcommand. 62992547SarrThere is no need for one client to read the keys and certificates 630159584Sjhbof other clients or servers, as these data are obtained automatically 631159584Sjhbby the Autokey protocol. 632159584Sjhb 63391040Sarr <p>Ordinarily, cryptographic files are generated by the host that uses them, 634159586Sjhbbut it is possible for a trusted agent (TA) to generate these files 635128057Speadarfor other hosts; however, in such cases files should always be encrypted. 63691040SarrThe subject name and trusted name default to the hostname 637128057Speadarof the host generating the files, but can be changed by command line options. 638128057SpeadarIt is convenient to designate the owner name and trusted name 63991040Sarras the subject and issuer fields, respectively, of the certificate. 64025537SdfrThe owner name is also used for the host and sign key files, 641159840Sjhbwhile the trusted name is used for the identity files. 642159840Sjhbseconds. 64391040Sarrseconds. 64491040Sarr 64591040Sarr <p>s Trusted Hosts and Groups 646188209SjhbEach cryptographic configuration involves selection of a signature scheme 647188209Sjhband identification scheme, called a cryptotype, 64891040Sarras explained in the 64991040Sarr<a href="#Authentication-Options">Authentication Options</a> 650188209Sjhbsection of 65125537Sdfr<code>ntp.conf(5)</code>. 65291040SarrThe default cryptotype uses RSA encryption, MD5 message digest 65325537Sdfrand TC identification. 65491040SarrFirst, configure a NTP subnet including one or more low-stratum 65591040Sarrtrusted hosts from which all other hosts derive synchronization 656132117Sphkdirectly or indirectly. 65791040SarrTrusted hosts have trusted certificates; 65891040Sarrall other hosts have nontrusted certificates. 65959751SpeterThese hosts will automatically and dynamically build authoritative 660160245Sjhbcertificate trails to one or more trusted hosts. 661160245SjhbA trusted group is the set of all hosts that have, directly or indirectly, 66291040Sarra certificate trail ending at a trusted host. 66391040SarrThe trail is defined by static configuration file entries 66459751Speteror dynamic means described on the 66591040Sarr<a href="#Automatic-NTP-Configuration-Options">Automatic NTP Configuration Options</a> 66691040Sarrsection of 66791040Sarr<code>ntp.conf(5)</code>. 66891040Sarr 66991040Sarr <p>On each trusted host as root, change to the keys directory. 670172862SjbTo insure a fresh fileset, remove all 671172862Sjb<code>ntpkey</code> 672172862Sjbfiles. 673172862SjbThen run 67491040Sarr<code>ntp-keygen</code> 675159584Sjhb<code>-T</code> 67625537Sdfrto generate keys and a trusted certificate. 67725537SdfrOn all other hosts do the same, but leave off the 678179238Sjb<code>-T</code> 679179238Sjbflag to generate keys and nontrusted certificates. 680179238SjbWhen complete, start the NTP daemons beginning at the lowest stratum 681179238Sjband working up the tree. 682179238SjbIt may take some time for Autokey to instantiate the certificate trails 683179238Sjbthroughout the subnet, but setting up the environment is completely automatic. 684159796Sjhb 68586469Siedowse <p>If it is necessary to use a different sign key or different digest/signature 68625537Sdfrscheme than the default, run 68791040Sarr<code>ntp-keygen</code> 68825537Sdfrwith the 689159845Sjhb<code>-S</code> <kbd>type</kbd> 69091040Sarroption, where 691111119Simp<kbd>type</kbd> 69291040Sarris either 69391040Sarr<code>RSA</code> 69425537Sdfror 69591040Sarr<code>DSA</code>. 69691040SarrThe most often need to do this is when a DSA-signed certificate is used. 69791040SarrIf it is necessary to use a different certificate scheme than the default, 69891040Sarrrun 69991040Sarr<code>ntp-keygen</code> 70091040Sarrwith the 70191040Sarr<code>-c</code> <kbd>scheme</kbd> 70291040Sarroption and selected 70391040Sarr<kbd>scheme</kbd> 70425537Sdfras needed. 70525537Sdfrf 70678161Speter<code>ntp-keygen</code> 70791040Sarris run again without these options, it generates a new certificate 708159841Sjhbusing the same scheme and sign key. 709159841Sjhb 710159841Sjhb <p>After setting up the environment it is advisable to update certificates 71178161Speterfrom time to time, if only to extend the validity interval. 71278161SpeterSimply run 71378161Speter<code>ntp-keygen</code> 71491040Sarrwith the same flags as before to generate new certificates 71578161Speterusing existing keys. 716159845SjhbHowever, if the host or sign key is changed, 71778161Speter<code>ntpd(1ntpdmdoc)</code> 718159845Sjhbshould be restarted. 719159845SjhbWhen 720159845Sjhb<code>ntpd(1ntpdmdoc)</code> 721159845Sjhbis restarted, it loads any new files and restarts the protocol. 722159845SjhbOther dependent hosts will continue as usual until signatures are refreshed, 723159845Sjhbat which time the protocol is restarted. 724159845Sjhb 72578161Speter<h5 class="subsubsection">Identity Schemes</h5> 72678161Speter 727173714Sjb<p>As mentioned on the Autonomous Authentication page, 728173714Sjbthe default TC identity scheme is vulnerable to a middleman attack. 729173714SjbHowever, there are more secure identity schemes available, 730173714Sjbincluding PC, IFF, GQ and MV described on the 731173714Sjb"Identification Schemes" 732179238Sjbpage 733173714Sjb(maybe available at 734173714Sjb<code>http://www.eecis.udel.edu/%7emills/keygen.html</code>). 735173714SjbThese schemes are based on a TA, one or more trusted hosts 736173714Sjband some number of nontrusted hosts. 73725537SdfrTrusted hosts prove identity using values provided by the TA, 73891040Sarrwhile the remaining hosts prove identity using values provided 73925537Sdfrby a trusted host and certificate trails that end on that host. 740159845SjhbThe name of a trusted host is also the name of its sugroup 741159845Sjhband also the subject and issuer name on its trusted certificate. 742159845SjhbThe TA is not necessarily a trusted host in this sense, but often is. 743159845Sjhb 744159845Sjhb <p>In some schemes there are separate keys for servers and clients. 745159845SjhbA server can also be a client of another server, 746159845Sjhbbut a client can never be a server for another client. 747159845SjhbIn general, trusted hosts and nontrusted hosts that operate 748159845Sjhbas both server and client have parameter files that contain 749159845Sjhbboth server and client keys. 750159845SjhbHosts that operate 751159845Sjhbonly as clients have key files that contain only client keys. 752159845Sjhb 753159845Sjhb <p>The PC scheme supports only one trusted host in the group. 754159845SjhbOn trusted host alice run 755159845Sjhb<code>ntp-keygen</code> 75691040Sarr<code>-P</code> 75791040Sarr<code>-p</code> <kbd>password</kbd> 75891040Sarrto generate the host key file 75991040Sarr<span class="file">ntpkey_RSAkey_</span><kbd>alice.filestamp</kbd> 76092032Sdwmaloneand trusted private certificate file 76125537Sdfr<span class="file">ntpkey_RSA-MD5_cert_</span><kbd>alice.filestamp</kbd>. 762159845SjhbCopy both files to all group hosts; 763109605Sjakethey replace the files which would be generated in other schemes. 76491040SarrOn each host bob install a soft link from the generic name 76525537Sdfr<span class="file">ntpkey_host_</span><kbd>bob</kbd> 76691040Sarrto the host key file and soft link 76791040Sarr<span class="file">ntpkey_cert_</span><kbd>bob</kbd> 76891040Sarrto the private certificate file. 76991040SarrNote the generic links are on bob, but point to files generated 77091040Sarrby trusted host alice. 77191040SarrIn this scheme it is not possible to refresh 77291040Sarreither the keys or certificates without copying them 77391040Sarrto all other hosts in the group. 77491040Sarr 77591040Sarr <p>For the IFF scheme proceed as in the TC scheme to generate keys 77691040Sarrand certificates for all group hosts, then for every trusted host in the group, 777109605Sjakegenerate the IFF parameter file. 77891040SarrOn trusted host alice run 77991040Sarr<code>ntp-keygen</code> 78040159Speter<code>-T</code> 78191040Sarr<code>-I</code> 78291040Sarr<code>-p</code> <kbd>password</kbd> 783159845Sjhbto produce her parameter file 784159845Sjhb<span class="file">ntpkey_IFFpar_</span><kbd>alice.filestamp</kbd>, 78591040Sarrwhich includes both server and client keys. 78691040SarrCopy this file to all group hosts that operate as both servers 787109605Sjakeand clients and install a soft link from the generic 78891040Sarr<span class="file">ntpkey_iff_</span><kbd>alice</kbd> 78991040Sarrto this file. 79091040SarrIf there are no hosts restricted to operate only as clients, 79125537Sdfrthere is nothing further to do. 79291040SarrAs the IFF scheme is independent 79391040Sarrof keys and certificates, these files can be refreshed as needed. 79491040Sarr 79591040Sarr <p>If a rogue client has the parameter file, it could masquerade 79691040Sarras a legitimate server and present a middleman threat. 79791040SarrTo eliminate this threat, the client keys can be extracted 79891040Sarrfrom the parameter file and distributed to all restricted clients. 79942849SpeterAfter generating the parameter file, on alice run 80091040Sarr<code>ntp-keygen</code> 80192032Sdwmalone<code>-e</code> 80291040Sarrand pipe the output to a file or mail program. 803109605SjakeCopy or mail this file to all restricted clients. 80491040SarrOn these clients install a soft link from the generic 80591040Sarr<span class="file">ntpkey_iff_</span><kbd>alice</kbd> 80691040Sarrto this file. 80791040SarrTo further protect the integrity of the keys, 80891040Sarreach file can be encrypted with a secret password. 80991040Sarr 81091040Sarr <p>For the GQ scheme proceed as in the TC scheme to generate keys 81191040Sarrand certificates for all group hosts, then for every trusted host 81291040Sarrin the group, generate the IFF parameter file. 813111119SimpOn trusted host alice run 81491040Sarr<code>ntp-keygen</code> 81591040Sarr<code>-T</code> 81691040Sarr<code>-G</code> 81791040Sarr<code>-p</code> <kbd>password</kbd> 81891040Sarrto produce her parameter file 81925537Sdfr<span class="file">ntpkey_GQpar_</span><kbd>alice.filestamp</kbd>, 82091040Sarrwhich includes both server and client keys. 821109605SjakeCopy this file to all group hosts and install a soft link 82291040Sarrfrom the generic 82340159Speter<span class="file">ntpkey_gq_</span><kbd>alice</kbd> 82491040Sarrto this file. 82591040SarrIn addition, on each host bob install a soft link 82625537Sdfrfrom generic 82725537Sdfr<span class="file">ntpkey_gq_</span><kbd>bob</kbd> 82825537Sdfrto this file. 829174132SrwatsonAs the GQ scheme updates the GQ parameters file and certificate 830174132Srwatsonat the same time, keys and certificates can be regenerated as needed. 831174132Srwatson 832174132Srwatson <p>For the MV scheme, proceed as in the TC scheme to generate keys 833174132Srwatsonand certificates for all group hosts. 834159840SjhbFor illustration assume trish is the TA, alice one of several trusted hosts 835174132Srwatsonand bob one of her clients. 83640159SpeterOn TA trish run 837174132Srwatson<code>ntp-keygen</code> 838174132Srwatson<code>-V</code> <kbd>n</kbd> 839174132Srwatson<code>-p</code> <kbd>password</kbd>, 84040159Speterwhere 84191040Sarr<kbd>n</kbd> 84240159Speteris the number of revokable keys (typically 5) to produce 84391040Sarrthe parameter file 84491040Sarr<span class="file">ntpkeys_MVpar_</span><kbd>trish.filestamp</kbd> 84591040Sarrand client key files 84691040Sarr<span class="file">ntpkeys_MVkeyd_</span><kbd>trish.filestamp</kbd> 84791040Sarrwhere 84840159Speter<kbd>d</kbd> 849174132Srwatsonis the key number (0 < 85040159Speter<kbd>d</kbd> 851174132Srwatson< 852174132Srwatson<kbd>n</kbd>). 85340159SpeterCopy the parameter file to alice and install a soft link 85491040Sarrfrom the generic 85591040Sarr<span class="file">ntpkey_mv_</span><kbd>alice</kbd> 85691040Sarrto this file. 85740159SpeterCopy one of the client key files to alice for later distribution 85891040Sarrto her clients. 85991040SarrIt doesn't matter which client key file goes to alice, 86091040Sarrsince they all work the same way. 86191040SarrAlice copies the client key file to all of her cliens. 86291040SarrOn client bob install a soft link from generic 86391040Sarr<span class="file">ntpkey_mvkey_</span><kbd>bob</kbd> 86491040Sarrto the client key file. 86591040SarrAs the MV scheme is independent of keys and certificates, 86691040Sarrthese files can be refreshed as needed. 86791040Sarr 86891040Sarr<h5 class="subsubsection">Command Line Options</h5> 86991040Sarr 87040159Speter <dl> 87191040Sarr<dt><code>-c</code> <kbd>scheme</kbd><dd>Select certificate message digest/signature encryption scheme. 87291040SarrThe 87391040Sarr<kbd>scheme</kbd> 87491040Sarrcan be one of the following: 87591040Sarr. Cm RSA-MD2 , RSA-MD5 , RSA-SHA , RSA-SHA1 , RSA-MDC2 , RSA-RIPEMD160 , DSA-SHA , 87691040Sarror 87791040Sarr<code>DSA-SHA1</code>. 87891040SarrNote that RSA schemes must be used with a RSA sign key and DSA 87991040Sarrschemes must be used with a DSA sign key. 88040159SpeterThe default without this option is 88140159Speter<code>RSA-MD5</code>. 882174132Srwatson<br><dt><code>-d</code><dd>Enable debugging. 883174132SrwatsonThis option displays the cryptographic data produced in eye-friendly billboards. 88440159Speter<br><dt><code>-e</code><dd>Write the IFF client keys to the standard output. 88591040SarrThis is intended for automatic key distribution by mail. 88640159Speter<br><dt><code>-G</code><dd>Generate parameters and keys for the GQ identification scheme, 88791040Sarrobsoleting any that may exist. 88891040Sarr<br><dt><code>-g</code><dd>Generate keys for the GQ identification scheme 88991040Sarrusing the existing GQ parameters. 89091040SarrIf the GQ parameters do not yet exist, create them first. 89191040Sarr<br><dt><code>-H</code><dd>Generate new host keys, obsoleting any that may exist. 89240159Speter<br><dt><code>-I</code><dd>Generate parameters for the IFF identification scheme, 893174132Srwatsonobsoleting any that may exist. 894174132Srwatson<br><dt><code>-i</code> <kbd>name</kbd><dd>Set the suject name to 895174132Srwatson<kbd>name</kbd>. 896174132SrwatsonThis is used as the subject field in certificates 897174132Srwatsonand in the file name for host and sign keys. 898174132Srwatson<br><dt><code>-M</code><dd>Generate MD5 keys, obsoleting any that may exist. 899174132Srwatson<br><dt><code>-P</code><dd>Generate a private certificate. 900174132SrwatsonBy default, the program generates public certificates. 901174132Srwatson<br><dt><code>-p</code> <kbd>password</kbd><dd>Encrypt generated files containing private data with 902174132Srwatson<kbd>password</kbd> 903174132Srwatsonand the DES-CBC algorithm. 904174132Srwatson<br><dt><code>-q</code><dd>Set the password for reading files to password. 905174132Srwatson<br><dt><code>-S</code> <code>[RSA | DSA]</code><dd>Generate a new sign key of the designated type, 906174132Srwatsonobsoleting any that may exist. 907174132SrwatsonBy default, the program uses the host key as the sign key. 908174132Srwatson<br><dt><code>-s</code> <kbd>name</kbd><dd>Set the issuer name to 909174132Srwatson<kbd>name</kbd>. 910174132SrwatsonThis is used for the issuer field in certificates 911174132Srwatsonand in the file name for identity files. 912174132Srwatson<br><dt><code>-T</code><dd>Generate a trusted certificate. 913174132SrwatsonBy default, the program generates a non-trusted certificate. 914174132Srwatson<br><dt><code>-V</code> <kbd>nkeys</kbd><dd>Generate parameters and keys for the Mu-Varadharajan (MV) identification scheme. 915174132Srwatson</dl> 916174132Srwatson 917174132Srwatson<h5 class="subsubsection">Random Seed File</h5> 918174132Srwatson 919174132Srwatson<p>All cryptographically sound key generation schemes must have means 920174132Srwatsonto randomize the entropy seed used to initialize 921174132Srwatsonthe internal pseudo-random number generator used 922174132Srwatsonby the library routines. 923174132SrwatsonThe OpenSSL library uses a designated random seed file for this purpose. 924174132SrwatsonThe file must be available when starting the NTP daemon and 925174132Srwatson<code>ntp-keygen</code> 926174132Srwatsonprogram. 927174132SrwatsonIf a site supports OpenSSL or its companion OpenSSH, 928174132Srwatsonit is very likely that means to do this are already available. 929174132Srwatson 930174132Srwatson <p>It is important to understand that entropy must be evolved 931174132Srwatsonfor each generation, for otherwise the random number sequence 932174132Srwatsonwould be predictable. 933174132SrwatsonVarious means dependent on external events, such as keystroke intervals, 934174132Srwatsoncan be used to do this and some systems have built-in entropy sources. 935174132SrwatsonSuitable means are described in the OpenSSL software documentation, 936174132Srwatsonbut are outside the scope of this page. 937174132Srwatson 938174132Srwatson <p>The entropy seed used by the OpenSSL library is contained in a file, 939174132Srwatsonusually called 940174132Srwatson<code>.rnd</code>, 941174132Srwatsonwhich must be available when starting the NTP daemon 942174132Srwatsonor the 943174132Srwatson<code>ntp-keygen</code> 944174132Srwatsonprogram. 945174132SrwatsonThe NTP daemon will first look for the file 946174132Srwatsonusing the path specified by the 947174132Srwatson<code>randfile</code> 948174132Srwatsonsubcommand of the 949174132Srwatson<code>crypto</code> 95040159Speterconfiguration command. 95140159SpeterIf not specified in this way, or when starting the 95240159Speter<code>ntp-keygen</code> 953174132Srwatsonprogram, 954174132Srwatsonthe OpenSSL library will look for the file using the path specified 955174132Srwatsonby the 956174132Srwatson.Ev RANDFILE 957174132Srwatsonenvironment variable in the user home directory, 958174132Srwatsonwhether root or some other user. 959174132SrwatsonIf the 960178380Spjd.Ev RANDFILE 961174132Srwatsonenvironment variable is not present, 962178380Spjdthe library will look for the 963174132Srwatson<code>.rnd</code> 964178380Spjdfile in the user home directory. 965174132SrwatsonIf the file is not available or cannot be written, 966174132Srwatsonthe daemon exits with a message to the system log and the program 967174132Srwatsonexits with a suitable error message. 968174132Srwatson 96925537Sdfr<h5 class="subsubsection">Cryptographic Data Files</h5> 97025537Sdfr 97125537Sdfr<p>All other file formats begin with two lines. 972159588SjhbThe first contains the file name, including the generated host name 97325537Sdfrand filestamp. 974157144SjkoshyThe second contains the datestamp in conventional Unix date format. 975157144SjkoshyLines beginning with # are considered comments and ignored by the 976157144Sjkoshy<code>ntp-keygen</code> 977159588Sjhbprogram and 97891040Sarr<code>ntpd(1ntpdmdoc)</code> 979159588Sjhbdaemon. 98025537SdfrCryptographic values are encoded first using ASN.1 rules, 98193159Sarrthen encrypted if necessary, and finally written PEM-encoded 982159588Sjhbprintable ASCII format preceded and followed by MIME content identifier lines. 98393159Sarr 984164033Srwatson <p>The format of the symmetric keys file is somewhat different 985159588Sjhbthan the other files in the interest of backward compatibility. 98625537SdfrSince DES-CBC is deprecated in NTPv4, the only key format of interest 98791040Sarris MD5 alphanumeric strings. 988159841SjhbFollowing hte heard the keys are 989159841Sjhbentered one per line in the format 99091040Sarr<pre class="example"> <kbd>keyno</kbd> <kbd>type</kbd> <kbd>key</kbd> 99191040Sarr</pre> 992159588Sjhb <p>where 993159588Sjhb<kbd>keyno</kbd> 99491040Sarris a positive integer in the range 1-65,535, 99591040Sarr<kbd>type</kbd> 99691040Sarris the string MD5 defining the key format and 997159588Sjhb<kbd>key</kbd> 99891040Sarris the key itself, 999159588Sjhbwhich is a printable ASCII string 16 characters or less in length. 1000159845SjhbEach character is chosen from the 93 printable characters 100191040Sarrin the range 0x21 through 0x7f excluding space and the 100291040Sarr# 1003159588Sjhbcharacter. 1004157144Sjkoshy 1005157144Sjkoshy <p>Note that the keys used by the 1006157144Sjkoshy<code>ntpq(1ntpqmdoc)</code> 1007157144Sjkoshyand 1008157144Sjkoshy<code>ntpdc(1ntpdcmdoc)</code> 100991040Sarrprograms 1010159588Sjhbare checked against passwords requested by the programs 1011159588Sjhband entered by hand, so it is generally appropriate to specify these keys 1012159588Sjhbin human readable ASCII format. 1013159845Sjhb 101491040Sarr <p>The 101525537Sdfr<code>ntp-keygen</code> 101625537Sdfrprogram generates a MD5 symmetric keys file 1017159588Sjhb<span class="file">ntpkey_MD5key_</span><kbd>hostname.filestamp</kbd>. 1018159588SjhbSince the file contains private shared keys, 1019159588Sjhbit should be visible only to root and distributed by secure means 1020159588Sjhbto other subnet hosts. 1021159596SmarcelThe NTP daemon loads the file 1022159588Sjhb<span class="file">ntp.keys</span>, 1023159588Sjhbso 1024159588Sjhb<code>ntp-keygen</code> 1025159588Sjhbinstalls a soft link from this name to the generated file. 1026159588SjhbSubsequently, similar soft links must be installed by manual 1027159596Smarcelor automated means on the other subnet hosts. 1028159596SmarcelWhile this file is not used with the Autokey Version 2 protocol, 1029159596Smarcelit is needed to authenticate some remote configuration commands 1030159596Smarcelused by the 1031159596Smarcel<code>ntpq(1ntpqmdoc)</code> 1032159588Sjhband 1033159588Sjhb<code>ntpdc(1ntpdcmdoc)</code> 1034159588Sjhbutilities. 1035159588Sjhb 1036159588Sjhb <p>This section was generated by <strong>AutoGen</strong>, 1037132117Sphkusing the <code>agtexi-cmd</code> template and the option descriptions for the <code>ntp-keygen</code> program. 103825537SdfrThis software is released under the NTP license, <http://ntp.org/license>. 1039157144Sjkoshy 1040157144Sjkoshy<ul class="menu"> 1041157144Sjkoshy<li><a accesskey="1" href="#ntp_002dkeygen-usage">ntp-keygen usage</a>: ntp-keygen help/usage (<span class="option">--help</span>) 104291040Sarr<li><a accesskey="2" href="#ntp_002dkeygen-imbits">ntp-keygen imbits</a>: imbits option (-b) 104391040Sarr<li><a accesskey="3" href="#ntp_002dkeygen-certificate">ntp-keygen certificate</a>: certificate option (-c) 104425537Sdfr<li><a accesskey="4" href="#ntp_002dkeygen-cipher">ntp-keygen cipher</a>: cipher option (-C) 104593159Sarr<li><a accesskey="5" href="#ntp_002dkeygen-id_002dkey">ntp-keygen id-key</a>: id-key option (-e) 1046159588Sjhb<li><a accesskey="6" href="#ntp_002dkeygen-gq_002dparams">ntp-keygen gq-params</a>: gq-params option (-G) 104793159Sarr<li><a accesskey="7" href="#ntp_002dkeygen-host_002dkey">ntp-keygen host-key</a>: host-key option (-H) 1048164033Srwatson<li><a accesskey="8" href="#ntp_002dkeygen-iffkey">ntp-keygen iffkey</a>: iffkey option (-I) 1049159588Sjhb<li><a accesskey="9" href="#ntp_002dkeygen-ident">ntp-keygen ident</a>: ident option (-i) 105025537Sdfr<li><a href="#ntp_002dkeygen-lifetime">ntp-keygen lifetime</a>: lifetime option (-l) 1051159845Sjhb<li><a href="#ntp_002dkeygen-md5key">ntp-keygen md5key</a>: md5key option (-M) 1052132117Sphk<li><a href="#ntp_002dkeygen-modulus">ntp-keygen modulus</a>: modulus option (-m) 105391040Sarr<li><a href="#ntp_002dkeygen-pvt_002dcert">ntp-keygen pvt-cert</a>: pvt-cert option (-P) 105491040Sarr<li><a href="#ntp_002dkeygen-password">ntp-keygen password</a>: password option (-p) 1055172862Sjb<li><a href="#ntp_002dkeygen-export_002dpasswd">ntp-keygen export-passwd</a>: export-passwd option (-q) 1056172862Sjb<li><a href="#ntp_002dkeygen-sign_002dkey">ntp-keygen sign-key</a>: sign-key option (-S) 1057172862Sjb<li><a href="#ntp_002dkeygen-subject_002dname">ntp-keygen subject-name</a>: subject-name option (-s) 1058172862Sjb<li><a href="#ntp_002dkeygen-trusted_002dcert">ntp-keygen trusted-cert</a>: trusted-cert option (-T) 1059172862Sjb<li><a href="#ntp_002dkeygen-mv_002dparams">ntp-keygen mv-params</a>: mv-params option (-V) 1060172862Sjb<li><a href="#ntp_002dkeygen-mv_002dkeys">ntp-keygen mv-keys</a>: mv-keys option (-v) 1061172862Sjb<li><a href="#ntp_002dkeygen-config">ntp-keygen config</a>: presetting/configuring ntp-keygen 1062132117Sphk<li><a href="#ntp_002dkeygen-exit-status">ntp-keygen exit status</a>: exit status 1063132117Sphk<li><a href="#ntp_002dkeygen-Usage">ntp-keygen Usage</a>: Usage 1064132117Sphk<li><a href="#ntp_002dkeygen-Notes">ntp-keygen Notes</a>: Notes 106591040Sarr<li><a href="#ntp_002dkeygen-Bugs">ntp-keygen Bugs</a>: Bugs 106691040Sarr</ul> 1067159840Sjhb 1068159588Sjhb<div class="node"> 1069157144Sjkoshy<p><hr> 1070159588Sjhb<a name="ntp_002dkeygen-usage"></a>Next: <a rel="next" accesskey="n" href="#ntp_002dkeygen-imbits">ntp-keygen imbits</a>, 1071159588SjhbUp: <a rel="up" accesskey="u" href="#ntp_002dkeygen-Invocation">ntp-keygen Invocation</a> 1072159588Sjhb<br> 1073157144Sjkoshy</div> 1074159588Sjhb 1075159588Sjhb<h4 class="subsection">ntp-keygen help/usage (<span class="option">--help</span>)</h4> 1076159588Sjhb 1077159588Sjhb<p><a name="index-ntp_002dkeygen-help-3"></a> 1078159588SjhbThis is the automatically generated usage text for ntp-keygen. 107991040Sarr 108091040Sarr <p>The text printed is the same whether selected with the <code>help</code> option 1081157144Sjkoshy(<span class="option">--help</span>) or the <code>more-help</code> option (<span class="option">--more-help</span>). <code>more-help</code> will print 1082157144Sjkoshythe usage text by passing it through a pager program. 1083157144Sjkoshy<code>more-help</code> is disabled on platforms without a working 1084157144Sjkoshy<code>fork(2)</code> function. The <code>PAGER</code> environment variable is 1085157144Sjkoshyused to select the program, defaulting to <span class="file">more</span>. Both will exit 1086159845Sjhbwith a status code of 0. 108791068Sarr 108825537Sdfr<pre class="example">ntp-keygen (ntp) - Create a NTP host key - Ver. 4.2.8p5 108925537SdfrUsage: ntp-keygen [ -<flag> [<val>] | --<name>[{=| }<val>] ]... 109025537Sdfr Flg Arg Option-Name Description 1091132117Sphk -b Num imbits identity modulus bits 1092132117Sphk - it must be in the range: 1093132117Sphk 256 to 2048 1094132117Sphk -c Str certificate certificate scheme 1095132117Sphk -C Str cipher privatekey cipher 1096132117Sphk -d no debug-level Increase debug verbosity level 1097132117Sphk - may appear multiple times 1098132117Sphk -D Num set-debug-level Set the debug verbosity level 1099132117Sphk - may appear multiple times 1100132117Sphk -e no id-key Write IFF or GQ identity keys 1101132117Sphk -G no gq-params Generate GQ parameters and keys 1102132117Sphk -H no host-key generate RSA host key 1103132117Sphk -I no iffkey generate IFF parameters 1104132117Sphk -i Str ident set Autokey group name 1105132117Sphk -l Num lifetime set certificate lifetime 1106132117Sphk -M no md5key generate MD5 keys 1107132117Sphk -m Num modulus modulus 110891040Sarr - it must be in the range: 110925537Sdfr 256 to 2048 111091040Sarr -P no pvt-cert generate PC private certificate 111191040Sarr -p Str password local private password 111291040Sarr -q Str export-passwd export IFF or GQ group keys with password 1113159791Sjhb -S Str sign-key generate sign key (RSA or DSA) 111425537Sdfr -s Str subject-name set host and optionally group name 1115107089Srwatson -T no trusted-cert trusted certificate (TC scheme) 1116172930Srwatson -V Num mv-params generate <num> MV parameters 1117107089Srwatson -v Num mv-keys update <num> MV keys 1118107089Srwatson opt version output version information and exit 1119107089Srwatson -? no help display extended usage information and exit 1120107089Srwatson -! no more-help extended usage information passed thru pager 112191040Sarr -> opt save-opts save the option state to a config file 112282749Sdillon -< Str load-opts load options from a config file 1123111119Simp - disabled as '--no-load-opts' 1124107855Salfred - may appear multiple times 112591040Sarr 112625537SdfrOptions are specified by doubled hyphens and their name or by a single 112791040Sarrhyphen and the flag character. 1128159845Sjhb 112991040Sarr 113091040SarrThe following option preset mechanisms are supported: 113191040Sarr - reading file $HOME/.ntprc 113291040Sarr - reading file ./.ntprc 113391040Sarr - examining environment variables named NTP_KEYGEN_* 1134159845Sjhb 113525537SdfrPlease send bug reports to: <http://bugs.ntp.org, bugs@ntp.org> 1136159791Sjhb</pre> 113791040Sarr <div class="node"> 113825537Sdfr<p><hr> 113925537Sdfr<a name="ntp_002dkeygen-imbits"></a>Next: <a rel="next" accesskey="n" href="#ntp_002dkeygen-certificate">ntp-keygen certificate</a>, 114025537SdfrPrevious: <a rel="previous" accesskey="p" href="#ntp_002dkeygen-usage">ntp-keygen usage</a>, 114191040SarrUp: <a rel="up" accesskey="u" href="#ntp_002dkeygen-Invocation">ntp-keygen Invocation</a> 114225537Sdfr<br> 114391040Sarr</div> 114491040Sarr 114525537Sdfr<h4 class="subsection">imbits option (-b)</h4> 1146107089Srwatson 1147172930Srwatson<p><a name="index-ntp_002dkeygen_002dimbits-4"></a> 1148107089SrwatsonThis is the “identity modulus bits” option. 1149107089SrwatsonThis option takes a number argument <span class="file">imbits</span>. 1150107089Srwatson 1151107089Srwatson<p class="noindent">This option has some usage constraints. It: 1152159845Sjhb <ul> 1153166921Sjhb<li>must be compiled in by defining <code>AUTOKEY</code> during the compilation. 1154166921Sjhb</ul> 1155166921Sjhb 1156166921Sjhb <p>The number of bits in the identity modulus. The default is 256. 1157166921Sjhb<div class="node"> 1158166921Sjhb<p><hr> 1159166921Sjhb<a name="ntp_002dkeygen-certificate"></a>Next: <a rel="next" accesskey="n" href="#ntp_002dkeygen-cipher">ntp-keygen cipher</a>, 1160166921SjhbPrevious: <a rel="previous" accesskey="p" href="#ntp_002dkeygen-imbits">ntp-keygen imbits</a>, 1161166921SjhbUp: <a rel="up" accesskey="u" href="#ntp_002dkeygen-Invocation">ntp-keygen Invocation</a> 116291040Sarr<br> 1163166921Sjhb</div> 1164166921Sjhb 1165166921Sjhb<h4 class="subsection">certificate option (-c)</h4> 1166166921Sjhb 1167166921Sjhb<p><a name="index-ntp_002dkeygen_002dcertificate-5"></a> 1168166921SjhbThis is the “certificate scheme” option. 1169166921SjhbThis option takes a string argument <span class="file">scheme</span>. 1170166921Sjhb 1171166921Sjhb<p class="noindent">This option has some usage constraints. It: 117282749Sdillon <ul> 1173159845Sjhb<li>must be compiled in by defining <code>AUTOKEY</code> during the compilation. 117491040Sarr</ul> 117525537Sdfr 117625537Sdfr <p>scheme is one of 117725537SdfrRSA-MD2, RSA-MD5, RSA-SHA, RSA-SHA1, RSA-MDC2, RSA-RIPEMD160, 117891040SarrDSA-SHA, or DSA-SHA1. 117925537Sdfr 1180159587Sjhb <p>Select the certificate message digest/signature encryption scheme. 118191040SarrNote that RSA schemes must be used with a RSA sign key and DSA 1182172862Sjbschemes must be used with a DSA sign key. The default without 118325537Sdfrthis option is RSA-MD5. 1184159587Sjhb<div class="node"> 1185159587Sjhb<p><hr> 1186159587Sjhb<a name="ntp_002dkeygen-cipher"></a>Next: <a rel="next" accesskey="n" href="#ntp_002dkeygen-id_002dkey">ntp-keygen id-key</a>, 1187172862SjbPrevious: <a rel="previous" accesskey="p" href="#ntp_002dkeygen-certificate">ntp-keygen certificate</a>, 1188159587SjhbUp: <a rel="up" accesskey="u" href="#ntp_002dkeygen-Invocation">ntp-keygen Invocation</a> 1189172862Sjb<br> 1190172862Sjb</div> 1191172862Sjb 1192172862Sjb<h4 class="subsection">cipher option (-C)</h4> 1193172862Sjb 1194159587Sjhb<p><a name="index-ntp_002dkeygen_002dcipher-6"></a> 1195159587SjhbThis is the “privatekey cipher” option. 1196107089SrwatsonThis option takes a string argument <span class="file">cipher</span>. 1197172930Srwatson 1198107089Srwatson<p class="noindent">This option has some usage constraints. It: 1199107089Srwatson <ul> 1200107089Srwatson<li>must be compiled in by defining <code>AUTOKEY</code> during the compilation. 1201107089Srwatson</ul> 1202159845Sjhb 1203107849Salfred <p>Select the cipher which is used to encrypt the files containing 120491040Sarrprivate keys. The default is three-key triple DES in CBC mode, 1205159845Sjhbequivalent to "<code>-C des-ede3-cbc". The openssl tool lists ciphers 1206159587Sjhbavailable in "openssl -h" output. 120791040Sarr</code><div class="node"> 120825537Sdfr<p><hr> 1209172862Sjb<a name="ntp_002dkeygen-id_002dkey"></a>Next: <a rel="next" accesskey="n" href="#ntp_002dkeygen-gq_002dparams">ntp-keygen gq-params</a>, 121091040SarrPrevious: <a rel="previous" accesskey="p" href="#ntp_002dkeygen-cipher">ntp-keygen cipher</a>, 121191040SarrUp: <a rel="up" accesskey="u" href="#ntp_002dkeygen-Invocation">ntp-keygen Invocation</a> 121291040Sarr<br> 1213159587Sjhb</div> 1214159587Sjhb 1215159587Sjhb<h4 class="subsection">id-key option (-e)</h4> 1216159587Sjhb 1217159587Sjhb<p><a name="index-ntp_002dkeygen_002did_002dkey-7"></a> 1218172862SjbThis is the “write iff or gq identity keys” option. 1219172862Sjb 1220172862Sjb<p class="noindent">This option has some usage constraints. It: 1221172862Sjb <ul> 1222172862Sjb<li>must be compiled in by defining <code>AUTOKEY</code> during the compilation. 1223172862Sjb</ul> 1224172862Sjb 1225159845Sjhb <p>Write the IFF or GQ client keys to the standard output. This is 122625537Sdfrintended for automatic key distribution by mail. 122791040Sarr<div class="node"> 1228159587Sjhb<p><hr> 1229172862Sjb<a name="ntp_002dkeygen-gq_002dparams"></a>Next: <a rel="next" accesskey="n" href="#ntp_002dkeygen-host_002dkey">ntp-keygen host-key</a>, 123025537SdfrPrevious: <a rel="previous" accesskey="p" href="#ntp_002dkeygen-id_002dkey">ntp-keygen id-key</a>, 123125537SdfrUp: <a rel="up" accesskey="u" href="#ntp_002dkeygen-Invocation">ntp-keygen Invocation</a> 123225537Sdfr<br> 123391040Sarr</div> 123425537Sdfr 123591040Sarr<h4 class="subsection">gq-params option (-G)</h4> 123691040Sarr 123791040Sarr<p><a name="index-ntp_002dkeygen_002dgq_002dparams-8"></a> 123825537SdfrThis is the “generate gq parameters and keys” option. 1239107089Srwatson 1240172930Srwatson<p class="noindent">This option has some usage constraints. It: 1241107089Srwatson <ul> 1242107089Srwatson<li>must be compiled in by defining <code>AUTOKEY</code> during the compilation. 1243107089Srwatson</ul> 1244107089Srwatson 1245159845Sjhb <p>Generate parameters and keys for the GQ identification scheme, 1246107849Salfredobsoleting any that may exist. 124791040Sarr<div class="node"> 124892547Sarr<p><hr> 124991040Sarr<a name="ntp_002dkeygen-host_002dkey"></a>Next: <a rel="next" accesskey="n" href="#ntp_002dkeygen-iffkey">ntp-keygen iffkey</a>, 125091040SarrPrevious: <a rel="previous" accesskey="p" href="#ntp_002dkeygen-gq_002dparams">ntp-keygen gq-params</a>, 125191040SarrUp: <a rel="up" accesskey="u" href="#ntp_002dkeygen-Invocation">ntp-keygen Invocation</a> 125291040Sarr<br> 125391040Sarr</div> 125492547Sarr 125591040Sarr<h4 class="subsection">host-key option (-H)</h4> 125691040Sarr 1257159845Sjhb<p><a name="index-ntp_002dkeygen_002dhost_002dkey-9"></a> 125891040SarrThis is the “generate rsa host key” option. 125925537Sdfr 126040159Speter<p class="noindent">This option has some usage constraints. It: 126141090Speter <ul> 126283366Sjulian<li>must be compiled in by defining <code>AUTOKEY</code> during the compilation. 126341090Speter</ul> 126491040Sarr 126591040Sarr <p>Generate new host keys, obsoleting any that may exist. 126691040Sarr<div class="node"> 126791040Sarr<p><hr> 126891040Sarr<a name="ntp_002dkeygen-iffkey"></a>Next: <a rel="next" accesskey="n" href="#ntp_002dkeygen-ident">ntp-keygen ident</a>, 126991040SarrPrevious: <a rel="previous" accesskey="p" href="#ntp_002dkeygen-host_002dkey">ntp-keygen host-key</a>, 127041090SpeterUp: <a rel="up" accesskey="u" href="#ntp_002dkeygen-Invocation">ntp-keygen Invocation</a> 1271107089Srwatson<br> 1272172930Srwatson</div> 1273107089Srwatson 1274107089Srwatson<h4 class="subsection">iffkey option (-I)</h4> 1275107089Srwatson 1276107089Srwatson<p><a name="index-ntp_002dkeygen_002diffkey-10"></a> 1277107849SalfredThis is the “generate iff parameters” option. 1278159843Sjhb 127991068Sarr<p class="noindent">This option has some usage constraints. It: 1280159843Sjhb <ul> 1281159843Sjhb<li>must be compiled in by defining <code>AUTOKEY</code> during the compilation. 1282111119Simp</ul> 128391040Sarr 128491040Sarr <p>Generate parameters for the IFF identification scheme, obsoleting 1285159845Sjhbany that may exist. 1286107849Salfred<div class="node"> 1287107849Salfred<p><hr> 1288159843Sjhb<a name="ntp_002dkeygen-ident"></a>Next: <a rel="next" accesskey="n" href="#ntp_002dkeygen-lifetime">ntp-keygen lifetime</a>, 128991040SarrPrevious: <a rel="previous" accesskey="p" href="#ntp_002dkeygen-iffkey">ntp-keygen iffkey</a>, 1290159843SjhbUp: <a rel="up" accesskey="u" href="#ntp_002dkeygen-Invocation">ntp-keygen Invocation</a> 129191040Sarr<br> 129291040Sarr</div> 129391040Sarr 1294107855Salfred<h4 class="subsection">ident option (-i)</h4> 129591040Sarr 129691040Sarr<p><a name="index-ntp_002dkeygen_002dident-11"></a> 129791040SarrThis is the “set autokey group name” option. 129891040SarrThis option takes a string argument <span class="file">group</span>. 129991040Sarr 130091040Sarr<p class="noindent">This option has some usage constraints. It: 130191040Sarr <ul> 130291040Sarr<li>must be compiled in by defining <code>AUTOKEY</code> during the compilation. 1303107849Salfred</ul> 130491040Sarr 130591068Sarr <p>Set the optional Autokey group name to name. This is used in 130691040Sarrthe file name of IFF, GQ, and MV client parameters files. In 130791040Sarrthat role, the default is the host name if this option is not 1308185895Szecprovided. The group name, if specified using <code>-i/--ident</code> or 1309185895Szecusing <code>-s/--subject-name</code> following an '<code>}' character, 1310185895Szecis also a part of the self-signed host certificate's subject and 1311185895Szecissuer names in the form host 1312185895Szec <p>'crypto ident' or 'server ident' configuration in 1313185895Szecntpd's configuration file. 1314185895Szec</code><div class="node"> 1315185895Szec<p><hr> 1316185895Szec<a name="ntp_002dkeygen-lifetime"></a>Next: <a rel="next" accesskey="n" href="#ntp_002dkeygen-md5key">ntp-keygen md5key</a>, 1317185895SzecPrevious: <a rel="previous" accesskey="p" href="#ntp_002dkeygen-ident">ntp-keygen ident</a>, 1318185895SzecUp: <a rel="up" accesskey="u" href="#ntp_002dkeygen-Invocation">ntp-keygen Invocation</a> 1319185895Szec<br> 1320185895Szec</div> 1321185895Szec 132291040Sarr<h4 class="subsection">lifetime option (-l)</h4> 132391040Sarr 1324185895Szec<p><a name="index-ntp_002dkeygen_002dlifetime-12"></a> 132541090SpeterThis is the ``set certificate lifetime'' option. 1326159845SjhbThis option takes a number argument <span class="file">lifetime</span>. 132741090Speter 1328159843Sjhb<p class="noindent">This option has some usage constraints. It: 132991040Sarr <ul> 133041090Speter<li>must be compiled in by defining <code>AUTOKEY</code> during the compilation. 133141090Speter</ul> 133240159Speter 133340159Speter <p>Set the certificate expiration to lifetime days from now. 133440159Speter<div class="node"> 133540159Speter<p><hr> 133659751Speter<a name="ntp_002dkeygen-md5key"></a>Next: <a rel="next" accesskey="n" href="#ntp_002dkeygen-modulus">ntp-keygen modulus</a>, 133774642SbpPrevious: <a rel="previous" accesskey="p" href="#ntp_002dkeygen-lifetime">ntp-keygen lifetime</a>, 133859751SpeterUp: <a rel="up" accesskey="u" href="#ntp_002dkeygen-Invocation">ntp-keygen Invocation</a> 133991040Sarr<br> 134059751Speter</div> 134191040Sarr 134292032Sdwmalone<h4 class="subsection">md5key option (-M)</h4> 134392032Sdwmalone 134491040Sarr<p><a name="index-ntp_002dkeygen_002dmd5key-13"></a> 134591040SarrThis is the ``generate md5 keys'' option. 134691040SarrGenerate MD5 keys, obsoleting any that may exist. 134759751Speter<div class="node"> 134859751Speter<p><hr> 134974642Sbp<a name="ntp_002dkeygen-modulus"></a>Next: <a rel="next" accesskey="n" href="#ntp_002dkeygen-pvt_002dcert">ntp-keygen pvt-cert</a>, 135083321SpeterPrevious: <a rel="previous" accesskey="p" href="#ntp_002dkeygen-md5key">ntp-keygen md5key</a>, 135183321SpeterUp: <a rel="up" accesskey="u" href="#ntp_002dkeygen-Invocation">ntp-keygen Invocation</a> 135291040Sarr<br> 135392032Sdwmalone</div> 135483321Speter 135591040Sarr<h4 class="subsection">modulus option (-m)</h4> 135691040Sarr 135791040Sarr<p><a name="index-ntp_002dkeygen_002dmodulus-14"></a> 1358159586SjhbThis is the ``modulus'' option. 135992032SdwmaloneThis option takes a number argument <span class="file">modulus</span>. 136091040Sarr 136191040Sarr<p class="noindent">This option has some usage constraints. It: 136291040Sarr <ul> 136391040Sarr<li>must be compiled in by defining <code>AUTOKEY</code> during the compilation. 136491040Sarr</ul> 136591068Sarr 1366120382Sfjoe <p>The number of bits in the prime modulus. The default is 512. 136791040Sarr<div class="node"> 136891040Sarr<p><hr> 136991040Sarr<a name="ntp_002dkeygen-pvt_002dcert"></a>Next: <a rel="next" accesskey="n" href="#ntp_002dkeygen-password">ntp-keygen password</a>, 137083321SpeterPrevious: <a rel="previous" accesskey="p" href="#ntp_002dkeygen-modulus">ntp-keygen modulus</a>, 137183321SpeterUp: <a rel="up" accesskey="u" href="#ntp_002dkeygen-Invocation">ntp-keygen Invocation</a> 137283321Speter<br> 137378501Sdes</div> 137474642Sbp 137591040Sarr<h4 class="subsection">pvt-cert option (-P)</h4> 137674642Sbp 137792705Sarr<p><a name="index-ntp_002dkeygen_002dpvt_002dcert-15"></a> 137891040SarrThis is the ``generate pc private certificate'' option. 137991040Sarr 138091040Sarr<p class="noindent">This option has some usage constraints. It: 138191040Sarr <ul> 138291040Sarr<li>must be compiled in by defining <code>AUTOKEY</code> during the compilation. 138391040Sarr</ul> 138491040Sarr 138574642Sbp <p>Generate a private certificate. By default, the program generates 138674642Sbppublic certificates. 138740159Speter<div class="node"> 138878161Speter<p><hr> 138991040Sarr<a name="ntp_002dkeygen-password"></a>Next: <a rel="next" accesskey="n" href="#ntp_002dkeygen-export_002dpasswd">ntp-keygen export-passwd</a>, 139074642SbpPrevious: <a rel="previous" accesskey="p" href="#ntp_002dkeygen-pvt_002dcert">ntp-keygen pvt-cert</a>, 139191040SarrUp: <a rel="up" accesskey="u" href="#ntp_002dkeygen-Invocation">ntp-keygen Invocation</a> 139291040Sarr<br> 139391040Sarr</div> 139474642Sbp 139591040Sarr<h4 class="subsection">password option (-p)</h4> 1396109605Sjake 139791040Sarr<p><a name="index-ntp_002dkeygen_002dpassword-16"></a> 139891040SarrThis is the ``local private password'' option. 1399109605SjakeThis option takes a string argument <span class="file">passwd</span>. 1400109605Sjake 140191040Sarr<p class="noindent">This option has some usage constraints. It: 140291040Sarr <ul> 140391040Sarr<li>must be compiled in by defining <code>AUTOKEY</code> during the compilation. 140491040Sarr</ul> 140591040Sarr 140691040Sarr <p>Local files containing private data are encrypted with the 140774642SbpDES-CBC algorithm and the specified password. The same password 140874642Sbpmust be specified to the local ntpd via the "crypto pw password" 140974642Sbpconfiguration command. The default password is the local 141074642Sbphostname. 141191040Sarr<div class="node"> 141240159Speter<p><hr> 141391040Sarr<a name="ntp_002dkeygen-export_002dpasswd"></a>Next: <a rel="next" accesskey="n" href="#ntp_002dkeygen-sign_002dkey">ntp-keygen sign-key</a>, 141491040SarrPrevious: <a rel="previous" accesskey="p" href="#ntp_002dkeygen-password">ntp-keygen password</a>, 141591040SarrUp: <a rel="up" accesskey="u" href="#ntp_002dkeygen-Invocation">ntp-keygen Invocation</a> 1416160244Sjhb<br> 141791040Sarr</div> 141892032Sdwmalone 141991040Sarr<h4 class="subsection">export-passwd option (-q)</h4> 142091040Sarr 142191040Sarr<p><a name="index-ntp_002dkeygen_002dexport_002dpasswd-17"></a> 142291040SarrThis is the ``export iff or gq group keys with password'' option. 142391040SarrThis option takes a string argument <span class="file">passwd</span>. 142491040Sarr 142591040Sarr<p class="noindent">This option has some usage constraints. It: 142691040Sarr <ul> 142791040Sarr<li>must be compiled in by defining <code>AUTOKEY</code> during the compilation. 142840159Speter</ul> 142991040Sarr 143091040Sarr <p>Export IFF or GQ identity group keys to the standard output, 143191040Sarrencrypted with the DES-CBC algorithm and the specified password. 143291040SarrThe same password must be specified to the remote ntpd via the 143359751Speter"crypto pw password" configuration command. See also the option 143491040Sarr--id-key (-e) for unencrypted exports. 143591040Sarr<div class="node"> 143691040Sarr<p><hr> 143791040Sarr<a name="ntp_002dkeygen-sign_002dkey"></a>Next: <a rel="next" accesskey="n" href="#ntp_002dkeygen-subject_002dname">ntp-keygen subject-name</a>, 143891040SarrPrevious: <a rel="previous" accesskey="p" href="#ntp_002dkeygen-export_002dpasswd">ntp-keygen export-passwd</a>, 143991040SarrUp: <a rel="up" accesskey="u" href="#ntp_002dkeygen-Invocation">ntp-keygen Invocation</a> 144091040Sarr<br> 144191040Sarr</div> 144291040Sarr 144391040Sarr<h4 class="subsection">sign-key option (-S)</h4> 144491040Sarr 144591040Sarr<p><a name="index-ntp_002dkeygen_002dsign_002dkey-18"></a> 144691040SarrThis is the ``generate sign key (rsa or dsa)'' option. 144791040SarrThis option takes a string argument <span class="file">sign</span>. 1448131398Sjhb 1449131398Sjhb<p class="noindent">This option has some usage constraints. It: 1450131398Sjhb <ul> 145140159Speter<li>must be compiled in by defining <code>AUTOKEY</code> during the compilation. 145291040Sarr</ul> 145391040Sarr 1454134364Siedowse <p>Generate a new sign key of the designated type, obsoleting any 145591040Sarrthat may exist. By default, the program uses the host key as the 1456134364Siedowsesign key. 145791040Sarr<div class="node"> 145891040Sarr<p><hr> 145991040Sarr<a name="ntp_002dkeygen-subject_002dname"></a>Next: <a rel="next" accesskey="n" href="#ntp_002dkeygen-trusted_002dcert">ntp-keygen trusted-cert</a>, 146040159SpeterPrevious: <a rel="previous" accesskey="p" href="#ntp_002dkeygen-sign_002dkey">ntp-keygen sign-key</a>, 146140159SpeterUp: <a rel="up" accesskey="u" href="#ntp_002dkeygen-Invocation">ntp-keygen Invocation</a> 146291040Sarr<br> 146391040Sarr</div> 146491040Sarr 146591040Sarr<h4 class="subsection">subject-name option (-s)</h4> 146691040Sarr 146791040Sarr<p><a name="index-ntp_002dkeygen_002dsubject_002dname-19"></a> 146859751SpeterThis is the ``set host and optionally group name'' option. 146959751SpeterThis option takes a string argument <span class="file">host@group</span>. 1470167019Sjhb 1471167019Sjhb<p class="noindent">This option has some usage constraints. It: 147259751Speter <ul> 147391040Sarr<li>must be compiled in by defining <code>AUTOKEY</code> during the compilation. 147491040Sarr</ul> 147591040Sarr 147691040Sarr <p>Set the Autokey host name, and optionally, group name specified 147791040Sarrfollowing an '<code>}' character. The host name is used in the file 147891040Sarrname of generated host and signing certificates, without the 147991040Sarrgroup name. The host name, and if provided, group name are used 148091040Sarrin host 148191040Sarr <p>fields. Specifying '-s 148291040Sarr <p>leaving the host name unchanged while appending 148391040Sarr <p>subject and issuer fields, as with -i group. The group name, or 1484109605Sjakeif not provided, the host name are also used in the file names 148591040Sarrof IFF, GQ, and MV client parameter files. 148691040Sarr</code><div class="node"> 1487109605Sjake<p><hr> 1488109605Sjake<a name="ntp_002dkeygen-trusted_002dcert"></a>Next: <a rel="next" accesskey="n" href="#ntp_002dkeygen-mv_002dparams">ntp-keygen mv-params</a>, 148991040SarrPrevious: <a rel="previous" accesskey="p" href="#ntp_002dkeygen-subject_002dname">ntp-keygen subject-name</a>, 1490109605SjakeUp: <a rel="up" accesskey="u" href="#ntp_002dkeygen-Invocation">ntp-keygen Invocation</a> 149191040Sarr<br> 149291040Sarr</div> 1493109605Sjake 149492032Sdwmalone<h4 class="subsection">trusted-cert option (-T)</h4> 149591040Sarr 149691040Sarr<p><a name="index-ntp_002dkeygen_002dtrusted_002dcert-20"></a> 149791040SarrThis is the ``trusted certificate (tc scheme)'' option. 149891040Sarr 1499159840Sjhb<p class="noindent">This option has some usage constraints. It: 150091040Sarr <ul> 150191040Sarr<li>must be compiled in by defining <code>AUTOKEY</code> during the compilation. 150291040Sarr</ul> 150391040Sarr 150491068Sarr <p>Generate a trusted certificate. By default, the program generates 150591040Sarra non-trusted certificate. 150691040Sarr<div class="node"> 150764143Speter<p><hr> 150891040Sarr<a name="ntp_002dkeygen-mv_002dparams"></a>Next: <a rel="next" accesskey="n" href="#ntp_002dkeygen-mv_002dkeys">ntp-keygen mv-keys</a>, 150991040SarrPrevious: <a rel="previous" accesskey="p" href="#ntp_002dkeygen-trusted_002dcert">ntp-keygen trusted-cert</a>, 151091040SarrUp: <a rel="up" accesskey="u" href="#ntp_002dkeygen-Invocation">ntp-keygen Invocation</a> 151191040Sarr<br> 151291040Sarr</div> 151391040Sarr 151491040Sarr<h4 class="subsection">mv-params option (-V)</h4> 151591040Sarr 1516109605Sjake<p><a name="index-ntp_002dkeygen_002dmv_002dparams-21"></a> 151791040SarrThis is the ``generate <num> mv parameters'' option. 151891040SarrThis option takes a number argument <span class="file">num</span>. 1519109605Sjake 1520109605Sjake<p class="noindent">This option has some usage constraints. It: 1521109605Sjake <ul> 152291040Sarr<li>must be compiled in by defining <code>AUTOKEY</code> during the compilation. 152391040Sarr</ul> 152491040Sarr 152591040Sarr <p>Generate parameters and keys for the Mu-Varadharajan (MV) 1526160244Sjhbidentification scheme. 1527160244Sjhb<div class="node"> 1528132117Sphk<p><hr> 1529132117Sphk<a name="ntp_002dkeygen-mv_002dkeys"></a>Next: <a rel="next" accesskey="n" href="#ntp_002dkeygen-config">ntp-keygen config</a>, 153091040SarrPrevious: <a rel="previous" accesskey="p" href="#ntp_002dkeygen-mv_002dparams">ntp-keygen mv-params</a>, 153191068SarrUp: <a rel="up" accesskey="u" href="#ntp_002dkeygen-Invocation">ntp-keygen Invocation</a> 153291040Sarr<br> 153391040Sarr</div> 153491040Sarr 153591040Sarr<h4 class="subsection">mv-keys option (-v)</h4> 153691040Sarr 153791040Sarr<p><a name="index-ntp_002dkeygen_002dmv_002dkeys-22"></a> 153891040SarrThis is the ``update <num> mv keys'' option. 153991040SarrThis option takes a number argument <span class="file">num</span>. 154091040Sarr 154191040Sarr<p class="noindent">This option has some usage constraints. It: 154291040Sarr <ul> 154391040Sarr<li>must be compiled in by defining <code>AUTOKEY</code> during the compilation. 154491040Sarr</ul> 154559751Speter 154659751Speter <p>This option has no <span class="samp">doc</span> documentation. 154791040Sarr 154859751Speter<div class="node"> 154991040Sarr<p><hr> 155059751Speter<a name="ntp_002dkeygen-config"></a>Next: <a rel="next" accesskey="n" href="#ntp_002dkeygen-exit-status">ntp-keygen exit status</a>, 1551160242SjhbPrevious: <a rel="previous" accesskey="p" href="#ntp_002dkeygen-mv_002dkeys">ntp-keygen mv-keys</a>, 1552160242SjhbUp: <a rel="up" accesskey="u" href="#ntp_002dkeygen-Invocation">ntp-keygen Invocation</a> 155391040Sarr<br> 1554132117Sphk</div> 155540159Speter 155659751Speter<h4 class="subsection">presetting/configuring ntp-keygen</h4> 155778161Speter 155891040Sarr<p>Any option that is not marked as <i>not presettable</i> may be preset by 155978161Speterloading 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 1560160244Sjhbthe options listed above in upper case and segmented with underscores. 156191040SarrThe <code>NTP-KEYGEN</code> variable will be tokenized and parsed like 156291040Sarrthe command line. The remaining variables are tested for existence and their 156391040Sarrvalues are treated like option arguments. 156491040Sarr 156591040Sarr<p class="noindent"><code>libopts</code> will search in 2 places for configuration files: 156691040Sarr <ul> 156791040Sarr<li>$HOME 156891040Sarr<li>$PWD 156991040Sarr</ul> 157091040Sarr The environment variables <code>HOME</code>, and <code>PWD</code> 157191040Sarrare expanded and replaced when <span class="file">ntp-keygen</span> runs. 157291040SarrFor any of these that are plain files, they are simply processed. 1573109605SjakeFor any that are directories, then a file named <span class="file">.ntprc</span> is searched for 157491040Sarrwithin that directory and processed. 157591040Sarr 1576109605Sjake <p>Configuration files may be in a wide variety of formats. 1577109605SjakeThe basic format is an option name followed by a value (argument) on the 157891040Sarrsame line. Values may be separated from the option name with a colon, 1579151484Sjdpequal sign or simply white space. Values may be continued across multiple 1580151484Sjdplines by escaping the newline with a backslash. 1581151484Sjdp 158291040Sarr <p>Multiple programs may also share the same initialization file. 158391040SarrCommon options are collected at the top, followed by program specific 158491040Sarrsegments. The segments are separated by lines like: 158591040Sarr<pre class="example"> [NTP-KEYGEN] 158691040Sarr</pre> 158791040Sarr <p class="noindent">or by 158891040Sarr<pre class="example"> <?program ntp-keygen> 158991040Sarr</pre> 159091040Sarr <p class="noindent">Do not mix these styles within one configuration file. 159191040Sarr 159291040Sarr <p>Compound values and carefully constructed string values may also be 159391040Sarrspecified using XML syntax: 159491040Sarr<pre class="example"> <option-name> 1595160244Sjhb <sub-opt>...&lt;...&gt;...</sub-opt> 159691040Sarr </option-name> 159791040Sarr</pre> 1598132117Sphk <p class="noindent">yielding an <code>option-name.sub-opt</code> string value of 159991040Sarr<pre class="example"> "...<...>..." 160091040Sarr</pre> 160191040Sarr <p><code>AutoOpts</code> does not track suboptions. You simply note that it is a 160291040Sarrhierarchicly valued option. <code>AutoOpts</code> does provide a means for searching 160391040Sarrthe associated name/value pair list (see: optionFindValue). 160491040Sarr 160591040Sarr <p>The command line options relating to configuration and/or usage help are: 160691040Sarr 160759751Speter<h5 class="subsubheading">version (-)</h5> 160891040Sarr 160940159Speter<p>Print the program version to standard out, optionally with licensing 161040159Speterinformation, then exit 0. The optional argument specifies how much licensing 1611177253Srwatsondetail to provide. The default is to print just the version. The licensing infomation may be selected with an option argument. 161240159SpeterOnly the first letter of the argument is examined: 161340159Speter 161440159Speter <dl> 1615159840Sjhb<dt><span class="samp">version</span><dd>Only print the version. This is the default. 161640159Speter<br><dt><span class="samp">copyright</span><dd>Name the copyright usage licensing terms. 1617159840Sjhb<br><dt><span class="samp">verbose</span><dd>Print the full copyright usage licensing terms. 161891040Sarr</dl> 161991040Sarr 1620159840Sjhb<div class="node"> 162191040Sarr<p><hr> 162291040Sarr<a name="ntp_002dkeygen-exit-status"></a>Next: <a rel="next" accesskey="n" href="#ntp_002dkeygen-Usage">ntp-keygen Usage</a>, 1623159840SjhbPrevious: <a rel="previous" accesskey="p" href="#ntp_002dkeygen-config">ntp-keygen config</a>, 162440159SpeterUp: <a rel="up" accesskey="u" href="#ntp_002dkeygen-Invocation">ntp-keygen Invocation</a> 162540159Speter<br> 162640159Speter</div> 162740159Speter 162883321Speter<h4 class="subsection">ntp-keygen exit status</h4> 1629111852Sru 163040159Speter<p>One of the following exit values will be returned: 163140159Speter <dl> 163291040Sarr<dt><span class="samp">0 (EXIT_SUCCESS)</span><dd>Successful program execution. 163340159Speter<br><dt><span class="samp">1 (EXIT_FAILURE)</span><dd>The operation failed or the command syntax was not valid. 163477843Speter<br><dt><span class="samp">66 (EX_NOINPUT)</span><dd>A specified configuration file could not be loaded. 163570417Speter<br><dt><span class="samp">70 (EX_SOFTWARE)</span><dd>libopts had an internal operational error. Please report 163659751Speterit to autogen-users@lists.sourceforge.net. Thank you. 163783321Speter</dl> 163859751Speter <div class="node"> 163959751Speter<p><hr> 164059751Speter<a name="ntp_002dkeygen-Usage"></a>Next: <a rel="next" accesskey="n" href="#ntp_002dkeygen-Notes">ntp-keygen Notes</a>, 164159751SpeterPrevious: <a rel="previous" accesskey="p" href="#ntp_002dkeygen-exit-status">ntp-keygen exit status</a>, 164283321SpeterUp: <a rel="up" accesskey="u" href="#ntp_002dkeygen-Invocation">ntp-keygen Invocation</a> 164391040Sarr<br> 164491040Sarr</div> 164591040Sarr 164683321Speter<h4 class="subsection">ntp-keygen Usage</h4> 164759751Speter 164891040Sarr<div class="node"> 164991040Sarr<p><hr> 165040159Speter<a name="ntp_002dkeygen-Notes"></a>Next: <a rel="next" accesskey="n" href="#ntp_002dkeygen-Bugs">ntp-keygen Bugs</a>, 165191040SarrPrevious: <a rel="previous" accesskey="p" href="#ntp_002dkeygen-Usage">ntp-keygen Usage</a>, 165291040SarrUp: <a rel="up" accesskey="u" href="#ntp_002dkeygen-Invocation">ntp-keygen Invocation</a> 165391040Sarr<br> 1654159808Sjhb</div> 165591040Sarr 165640159Speter<h4 class="subsection">ntp-keygen Notes</h4> 165791040Sarr 165891040Sarr<div class="node"> 165991040Sarr<p><hr> 166091040Sarr<a name="ntp_002dkeygen-Bugs"></a>Previous: <a rel="previous" accesskey="p" href="#ntp_002dkeygen-Notes">ntp-keygen Notes</a>, 166191040SarrUp: <a rel="up" accesskey="u" href="#ntp_002dkeygen-Invocation">ntp-keygen Invocation</a> 166291040Sarr<br> 166391040Sarr</div> 166491040Sarr 166583321Speter<h4 class="subsection">ntp-keygen Bugs</h4> 166691040Sarr 1667111119Simp<div class="node"> 166891040Sarr<p><hr> 166991040Sarr<a name="Random-Seed-File"></a>Next: <a rel="next" accesskey="n" href="#Cryptographic-Data-Files">Cryptographic Data Files</a>, 167091040SarrPrevious: <a rel="previous" accesskey="p" href="#Running-the-Program">Running the Program</a>, 167191040SarrUp: <a rel="up" accesskey="u" href="#Top">Top</a> 167291040Sarr<br> 167391040Sarr</div> 167491040Sarr 1675159808Sjhb<!-- node-name, next, previous, up --> 167691040Sarr<h3 class="section">Random Seed File</h3> 1677170152Skib 167891040Sarr<p>All cryptographically sound key generation schemes must have means to 1679159808Sjhbrandomize the entropy seed used to initialize the internal 168091040Sarrpseudo-random number generator used by the OpenSSL library routines. 168191040SarrIf a site supports ssh, it is very likely that means to do this are 168291040Sarralready available. 1683182371SattilioThe entropy seed used by the OpenSSL library is contained in a file, 1684175294Sattiliousually called <code>.rnd</code>, which must be available when 168591406Sjhbstarting the <code>ntp-keygen</code> program or <code>ntpd</code> daemon. 1686159808Sjhb 168791040Sarr <p>The OpenSSL library looks for the file using the path specified by the 168891040Sarr<code>RANDFILE</code> environment variable in the user home directory, whether root 168991040Sarror some other user. 169083321SpeterIf the <code>RANDFILE</code> environment variable is not 169191040Sarrpresent, the library looks for the <code>.rnd</code> file in the user home 169291040Sarrdirectory. 169383321SpeterSince both the <code>ntp-keygen</code> program and <code>ntpd</code> daemon must run 169483321Speteras root, the logical place to put this file is in <code>/.rnd</code> or 169591040Sarr<code>/root/.rnd</code>. 169683321SpeterIf the file is not available or cannot be written, the program exits 169783321Speterwith a message to the system log. 169883321Speter 169991040Sarr<div class="node"> 170091040Sarr<p><hr> 170183321Speter<a name="Cryptographic-Data-Files"></a>Previous: <a rel="previous" accesskey="p" href="#Random-Seed-File">Random Seed File</a>, 170283321SpeterUp: <a rel="up" accesskey="u" href="#Top">Top</a> 170383321Speter<br> 170491040Sarr</div> 170591040Sarr 170683321Speter<!-- node-name, next, previous, up --> 170791040Sarr<h3 class="section">Cryptographic Data Files</h3> 170891406Sjhb 170991040Sarr<p>File and link names are in the <code>form ntpkey_key_name.fstamp</code>, 171091040Sarrwhere <code>key</code> is the key or parameter type, 171191040Sarr<code>name</code> is the host or group name and 171291040Sarr<code>fstamp</code> is the filestamp (NTP seconds) when the file was created). 171391040SarrBy convention, key names in generated file names include both upper and 1714159808Sjhblower case characters, while key names in generated link names include 171583321Speteronly lower case characters. The filestamp is not used in generated link 171691040Sarrnames. 171791040Sarr 171883321Speter <p>The key name is a string defining the cryptographic key type. 171991040SarrKey types include public/private keys host and sign, certificate cert 172091040Sarrand several challenge/response key types. 172191040SarrBy convention, client files used for 1722111119Simpchallenges have a par subtype, as in the IFF challenge IFFpar, while 172391040Sarrserver files for responses have a key subtype, as in the GQ response 172491040SarrGQkey. 172583321Speter 1726159808Sjhb <p>All files begin with two nonencrypted lines. The first line contains 172791040Sarrthe file name in the format <code>ntpkey_key_host.fstamp</code>. 1728170152SkibThe second line contains the datestamp in conventional Unix date format. 172991040SarrLines beginning with <code>#</code> are ignored. 173091040Sarr 1731159808Sjhb <p>The remainder of the file contains cryptographic data encoded first 173291040Sarrusing ASN.1 rules, then encrypted using the DES-CBC algorithm with 173391040Sarrgiven password and finally written in PEM-encoded printable ASCII text 173491040Sarrpreceded and followed by MIME content identifier lines. 173591040Sarr 1736182371Sattilio <p>The format of the symmetric keys file, ordinarily named <code>ntp.keys</code>, 173791040Sarris somewhat different than the other files in the interest of backward 173891040Sarrcompatibility. 173991040SarrOrdinarily, the file is generated by this program, but 174091040Sarrit can be constructed and edited using an ordinary text editor. 174191040Sarr 174291040Sarr<pre class="example"> # ntpkey_MD5key_hms.local.3564038757 174391040Sarr # Sun Dec 9 02:45:57 2012 174491040Sarr 174591040Sarr 1 MD5 "]!ghT%O;3)WJ,/Nc:>I # MD5 key 1746111119Simp 2 MD5 lu+H^tF46BKR-6~pV_5 # MD5 key 174791040Sarr 3 MD5 :lnoVsE%Yz*avh%EtNC # MD5 key 174891040Sarr 4 MD5 |fdZrf0sF~^V # MD5 key 174991068Sarr 5 MD5 IyAG>O"y"LmCRS!*bHC # MD5 key 1750101941Srwatson 6 MD5 ">e\A # MD5 key 175191040Sarr 7 MD5 c9x=M'CfLxax9v)PV-si # MD5 key 175291040Sarr 8 MD5 E|=jvFVov?Bn|Ev=&aK\ # MD5 key 1753175294Sattilio 9 MD5 T!c4UT&`(m$+m+B6,`Q0 # MD5 key 175491040Sarr 10 MD5 JVF/1=)=IFbHbJQz..Cd # MD5 key 1755159808Sjhb 11 SHA1 6dea311109529e436c2b4fccae9bc753c16d1b48 # SHA1 key 175691040Sarr 12 SHA1 7076f373d86c4848c59ff8046e49cb7d614ec394 # SHA1 key 175791040Sarr 13 SHA1 5f48b1b60591eb01b7cf1d33b7774f08d20262d3 # SHA1 key 175891040Sarr 14 SHA1 eed5ab9d9497319ec60cf3781d52607e76720178 # SHA1 key 175991040Sarr 15 SHA1 f283562611a04c964da8126296f5f8e58c3f85de # SHA1 key 176091040Sarr 16 SHA1 1930da171297dd63549af50b29449de17dcf341f # SHA1 key 176191040Sarr 17 SHA1 fee892110358cd4382322b889869e750db8e8a8f # SHA1 key 176283321Speter 18 SHA1 b5520c9fadd7ad3fd8bfa061c8821b65d029bb37 # SHA1 key 176391040Sarr 19 SHA1 8c74fb440ec80f453ec6aaa62b9baed0ab723b92 # SHA1 key 176491040Sarr 20 SHA1 6bc05f734306a189326000970c19b3910f403795 # SHA1 key 176591040Sarr</pre> 176683321Speter <p>Figure 1. Typical Symmetric Key File 176791040Sarr 176891040Sarr <p>Figure 1 shows a typical symmetric keys file used by the reference 176991040Sarrimplementation. 177091040SarrEach line of the file contains three fields, first an 177191040Sarrinteger between 1 and 65534, inclusive, representing the key identifier 177291040Sarrused in the server and peer configuration commands. 177391040SarrNext is the key type for the message digest algorithm, 177491040Sarrwhich in the absence of the 177591040SarrOpenSSL library must be MD5 to designate the MD5 message digest 177691040Sarralgorithm. 177791040SarrIf the OpenSSL library is installed, the key type can be any 177891040Sarrmessage digest algorithm supported by that library. 177991040SarrHowever, if 178091040Sarrcompatibility with FIPS 140-2 is required, the key type must be either 178191040SarrSHA or SHA1. 178291040SarrThe key type can be changed using an ASCII text editor. 178391040Sarr 178491040Sarr <p>An MD5 key consists of a printable ASCII string less than or equal to 178591040Sarr16 characters and terminated by whitespace or a # character. 178691040SarrAn OpenSSL 178791040Sarrkey consists of a hex-encoded ASCII string of 40 characters, which is 178891040Sarrtruncated as necessary. 178991040Sarr 179091040Sarr <p>Note that the keys used by the <code>ntpq</code> and <code>ntpdc</code> programs are 179191040Sarrchecked against passwords requested by the programs and entered by hand, 179291040Sarrso it 179391040Sarris generally appropriate to specify these keys in human readable ASCII 179491040Sarrformat. 179591040Sarr 179691040Sarr <p>The <code>ntp-keygen</code> program generates a MD5 symmetric keys file 179791040Sarr<code>ntpkey_MD5key_hostname.filestamp</code>. 179891040SarrSince the file contains private 179991040Sarrshared keys, it should be visible only to root and distributed by 180091040Sarrsecure means to other subnet hosts. 180191040SarrThe NTP daemon loads the file <code>ntp.keys</code>, so <code>ntp-keygen</code> 180291040Sarrinstalls a soft link from this name to the generated file. 180383321SpeterSubsequently, similar soft links must be installed by 180491040Sarrmanual or automated means on the other subnet hosts. 180583321SpeterWhile this file is 180691040Sarrnot used with the Autokey Version 2 protocol, it is needed to 180791040Sarrauthenticate some remote configuration commands used by the <code>ntpq</code> and 180891040Sarr<code>ntpdc</code> utilities. 180991040Sarr 181091040Sarr</body></html> 181191040Sarr 181291040Sarr