ntp-keygen.html revision 275970
190926Snectar<html lang="en"> 255682Smarkm<head> 390926Snectar<title>Ntp-keygen User's Manual</title> 478527Sassar<meta http-equiv="Content-Type" content="text/html"> 555682Smarkm<meta name="description" content="Ntp-keygen User's Manual"> 655682Smarkm<meta name="generator" content="makeinfo 4.7"> 755682Smarkm<link title="Top" rel="top" href="#Top"> 855682Smarkm<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage"> 955682Smarkm<meta http-equiv="Content-Style-Type" content="text/css"> 1055682Smarkm<style type="text/css"><!-- 1155682Smarkm pre.display { font-family:inherit } 1255682Smarkm pre.format { font-family:inherit } 1355682Smarkm pre.smalldisplay { font-family:inherit; font-size:smaller } 1490926Snectar pre.smallformat { font-family:inherit; font-size:smaller } 1590926Snectar pre.smallexample { font-size:smaller } 1690926Snectar pre.smalllisp { font-size:smaller } 1790926Snectar span.sc { font-variant:small-caps } 1890926Snectar span.roman { font-family: serif; font-weight: normal; } 1990926Snectar--></style> 2090926Snectar</head> 2190926Snectar<body> 2290926Snectar<h1 class="settitle">Ntp-keygen User's Manual</h1> 2390926Snectar <div class="shortcontents"> 2455682Smarkm<h2>Short Contents</h2> 2555682Smarkm<ul> 2655682Smarkm<a href="#Top">Top</a> 2755682Smarkm<a href="#Top">NTP Key Generation Program User Manual</a> 2855682Smarkm</ul> 2955682Smarkm</div> 3055682Smarkm 3155682Smarkm 3255682Smarkm 3355682Smarkm<div class="node"> 3455682Smarkm<p><hr> 3555682Smarkm<a name="Top"></a>Up: <a rel="up" accesskey="u" href="#dir">(dir)</a> 3655682Smarkm<br> 3755682Smarkm</div> 3855682Smarkm 3955682Smarkm<h2 class="unnumbered">Top</h2> 4055682Smarkm 4155682Smarkm<ul class="menu"> 4255682Smarkm<li><a accesskey="1" href="#Description">Description</a> 4355682Smarkm<li><a accesskey="2" href="#ntp_002dkeygen-Invocation">ntp-keygen Invocation</a>: Invoking ntp-keygen 4455682Smarkm<li><a accesskey="3" href="#Running-the-Program">Running the Program</a> 4555682Smarkm<li><a accesskey="4" href="#Random-Seed-File">Random Seed File</a> 4655682Smarkm<li><a accesskey="5" href="#Cryptographic-Data-Files">Cryptographic Data Files</a> 4755682Smarkm</ul> 4855682Smarkm 4955682Smarkm<div class="node"> 5055682Smarkm<p><hr> 5155682Smarkm<a name="Top"></a>Next: <a rel="next" accesskey="n" href="#Description">Description</a>, 5255682SmarkmPrevious: <a rel="previous" accesskey="p" href="#dir">(dir)</a>, 5355682SmarkmUp: <a rel="up" accesskey="u" href="#dir">(dir)</a> 5455682Smarkm<br> 5572445Sassar</div> 5655682Smarkm 5755682Smarkm<h2 class="unnumbered">NTP Key Generation Program User Manual</h2> 5890926Snectar 5955682Smarkm<p>This document describes the use of the NTP Project's <code>ntp-keygen</code> 6055682Smarkmprogram, that generates cryptographic data files used by the NTPv4 6155682Smarkmauthentication and identity schemes. 6255682SmarkmIt can generate message digest keys used in symmetric key cryptography and, 6355682Smarkmif the OpenSSL software 6455682Smarkmlibrary has been installed, it can generate host keys, sign keys, 6555682Smarkmcertificates, and identity keys and parameters used by the Autokey 6655682Smarkmpublic key cryptography. 6755682SmarkmThe message digest keys file is generated in a 6855682Smarkmformat compatible with NTPv3. 6972445SassarAll other files are in PEM-encoded 7072445Sassarprintable ASCII format so they can be embedded as MIME attachments in 7155682Smarkmmail to other sites. 7255682Smarkm 7355682Smarkm <p>This document applies to version 4.2.8 of <code>ntp-keygen</code>. 7455682Smarkm 7555682Smarkm<div class="node"> 7690926Snectar<p><hr> 7772445Sassar<a name="Description"></a>Next: <a rel="next" accesskey="n" href="#Running-the-Program">Running the Program</a>, 7855682SmarkmPrevious: <a rel="previous" accesskey="p" href="#Top">Top</a>, 7972445SassarUp: <a rel="up" accesskey="u" href="#Top">Top</a> 8090926Snectar<br> 8172445Sassar</div> 8272445Sassar 8372445Sassar<!-- node-name, next, previous, up --> 8455682Smarkm<h3 class="section">Description</h3> 8555682Smarkm 8655682Smarkm<p>This program generates cryptographic data files used by the NTPv4 8772445Sassarauthentication and identity schemes. It can generate message digest 8855682Smarkmkeys used in symmetric key cryptography and, if the OpenSSL software 8990926Snectarlibrary has been installed, it can generate host keys, sign keys, 9090926Snectarcertificates, and identity keys and parameters used by the Autokey 9155682Smarkmpublic key cryptography. The message digest keys file is generated in a 9255682Smarkmformat compatible with NTPv3. All other files are in PEM-encoded 9355682Smarkmprintable ASCII format so they can be embedded as MIME attachments in 9455682Smarkmmail to other sites. 9555682Smarkm 9690926Snectar <p>When used to generate message digest keys, the program produces a file 9790926Snectarcontaining ten pseudo-random printable ASCII strings suitable for the 9890926SnectarMD5 message digest algorithm included in the distribution. 9990926SnectarIf the 10072445SassarOpenSSL library is installed, it produces an additional ten hex-encoded 10190926Snectarrandom bit strings suitable for the SHA1 and other message digest 10272445Sassaralgorithms. 10390926SnectarThe message digest keys file must be distributed and stored 10455682Smarkmusing secure means beyond the scope of NTP itself. 10555682SmarkmBesides the keys 10655682Smarkmused for ordinary NTP associations, additional keys can be defined as 10755682Smarkmpasswords for the ntpq and ntpdc utility programs. 10855682Smarkm 10955682Smarkm <p>The remaining generated files are compatible with other OpenSSL 11055682Smarkmapplications and other Public Key Infrastructure (PKI) resources. 11155682SmarkmCertificates generated by this program are compatible with extant 11255682Smarkmindustry practice, although some users might find the interpretation of 11372445SassarX509v3 extension fields somewhat liberal. 11455682SmarkmHowever, the identity keys 11555682Smarkmare probably not compatible with anything other than Autokey. 11655682Smarkm 11755682Smarkm <p>Some files used by this program are encrypted using a private password. 11855682SmarkmThe <code>-p</code> option specifies the password for local encrypted files and the 11955682Smarkm<code>-q</code> option the password for encrypted files sent to remote sites. 12055682SmarkmIf no password is specified, the host name returned by the Unix 12155682Smarkm<code>gethostname()</code> function, normally the DNS name of the host, is used. 12290926Snectar 12390926Snectar <p>The <kbd>pw</kbd> option of the <code>crypto</code> configuration command 12490926Snectarspecifies the read password for previously encrypted local files. 12590926SnectarThis must match the local password used by this program. 12655682SmarkmIf not specified, the host name is used. 12790926SnectarThus, if files are generated by this program without password, 12890926Snectarthey can be read back by ntpd without password, but only on the same 12972445Sassarhost. 13072445Sassar 13172445Sassar <p>Normally, encrypted files for each host are generated by that host and 13255682Smarkmused only by that host, although exceptions exist as noted later on 13390926Snectarthis page. 13472445SassarThe symmetric keys file, normally called <code>ntp.keys</code>, is 13555682Smarkmusually installed in <code>/etc</code>. 13655682SmarkmOther files and links are usually installed 13772445Sassarin <code>/usr/local/etc</code>, which is normally in a shared filesystem in 13855682SmarkmNFS-mounted networks and cannot be changed by shared clients. 13990926SnectarThe location of the keys directory can be changed by the keysdir 14055682Smarkmconfiguration command in such cases. 14172445SassarNormally, this is in <code>/etc</code>. 14272445Sassar 14355682Smarkm <p>This program directs commentary and error messages to the standard 14455682Smarkmerror stream <code>stderr</code> and remote files to the standard output stream 14555682Smarkm<code>stdout</code> where they can be piped to other applications or redirected to 14655682Smarkmfiles. 14755682SmarkmThe names used for generated files and links all begin with the 14855682Smarkmstring <code>ntpkey</code> and include the file type, 14955682Smarkmgenerating host and filestamp, 15055682Smarkmas described in the <a href="#Cryptographic-Data-Files">Cryptographic Data Files</a> section below. 15155682Smarkm 15255682Smarkm<div class="node"> 15355682Smarkm<p><hr> 15455682Smarkm<a name="Running-the-Program"></a>Next: <a rel="next" accesskey="n" href="#Random-Seed-File">Random Seed File</a>, 15555682SmarkmPrevious: <a rel="previous" accesskey="p" href="#Description">Description</a>, 15655682SmarkmUp: <a rel="up" accesskey="u" href="#Top">Top</a> 15755682Smarkm<br> 15855682Smarkm</div> 15955682Smarkm 16090926Snectar<!-- node-name, next, previous, up --> 16172445Sassar<h3 class="section">Running the Program</h3> 16255682Smarkm 16355682Smarkm<p>To test and gain experience with Autokey concepts, log in as root and 16455682Smarkmchange to the keys directory, usually <code>/usr/local/etc</code>. 16555682SmarkmWhen run for the 16655682Smarkmfirst time, or if all files with names beginning <code>ntpkey</code>] have been 16755682Smarkmremoved, use the <code>ntp-keygen</code> command without arguments to generate a 16855682Smarkmdefault RSA host key and matching RSA-MD5 certificate with expiration 16972445Sassardate one year hence. 17072445SassarIf run again without options, the program uses the 17155682Smarkmexisting keys and parameters and generates only a new certificate with 17255682Smarkmnew expiration date one year hence. 17355682Smarkm 17455682Smarkm <p>Run the command on as many hosts as necessary. 17555682SmarkmDesignate one of them as the trusted host (TH) using <code>ntp-keygen</code> 17655682Smarkmwith the <code>-T</code> option and configure 17755682Smarkmit to synchronize from reliable Internet servers. 17855682SmarkmThen configure the other hosts to synchronize to the TH directly or indirectly. 17972445SassarA certificate trail is created when Autokey asks the immediately 18072445Sassarascendant host towards the TH to sign its certificate, which is then 18172445Sassarprovided to the immediately descendant host on request. 18255682SmarkmAll group hosts should have acyclic certificate trails ending on the TH. 18390926Snectar 18455682Smarkm <p>The host key is used to encrypt the cookie when required and so must be 18555682SmarkmRSA type. 18655682SmarkmBy default, the host key is also the sign key used to encrypt signatures. 18755682SmarkmA different sign key can be assigned using the <code>-S</code> option 18855682Smarkmand this can be either RSA or DSA type. 18990926SnectarBy default, the signature 19055682Smarkmmessage digest type is MD5, but any combination of sign key type and 19190926Snectarmessage digest type supported by the OpenSSL library can be specified 19272445Sassarusing the <code>-c</code> option. 19355682Smarkm 19490926Snectar <p>The rules say cryptographic media should be generated with proventic 19578527Sassarfilestamps, which means the host should already be synchronized before 19690926Snectarthis program is run. 19790926SnectarThis of course creates a chicken-and-egg problem 19855682Smarkmwhen the host is started for the first time. 19955682SmarkmAccordingly, the host time 20090926Snectarshould be set by some other means, such as eyeball-and-wristwatch, at 20190926Snectarleast so that the certificate lifetime is within the current year. 20272445SassarAfter that and when the host is synchronized to a proventic source, the 20372445Sassarcertificate should be re-generated. 20472445Sassar 20572445Sassar <p>Additional information on trusted groups and identity schemes is on the 20672445SassarAutokey Public-Key Authentication page. 20772445Sassar 20872445Sassar<div class="node"> 20972445Sassar<p><hr> 21072445Sassar<a name="ntp_002dkeygen-Invocation"></a> 21172445Sassar<br> 21272445Sassar</div> 21372445Sassar 21472445Sassar<h3 class="section">Invoking ntp-keygen</h3> 21572445Sassar 21672445Sassar<p><a name="index-ntp_002dkeygen-1"></a><a name="index-Create-a-NTP-host-key-2"></a> 21772445Sassar 21855682Smarkm <p>This program generates cryptographic data files used by the NTPv4 21972445Sassarauthentication and identification schemes. 22055682SmarkmIt generates MD5 key files used in symmetric key cryptography. 22190926SnectarIn addition, if the OpenSSL software library has been installed, 22290926Snectarit generates keys, certificate and identity files used in public key 22390926Snectarcryptography. 22455682SmarkmThese files are used for cookie encryption, 22590926Snectardigital signature and challenge/response identification algorithms 22690926Snectarcompatible with the Internet standard security infrastructure. 22790926Snectar 22890926Snectar <p>All files are in PEM-encoded printable ASCII format, 22955682Smarkmso they can be embedded as MIME attachments in mail to other sites 23090926Snectarand certificate authorities. 23190926SnectarBy default, files are not encrypted. 23290926Snectar 23355682Smarkm <p>When used to generate message digest keys, the program produces a file 23490926Snectarcontaining ten pseudo-random printable ASCII strings suitable for the 23590926SnectarMD5 message digest algorithm included in the distribution. 23690926SnectarIf the OpenSSL library is installed, it produces an additional ten 23790926Snectarhex-encoded random bit strings suitable for the SHA1 and other message 23890926Snectardigest algorithms. 23990926SnectarThe message digest keys file must be distributed and stored 24090926Snectarusing secure means beyond the scope of NTP itself. 24190926SnectarBesides the keys used for ordinary NTP associations, additional keys 24255682Smarkmcan be defined as passwords for the 24355682Smarkm<code>ntpq(1ntpqmdoc)</code> 24490926Snectarand 24555682Smarkm<code>ntpdc(1ntpdcmdoc)</code> 24690926Snectarutility programs. 24790926Snectar 24855682Smarkm <p>The remaining generated files are compatible with other OpenSSL 24990926Snectarapplications and other Public Key Infrastructure (PKI) resources. 25090926SnectarCertificates generated by this program are compatible with extant 25155682Smarkmindustry practice, although some users might find the interpretation of 25290926SnectarX509v3 extension fields somewhat liberal. 25390926SnectarHowever, the identity keys are probably not compatible with anything 25490926Snectarother than Autokey. 25590926Snectar 25690926Snectar <p>Some files used by this program are encrypted using a private password. 25790926SnectarThe 25890926Snectar<code>-p</code> 25990926Snectaroption specifies the password for local encrypted files and the 26090926Snectar<code>-q</code> 26190926Snectaroption the password for encrypted files sent to remote sites. 26290926SnectarIf no password is specified, the host name returned by the Unix 26355682Smarkm<code>gethostname()</code> 26455682Smarkmfunction, normally the DNS name of the host is used. 26555682Smarkm 26655682Smarkm <p>The 26755682Smarkm<kbd>pw</kbd> 26855682Smarkmoption of the 26990926Snectar<kbd>crypto</kbd> 27055682Smarkmconfiguration command specifies the read 27155682Smarkmpassword for previously encrypted local files. 27255682SmarkmThis must match the local password used by this program. 27355682SmarkmIf not specified, the host name is used. 27455682SmarkmThus, if files are generated by this program without password, 27555682Smarkmthey can be read back by 27655682Smarkm<kbd>ntpd</kbd> 27755682Smarkmwithout password but only on the same host. 27855682Smarkm 27955682Smarkm <p>Normally, encrypted files for each host are generated by that host and 28055682Smarkmused only by that host, although exceptions exist as noted later on 28155682Smarkmthis page. 28255682SmarkmThe symmetric keys file, normally called 28355682Smarkm<kbd>ntp.keys</kbd>, 28455682Smarkmis usually installed in 28555682Smarkm<span class="file">/etc</span>. 28655682SmarkmOther files and links are usually installed in 28755682Smarkm<span class="file">/usr/local/etc</span>, 28855682Smarkmwhich is normally in a shared filesystem in 28955682SmarkmNFS-mounted networks and cannot be changed by shared clients. 29055682SmarkmThe location of the keys directory can be changed by the 29155682Smarkm<kbd>keysdir</kbd> 29278527Sassarconfiguration command in such cases. 29378527SassarNormally, this is in 29478527Sassar<span class="file">/etc</span>. 29578527Sassar 29678527Sassar <p>This program directs commentary and error messages to the standard 29778527Sassarerror stream 29878527Sassar<kbd>stderr</kbd> 29978527Sassarand remote files to the standard output stream 30055682Smarkm<kbd>stdout</kbd> 30178527Sassarwhere they can be piped to other applications or redirected to files. 30255682SmarkmThe names used for generated files and links all begin with the 30355682Smarkmstring 30455682Smarkm<kbd>ntpkey</kbd> 30555682Smarkmand include the file type, generating host and filestamp, 30655682Smarkmas described in the 30755682SmarkmCryptographic Data Files 30855682Smarkmsection below. 30955682Smarkm 31055682Smarkm<h5 class="subsubsection">Running the Program</h5> 31155682Smarkm 31255682Smarkm<p>To test and gain experience with Autokey concepts, log in as root and 31355682Smarkmchange to the keys directory, usually 31455682Smarkm<span class="file">/usr/local/etc</span> 31555682SmarkmWhen run for the first time, or if all files with names beginning with 31655682Smarkm<kbd>ntpkey</kbd> 31755682Smarkmhave been removed, use the 31855682Smarkm<code>ntp-keygen</code> 31955682Smarkmcommand without arguments to generate a 32072445Sassardefault RSA host key and matching RSA-MD5 certificate with expiration 32172445Sassardate one year hence. 32272445SassarIf run again without options, the program uses the 32372445Sassarexisting keys and parameters and generates only a new certificate with 32472445Sassarnew expiration date one year hence. 32572445Sassar 32655682Smarkm <p>Run the command on as many hosts as necessary. 32772445SassarDesignate one of them as the trusted host (TH) using 32855682Smarkm<code>ntp-keygen</code> 32972445Sassarwith the 33072445Sassar<code>-T</code> 33155682Smarkmoption and configure it to synchronize from reliable Internet servers. 33255682SmarkmThen configure the other hosts to synchronize to the TH directly or 33355682Smarkmindirectly. 33490926SnectarA certificate trail is created when Autokey asks the immediately 33555682Smarkmascendant host towards the TH to sign its certificate, which is then 33690926Snectarprovided to the immediately descendant host on request. 33755682SmarkmAll group hosts should have acyclic certificate trails ending on the TH. 33872445Sassar 33972445Sassar <p>The host key is used to encrypt the cookie when required and so must be 34072445SassarRSA type. 34172445SassarBy default, the host key is also the sign key used to encrypt 34272445Sassarsignatures. 34355682SmarkmA different sign key can be assigned using the 34455682Smarkm<code>-S</code> 34572445Sassaroption and this can be either RSA or DSA type. 34655682SmarkmBy default, the signature 34778527Sassarmessage digest type is MD5, but any combination of sign key type and 34878527Sassarmessage digest type supported by the OpenSSL library can be specified 34978527Sassarusing the 35090926Snectar<code>-c</code> 35178527Sassaroption. 35255682SmarkmThe rules say cryptographic media should be generated with proventic 35390926Snectarfilestamps, which means the host should already be synchronized before 35455682Smarkmthis program is run. 35590926SnectarThis of course creates a chicken-and-egg problem 35655682Smarkmwhen the host is started for the first time. 35790926SnectarAccordingly, the host time 35890926Snectarshould be set by some other means, such as eyeball-and-wristwatch, at 35955682Smarkmleast so that the certificate lifetime is within the current year. 36055682SmarkmAfter that and when the host is synchronized to a proventic source, the 36155682Smarkmcertificate should be re-generated. 36290926Snectar 36390926Snectar <p>Additional information on trusted groups and identity schemes is on the 36490926SnectarAutokey Public-Key Authentication 36590926Snectarpage. 36690926Snectar 36755682Smarkm <p>The 36872445Sassar<code>ntpd(1ntpdmdoc)</code> 36972445Sassarconfiguration command 37055682Smarkm<code>crypto</code> <code>pw</code> <kbd>password</kbd> 37155682Smarkmspecifies the read password for previously encrypted files. 37272445SassarThe daemon expires on the spot if the password is missing 37372445Sassaror incorrect. 37455682SmarkmFor convenience, if a file has been previously encrypted, 37555682Smarkmthe default read password is the name of the host running 37655682Smarkmthe program. 37755682SmarkmIf the previous write password is specified as the host name, 37855682Smarkmthese files can be read by that host with no explicit password. 37955682Smarkm 38055682Smarkm <p>File names begin with the prefix 38190926Snectar<code>ntpkey_</code> 38290926Snectarand end with the postfix 38390926Snectar<kbd>_hostname.filestamp</kbd>, 38490926Snectarwhere 38590926Snectar<kbd>hostname</kbd> 38655682Smarkmis the owner name, usually the string returned 38755682Smarkmby the Unix gethostname() routine, and 38855682Smarkm<kbd>filestamp</kbd> 38990926Snectaris the NTP seconds when the file was generated, in decimal digits. 39090926SnectarThis both guarantees uniqueness and simplifies maintenance 39190926Snectarprocedures, since all files can be quickly removed 39255682Smarkmby a 39355682Smarkm<code>rm</code> <code>ntpkey*</code> 39455682Smarkmcommand or all files generated 39590926Snectarat a specific time can be removed by a 39690926Snectar<code>rm</code> 39790926Snectar<kbd>*filestamp</kbd> 39890926Snectarcommand. 39990926SnectarTo further reduce the risk of misconfiguration, 40055682Smarkmthe first two lines of a file contain the file name 40155682Smarkmand generation date and time as comments. 40290926Snectar 40355682Smarkm <p>All files are installed by default in the keys directory 40455682Smarkm<span class="file">/usr/local/etc</span>, 40555682Smarkmwhich is normally in a shared filesystem 40690926Snectarin NFS-mounted networks. 40790926SnectarThe actual location of the keys directory 40855682Smarkmand each file can be overridden by configuration commands, 40990926Snectarbut this is not recommended. 41090926SnectarNormally, the files for each host are generated by that host 41190926Snectarand used only by that host, although exceptions exist 41255682Smarkmas noted later on this page. 41355682Smarkm 41455682Smarkm <p>Normally, files containing private values, 41555682Smarkmincluding the host key, sign key and identification parameters, 41655682Smarkmare permitted root read/write-only; 41790926Snectarwhile others containing public values are permitted world readable. 41855682SmarkmAlternatively, files containing private values can be encrypted 41955682Smarkmand these files permitted world readable, 42090926Snectarwhich simplifies maintenance in shared file systems. 42190926SnectarSince uniqueness is insured by the hostname and 42290926Snectarfile name extensions, the files for a NFS server and 42355682Smarkmdependent clients can all be installed in the same shared directory. 42490926Snectar 42555682Smarkm <p>The recommended practice is to keep the file name extensions 42690926Snectarwhen installing a file and to install a soft link 42755682Smarkmfrom the generic names specified elsewhere on this page 42890926Snectarto the generated files. 42990926SnectarThis allows new file generations to be activated simply 43055682Smarkmby changing the link. 43190926SnectarIf a link is present, ntpd follows it to the file name 43255682Smarkmto extract the filestamp. 43390926SnectarIf a link is not present, 43455682Smarkm<code>ntpd(1ntpdmdoc)</code> 43590926Snectarextracts the filestamp from the file itself. 43655682SmarkmThis allows clients to verify that the file and generation times 43790926Snectarare always current. 43890926SnectarThe 43990926Snectar<code>ntp-keygen</code> 44090926Snectarprogram uses the same timestamp extension for all files generated 44190926Snectarat one time, so each generation is distinct and can be readily 44290926Snectarrecognized in monitoring data. 44390926Snectar 44490926Snectar<h5 class="subsubsection">Running the program</h5> 44590926Snectar 44690926Snectar<p>The safest way to run the 44790926Snectar<code>ntp-keygen</code> 44890926Snectarprogram is logged in directly as root. 44990926SnectarThe recommended procedure is change to the keys directory, 45090926Snectarusually 45155682Smarkm<span class="file">/usr/local/etc</span>, 45255682Smarkmthen run the program. 45390926SnectarWhen run for the first time, 45455682Smarkmor if all 45590926Snectar<code>ntpkey</code> 45655682Smarkmfiles have been removed, 45790926Snectarthe program generates a RSA host key file and matching RSA-MD5 certificate file, 45890926Snectarwhich is all that is necessary in many cases. 45990926SnectarThe program also generates soft links from the generic names 46090926Snectarto the respective files. 46190926SnectarIf run again, the program uses the same host key file, 46290926Snectarbut generates a new certificate file and link. 46390926Snectar 46490926Snectar <p>The host key is used to encrypt the cookie when required and so must be RSA type. 46590926SnectarBy default, the host key is also the sign key used to encrypt signatures. 46690926SnectarWhen necessary, a different sign key can be specified and this can be 46790926Snectareither RSA or DSA type. 46890926SnectarBy default, the message digest type is MD5, but any combination 46990926Snectarof sign key type and message digest type supported by the OpenSSL library 47090926Snectarcan be specified, including those using the MD2, MD5, SHA, SHA1, MDC2 47190926Snectarand RIPE160 message digest algorithms. 47290926SnectarHowever, the scheme specified in the certificate must be compatible 47390926Snectarwith the sign key. 47490926SnectarCertificates using any digest algorithm are compatible with RSA sign keys; 47590926Snectarhowever, only SHA and SHA1 certificates are compatible with DSA sign keys. 47690926Snectar 47790926Snectar <p>Private/public key files and certificates are compatible with 47890926Snectarother OpenSSL applications and very likely other libraries as well. 47990926SnectarCertificates or certificate requests derived from them should be compatible 48055682Smarkmwith extant industry practice, although some users might find 48155682Smarkmthe interpretation of X509v3 extension fields somewhat liberal. 48255682SmarkmHowever, the identification parameter files, although encoded 48355682Smarkmas the other files, are probably not compatible with anything other than Autokey. 48455682Smarkm 48572445Sassar <p>Running the program as other than root and using the Unix 48672445Sassar<code>su</code> 48772445Sassarcommand 48872445Sassarto assume root may not work properly, since by default the OpenSSL library 48955682Smarkmlooks for the random seed file 49055682Smarkm<code>.rnd</code> 49155682Smarkmin the user home directory. 49255682SmarkmHowever, there should be only one 49355682Smarkm<code>.rnd</code>, 49455682Smarkmmost conveniently 49555682Smarkmin the root directory, so it is convenient to define the 49655682Smarkm<code>$RANDFILE</code> 49755682Smarkmenvironment variable used by the OpenSSL library as the path to 49855682Smarkm<code>/.rnd</code>. 49955682Smarkm 50072445Sassar <p>Installing the keys as root might not work in NFS-mounted 50172445Sassarshared file systems, as NFS clients may not be able to write 50255682Smarkmto the shared keys directory, even as root. 50355682SmarkmIn this case, NFS clients can specify the files in another 50455682Smarkmdirectory such as 50555682Smarkm<span class="file">/etc</span> 50655682Smarkmusing the 50755682Smarkm<code>keysdir</code> 50855682Smarkmcommand. 50955682SmarkmThere is no need for one client to read the keys and certificates 51055682Smarkmof other clients or servers, as these data are obtained automatically 51155682Smarkmby the Autokey protocol. 51255682Smarkm 51355682Smarkm <p>Ordinarily, cryptographic files are generated by the host that uses them, 51455682Smarkmbut it is possible for a trusted agent (TA) to generate these files 51555682Smarkmfor other hosts; however, in such cases files should always be encrypted. 51655682SmarkmThe subject name and trusted name default to the hostname 51755682Smarkmof the host generating the files, but can be changed by command line options. 51855682SmarkmIt is convenient to designate the owner name and trusted name 51955682Smarkmas the subject and issuer fields, respectively, of the certificate. 52055682SmarkmThe owner name is also used for the host and sign key files, 52155682Smarkmwhile the trusted name is used for the identity files. 52255682Smarkm 52355682Smarkm <p>All files are installed by default in the keys directory 52455682Smarkm<span class="file">/usr/local/etc</span>, 52555682Smarkmwhich is normally in a shared filesystem 52655682Smarkmin NFS-mounted networks. 52755682SmarkmThe actual location of the keys directory 52855682Smarkmand each file can be overridden by configuration commands, 52955682Smarkmbut this is not recommended. 53055682SmarkmNormally, the files for each host are generated by that host 53155682Smarkmand used only by that host, although exceptions exist 53255682Smarkmas noted later on this page. 53355682Smarkm 53455682Smarkm <p>Normally, files containing private values, 53555682Smarkmincluding the host key, sign key and identification parameters, 53655682Smarkmare permitted root read/write-only; 53755682Smarkmwhile others containing public values are permitted world readable. 53855682SmarkmAlternatively, files containing private values can be encrypted 53955682Smarkmand these files permitted world readable, 54055682Smarkmwhich simplifies maintenance in shared file systems. 54155682SmarkmSince uniqueness is insured by the hostname and 54255682Smarkmfile name extensions, the files for a NFS server and 54355682Smarkmdependent clients can all be installed in the same shared directory. 54455682Smarkm 54555682Smarkm <p>The recommended practice is to keep the file name extensions 54655682Smarkmwhen installing a file and to install a soft link 54755682Smarkmfrom the generic names specified elsewhere on this page 54855682Smarkmto the generated files. 54955682SmarkmThis allows new file generations to be activated simply 55055682Smarkmby changing the link. 55155682SmarkmIf a link is present, ntpd follows it to the file name 55255682Smarkmto extract the filestamp. 55355682SmarkmIf a link is not present, 55455682Smarkm<code>ntpd(1ntpdmdoc)</code> 55555682Smarkmextracts the filestamp from the file itself. 55655682SmarkmThis allows clients to verify that the file and generation times 55755682Smarkmare always current. 55855682SmarkmThe 55955682Smarkm<code>ntp-keygen</code> 56055682Smarkmprogram uses the same timestamp extension for all files generated 56155682Smarkmat one time, so each generation is distinct and can be readily 56255682Smarkmrecognized in monitoring data. 56355682Smarkm 56455682Smarkm<h5 class="subsubsection">Running the program</h5> 56555682Smarkm 56655682Smarkm<p>The safest way to run the 56755682Smarkm<code>ntp-keygen</code> 56855682Smarkmprogram is logged in directly as root. 56955682SmarkmThe recommended procedure is change to the keys directory, 57072445Sassarusually 57172445Sassar<span class="file">/usr/local/etc</span>, 57255682Smarkmthen run the program. 57355682SmarkmWhen run for the first time, 57455682Smarkmor if all 57555682Smarkm<code>ntpkey</code> 57655682Smarkmfiles have been removed, 57755682Smarkmthe program generates a RSA host key file and matching RSA-MD5 certificate file, 57855682Smarkmwhich is all that is necessary in many cases. 57955682SmarkmThe program also generates soft links from the generic names 58055682Smarkmto the respective files. 58155682SmarkmIf run again, the program uses the same host key file, 58255682Smarkmbut generates a new certificate file and link. 58355682Smarkm 58455682Smarkm <p>The host key is used to encrypt the cookie when required and so must be RSA type. 58555682SmarkmBy default, the host key is also the sign key used to encrypt signatures. 58655682SmarkmWhen necessary, a different sign key can be specified and this can be 58755682Smarkmeither RSA or DSA type. 58855682SmarkmBy default, the message digest type is MD5, but any combination 58955682Smarkmof sign key type and message digest type supported by the OpenSSL library 59055682Smarkmcan be specified, including those using the MD2, MD5, SHA, SHA1, MDC2 59155682Smarkmand RIPE160 message digest algorithms. 59255682SmarkmHowever, the scheme specified in the certificate must be compatible 59355682Smarkmwith the sign key. 59455682SmarkmCertificates using any digest algorithm are compatible with RSA sign keys; 59555682Smarkmhowever, only SHA and SHA1 certificates are compatible with DSA sign keys. 59655682Smarkm 59755682Smarkm <p>Private/public key files and certificates are compatible with 59855682Smarkmother OpenSSL applications and very likely other libraries as well. 59955682SmarkmCertificates or certificate requests derived from them should be compatible 60055682Smarkmwith extant industry practice, although some users might find 60155682Smarkmthe interpretation of X509v3 extension fields somewhat liberal. 60255682SmarkmHowever, the identification parameter files, although encoded 60355682Smarkmas the other files, are probably not compatible with anything other than Autokey. 60455682Smarkm 60555682Smarkm <p>Running the program as other than root and using the Unix 60655682Smarkm<code>su</code> 60755682Smarkmcommand 60855682Smarkmto assume root may not work properly, since by default the OpenSSL library 60955682Smarkmlooks for the random seed file 610<code>.rnd</code> 611in the user home directory. 612However, there should be only one 613<code>.rnd</code>, 614most conveniently 615in the root directory, so it is convenient to define the 616<code>$RANDFILE</code> 617environment variable used by the OpenSSL library as the path to 618<code>/.rnd</code>. 619 620 <p>Installing the keys as root might not work in NFS-mounted 621shared file systems, as NFS clients may not be able to write 622to the shared keys directory, even as root. 623In this case, NFS clients can specify the files in another 624directory such as 625<span class="file">/etc</span> 626using the 627<code>keysdir</code> 628command. 629There is no need for one client to read the keys and certificates 630of other clients or servers, as these data are obtained automatically 631by the Autokey protocol. 632 633 <p>Ordinarily, cryptographic files are generated by the host that uses them, 634but it is possible for a trusted agent (TA) to generate these files 635for other hosts; however, in such cases files should always be encrypted. 636The subject name and trusted name default to the hostname 637of the host generating the files, but can be changed by command line options. 638It is convenient to designate the owner name and trusted name 639as the subject and issuer fields, respectively, of the certificate. 640The owner name is also used for the host and sign key files, 641while the trusted name is used for the identity files. 642seconds. 643seconds. 644 645 <p>s Trusted Hosts and Groups 646Each cryptographic configuration involves selection of a signature scheme 647and identification scheme, called a cryptotype, 648as explained in the 649<a href="#Authentication-Options">Authentication Options</a> 650section of 651<code>ntp.conf(5)</code>. 652The default cryptotype uses RSA encryption, MD5 message digest 653and TC identification. 654First, configure a NTP subnet including one or more low-stratum 655trusted hosts from which all other hosts derive synchronization 656directly or indirectly. 657Trusted hosts have trusted certificates; 658all other hosts have nontrusted certificates. 659These hosts will automatically and dynamically build authoritative 660certificate trails to one or more trusted hosts. 661A trusted group is the set of all hosts that have, directly or indirectly, 662a certificate trail ending at a trusted host. 663The trail is defined by static configuration file entries 664or dynamic means described on the 665<a href="#Automatic-NTP-Configuration-Options">Automatic NTP Configuration Options</a> 666section of 667<code>ntp.conf(5)</code>. 668 669 <p>On each trusted host as root, change to the keys directory. 670To insure a fresh fileset, remove all 671<code>ntpkey</code> 672files. 673Then run 674<code>ntp-keygen</code> 675<code>-T</code> 676to generate keys and a trusted certificate. 677On all other hosts do the same, but leave off the 678<code>-T</code> 679flag to generate keys and nontrusted certificates. 680When complete, start the NTP daemons beginning at the lowest stratum 681and working up the tree. 682It may take some time for Autokey to instantiate the certificate trails 683throughout the subnet, but setting up the environment is completely automatic. 684 685 <p>If it is necessary to use a different sign key or different digest/signature 686scheme than the default, run 687<code>ntp-keygen</code> 688with the 689<code>-S</code> <kbd>type</kbd> 690option, where 691<kbd>type</kbd> 692is either 693<code>RSA</code> 694or 695<code>DSA</code>. 696The most often need to do this is when a DSA-signed certificate is used. 697If it is necessary to use a different certificate scheme than the default, 698run 699<code>ntp-keygen</code> 700with the 701<code>-c</code> <kbd>scheme</kbd> 702option and selected 703<kbd>scheme</kbd> 704as needed. 705f 706<code>ntp-keygen</code> 707is run again without these options, it generates a new certificate 708using the same scheme and sign key. 709 710 <p>After setting up the environment it is advisable to update certificates 711from time to time, if only to extend the validity interval. 712Simply run 713<code>ntp-keygen</code> 714with the same flags as before to generate new certificates 715using existing keys. 716However, if the host or sign key is changed, 717<code>ntpd(1ntpdmdoc)</code> 718should be restarted. 719When 720<code>ntpd(1ntpdmdoc)</code> 721is restarted, it loads any new files and restarts the protocol. 722Other dependent hosts will continue as usual until signatures are refreshed, 723at which time the protocol is restarted. 724 725<h5 class="subsubsection">Identity Schemes</h5> 726 727<p>As mentioned on the Autonomous Authentication page, 728the default TC identity scheme is vulnerable to a middleman attack. 729However, there are more secure identity schemes available, 730including PC, IFF, GQ and MV described on the 731"Identification Schemes" 732page 733(maybe available at 734<code>http://www.eecis.udel.edu/%7emills/keygen.html</code>). 735These schemes are based on a TA, one or more trusted hosts 736and some number of nontrusted hosts. 737Trusted hosts prove identity using values provided by the TA, 738while the remaining hosts prove identity using values provided 739by a trusted host and certificate trails that end on that host. 740The name of a trusted host is also the name of its sugroup 741and also the subject and issuer name on its trusted certificate. 742The TA is not necessarily a trusted host in this sense, but often is. 743 744 <p>In some schemes there are separate keys for servers and clients. 745A server can also be a client of another server, 746but a client can never be a server for another client. 747In general, trusted hosts and nontrusted hosts that operate 748as both server and client have parameter files that contain 749both server and client keys. 750Hosts that operate 751only as clients have key files that contain only client keys. 752 753 <p>The PC scheme supports only one trusted host in the group. 754On trusted host alice run 755<code>ntp-keygen</code> 756<code>-P</code> 757<code>-p</code> <kbd>password</kbd> 758to generate the host key file 759<span class="file">ntpkey_RSAkey_</span><kbd>alice.filestamp</kbd> 760and trusted private certificate file 761<span class="file">ntpkey_RSA-MD5_cert_</span><kbd>alice.filestamp</kbd>. 762Copy both files to all group hosts; 763they replace the files which would be generated in other schemes. 764On each host bob install a soft link from the generic name 765<span class="file">ntpkey_host_</span><kbd>bob</kbd> 766to the host key file and soft link 767<span class="file">ntpkey_cert_</span><kbd>bob</kbd> 768to the private certificate file. 769Note the generic links are on bob, but point to files generated 770by trusted host alice. 771In this scheme it is not possible to refresh 772either the keys or certificates without copying them 773to all other hosts in the group. 774 775 <p>For the IFF scheme proceed as in the TC scheme to generate keys 776and certificates for all group hosts, then for every trusted host in the group, 777generate the IFF parameter file. 778On trusted host alice run 779<code>ntp-keygen</code> 780<code>-T</code> 781<code>-I</code> 782<code>-p</code> <kbd>password</kbd> 783to produce her parameter file 784<span class="file">ntpkey_IFFpar_</span><kbd>alice.filestamp</kbd>, 785which includes both server and client keys. 786Copy this file to all group hosts that operate as both servers 787and clients and install a soft link from the generic 788<span class="file">ntpkey_iff_</span><kbd>alice</kbd> 789to this file. 790If there are no hosts restricted to operate only as clients, 791there is nothing further to do. 792As the IFF scheme is independent 793of keys and certificates, these files can be refreshed as needed. 794 795 <p>If a rogue client has the parameter file, it could masquerade 796as a legitimate server and present a middleman threat. 797To eliminate this threat, the client keys can be extracted 798from the parameter file and distributed to all restricted clients. 799After generating the parameter file, on alice run 800<code>ntp-keygen</code> 801<code>-e</code> 802and pipe the output to a file or mail program. 803Copy or mail this file to all restricted clients. 804On these clients install a soft link from the generic 805<span class="file">ntpkey_iff_</span><kbd>alice</kbd> 806to this file. 807To further protect the integrity of the keys, 808each file can be encrypted with a secret password. 809 810 <p>For the GQ scheme proceed as in the TC scheme to generate keys 811and certificates for all group hosts, then for every trusted host 812in the group, generate the IFF parameter file. 813On trusted host alice run 814<code>ntp-keygen</code> 815<code>-T</code> 816<code>-G</code> 817<code>-p</code> <kbd>password</kbd> 818to produce her parameter file 819<span class="file">ntpkey_GQpar_</span><kbd>alice.filestamp</kbd>, 820which includes both server and client keys. 821Copy this file to all group hosts and install a soft link 822from the generic 823<span class="file">ntpkey_gq_</span><kbd>alice</kbd> 824to this file. 825In addition, on each host bob install a soft link 826from generic 827<span class="file">ntpkey_gq_</span><kbd>bob</kbd> 828to this file. 829As the GQ scheme updates the GQ parameters file and certificate 830at the same time, keys and certificates can be regenerated as needed. 831 832 <p>For the MV scheme, proceed as in the TC scheme to generate keys 833and certificates for all group hosts. 834For illustration assume trish is the TA, alice one of several trusted hosts 835and bob one of her clients. 836On TA trish run 837<code>ntp-keygen</code> 838<code>-V</code> <kbd>n</kbd> 839<code>-p</code> <kbd>password</kbd>, 840where 841<kbd>n</kbd> 842is the number of revokable keys (typically 5) to produce 843the parameter file 844<span class="file">ntpkeys_MVpar_</span><kbd>trish.filestamp</kbd> 845and client key files 846<span class="file">ntpkeys_MVkeyd_</span><kbd>trish.filestamp</kbd> 847where 848<kbd>d</kbd> 849is the key number (0 < 850<kbd>d</kbd> 851< 852<kbd>n</kbd>). 853Copy the parameter file to alice and install a soft link 854from the generic 855<span class="file">ntpkey_mv_</span><kbd>alice</kbd> 856to this file. 857Copy one of the client key files to alice for later distribution 858to her clients. 859It doesn't matter which client key file goes to alice, 860since they all work the same way. 861Alice copies the client key file to all of her cliens. 862On client bob install a soft link from generic 863<span class="file">ntpkey_mvkey_</span><kbd>bob</kbd> 864to the client key file. 865As the MV scheme is independent of keys and certificates, 866these files can be refreshed as needed. 867 868<h5 class="subsubsection">Command Line Options</h5> 869 870 <dl> 871<dt><code>-c</code> <kbd>scheme</kbd><dd>Select certificate message digest/signature encryption scheme. 872The 873<kbd>scheme</kbd> 874can be one of the following: 875. Cm RSA-MD2 , RSA-MD5 , RSA-SHA , RSA-SHA1 , RSA-MDC2 , RSA-RIPEMD160 , DSA-SHA , 876or 877<code>DSA-SHA1</code>. 878Note that RSA schemes must be used with a RSA sign key and DSA 879schemes must be used with a DSA sign key. 880The default without this option is 881<code>RSA-MD5</code>. 882<br><dt><code>-d</code><dd>Enable debugging. 883This option displays the cryptographic data produced in eye-friendly billboards. 884<br><dt><code>-e</code><dd>Write the IFF client keys to the standard output. 885This is intended for automatic key distribution by mail. 886<br><dt><code>-G</code><dd>Generate parameters and keys for the GQ identification scheme, 887obsoleting any that may exist. 888<br><dt><code>-g</code><dd>Generate keys for the GQ identification scheme 889using the existing GQ parameters. 890If the GQ parameters do not yet exist, create them first. 891<br><dt><code>-H</code><dd>Generate new host keys, obsoleting any that may exist. 892<br><dt><code>-I</code><dd>Generate parameters for the IFF identification scheme, 893obsoleting any that may exist. 894<br><dt><code>-i</code> <kbd>name</kbd><dd>Set the suject name to 895<kbd>name</kbd>. 896This is used as the subject field in certificates 897and in the file name for host and sign keys. 898<br><dt><code>-M</code><dd>Generate MD5 keys, obsoleting any that may exist. 899<br><dt><code>-P</code><dd>Generate a private certificate. 900By default, the program generates public certificates. 901<br><dt><code>-p</code> <kbd>password</kbd><dd>Encrypt generated files containing private data with 902<kbd>password</kbd> 903and the DES-CBC algorithm. 904<br><dt><code>-q</code><dd>Set the password for reading files to password. 905<br><dt><code>-S</code> <code>[RSA | DSA]</code><dd>Generate a new sign key of the designated type, 906obsoleting any that may exist. 907By default, the program uses the host key as the sign key. 908<br><dt><code>-s</code> <kbd>name</kbd><dd>Set the issuer name to 909<kbd>name</kbd>. 910This is used for the issuer field in certificates 911and in the file name for identity files. 912<br><dt><code>-T</code><dd>Generate a trusted certificate. 913By default, the program generates a non-trusted certificate. 914<br><dt><code>-V</code> <kbd>nkeys</kbd><dd>Generate parameters and keys for the Mu-Varadharajan (MV) identification scheme. 915</dl> 916 917<h5 class="subsubsection">Random Seed File</h5> 918 919<p>All cryptographically sound key generation schemes must have means 920to randomize the entropy seed used to initialize 921the internal pseudo-random number generator used 922by the library routines. 923The OpenSSL library uses a designated random seed file for this purpose. 924The file must be available when starting the NTP daemon and 925<code>ntp-keygen</code> 926program. 927If a site supports OpenSSL or its companion OpenSSH, 928it is very likely that means to do this are already available. 929 930 <p>It is important to understand that entropy must be evolved 931for each generation, for otherwise the random number sequence 932would be predictable. 933Various means dependent on external events, such as keystroke intervals, 934can be used to do this and some systems have built-in entropy sources. 935Suitable means are described in the OpenSSL software documentation, 936but are outside the scope of this page. 937 938 <p>The entropy seed used by the OpenSSL library is contained in a file, 939usually called 940<code>.rnd</code>, 941which must be available when starting the NTP daemon 942or the 943<code>ntp-keygen</code> 944program. 945The NTP daemon will first look for the file 946using the path specified by the 947<code>randfile</code> 948subcommand of the 949<code>crypto</code> 950configuration command. 951If not specified in this way, or when starting the 952<code>ntp-keygen</code> 953program, 954the OpenSSL library will look for the file using the path specified 955by the 956.Ev RANDFILE 957environment variable in the user home directory, 958whether root or some other user. 959If the 960.Ev RANDFILE 961environment variable is not present, 962the library will look for the 963<code>.rnd</code> 964file in the user home directory. 965If the file is not available or cannot be written, 966the daemon exits with a message to the system log and the program 967exits with a suitable error message. 968 969<h5 class="subsubsection">Cryptographic Data Files</h5> 970 971<p>All other file formats begin with two lines. 972The first contains the file name, including the generated host name 973and filestamp. 974The second contains the datestamp in conventional Unix date format. 975Lines beginning with # are considered comments and ignored by the 976<code>ntp-keygen</code> 977program and 978<code>ntpd(1ntpdmdoc)</code> 979daemon. 980Cryptographic values are encoded first using ASN.1 rules, 981then encrypted if necessary, and finally written PEM-encoded 982printable ASCII format preceded and followed by MIME content identifier lines. 983 984 <p>The format of the symmetric keys file is somewhat different 985than the other files in the interest of backward compatibility. 986Since DES-CBC is deprecated in NTPv4, the only key format of interest 987is MD5 alphanumeric strings. 988Following hte heard the keys are 989entered one per line in the format 990<pre class="example"> <kbd>keyno</kbd> <kbd>type</kbd> <kbd>key</kbd> 991</pre> 992 <p>where 993<kbd>keyno</kbd> 994is a positive integer in the range 1-65,535, 995<kbd>type</kbd> 996is the string MD5 defining the key format and 997<kbd>key</kbd> 998is the key itself, 999which is a printable ASCII string 16 characters or less in length. 1000Each character is chosen from the 93 printable characters 1001in the range 0x21 through 0x7f excluding space and the 1002# 1003character. 1004 1005 <p>Note that the keys used by the 1006<code>ntpq(1ntpqmdoc)</code> 1007and 1008<code>ntpdc(1ntpdcmdoc)</code> 1009programs 1010are checked against passwords requested by the programs 1011and entered by hand, so it is generally appropriate to specify these keys 1012in human readable ASCII format. 1013 1014 <p>The 1015<code>ntp-keygen</code> 1016program generates a MD5 symmetric keys file 1017<span class="file">ntpkey_MD5key_</span><kbd>hostname.filestamp</kbd>. 1018Since the file contains private shared keys, 1019it should be visible only to root and distributed by secure means 1020to other subnet hosts. 1021The NTP daemon loads the file 1022<span class="file">ntp.keys</span>, 1023so 1024<code>ntp-keygen</code> 1025installs a soft link from this name to the generated file. 1026Subsequently, similar soft links must be installed by manual 1027or automated means on the other subnet hosts. 1028While this file is not used with the Autokey Version 2 protocol, 1029it is needed to authenticate some remote configuration commands 1030used by the 1031<code>ntpq(1ntpqmdoc)</code> 1032and 1033<code>ntpdc(1ntpdcmdoc)</code> 1034utilities. 1035 1036 <p>This section was generated by <strong>AutoGen</strong>, 1037using the <code>agtexi-cmd</code> template and the option descriptions for the <code>ntp-keygen</code> program. 1038This software is released under the NTP license, <http://ntp.org/license>. 1039 1040<ul class="menu"> 1041<li><a accesskey="1" href="#ntp_002dkeygen-usage">ntp-keygen usage</a>: ntp-keygen help/usage (<span class="option">--help</span>) 1042<li><a accesskey="2" href="#ntp_002dkeygen-imbits">ntp-keygen imbits</a>: imbits option (-b) 1043<li><a accesskey="3" href="#ntp_002dkeygen-certificate">ntp-keygen certificate</a>: certificate option (-c) 1044<li><a accesskey="4" href="#ntp_002dkeygen-cipher">ntp-keygen cipher</a>: cipher option (-C) 1045<li><a accesskey="5" href="#ntp_002dkeygen-id_002dkey">ntp-keygen id-key</a>: id-key option (-e) 1046<li><a accesskey="6" href="#ntp_002dkeygen-gq_002dparams">ntp-keygen gq-params</a>: gq-params option (-G) 1047<li><a accesskey="7" href="#ntp_002dkeygen-host_002dkey">ntp-keygen host-key</a>: host-key option (-H) 1048<li><a accesskey="8" href="#ntp_002dkeygen-iffkey">ntp-keygen iffkey</a>: iffkey option (-I) 1049<li><a accesskey="9" href="#ntp_002dkeygen-ident">ntp-keygen ident</a>: ident option (-i) 1050<li><a href="#ntp_002dkeygen-lifetime">ntp-keygen lifetime</a>: lifetime option (-l) 1051<li><a href="#ntp_002dkeygen-md5key">ntp-keygen md5key</a>: md5key option (-M) 1052<li><a href="#ntp_002dkeygen-modulus">ntp-keygen modulus</a>: modulus option (-m) 1053<li><a href="#ntp_002dkeygen-pvt_002dcert">ntp-keygen pvt-cert</a>: pvt-cert option (-P) 1054<li><a href="#ntp_002dkeygen-password">ntp-keygen password</a>: password option (-p) 1055<li><a href="#ntp_002dkeygen-export_002dpasswd">ntp-keygen export-passwd</a>: export-passwd option (-q) 1056<li><a href="#ntp_002dkeygen-sign_002dkey">ntp-keygen sign-key</a>: sign-key option (-S) 1057<li><a href="#ntp_002dkeygen-subject_002dname">ntp-keygen subject-name</a>: subject-name option (-s) 1058<li><a href="#ntp_002dkeygen-trusted_002dcert">ntp-keygen trusted-cert</a>: trusted-cert option (-T) 1059<li><a href="#ntp_002dkeygen-mv_002dparams">ntp-keygen mv-params</a>: mv-params option (-V) 1060<li><a href="#ntp_002dkeygen-mv_002dkeys">ntp-keygen mv-keys</a>: mv-keys option (-v) 1061<li><a href="#ntp_002dkeygen-config">ntp-keygen config</a>: presetting/configuring ntp-keygen 1062<li><a href="#ntp_002dkeygen-exit-status">ntp-keygen exit status</a>: exit status 1063<li><a href="#ntp_002dkeygen-Usage">ntp-keygen Usage</a>: Usage 1064<li><a href="#ntp_002dkeygen-Notes">ntp-keygen Notes</a>: Notes 1065<li><a href="#ntp_002dkeygen-Bugs">ntp-keygen Bugs</a>: Bugs 1066</ul> 1067 1068<div class="node"> 1069<p><hr> 1070<a name="ntp_002dkeygen-usage"></a>Next: <a rel="next" accesskey="n" href="#ntp_002dkeygen-imbits">ntp-keygen imbits</a>, 1071Up: <a rel="up" accesskey="u" href="#ntp_002dkeygen-Invocation">ntp-keygen Invocation</a> 1072<br> 1073</div> 1074 1075<h4 class="subsection">ntp-keygen help/usage (<span class="option">--help</span>)</h4> 1076 1077<p><a name="index-ntp_002dkeygen-help-3"></a> 1078This is the automatically generated usage text for ntp-keygen. 1079 1080 <p>The text printed is the same whether selected with the <code>help</code> option 1081(<span class="option">--help</span>) or the <code>more-help</code> option (<span class="option">--more-help</span>). <code>more-help</code> will print 1082the usage text by passing it through a pager program. 1083<code>more-help</code> is disabled on platforms without a working 1084<code>fork(2)</code> function. The <code>PAGER</code> environment variable is 1085used to select the program, defaulting to <span class="file">more</span>. Both will exit 1086with a status code of 0. 1087 1088<pre class="example">ntp-keygen (ntp) - Create a NTP host key - Ver. 4.2.7p486-RC 1089Usage: ntp-keygen [ -<flag> [<val>] | --<name>[{=| }<val>] ]... 1090 Flg Arg Option-Name Description 1091 -b Num imbits identity modulus bits 1092 - it must be in the range: 1093 256 to 2048 1094 -c Str certificate certificate scheme 1095 -C Str cipher privatekey cipher 1096 -d no debug-level Increase debug verbosity level 1097 - may appear multiple times 1098 -D Num set-debug-level Set the debug verbosity level 1099 - may appear multiple times 1100 -e no id-key Write IFF or GQ identity keys 1101 -G no gq-params Generate GQ parameters and keys 1102 -H no host-key generate RSA host key 1103 -I no iffkey generate IFF parameters 1104 -i Str ident set Autokey group name 1105 -l Num lifetime set certificate lifetime 1106 -M no md5key generate MD5 keys 1107 -m Num modulus modulus 1108 - it must be in the range: 1109 256 to 2048 1110 -P no pvt-cert generate PC private certificate 1111 -p Str password local private password 1112 -q Str export-passwd export IFF or GQ group keys with password 1113 -S Str sign-key generate sign key (RSA or DSA) 1114 -s Str subject-name set host and optionally group name 1115 -T no trusted-cert trusted certificate (TC scheme) 1116 -V Num mv-params generate <num> MV parameters 1117 -v Num mv-keys update <num> MV keys 1118 opt version output version information and exit 1119 -? no help display extended usage information and exit 1120 -! no more-help extended usage information passed thru pager 1121 -> opt save-opts save the option state to a config file 1122 -< Str load-opts load options from a config file 1123 - disabled as '--no-load-opts' 1124 - may appear multiple times 1125 1126Options are specified by doubled hyphens and their name or by a single 1127hyphen and the flag character. 1128 1129 1130The following option preset mechanisms are supported: 1131 - reading file $HOME/.ntprc 1132 - reading file ./.ntprc 1133 - examining environment variables named NTP_KEYGEN_* 1134 1135Please send bug reports to: <http://bugs.ntp.org, bugs@ntp.org> 1136</pre> 1137 <div class="node"> 1138<p><hr> 1139<a name="ntp_002dkeygen-imbits"></a>Next: <a rel="next" accesskey="n" href="#ntp_002dkeygen-certificate">ntp-keygen certificate</a>, 1140Previous: <a rel="previous" accesskey="p" href="#ntp_002dkeygen-usage">ntp-keygen usage</a>, 1141Up: <a rel="up" accesskey="u" href="#ntp_002dkeygen-Invocation">ntp-keygen Invocation</a> 1142<br> 1143</div> 1144 1145<h4 class="subsection">imbits option (-b)</h4> 1146 1147<p><a name="index-ntp_002dkeygen_002dimbits-4"></a> 1148This is the “identity modulus bits” option. 1149This option takes a number argument <span class="file">imbits</span>. 1150 1151<p class="noindent">This option has some usage constraints. It: 1152 <ul> 1153<li>must be compiled in by defining <code>AUTOKEY</code> during the compilation. 1154</ul> 1155 1156 <p>The number of bits in the identity modulus. The default is 256. 1157<div class="node"> 1158<p><hr> 1159<a name="ntp_002dkeygen-certificate"></a>Next: <a rel="next" accesskey="n" href="#ntp_002dkeygen-cipher">ntp-keygen cipher</a>, 1160Previous: <a rel="previous" accesskey="p" href="#ntp_002dkeygen-imbits">ntp-keygen imbits</a>, 1161Up: <a rel="up" accesskey="u" href="#ntp_002dkeygen-Invocation">ntp-keygen Invocation</a> 1162<br> 1163</div> 1164 1165<h4 class="subsection">certificate option (-c)</h4> 1166 1167<p><a name="index-ntp_002dkeygen_002dcertificate-5"></a> 1168This is the “certificate scheme” option. 1169This option takes a string argument <span class="file">scheme</span>. 1170 1171<p class="noindent">This option has some usage constraints. It: 1172 <ul> 1173<li>must be compiled in by defining <code>AUTOKEY</code> during the compilation. 1174</ul> 1175 1176 <p>scheme is one of 1177RSA-MD2, RSA-MD5, RSA-SHA, RSA-SHA1, RSA-MDC2, RSA-RIPEMD160, 1178DSA-SHA, or DSA-SHA1. 1179 1180 <p>Select the certificate message digest/signature encryption scheme. 1181Note that RSA schemes must be used with a RSA sign key and DSA 1182schemes must be used with a DSA sign key. The default without 1183this option is RSA-MD5. 1184<div class="node"> 1185<p><hr> 1186<a name="ntp_002dkeygen-cipher"></a>Next: <a rel="next" accesskey="n" href="#ntp_002dkeygen-id_002dkey">ntp-keygen id-key</a>, 1187Previous: <a rel="previous" accesskey="p" href="#ntp_002dkeygen-certificate">ntp-keygen certificate</a>, 1188Up: <a rel="up" accesskey="u" href="#ntp_002dkeygen-Invocation">ntp-keygen Invocation</a> 1189<br> 1190</div> 1191 1192<h4 class="subsection">cipher option (-C)</h4> 1193 1194<p><a name="index-ntp_002dkeygen_002dcipher-6"></a> 1195This is the “privatekey cipher” option. 1196This option takes a string argument <span class="file">cipher</span>. 1197 1198<p class="noindent">This option has some usage constraints. It: 1199 <ul> 1200<li>must be compiled in by defining <code>AUTOKEY</code> during the compilation. 1201</ul> 1202 1203 <p>Select the cipher which is used to encrypt the files containing 1204private keys. The default is three-key triple DES in CBC mode, 1205equivalent to "<code>-C des-ede3-cbc". The openssl tool lists ciphers 1206available in "openssl -h" output. 1207</code><div class="node"> 1208<p><hr> 1209<a name="ntp_002dkeygen-id_002dkey"></a>Next: <a rel="next" accesskey="n" href="#ntp_002dkeygen-gq_002dparams">ntp-keygen gq-params</a>, 1210Previous: <a rel="previous" accesskey="p" href="#ntp_002dkeygen-cipher">ntp-keygen cipher</a>, 1211Up: <a rel="up" accesskey="u" href="#ntp_002dkeygen-Invocation">ntp-keygen Invocation</a> 1212<br> 1213</div> 1214 1215<h4 class="subsection">id-key option (-e)</h4> 1216 1217<p><a name="index-ntp_002dkeygen_002did_002dkey-7"></a> 1218This is the “write iff or gq identity keys” option. 1219 1220<p class="noindent">This option has some usage constraints. It: 1221 <ul> 1222<li>must be compiled in by defining <code>AUTOKEY</code> during the compilation. 1223</ul> 1224 1225 <p>Write the IFF or GQ client keys to the standard output. This is 1226intended for automatic key distribution by mail. 1227<div class="node"> 1228<p><hr> 1229<a name="ntp_002dkeygen-gq_002dparams"></a>Next: <a rel="next" accesskey="n" href="#ntp_002dkeygen-host_002dkey">ntp-keygen host-key</a>, 1230Previous: <a rel="previous" accesskey="p" href="#ntp_002dkeygen-id_002dkey">ntp-keygen id-key</a>, 1231Up: <a rel="up" accesskey="u" href="#ntp_002dkeygen-Invocation">ntp-keygen Invocation</a> 1232<br> 1233</div> 1234 1235<h4 class="subsection">gq-params option (-G)</h4> 1236 1237<p><a name="index-ntp_002dkeygen_002dgq_002dparams-8"></a> 1238This is the “generate gq parameters and keys” option. 1239 1240<p class="noindent">This option has some usage constraints. It: 1241 <ul> 1242<li>must be compiled in by defining <code>AUTOKEY</code> during the compilation. 1243</ul> 1244 1245 <p>Generate parameters and keys for the GQ identification scheme, 1246obsoleting any that may exist. 1247<div class="node"> 1248<p><hr> 1249<a name="ntp_002dkeygen-host_002dkey"></a>Next: <a rel="next" accesskey="n" href="#ntp_002dkeygen-iffkey">ntp-keygen iffkey</a>, 1250Previous: <a rel="previous" accesskey="p" href="#ntp_002dkeygen-gq_002dparams">ntp-keygen gq-params</a>, 1251Up: <a rel="up" accesskey="u" href="#ntp_002dkeygen-Invocation">ntp-keygen Invocation</a> 1252<br> 1253</div> 1254 1255<h4 class="subsection">host-key option (-H)</h4> 1256 1257<p><a name="index-ntp_002dkeygen_002dhost_002dkey-9"></a> 1258This is the “generate rsa host key” option. 1259 1260<p class="noindent">This option has some usage constraints. It: 1261 <ul> 1262<li>must be compiled in by defining <code>AUTOKEY</code> during the compilation. 1263</ul> 1264 1265 <p>Generate new host keys, obsoleting any that may exist. 1266<div class="node"> 1267<p><hr> 1268<a name="ntp_002dkeygen-iffkey"></a>Next: <a rel="next" accesskey="n" href="#ntp_002dkeygen-ident">ntp-keygen ident</a>, 1269Previous: <a rel="previous" accesskey="p" href="#ntp_002dkeygen-host_002dkey">ntp-keygen host-key</a>, 1270Up: <a rel="up" accesskey="u" href="#ntp_002dkeygen-Invocation">ntp-keygen Invocation</a> 1271<br> 1272</div> 1273 1274<h4 class="subsection">iffkey option (-I)</h4> 1275 1276<p><a name="index-ntp_002dkeygen_002diffkey-10"></a> 1277This is the “generate iff parameters” option. 1278 1279<p class="noindent">This option has some usage constraints. It: 1280 <ul> 1281<li>must be compiled in by defining <code>AUTOKEY</code> during the compilation. 1282</ul> 1283 1284 <p>Generate parameters for the IFF identification scheme, obsoleting 1285any that may exist. 1286<div class="node"> 1287<p><hr> 1288<a name="ntp_002dkeygen-ident"></a>Next: <a rel="next" accesskey="n" href="#ntp_002dkeygen-lifetime">ntp-keygen lifetime</a>, 1289Previous: <a rel="previous" accesskey="p" href="#ntp_002dkeygen-iffkey">ntp-keygen iffkey</a>, 1290Up: <a rel="up" accesskey="u" href="#ntp_002dkeygen-Invocation">ntp-keygen Invocation</a> 1291<br> 1292</div> 1293 1294<h4 class="subsection">ident option (-i)</h4> 1295 1296<p><a name="index-ntp_002dkeygen_002dident-11"></a> 1297This is the “set autokey group name” option. 1298This option takes a string argument <span class="file">group</span>. 1299 1300<p class="noindent">This option has some usage constraints. It: 1301 <ul> 1302<li>must be compiled in by defining <code>AUTOKEY</code> during the compilation. 1303</ul> 1304 1305 <p>Set the optional Autokey group name to name. This is used in 1306the file name of IFF, GQ, and MV client parameters files. In 1307that role, the default is the host name if this option is not 1308provided. The group name, if specified using <code>-i/--ident</code> or 1309using <code>-s/--subject-name</code> following an '<code>}' character, 1310is also a part of the self-signed host certificate's subject and 1311issuer names in the form host 1312 <p>'crypto ident' or 'server ident' configuration in 1313ntpd's configuration file. 1314</code><div class="node"> 1315<p><hr> 1316<a name="ntp_002dkeygen-lifetime"></a>Next: <a rel="next" accesskey="n" href="#ntp_002dkeygen-md5key">ntp-keygen md5key</a>, 1317Previous: <a rel="previous" accesskey="p" href="#ntp_002dkeygen-ident">ntp-keygen ident</a>, 1318Up: <a rel="up" accesskey="u" href="#ntp_002dkeygen-Invocation">ntp-keygen Invocation</a> 1319<br> 1320</div> 1321 1322<h4 class="subsection">lifetime option (-l)</h4> 1323 1324<p><a name="index-ntp_002dkeygen_002dlifetime-12"></a> 1325This is the ``set certificate lifetime'' option. 1326This option takes a number argument <span class="file">lifetime</span>. 1327 1328<p class="noindent">This option has some usage constraints. It: 1329 <ul> 1330<li>must be compiled in by defining <code>AUTOKEY</code> during the compilation. 1331</ul> 1332 1333 <p>Set the certificate expiration to lifetime days from now. 1334<div class="node"> 1335<p><hr> 1336<a name="ntp_002dkeygen-md5key"></a>Next: <a rel="next" accesskey="n" href="#ntp_002dkeygen-modulus">ntp-keygen modulus</a>, 1337Previous: <a rel="previous" accesskey="p" href="#ntp_002dkeygen-lifetime">ntp-keygen lifetime</a>, 1338Up: <a rel="up" accesskey="u" href="#ntp_002dkeygen-Invocation">ntp-keygen Invocation</a> 1339<br> 1340</div> 1341 1342<h4 class="subsection">md5key option (-M)</h4> 1343 1344<p><a name="index-ntp_002dkeygen_002dmd5key-13"></a> 1345This is the ``generate md5 keys'' option. 1346Generate MD5 keys, obsoleting any that may exist. 1347<div class="node"> 1348<p><hr> 1349<a name="ntp_002dkeygen-modulus"></a>Next: <a rel="next" accesskey="n" href="#ntp_002dkeygen-pvt_002dcert">ntp-keygen pvt-cert</a>, 1350Previous: <a rel="previous" accesskey="p" href="#ntp_002dkeygen-md5key">ntp-keygen md5key</a>, 1351Up: <a rel="up" accesskey="u" href="#ntp_002dkeygen-Invocation">ntp-keygen Invocation</a> 1352<br> 1353</div> 1354 1355<h4 class="subsection">modulus option (-m)</h4> 1356 1357<p><a name="index-ntp_002dkeygen_002dmodulus-14"></a> 1358This is the ``modulus'' option. 1359This option takes a number argument <span class="file">modulus</span>. 1360 1361<p class="noindent">This option has some usage constraints. It: 1362 <ul> 1363<li>must be compiled in by defining <code>AUTOKEY</code> during the compilation. 1364</ul> 1365 1366 <p>The number of bits in the prime modulus. The default is 512. 1367<div class="node"> 1368<p><hr> 1369<a name="ntp_002dkeygen-pvt_002dcert"></a>Next: <a rel="next" accesskey="n" href="#ntp_002dkeygen-password">ntp-keygen password</a>, 1370Previous: <a rel="previous" accesskey="p" href="#ntp_002dkeygen-modulus">ntp-keygen modulus</a>, 1371Up: <a rel="up" accesskey="u" href="#ntp_002dkeygen-Invocation">ntp-keygen Invocation</a> 1372<br> 1373</div> 1374 1375<h4 class="subsection">pvt-cert option (-P)</h4> 1376 1377<p><a name="index-ntp_002dkeygen_002dpvt_002dcert-15"></a> 1378This is the ``generate pc private certificate'' option. 1379 1380<p class="noindent">This option has some usage constraints. It: 1381 <ul> 1382<li>must be compiled in by defining <code>AUTOKEY</code> during the compilation. 1383</ul> 1384 1385 <p>Generate a private certificate. By default, the program generates 1386public certificates. 1387<div class="node"> 1388<p><hr> 1389<a name="ntp_002dkeygen-password"></a>Next: <a rel="next" accesskey="n" href="#ntp_002dkeygen-export_002dpasswd">ntp-keygen export-passwd</a>, 1390Previous: <a rel="previous" accesskey="p" href="#ntp_002dkeygen-pvt_002dcert">ntp-keygen pvt-cert</a>, 1391Up: <a rel="up" accesskey="u" href="#ntp_002dkeygen-Invocation">ntp-keygen Invocation</a> 1392<br> 1393</div> 1394 1395<h4 class="subsection">password option (-p)</h4> 1396 1397<p><a name="index-ntp_002dkeygen_002dpassword-16"></a> 1398This is the ``local private password'' option. 1399This option takes a string argument <span class="file">passwd</span>. 1400 1401<p class="noindent">This option has some usage constraints. It: 1402 <ul> 1403<li>must be compiled in by defining <code>AUTOKEY</code> during the compilation. 1404</ul> 1405 1406 <p>Local files containing private data are encrypted with the 1407DES-CBC algorithm and the specified password. The same password 1408must be specified to the local ntpd via the "crypto pw password" 1409configuration command. The default password is the local 1410hostname. 1411<div class="node"> 1412<p><hr> 1413<a name="ntp_002dkeygen-export_002dpasswd"></a>Next: <a rel="next" accesskey="n" href="#ntp_002dkeygen-sign_002dkey">ntp-keygen sign-key</a>, 1414Previous: <a rel="previous" accesskey="p" href="#ntp_002dkeygen-password">ntp-keygen password</a>, 1415Up: <a rel="up" accesskey="u" href="#ntp_002dkeygen-Invocation">ntp-keygen Invocation</a> 1416<br> 1417</div> 1418 1419<h4 class="subsection">export-passwd option (-q)</h4> 1420 1421<p><a name="index-ntp_002dkeygen_002dexport_002dpasswd-17"></a> 1422This is the ``export iff or gq group keys with password'' option. 1423This option takes a string argument <span class="file">passwd</span>. 1424 1425<p class="noindent">This option has some usage constraints. It: 1426 <ul> 1427<li>must be compiled in by defining <code>AUTOKEY</code> during the compilation. 1428</ul> 1429 1430 <p>Export IFF or GQ identity group keys to the standard output, 1431encrypted with the DES-CBC algorithm and the specified password. 1432The same password must be specified to the remote ntpd via the 1433"crypto pw password" configuration command. See also the option 1434--id-key (-e) for unencrypted exports. 1435<div class="node"> 1436<p><hr> 1437<a name="ntp_002dkeygen-sign_002dkey"></a>Next: <a rel="next" accesskey="n" href="#ntp_002dkeygen-subject_002dname">ntp-keygen subject-name</a>, 1438Previous: <a rel="previous" accesskey="p" href="#ntp_002dkeygen-export_002dpasswd">ntp-keygen export-passwd</a>, 1439Up: <a rel="up" accesskey="u" href="#ntp_002dkeygen-Invocation">ntp-keygen Invocation</a> 1440<br> 1441</div> 1442 1443<h4 class="subsection">sign-key option (-S)</h4> 1444 1445<p><a name="index-ntp_002dkeygen_002dsign_002dkey-18"></a> 1446This is the ``generate sign key (rsa or dsa)'' option. 1447This option takes a string argument <span class="file">sign</span>. 1448 1449<p class="noindent">This option has some usage constraints. It: 1450 <ul> 1451<li>must be compiled in by defining <code>AUTOKEY</code> during the compilation. 1452</ul> 1453 1454 <p>Generate a new sign key of the designated type, obsoleting any 1455that may exist. By default, the program uses the host key as the 1456sign key. 1457<div class="node"> 1458<p><hr> 1459<a name="ntp_002dkeygen-subject_002dname"></a>Next: <a rel="next" accesskey="n" href="#ntp_002dkeygen-trusted_002dcert">ntp-keygen trusted-cert</a>, 1460Previous: <a rel="previous" accesskey="p" href="#ntp_002dkeygen-sign_002dkey">ntp-keygen sign-key</a>, 1461Up: <a rel="up" accesskey="u" href="#ntp_002dkeygen-Invocation">ntp-keygen Invocation</a> 1462<br> 1463</div> 1464 1465<h4 class="subsection">subject-name option (-s)</h4> 1466 1467<p><a name="index-ntp_002dkeygen_002dsubject_002dname-19"></a> 1468This is the ``set host and optionally group name'' option. 1469This option takes a string argument <span class="file">host@group</span>. 1470 1471<p class="noindent">This option has some usage constraints. It: 1472 <ul> 1473<li>must be compiled in by defining <code>AUTOKEY</code> during the compilation. 1474</ul> 1475 1476 <p>Set the Autokey host name, and optionally, group name specified 1477following an '<code>}' character. The host name is used in the file 1478name of generated host and signing certificates, without the 1479group name. The host name, and if provided, group name are used 1480in host 1481 <p>fields. Specifying '-s 1482 <p>leaving the host name unchanged while appending 1483 <p>subject and issuer fields, as with -i group. The group name, or 1484if not provided, the host name are also used in the file names 1485of IFF, GQ, and MV client parameter files. 1486</code><div class="node"> 1487<p><hr> 1488<a name="ntp_002dkeygen-trusted_002dcert"></a>Next: <a rel="next" accesskey="n" href="#ntp_002dkeygen-mv_002dparams">ntp-keygen mv-params</a>, 1489Previous: <a rel="previous" accesskey="p" href="#ntp_002dkeygen-subject_002dname">ntp-keygen subject-name</a>, 1490Up: <a rel="up" accesskey="u" href="#ntp_002dkeygen-Invocation">ntp-keygen Invocation</a> 1491<br> 1492</div> 1493 1494<h4 class="subsection">trusted-cert option (-T)</h4> 1495 1496<p><a name="index-ntp_002dkeygen_002dtrusted_002dcert-20"></a> 1497This is the ``trusted certificate (tc scheme)'' option. 1498 1499<p class="noindent">This option has some usage constraints. It: 1500 <ul> 1501<li>must be compiled in by defining <code>AUTOKEY</code> during the compilation. 1502</ul> 1503 1504 <p>Generate a trusted certificate. By default, the program generates 1505a non-trusted certificate. 1506<div class="node"> 1507<p><hr> 1508<a name="ntp_002dkeygen-mv_002dparams"></a>Next: <a rel="next" accesskey="n" href="#ntp_002dkeygen-mv_002dkeys">ntp-keygen mv-keys</a>, 1509Previous: <a rel="previous" accesskey="p" href="#ntp_002dkeygen-trusted_002dcert">ntp-keygen trusted-cert</a>, 1510Up: <a rel="up" accesskey="u" href="#ntp_002dkeygen-Invocation">ntp-keygen Invocation</a> 1511<br> 1512</div> 1513 1514<h4 class="subsection">mv-params option (-V)</h4> 1515 1516<p><a name="index-ntp_002dkeygen_002dmv_002dparams-21"></a> 1517This is the ``generate <num> mv parameters'' option. 1518This option takes a number argument <span class="file">num</span>. 1519 1520<p class="noindent">This option has some usage constraints. It: 1521 <ul> 1522<li>must be compiled in by defining <code>AUTOKEY</code> during the compilation. 1523</ul> 1524 1525 <p>Generate parameters and keys for the Mu-Varadharajan (MV) 1526identification scheme. 1527<div class="node"> 1528<p><hr> 1529<a name="ntp_002dkeygen-mv_002dkeys"></a>Next: <a rel="next" accesskey="n" href="#ntp_002dkeygen-config">ntp-keygen config</a>, 1530Previous: <a rel="previous" accesskey="p" href="#ntp_002dkeygen-mv_002dparams">ntp-keygen mv-params</a>, 1531Up: <a rel="up" accesskey="u" href="#ntp_002dkeygen-Invocation">ntp-keygen Invocation</a> 1532<br> 1533</div> 1534 1535<h4 class="subsection">mv-keys option (-v)</h4> 1536 1537<p><a name="index-ntp_002dkeygen_002dmv_002dkeys-22"></a> 1538This is the ``update <num> mv keys'' option. 1539This option takes a number argument <span class="file">num</span>. 1540 1541<p class="noindent">This option has some usage constraints. It: 1542 <ul> 1543<li>must be compiled in by defining <code>AUTOKEY</code> during the compilation. 1544</ul> 1545 1546 <p>This option has no <span class="samp">doc</span> documentation. 1547 1548<div class="node"> 1549<p><hr> 1550<a name="ntp_002dkeygen-config"></a>Next: <a rel="next" accesskey="n" href="#ntp_002dkeygen-exit-status">ntp-keygen exit status</a>, 1551Previous: <a rel="previous" accesskey="p" href="#ntp_002dkeygen-mv_002dkeys">ntp-keygen mv-keys</a>, 1552Up: <a rel="up" accesskey="u" href="#ntp_002dkeygen-Invocation">ntp-keygen Invocation</a> 1553<br> 1554</div> 1555 1556<h4 class="subsection">presetting/configuring ntp-keygen</h4> 1557 1558<p>Any option that is not marked as <i>not presettable</i> may be preset by 1559loading 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 1560the options listed above in upper case and segmented with underscores. 1561The <code>NTP-KEYGEN</code> variable will be tokenized and parsed like 1562the command line. The remaining variables are tested for existence and their 1563values are treated like option arguments. 1564 1565<p class="noindent"><code>libopts</code> will search in 2 places for configuration files: 1566 <ul> 1567<li>$HOME 1568<li>$PWD 1569</ul> 1570 The environment variables <code>HOME</code>, and <code>PWD</code> 1571are expanded and replaced when <span class="file">ntp-keygen</span> runs. 1572For any of these that are plain files, they are simply processed. 1573For any that are directories, then a file named <span class="file">.ntprc</span> is searched for 1574within that directory and processed. 1575 1576 <p>Configuration files may be in a wide variety of formats. 1577The basic format is an option name followed by a value (argument) on the 1578same line. Values may be separated from the option name with a colon, 1579equal sign or simply white space. Values may be continued across multiple 1580lines by escaping the newline with a backslash. 1581 1582 <p>Multiple programs may also share the same initialization file. 1583Common options are collected at the top, followed by program specific 1584segments. The segments are separated by lines like: 1585<pre class="example"> [NTP-KEYGEN] 1586</pre> 1587 <p class="noindent">or by 1588<pre class="example"> <?program ntp-keygen> 1589</pre> 1590 <p class="noindent">Do not mix these styles within one configuration file. 1591 1592 <p>Compound values and carefully constructed string values may also be 1593specified using XML syntax: 1594<pre class="example"> <option-name> 1595 <sub-opt>...&lt;...&gt;...</sub-opt> 1596 </option-name> 1597</pre> 1598 <p class="noindent">yielding an <code>option-name.sub-opt</code> string value of 1599<pre class="example"> "...<...>..." 1600</pre> 1601 <p><code>AutoOpts</code> does not track suboptions. You simply note that it is a 1602hierarchicly valued option. <code>AutoOpts</code> does provide a means for searching 1603the associated name/value pair list (see: optionFindValue). 1604 1605 <p>The command line options relating to configuration and/or usage help are: 1606 1607<h5 class="subsubheading">version (-)</h5> 1608 1609<p>Print the program version to standard out, optionally with licensing 1610information, then exit 0. The optional argument specifies how much licensing 1611detail to provide. The default is to print just the version. The licensing infomation may be selected with an option argument. 1612Only the first letter of the argument is examined: 1613 1614 <dl> 1615<dt><span class="samp">version</span><dd>Only print the version. This is the default. 1616<br><dt><span class="samp">copyright</span><dd>Name the copyright usage licensing terms. 1617<br><dt><span class="samp">verbose</span><dd>Print the full copyright usage licensing terms. 1618</dl> 1619 1620<div class="node"> 1621<p><hr> 1622<a name="ntp_002dkeygen-exit-status"></a>Next: <a rel="next" accesskey="n" href="#ntp_002dkeygen-Usage">ntp-keygen Usage</a>, 1623Previous: <a rel="previous" accesskey="p" href="#ntp_002dkeygen-config">ntp-keygen config</a>, 1624Up: <a rel="up" accesskey="u" href="#ntp_002dkeygen-Invocation">ntp-keygen Invocation</a> 1625<br> 1626</div> 1627 1628<h4 class="subsection">ntp-keygen exit status</h4> 1629 1630<p>One of the following exit values will be returned: 1631 <dl> 1632<dt><span class="samp">0 (EXIT_SUCCESS)</span><dd>Successful program execution. 1633<br><dt><span class="samp">1 (EXIT_FAILURE)</span><dd>The operation failed or the command syntax was not valid. 1634<br><dt><span class="samp">66 (EX_NOINPUT)</span><dd>A specified configuration file could not be loaded. 1635<br><dt><span class="samp">70 (EX_SOFTWARE)</span><dd>libopts had an internal operational error. Please report 1636it to autogen-users@lists.sourceforge.net. Thank you. 1637</dl> 1638 <div class="node"> 1639<p><hr> 1640<a name="ntp_002dkeygen-Usage"></a>Next: <a rel="next" accesskey="n" href="#ntp_002dkeygen-Notes">ntp-keygen Notes</a>, 1641Previous: <a rel="previous" accesskey="p" href="#ntp_002dkeygen-exit-status">ntp-keygen exit status</a>, 1642Up: <a rel="up" accesskey="u" href="#ntp_002dkeygen-Invocation">ntp-keygen Invocation</a> 1643<br> 1644</div> 1645 1646<h4 class="subsection">ntp-keygen Usage</h4> 1647 1648<div class="node"> 1649<p><hr> 1650<a name="ntp_002dkeygen-Notes"></a>Next: <a rel="next" accesskey="n" href="#ntp_002dkeygen-Bugs">ntp-keygen Bugs</a>, 1651Previous: <a rel="previous" accesskey="p" href="#ntp_002dkeygen-Usage">ntp-keygen Usage</a>, 1652Up: <a rel="up" accesskey="u" href="#ntp_002dkeygen-Invocation">ntp-keygen Invocation</a> 1653<br> 1654</div> 1655 1656<h4 class="subsection">ntp-keygen Notes</h4> 1657 1658<div class="node"> 1659<p><hr> 1660<a name="ntp_002dkeygen-Bugs"></a>Previous: <a rel="previous" accesskey="p" href="#ntp_002dkeygen-Notes">ntp-keygen Notes</a>, 1661Up: <a rel="up" accesskey="u" href="#ntp_002dkeygen-Invocation">ntp-keygen Invocation</a> 1662<br> 1663</div> 1664 1665<h4 class="subsection">ntp-keygen Bugs</h4> 1666 1667<div class="node"> 1668<p><hr> 1669<a name="Random-Seed-File"></a>Next: <a rel="next" accesskey="n" href="#Cryptographic-Data-Files">Cryptographic Data Files</a>, 1670Previous: <a rel="previous" accesskey="p" href="#Running-the-Program">Running the Program</a>, 1671Up: <a rel="up" accesskey="u" href="#Top">Top</a> 1672<br> 1673</div> 1674 1675<!-- node-name, next, previous, up --> 1676<h3 class="section">Random Seed File</h3> 1677 1678<p>All cryptographically sound key generation schemes must have means to 1679randomize the entropy seed used to initialize the internal 1680pseudo-random number generator used by the OpenSSL library routines. 1681If a site supports ssh, it is very likely that means to do this are 1682already available. 1683The entropy seed used by the OpenSSL library is contained in a file, 1684usually called <code>.rnd</code>, which must be available when 1685starting the <code>ntp-keygen</code> program or <code>ntpd</code> daemon. 1686 1687 <p>The OpenSSL library looks for the file using the path specified by the 1688<code>RANDFILE</code> environment variable in the user home directory, whether root 1689or some other user. 1690If the <code>RANDFILE</code> environment variable is not 1691present, the library looks for the <code>.rnd</code> file in the user home 1692directory. 1693Since both the <code>ntp-keygen</code> program and <code>ntpd</code> daemon must run 1694as root, the logical place to put this file is in <code>/.rnd</code> or 1695<code>/root/.rnd</code>. 1696If the file is not available or cannot be written, the program exits 1697with a message to the system log. 1698 1699<div class="node"> 1700<p><hr> 1701<a name="Cryptographic-Data-Files"></a>Previous: <a rel="previous" accesskey="p" href="#Random-Seed-File">Random Seed File</a>, 1702Up: <a rel="up" accesskey="u" href="#Top">Top</a> 1703<br> 1704</div> 1705 1706<!-- node-name, next, previous, up --> 1707<h3 class="section">Cryptographic Data Files</h3> 1708 1709<p>File and link names are in the <code>form ntpkey_key_name.fstamp</code>, 1710where <code>key</code> is the key or parameter type, 1711<code>name</code> is the host or group name and 1712<code>fstamp</code> is the filestamp (NTP seconds) when the file was created). 1713By convention, key names in generated file names include both upper and 1714lower case characters, while key names in generated link names include 1715only lower case characters. The filestamp is not used in generated link 1716names. 1717 1718 <p>The key name is a string defining the cryptographic key type. 1719Key types include public/private keys host and sign, certificate cert 1720and several challenge/response key types. 1721By convention, client files used for 1722challenges have a par subtype, as in the IFF challenge IFFpar, while 1723server files for responses have a key subtype, as in the GQ response 1724GQkey. 1725 1726 <p>All files begin with two nonencrypted lines. The first line contains 1727the file name in the format <code>ntpkey_key_host.fstamp</code>. 1728The second line contains the datestamp in conventional Unix date format. 1729Lines beginning with <code>#</code> are ignored. 1730 1731 <p>The remainder of the file contains cryptographic data encoded first 1732using ASN.1 rules, then encrypted using the DES-CBC algorithm with 1733given password and finally written in PEM-encoded printable ASCII text 1734preceded and followed by MIME content identifier lines. 1735 1736 <p>The format of the symmetric keys file, ordinarily named <code>ntp.keys</code>, 1737is somewhat different than the other files in the interest of backward 1738compatibility. 1739Ordinarily, the file is generated by this program, but 1740it can be constructed and edited using an ordinary text editor. 1741 1742<pre class="example"> # ntpkey_MD5key_hms.local.3564038757 1743 # Sun Dec 9 02:45:57 2012 1744 1745 1 MD5 "]!ghT%O;3)WJ,/Nc:>I # MD5 key 1746 2 MD5 lu+H^tF46BKR-6~pV_5 # MD5 key 1747 3 MD5 :lnoVsE%Yz*avh%EtNC # MD5 key 1748 4 MD5 |fdZrf0sF~^V # MD5 key 1749 5 MD5 IyAG>O"y"LmCRS!*bHC # MD5 key 1750 6 MD5 ">e\A # MD5 key 1751 7 MD5 c9x=M'CfLxax9v)PV-si # MD5 key 1752 8 MD5 E|=jvFVov?Bn|Ev=&aK\ # MD5 key 1753 9 MD5 T!c4UT&`(m$+m+B6,`Q0 # MD5 key 1754 10 MD5 JVF/1=)=IFbHbJQz..Cd # MD5 key 1755 11 SHA1 6dea311109529e436c2b4fccae9bc753c16d1b48 # SHA1 key 1756 12 SHA1 7076f373d86c4848c59ff8046e49cb7d614ec394 # SHA1 key 1757 13 SHA1 5f48b1b60591eb01b7cf1d33b7774f08d20262d3 # SHA1 key 1758 14 SHA1 eed5ab9d9497319ec60cf3781d52607e76720178 # SHA1 key 1759 15 SHA1 f283562611a04c964da8126296f5f8e58c3f85de # SHA1 key 1760 16 SHA1 1930da171297dd63549af50b29449de17dcf341f # SHA1 key 1761 17 SHA1 fee892110358cd4382322b889869e750db8e8a8f # SHA1 key 1762 18 SHA1 b5520c9fadd7ad3fd8bfa061c8821b65d029bb37 # SHA1 key 1763 19 SHA1 8c74fb440ec80f453ec6aaa62b9baed0ab723b92 # SHA1 key 1764 20 SHA1 6bc05f734306a189326000970c19b3910f403795 # SHA1 key 1765</pre> 1766 <p>Figure 1. Typical Symmetric Key File 1767 1768 <p>Figure 1 shows a typical symmetric keys file used by the reference 1769implementation. 1770Each line of the file contains three fields, first an 1771integer between 1 and 65534, inclusive, representing the key identifier 1772used in the server and peer configuration commands. 1773Next is the key type for the message digest algorithm, 1774which in the absence of the 1775OpenSSL library must be MD5 to designate the MD5 message digest 1776algorithm. 1777If the OpenSSL library is installed, the key type can be any 1778message digest algorithm supported by that library. 1779However, if 1780compatibility with FIPS 140-2 is required, the key type must be either 1781SHA or SHA1. 1782The key type can be changed using an ASCII text editor. 1783 1784 <p>An MD5 key consists of a printable ASCII string less than or equal to 178516 characters and terminated by whitespace or a # character. 1786An OpenSSL 1787key consists of a hex-encoded ASCII string of 40 characters, which is 1788truncated as necessary. 1789 1790 <p>Note that the keys used by the <code>ntpq</code> and <code>ntpdc</code> programs are 1791checked against passwords requested by the programs and entered by hand, 1792so it 1793is generally appropriate to specify these keys in human readable ASCII 1794format. 1795 1796 <p>The <code>ntp-keygen</code> program generates a MD5 symmetric keys file 1797<code>ntpkey_MD5key_hostname.filestamp</code>. 1798Since the file contains private 1799shared keys, it should be visible only to root and distributed by 1800secure means to other subnet hosts. 1801The NTP daemon loads the file <code>ntp.keys</code>, so <code>ntp-keygen</code> 1802installs a soft link from this name to the generated file. 1803Subsequently, similar soft links must be installed by 1804manual or automated means on the other subnet hosts. 1805While this file is 1806not used with the Autokey Version 2 protocol, it is needed to 1807authenticate some remote configuration commands used by the <code>ntpq</code> and 1808<code>ntpdc</code> utilities. 1809 1810</body></html> 1811 1812