Home | History | Annotate | Line # | Download | only in html
      1      1.1    kardel <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
      2      1.1    kardel <html>
      3  1.1.1.5  christos   <head>
      4  1.1.1.5  christos     <meta http-equiv="content-type" content="text/html;charset=iso-8859-1">
      5  1.1.1.5  christos     <meta name="generator" content="HTML Tidy, see www.w3.org">
      6  1.1.1.5  christos     <title>ntp-keygen - generate public and private keys</title>
      7  1.1.1.5  christos     <link href="scripts/style.css" type="text/css" rel="stylesheet">
      8  1.1.1.5  christos   </head>
      9  1.1.1.5  christos   <body>
     10  1.1.1.5  christos     <h3><tt>ntp-keygen</tt> - generate public and private keys</h3>
     11  1.1.1.5  christos     <p><img src="pic/alice23.gif" alt="gif" align="left"><a href="http://www.eecis.udel.edu/%7emills/pictures.html">from <i>Alice's Adventures in Wonderland</i>, Lewis Carroll</a></p>
     12  1.1.1.5  christos     <p>Alice holds the key.</p>
     13  1.1.1.5  christos     <p>Last update:
     14  1.1.1.6  christos       <!-- #BeginDate format:En2m -->24-Jul-2018  07:27<!-- #EndDate -->
     15  1.1.1.5  christos       UTC</p>
     16  1.1.1.5  christos     <br clear="left">
     17  1.1.1.5  christos     <h4>Related Links</h4>
     18  1.1.1.5  christos     <script type="text/javascript" language="javascript" src="scripts/manual.txt"></script>
     19  1.1.1.5  christos     <h4>Table of Contents</h4>
     20  1.1.1.5  christos     <ul>
     21  1.1.1.5  christos       <li class="inline"><a href="#synop">Synopsis</a></li>
     22  1.1.1.5  christos       <li class="inline"><a href="#descrip">Description</a></li>
     23  1.1.1.5  christos       <li class="inline"><a href="#run">Running the program</a></li>
     24  1.1.1.5  christos       <li class="inline"><a href="#cmd">Command Line Options</a></li>
     25  1.1.1.5  christos       <li class="inline"><a href="#rand">Random Seed File</a></li>
     26  1.1.1.5  christos       <li class="inline"><a href="#fmt">Cryptographic Data Files</a></li>
     27  1.1.1.5  christos       <li class="inline"><a href="#bug">Bugs</a></li>
     28  1.1.1.5  christos     </ul>
     29  1.1.1.5  christos     <hr>
     30  1.1.1.5  christos     <h4 id="synop">Synopsis</h4>
     31  1.1.1.5  christos     <p id="intro"><tt>ntp-keygen [ -deGHIMPT ] [ -b <i>modulus</i> ] [ -c [ RSA-MD2 | RSA-MD5 | RSA-SHA
     32  1.1.1.5  christos 	| RSA-SHA1 | RSA-MDC2 | RSA-RIPEMD160 | DSA-SHA | DSA-SHA1 ] ]
     33  1.1.1.5  christos 	[ -C <i>cipher</i> ] [-i <i>group</i> ] [ -l <em>days</em>]
     34  1.1.1.5  christos 	[ -m <i>modulus</i> ]  [ -p <i>passwd1</i> ] [ -q <i>passwd2</i> ] 
     35  1.1.1.5  christos 	[ -S [ RSA | DSA ] ] [ -s <i>host</i> ] [ -V <i>nkeys</i> ]</tt></p>
     36  1.1.1.5  christos     <h4 id="descrip">Description</h4>
     37  1.1.1.5  christos     <p>This program generates cryptographic data files used by the NTPv4
     38  1.1.1.5  christos       authentication and identity schemes.  It can generate message digest keys
     39  1.1.1.5  christos       used in symmetric key cryptography and, if the OpenSSL software library
     40  1.1.1.5  christos       has been installed, it can generate host keys, sign keys, certificates,
     41  1.1.1.5  christos       and identity keys and parameters used by the Autokey public key
     42  1.1.1.5  christos       cryptography.  The message digest keys file is generated in a format
     43  1.1.1.5  christos       compatible with NTPv3.  All other files are in PEM-encoded printable ASCII
     44  1.1.1.5  christos       format so they can be embedded as MIME attachments in mail to other
     45  1.1.1.5  christos       sites.</p>
     46  1.1.1.5  christos     <p>When used to generate message digest keys, the program produces a file
     47  1.1.1.5  christos       containing ten pseudo-random printable ASCII strings suitable for the MD5
     48  1.1.1.5  christos       message digest algorithm included in the distribution.  If the OpenSSL
     49  1.1.1.5  christos       library is installed, it produces an additional ten hex-encoded random bit
     50  1.1.1.5  christos       strings suitable for the SHA1, AES-128 CMAC, and other message digest
     51  1.1.1.5  christos       algorithms.  The message digest keys file must be distributed and stored
     52  1.1.1.5  christos       using secure means beyond the scope of NTP itself.  Besides the keys used
     53  1.1.1.5  christos       for ordinary NTP associations, additional keys can be defined as passwords
     54  1.1.1.5  christos       for the <tt><a href="ntpq.html">ntpq</a></tt>
     55  1.1.1.5  christos       and <tt><a href="ntpdc.html">ntpdc</a></tt> utility programs.</p>
     56  1.1.1.5  christos     <p>The remaining generated files are compatible with other OpenSSL
     57  1.1.1.5  christos       applications and other Public Key Infrastructure (PKI)
     58  1.1.1.5  christos       resources.  Certificates generated by this program are compatible with
     59  1.1.1.5  christos       extant industry practice, although some users might find the
     60  1.1.1.5  christos       interpretation of X509v3 extension fields somewhat liberal.  However,
     61  1.1.1.5  christos       the identity keys are probably not compatible with anything other than
     62  1.1.1.5  christos       Autokey.</p>
     63  1.1.1.5  christos     <p>Some files used by this program are encrypted using a private
     64  1.1.1.5  christos       password.  The <tt>-p</tt> option specifies the password for local
     65  1.1.1.5  christos       encrypted files and the <tt>-q</tt> option the password for encrypted
     66  1.1.1.5  christos       files sent to remote sites.  If no password is specified, the host name
     67  1.1.1.5  christos       returned by the Unix <tt>gethostname()</tt> function, normally the DNS
     68  1.1.1.5  christos       name of the host, is used.</p>
     69  1.1.1.5  christos     <p>The <tt>pw</tt> option of the <tt>crypto</tt> configuration command
     70  1.1.1.5  christos       specifies the read password for previously encrypted local files.
     71  1.1.1.5  christos       This must match the local password used by this program.  If not
     72  1.1.1.5  christos       specified, the host name is used.  Thus, if files are generated by
     73  1.1.1.5  christos       this program without password, they can be read back by <tt>ntpd</tt>
     74  1.1.1.5  christos       without password, but only on the same host.</p>
     75  1.1.1.5  christos     <p>Normally, encrypted files for each host are generated by that host
     76  1.1.1.5  christos       and used only by that host, although exceptions exist as noted later
     77  1.1.1.5  christos       on this page.  The symmetric keys file, normally
     78  1.1.1.5  christos       called <tt>ntp.keys</tt>, is usually installed in <tt>/etc</tt>.
     79  1.1.1.5  christos       Other files and links are usually installed
     80  1.1.1.5  christos       in <tt>/usr/local/etc</tt>, which is normally in a shared filesystem
     81  1.1.1.5  christos       in NFS-mounted networks and cannot be changed by shared clients.  The
     82  1.1.1.5  christos       location of the keys directory can be changed by the <tt>keysdir</tt>
     83  1.1.1.5  christos       configuration command in such cases.  Normally, this is
     84  1.1.1.5  christos       in <tt>/etc</tt>.</p>
     85  1.1.1.5  christos     <p>This program directs commentary and error messages to the standard
     86  1.1.1.5  christos       error stream <tt>stderr</tt> and remote files to the standard output
     87  1.1.1.5  christos       stream <tt>stdout</tt> where they can be piped to other applications
     88  1.1.1.5  christos       or redirected to files.  The names used for generated files and links
     89  1.1.1.5  christos       all begin with the string <tt>ntpkey</tt> and include the file type,
     90  1.1.1.5  christos       generating host and filestamp, as described in
     91  1.1.1.5  christos       the <a href="#fmt">Cryptographic Data Files</a> section below</p>
     92  1.1.1.5  christos     <h4 id="run">Running the Program</h4>
     93  1.1.1.5  christos     <p>To test and gain experience with Autokey concepts, log in as root and
     94  1.1.1.5  christos       change to the keys directory, usually <tt>/usr/local/etc</tt>.  When
     95  1.1.1.5  christos       run for the first time, or if all files with names
     96  1.1.1.5  christos       beginning <tt>ntpkey</tt> have been removed, use
     97  1.1.1.5  christos       the <tt>ntp-keygen</tt> command without arguments to generate a
     98  1.1.1.5  christos       default RSA host key and matching RSA-MD5 certificate with expiration
     99  1.1.1.5  christos       date one year hence.  If run again without options, the program uses
    100  1.1.1.5  christos       the existing keys and parameters and generates only a new certificate
    101  1.1.1.5  christos       with new expiration date one year hence.</p>
    102  1.1.1.5  christos     <p>Run the command on as many hosts as necessary.  Designate one of them
    103  1.1.1.5  christos       as the trusted host (TH) using <tt>ntp-keygen</tt> with
    104  1.1.1.5  christos       the <tt>-T</tt> option and configure it to synchronize from reliable
    105  1.1.1.5  christos       Internet servers.  Then configure the other hosts to synchronize to
    106  1.1.1.5  christos       the TH directly or indirectly.  A certificate trail is created when
    107  1.1.1.5  christos       Autokey asks the immediately ascendant host towards the TH to sign its
    108  1.1.1.5  christos       certificate, which is then provided to the immediately descendant host
    109  1.1.1.5  christos       on request.  All group hosts should have acyclic certificate trails
    110  1.1.1.5  christos       ending on the TH.</p>
    111  1.1.1.5  christos     <p>The host key is used to encrypt the cookie when required and so must
    112  1.1.1.5  christos       be RSA type.  By default, the host key is also the sign key used to
    113  1.1.1.5  christos       encrypt signatures.  A different sign key can be assigned using
    114  1.1.1.5  christos       the <tt>-S</tt> option and this can be either RSA or DSA type.  By
    115  1.1.1.5  christos       default, the signature message digest type is MD5, but any combination
    116  1.1.1.5  christos       of sign key type and message digest type supported by the OpenSSL
    117  1.1.1.5  christos       library can be specified using the <tt>-c</tt> option.</p>
    118  1.1.1.5  christos     <p>The rules say cryptographic media should be generated with proventic
    119  1.1.1.5  christos       filestamps, which means the host should already be synchronized before
    120  1.1.1.5  christos       this program is run.  This of course creates a chicken-and-egg problem
    121  1.1.1.5  christos       when the host is started for the first time.  Accordingly, the host
    122  1.1.1.5  christos       time should be set by some other means, such as
    123  1.1.1.5  christos       eyeball-and-wristwatch, at least so that the certificate lifetime is
    124  1.1.1.5  christos       within the current year.  After that and when the host is synchronized
    125  1.1.1.5  christos       to a proventic source, the certificate should be re-generated.</p>
    126  1.1.1.5  christos     <p>Additional information on trusted groups and identity schemes is on
    127  1.1.1.5  christos       the <a href="autokey.html">Autokey Public-Key Authentication</a>
    128  1.1.1.5  christos       page.</p>
    129  1.1.1.5  christos     <h4 id="cmd">Command Line Options</h4>
    130  1.1.1.5  christos     <dl>
    131  1.1.1.5  christos       <dt><tt>-b <i>modulus</i></tt></dt>
    132  1.1.1.5  christos       <dd>Set the modulus for generating identity keys to <i>modulus</i>
    133  1.1.1.5  christos 	bits.  The modulus defaults to 256, but can be set from 256 (32
    134  1.1.1.5  christos 	octets) to 2048 (256 octets).  Use the larger moduli with caution,
    135  1.1.1.5  christos 	as this can consume considerable computing resources and increases
    136  1.1.1.5  christos 	the size of authenticated packets.</dd>
    137  1.1.1.5  christos       <dt><tt>-c [ RSA-MD2 | RSA-MD5 | RSA-SHA | RSA-SHA1 | RSA-MDC2 | RSA-RIPEMD160 | DSA-SHA | DSA-SHA1 ]</tt></dt>
    138  1.1.1.5  christos       <dd>Select certificate digital signature and message digest scheme.
    139  1.1.1.5  christos 	Note that RSA schemes must be used with an RSA sign key and DSA
    140  1.1.1.5  christos 	schemes must be used with a DSA sign key.  The default without this
    141  1.1.1.5  christos 	option is <tt>RSA-MD5</tt>.  If compatibility with FIPS 140-2 is
    142  1.1.1.5  christos 	required, either the <tt>DSA-SHA</tt> or <tt>DSA-SHA1</tt> scheme
    143  1.1.1.5  christos 	must be used.</dd>
    144  1.1.1.5  christos       <dt><tt>-C <i>cipher</i></tt></dt>
    145  1.1.1.5  christos       <dd>Select the OpenSSL cipher to use for password-protected keys.
    146  1.1.1.5  christos 	The <tt>openssl -h</tt> command provided with OpenSSL displays
    147  1.1.1.5  christos 	available ciphers.  The default without this option
    148  1.1.1.5  christos 	is <tt>des-ede3-cbc</tt>.</dd>
    149  1.1.1.5  christos       <dt><tt>-d</tt></dt>
    150  1.1.1.5  christos       <dd>Enable debugging.  This option displays the cryptographic data
    151  1.1.1.5  christos 	produced for eye-friendly billboards.</dd>
    152  1.1.1.5  christos       <dt><tt>-e</tt></dt>
    153  1.1.1.5  christos       <dd>Extract the IFF or GQ public parameters from the <tt>IFFkey</tt>
    154  1.1.1.5  christos 	or <tt>GQkey</tt> keys file previously specified.  Send the
    155  1.1.1.5  christos 	unencrypted data to the standard output stream <tt>stdout</tt>.</dd>
    156  1.1.1.5  christos       <dt><tt>-G</tt></dt>
    157  1.1.1.5  christos       <dd>Generate a new encrypted GQ key file for the Guillou-Quisquater
    158  1.1.1.5  christos        (GQ) identity scheme.  This option is mutually exclusive with
    159  1.1.1.5  christos        the <tt>-I</tt> and <tt>-V</tt> options.</dd>
    160  1.1.1.5  christos       <dt><tt>-H</tt></dt>
    161  1.1.1.5  christos       <dd>Generate a new encrypted RSA public/private host key file.</dd>
    162  1.1.1.5  christos       <dt><tt>-i <i>group</i></tt></dt>
    163  1.1.1.5  christos       <dd>Set the optional Autokey group name to <tt><i>group</i></tt>. This
    164  1.1.1.5  christos 	is used in the identity scheme parameter file names.  In that role,
    165  1.1.1.5  christos 	the default is the host name if no group is provided.  The group
    166  1.1.1.5  christos 	name, if specified using <tt>-i</tt> or using <tt>-s</tt> following
    167  1.1.1.5  christos 	an <tt>@</tt> character, is also used in certificate subject and
    168  1.1.1.5  christos 	issuer names in the form <tt><i>host</i>@<i>group</i></tt> and
    169  1.1.1.5  christos 	should match the group specified via <tt>crypto ident</tt>
    170  1.1.1.5  christos 	or <tt>server ident</tt> in ntpd's configuration file.</dd>
    171  1.1.1.5  christos       <dt><tt>-I</tt></dt>
    172  1.1.1.5  christos       <dd>Generate a new encrypted IFF key file for the Schnorr (IFF)
    173  1.1.1.5  christos 	identity scheme.  This option is mutually exclusive with
    174  1.1.1.5  christos 	the <tt>-G</tt> and <tt>-V</tt> options.</dd>
    175  1.1.1.5  christos       <dt><tt>-l <i>days</i></tt></dt>
    176  1.1.1.5  christos       <dd>Set the lifetime for certificates to <tt><i>days</i></tt>.  The
    177  1.1.1.5  christos       default lifetime is one year (365 d).</dd>
    178  1.1.1.5  christos       <dt><tt>-m <i>modulus</i></tt></dt>
    179  1.1.1.5  christos       <dd>Set the modulus for generating files to <i>modulus</i> bits.  The
    180  1.1.1.5  christos 	modulus defaults to 512, but can be set from 256 (32 octets) to 2048
    181  1.1.1.5  christos 	(256 octets).  Use the larger moduli with caution, as this can
    182  1.1.1.5  christos 	consume considerable computing resources and increases the size of
    183  1.1.1.5  christos 	authenticated packets.</dd>
    184  1.1.1.5  christos       <dt><tt>-M</tt></dt>
    185  1.1.1.5  christos       <dd>Generate a new keys file containing 10 MD5 keys and 10 SHA keys.
    186  1.1.1.5  christos 	An MD5 key is a string of 20 random printable ASCII characters,
    187  1.1.1.5  christos 	while a SHA key is a string of 40 random hex digits. The file can be
    188  1.1.1.5  christos 	edited using a text editor to change the key type or key content.
    189  1.1.1.5  christos 	This option is mutually exclusive with all other options.</dd>
    190  1.1.1.5  christos       <dt><tt>-P</tt></dt>
    191  1.1.1.5  christos       <dd>Generate a new private certificate used by the PC identity scheme.
    192  1.1.1.5  christos 	By default, the program generates public certificates.  Note: the PC
    193  1.1.1.5  christos 	identity scheme is not recommended for new installations.</dd>
    194  1.1.1.5  christos       <dt><tt>-p <i>passwd</i></tt></dt>
    195  1.1.1.5  christos       <dd>Set the password for reading and writing encrypted files
    196  1.1.1.5  christos 	to <tt><i>passwd</i></tt>.  These include the host, sign and
    197  1.1.1.5  christos 	identify key files.  By default, the password is the string returned
    198  1.1.1.5  christos 	by the Unix <tt>gethostname()</tt> routine.</dd>
    199  1.1.1.5  christos       <dt><tt>-q <i>passwd</i></tt></dt>
    200  1.1.1.5  christos       <dd>Set the password for writing encrypted IFF, GQ and MV identity
    201  1.1.1.5  christos 	files redirected to <tt>stdout</tt> to <tt><i>passwd</i></tt>=.  In
    202  1.1.1.5  christos 	effect, these files are decrypted with the <tt>-p</tt> password,
    203  1.1.1.5  christos 	then encrypted with the <tt>-q</tt> password.  By default, the
    204  1.1.1.5  christos 	password is the string returned by the Unix <tt>gethostname()</tt>
    205  1.1.1.5  christos 	routine.</dd>
    206  1.1.1.5  christos       <dt><tt>-S [ RSA | DSA ]</tt></dt>
    207  1.1.1.5  christos       <dd>Generate a new encrypted public/private sign key file of the
    208  1.1.1.5  christos 	specified type.  By default, the sign key is the host key and has
    209  1.1.1.5  christos 	the same type.  If compatibly with FIPS 140-2 is required, the sign
    210  1.1.1.5  christos 	key type must be <tt>DSA</tt>.</dd>
    211  1.1.1.5  christos       <dt><tt>-s <i>host</i>[@<i>group</i>]</tt></dt>
    212  1.1.1.5  christos       <dd>Specify the Autokey host name, where <tt><i>host</i></tt> is the
    213  1.1.1.5  christos 	host name and <tt><i>group</i></tt> is the optional group name.  The
    214  1.1.1.5  christos 	host name, and if provided, group name are used
    215  1.1.1.5  christos 	in <tt><i>host</i>@<i>group</i></tt> form as certificate subject and
    216  1.1.1.5  christos 	issuer.  Specifying <tt>-s @<i>group</i></tt> is allowed, and
    217  1.1.1.5  christos 	results in leaving the host name unchanged, as
    218  1.1.1.5  christos 	with <tt>-i <i>group</i></tt>.  The group name, or if no group is
    219  1.1.1.5  christos 	provided, the host name are also used in the file names of IFF, GQ,
    220  1.1.1.5  christos 	and MV identity scheme parameter files.  If <tt><i>host</i></tt> is
    221  1.1.1.5  christos 	not specified, the default host name is the string returned by
    222  1.1.1.5  christos 	the <tt>gethostname()</tt> routine.</dd>
    223  1.1.1.5  christos       <dt><tt>-T</tt></dt>
    224  1.1.1.5  christos       <dd>Generate a trusted certificate.  By default, the program generates
    225  1.1.1.5  christos 	nontrusted certificates.</dd>
    226  1.1.1.5  christos       <dt><tt>-V <i>nkeys</i></tt></dt>
    227  1.1.1.5  christos       <dd>Generate <tt>nkeys</tt> encrypted server keys for the
    228  1.1.1.5  christos 	Mu-Varadharajan (MV) identity scheme.  This option is mutually
    229  1.1.1.5  christos 	exclusive with the <tt>-I</tt> and <tt>-G</tt> options.  Note:
    230  1.1.1.5  christos 	support for this option should be considered a work in
    231  1.1.1.5  christos 	progress.</dd>
    232  1.1.1.5  christos     </dl>
    233  1.1.1.5  christos     <h4 id="rand">Random Seed File</h4>
    234  1.1.1.5  christos     <p>All cryptographically sound key generation schemes must have means to
    235  1.1.1.5  christos       randomize the entropy seed used to initialize the internal
    236  1.1.1.5  christos       pseudo-random number generator used by the OpenSSL library routines.
    237  1.1.1.5  christos       If a site supports <tt>ssh</tt>, it is very likely that means to do
    238  1.1.1.5  christos       this are already available.  The entropy seed used by the OpenSSL
    239  1.1.1.5  christos       library is contained in a file, usually called <tt>.rnd</tt>, which
    240  1.1.1.5  christos       must be available when starting the <tt>ntp-keygen</tt> program
    241  1.1.1.5  christos       or <tt>ntpd</tt> daemon.</p>
    242  1.1.1.5  christos     <p>The OpenSSL library looks for the file using the path specified by
    243  1.1.1.5  christos       the <tt>RANDFILE</tt> environment variable in the user home directory,
    244  1.1.1.5  christos       whether root or some other user.  If the <tt>RANDFILE</tt> environment
    245  1.1.1.5  christos       variable is not present, the library looks for the <tt>.rnd</tt> file
    246  1.1.1.5  christos       in the user home directory.  Since both the <tt>ntp-keygen</tt>
    247  1.1.1.5  christos       program and <tt>ntpd</tt> daemon must run as root, the logical place
    248  1.1.1.5  christos       to put this file is in <tt>/.rnd</tt> or <tt>/root/.rnd</tt>.  If the
    249  1.1.1.5  christos       file is not available or cannot be written, the program exits with a
    250  1.1.1.5  christos       message to the system log.</p>
    251  1.1.1.5  christos     <h4 id="fmt">Cryptographic Data Files</h4>
    252  1.1.1.5  christos     <p>File and link names are in the
    253  1.1.1.5  christos       form <tt>ntpkey_<i>key</i>_<i>name</i>.<i>fstamp</i></tt>,
    254  1.1.1.5  christos       where <tt><i>key</i></tt> is the key or parameter
    255  1.1.1.5  christos       type, <tt><i>name</i></tt> is the host or group name
    256  1.1.1.5  christos       and <tt><i>fstamp</i></tt> is the filestamp (NTP seconds) when the
    257  1.1.1.5  christos       file was created).  By convention, <em><tt>key</tt></em> names in
    258  1.1.1.5  christos       generated file names include both upper and lower case characters,
    259  1.1.1.5  christos       while <em><tt>key</tt></em> names in generated link names include only
    260  1.1.1.5  christos       lower case characters.  The filestamp is not used in generated link
    261  1.1.1.5  christos       names.</p>
    262  1.1.1.5  christos     <p>The <em><tt>key</tt></em> name is a string defining the cryptographic
    263  1.1.1.5  christos       key type.  Key types include public/private keys <tt>host</tt>
    264  1.1.1.5  christos       and <tt>sign</tt>, certificate <tt>cert</tt> and several
    265  1.1.1.5  christos       challenge/response key types.  By convention, client files used for
    266  1.1.1.5  christos       challenges have a <tt>par</tt> subtype, as in the IFF
    267  1.1.1.5  christos       challenge <tt>IFFpar</tt>, while server files for responses have
    268  1.1.1.5  christos       a <tt>key</tt> subtype, as in the GQ response <tt>GQkey</tt>.</p>
    269  1.1.1.5  christos     <p>All files begin with two nonencrypted lines.  The first line contains
    270  1.1.1.5  christos     the file name in the
    271  1.1.1.5  christos     format <tt>ntpkey_<i>key</i>_<i>host</i>.<i>fstamp</i></tt>.  The second
    272  1.1.1.5  christos     line contains the datestamp in conventional Unix <tt>date</tt> format.
    273  1.1.1.5  christos     Lines beginning with <tt>#</tt> are ignored.</p>
    274  1.1.1.5  christos     <p>The remainder of the file contains cryptographic data encoded first
    275  1.1.1.5  christos       using ASN.1 rules, then encrypted using the DES-CBC algorithm with
    276  1.1.1.5  christos       given password and finally written in PEM-encoded printable ASCII text
    277  1.1.1.5  christos       preceded and followed by MIME content identifier lines.</p>
    278  1.1.1.5  christos     <p>The format of the symmetric keys file, ordinarily
    279  1.1.1.5  christos       named <tt>ntp.keys,</tt> is somewhat different than the other files in
    280  1.1.1.5  christos       the interest of backward compatibility.  Ordinarily, the file is
    281  1.1.1.5  christos       generated by this program, but it can be constructed and edited using
    282  1.1.1.5  christos       an ordinary text editor.</p>
    283  1.1.1.5  christos     <table>
    284  1.1.1.5  christos       <caption style="caption-side: bottom;">
    285  1.1.1.5  christos 	Figure 1. Typical Symmetric Key File
    286  1.1.1.5  christos       </caption>
    287  1.1.1.5  christos       <tr><td style="border: 1px solid black; border-spacing: 0;">
    288  1.1.1.5  christos 	  <pre style="color:grey;">
    289  1.1.1.5  christos 	    # ntpkey_MD5key_bk.ntp.org.3595864945
    290  1.1.1.5  christos 	    # Thu Dec 12 19:22:25 2013
    291  1.1.1.5  christos 
    292  1.1.1.5  christos 	    1  MD5 L";Nw&lt;`.I&lt;f4U0)247"i  # MD5 key
    293  1.1.1.5  christos 	    2  MD5 &amp;&gt;l0%XXK9O'51VwV&lt;xq~  # MD5 key
    294  1.1.1.5  christos 	    3  MD5 lb4zLW~d^!K:]RsD'qb6  # MD5 key
    295  1.1.1.5  christos 	    4  MD5 Yue:tL[+vR)M`n~bY,'?  # MD5 key
    296  1.1.1.5  christos 	    5  MD5 B;fxlKgr/&amp;4ZTbL6=RxA  # MD5 key
    297  1.1.1.5  christos 	    6  MD5 4eYwa`o}3i@@V (a] ..R9!l  # MD5 key
    298  1.1.1.5  christos 	    7  MD5 `A.([h+;wTQ|xfi%Sn_!  # MD5 key
    299  1.1.1.5  christos 	    8  MD5 45:V,r4]l6y^JH6.Sh?F  # MD5 key
    300  1.1.1.5  christos 	    9  MD5 3-5vcn*6l29DS?Xdsg)*  # MD5 key
    301  1.1.1.5  christos 	    10 MD5 2late4Me              # MD5 key
    302  1.1.1.5  christos 	    11 SHA1 a27872d3030a9025b8446c751b4551a7629af65c  # SHA1 key
    303  1.1.1.5  christos 	    12 SHA1 21bc3b4865dbb9e920902abdccb3e04ff97a5e74  # SHA1 key
    304  1.1.1.5  christos 	    13 SHA1 2b7736fe24fef5ba85ae11594132ab5d6f6daba9  # SHA1 key
    305  1.1.1.5  christos 	    14 SHA  a5332809c8878dd3a5b918819108a111509aeceb  # SHA  key
    306  1.1.1.5  christos 	    15 MD2  2fe16c88c760ff2f16d4267e36c1aa6c926e6964  # MD2  key
    307  1.1.1.5  christos 	    16 MD4  b2691811dc19cfc0e2f9bcacd74213f29812183d  # MD4  key
    308  1.1.1.5  christos 	    17 MD5  e4d6735b8bdad58ec5ffcb087300a17f7fef1f7c  # MD5  key
    309  1.1.1.5  christos 	    18 MDC2 a8d5e2315c025bf3a79174c87fbd10477de2eabc  # MDC2 key
    310  1.1.1.5  christos 	    19 RIPEMD160 77ca332cafb30e3cafb174dcd5b80ded7ba9b3d2  # RIPEMD160 key
    311  1.1.1.5  christos 	    20 AES128CMAC f92ff73eee86c1e7dc638d6489a04e4e555af878  # AES128CMAC key
    312  1.1.1.5  christos 	    21 MD5 sampo 10.1.2.3/24
    313  1.1.1.5  christos     </pre></td></tr></table>
    314  1.1.1.5  christos     <p>Figure 1 shows a typical symmetric keys file used by the reference
    315  1.1.1.5  christos       implementation.  Each line of the file contains three or four fields,
    316  1.1.1.6  christos       first an integer between 1 and 65535, inclusive, representing the key
    317  1.1.1.5  christos       identifier used in the <tt>server</tt> and <tt>peer</tt> configuration
    318  1.1.1.5  christos       commands.  Second is the key type for the message digest algorithm,
    319  1.1.1.5  christos       which in the absence of the OpenSSL library must be <tt>MD5</tt> to
    320  1.1.1.5  christos       designate the MD5 message digest algorithm.  If the OpenSSL library is
    321  1.1.1.5  christos       installed, the key type can be any message digest algorithm supported
    322  1.1.1.5  christos       by that library.  However, if compatibility with FIPS 140-2 is
    323  1.1.1.5  christos       required, the key type must be either <tt>SHA</tt> or <tt>SHA1</tt>.
    324  1.1.1.5  christos       The key type can be changed using an ASCII text editor.</p>
    325  1.1.1.5  christos     <p>The third field is the key.</p>
    326  1.1.1.5  christos     <p>An MD5 key consists of a printable ASCII string less than or equal to
    327  1.1.1.5  christos       16 characters and terminated by whitespace or a # character.  An
    328  1.1.1.5  christos       OpenSSL key consists of a hex-encoded ASCII string of 40 characters,
    329  1.1.1.5  christos       which is truncated as necessary.</p>
    330  1.1.1.5  christos     <p>Note that the keys used by the <tt>ntpq</tt> and <tt>ntpdc</tt>
    331  1.1.1.5  christos       programs are checked against passwords requested by the programs and
    332  1.1.1.5  christos       entered by hand, so it is generally appropriate to specify these keys
    333  1.1.1.5  christos       in human readable ASCII format.</p>
    334  1.1.1.5  christos     <p>The optional fourth field is one or more IPs, with each IP separated
    335  1.1.1.5  christos       with a comma.  An IP may end with an optional <tt>/subnetbits</tt>
    336  1.1.1.5  christos       suffix, which limits the acceptance of the key identifier to packets
    337  1.1.1.5  christos       claiming to be from the described IP space.</p>
    338  1.1.1.5  christos     <p>The <tt>ntp-keygen</tt> program generates a MD5 symmetric keys
    339  1.1.1.5  christos       file <tt>ntpkey_MD5key_<i>hostname.filestamp</i></tt>.  Since the file
    340  1.1.1.5  christos       contains private shared keys, it should be visible only to root and
    341  1.1.1.5  christos       distributed by secure means to other subnet hosts.  The NTP daemon
    342  1.1.1.5  christos       loads the file <tt>ntp.keys</tt>, so <tt>ntp-keygen</tt> installs a
    343  1.1.1.5  christos       soft link from this name to the generated file.  Subsequently, similar
    344  1.1.1.5  christos       soft links must be installed by manual or automated means on the other
    345  1.1.1.5  christos       subnet hosts.  While this file is not used with the Autokey Version 2
    346  1.1.1.5  christos       protocol, it is needed to authenticate some remote configuration
    347  1.1.1.5  christos       commands used by the <a href="ntpq.html"><tt>ntpq</tt></a>
    348  1.1.1.5  christos       and <a href="ntpdc.html"><tt>ntpdc</tt></a> utilities.</p>
    349  1.1.1.5  christos     <h4 id="bug">Bugs</h4>
    350  1.1.1.5  christos     <p>It can take quite a while to generate some cryptographic values.</p>
    351  1.1.1.5  christos     <hr>
    352  1.1.1.5  christos     <script type="text/javascript" language="javascript" src="scripts/footer.txt"></script>
    353  1.1.1.5  christos   </body>
    354  1.1.1.3  christos </html>
    355