xref: /freebsd/contrib/ntp/html/keygen.html (revision 7847e04111f2c2b06b36f6d19a46d78814d7836d)
19c2daa00SOllivier Robert<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
29c2daa00SOllivier Robert<html>
39c2daa00SOllivier Robert  <head>
4ea906c41SOllivier Robert    <meta http-equiv="content-type" content="text/html;charset=iso-8859-1">
59c2daa00SOllivier Robert    <meta name="generator" content="HTML Tidy, see www.w3.org">
69c2daa00SOllivier Robert    <title>ntp-keygen - generate public and private keys</title>
79c2daa00SOllivier Robert    <link href="scripts/style.css" type="text/css" rel="stylesheet">
89c2daa00SOllivier Robert  </head>
99c2daa00SOllivier Robert  <body>
109c2daa00SOllivier Robert    <h3><tt>ntp-keygen</tt> - generate public and private keys</h3>
112b15cb3dSCy Schubert    <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>
129c2daa00SOllivier Robert    <p>Alice holds the key.</p>
132b15cb3dSCy Schubert    <p>Last update:
14*4e1ef62aSXin LI      <!-- #BeginDate format:En2m -->24-Jul-2018  07:27<!-- #EndDate -->
152b15cb3dSCy Schubert      UTC</p>
169c2daa00SOllivier Robert    <br clear="left">
179c2daa00SOllivier Robert    <h4>Related Links</h4>
182b15cb3dSCy Schubert    <script type="text/javascript" language="javascript" src="scripts/manual.txt"></script>
199c2daa00SOllivier Robert    <h4>Table of Contents</h4>
209c2daa00SOllivier Robert    <ul>
212b15cb3dSCy Schubert      <li class="inline"><a href="#synop">Synopsis</a></li>
222b15cb3dSCy Schubert      <li class="inline"><a href="#descrip">Description</a></li>
232b15cb3dSCy Schubert      <li class="inline"><a href="#run">Running the program</a></li>
242b15cb3dSCy Schubert      <li class="inline"><a href="#cmd">Command Line Options</a></li>
252b15cb3dSCy Schubert      <li class="inline"><a href="#rand">Random Seed File</a></li>
262b15cb3dSCy Schubert      <li class="inline"><a href="#fmt">Cryptographic Data Files</a></li>
272b15cb3dSCy Schubert      <li class="inline"><a href="#bug">Bugs</a></li>
289c2daa00SOllivier Robert    </ul>
299c2daa00SOllivier Robert    <hr>
309c2daa00SOllivier Robert    <h4 id="synop">Synopsis</h4>
312b15cb3dSCy Schubert    <p id="intro"><tt>ntp-keygen [ -deGHIMPT ] [ -b <i>modulus</i> ] [ -c [ RSA-MD2 | RSA-MD5 | RSA-SHA
322b15cb3dSCy Schubert	| RSA-SHA1 | RSA-MDC2 | RSA-RIPEMD160 | DSA-SHA | DSA-SHA1 ] ]
332b15cb3dSCy Schubert	[ -C <i>cipher</i> ] [-i <i>group</i> ] [ -l <em>days</em>]
342b15cb3dSCy Schubert	[ -m <i>modulus</i> ]  [ -p <i>passwd1</i> ] [ -q <i>passwd2</i> ]
352b15cb3dSCy Schubert	[ -S [ RSA | DSA ] ] [ -s <i>host</i> ] [ -V <i>nkeys</i> ]</tt></p>
369c2daa00SOllivier Robert    <h4 id="descrip">Description</h4>
3709100258SXin LI    <p>This program generates cryptographic data files used by the NTPv4
3809100258SXin LI      authentication and identity schemes.  It can generate message digest keys
3909100258SXin LI      used in symmetric key cryptography and, if the OpenSSL software library
4009100258SXin LI      has been installed, it can generate host keys, sign keys, certificates,
4109100258SXin LI      and identity keys and parameters used by the Autokey public key
4209100258SXin LI      cryptography.  The message digest keys file is generated in a format
4309100258SXin LI      compatible with NTPv3.  All other files are in PEM-encoded printable ASCII
4409100258SXin LI      format so they can be embedded as MIME attachments in mail to other
4509100258SXin LI      sites.</p>
4609100258SXin LI    <p>When used to generate message digest keys, the program produces a file
4709100258SXin LI      containing ten pseudo-random printable ASCII strings suitable for the MD5
4809100258SXin LI      message digest algorithm included in the distribution.  If the OpenSSL
4909100258SXin LI      library is installed, it produces an additional ten hex-encoded random bit
5009100258SXin LI      strings suitable for the SHA1, AES-128 CMAC, and other message digest
5109100258SXin LI      algorithms.  The message digest keys file must be distributed and stored
5209100258SXin LI      using secure means beyond the scope of NTP itself.  Besides the keys used
5309100258SXin LI      for ordinary NTP associations, additional keys can be defined as passwords
5409100258SXin LI      for the <tt><a href="ntpq.html">ntpq</a></tt>
5509100258SXin LI      and <tt><a href="ntpdc.html">ntpdc</a></tt> utility programs.</p>
5609100258SXin LI    <p>The remaining generated files are compatible with other OpenSSL
5709100258SXin LI      applications and other Public Key Infrastructure (PKI)
5809100258SXin LI      resources.  Certificates generated by this program are compatible with
5909100258SXin LI      extant industry practice, although some users might find the
6009100258SXin LI      interpretation of X509v3 extension fields somewhat liberal.  However,
6109100258SXin LI      the identity keys are probably not compatible with anything other than
6209100258SXin LI      Autokey.</p>
6309100258SXin LI    <p>Some files used by this program are encrypted using a private
6409100258SXin LI      password.  The <tt>-p</tt> option specifies the password for local
6509100258SXin LI      encrypted files and the <tt>-q</tt> option the password for encrypted
6609100258SXin LI      files sent to remote sites.  If no password is specified, the host name
6709100258SXin LI      returned by the Unix <tt>gethostname()</tt> function, normally the DNS
6809100258SXin LI      name of the host, is used.</p>
6909100258SXin LI    <p>The <tt>pw</tt> option of the <tt>crypto</tt> configuration command
7009100258SXin LI      specifies the read password for previously encrypted local files.
7109100258SXin LI      This must match the local password used by this program.  If not
7209100258SXin LI      specified, the host name is used.  Thus, if files are generated by
7309100258SXin LI      this program without password, they can be read back by <tt>ntpd</tt>
7409100258SXin LI      without password, but only on the same host.</p>
7509100258SXin LI    <p>Normally, encrypted files for each host are generated by that host
7609100258SXin LI      and used only by that host, although exceptions exist as noted later
7709100258SXin LI      on this page.  The symmetric keys file, normally
7809100258SXin LI      called <tt>ntp.keys</tt>, is usually installed in <tt>/etc</tt>.
7909100258SXin LI      Other files and links are usually installed
8009100258SXin LI      in <tt>/usr/local/etc</tt>, which is normally in a shared filesystem
8109100258SXin LI      in NFS-mounted networks and cannot be changed by shared clients.  The
8209100258SXin LI      location of the keys directory can be changed by the <tt>keysdir</tt>
8309100258SXin LI      configuration command in such cases.  Normally, this is
8409100258SXin LI      in <tt>/etc</tt>.</p>
8509100258SXin LI    <p>This program directs commentary and error messages to the standard
8609100258SXin LI      error stream <tt>stderr</tt> and remote files to the standard output
8709100258SXin LI      stream <tt>stdout</tt> where they can be piped to other applications
8809100258SXin LI      or redirected to files.  The names used for generated files and links
8909100258SXin LI      all begin with the string <tt>ntpkey</tt> and include the file type,
9009100258SXin LI      generating host and filestamp, as described in
9109100258SXin LI      the <a href="#fmt">Cryptographic Data Files</a> section below</p>
922b15cb3dSCy Schubert    <h4 id="run">Running the Program</h4>
9309100258SXin LI    <p>To test and gain experience with Autokey concepts, log in as root and
9409100258SXin LI      change to the keys directory, usually <tt>/usr/local/etc</tt>.  When
9509100258SXin LI      run for the first time, or if all files with names
9609100258SXin LI      beginning <tt>ntpkey</tt> have been removed, use
9709100258SXin LI      the <tt>ntp-keygen</tt> command without arguments to generate a
9809100258SXin LI      default RSA host key and matching RSA-MD5 certificate with expiration
9909100258SXin LI      date one year hence.  If run again without options, the program uses
10009100258SXin LI      the existing keys and parameters and generates only a new certificate
10109100258SXin LI      with new expiration date one year hence.</p>
10209100258SXin LI    <p>Run the command on as many hosts as necessary.  Designate one of them
10309100258SXin LI      as the trusted host (TH) using <tt>ntp-keygen</tt> with
10409100258SXin LI      the <tt>-T</tt> option and configure it to synchronize from reliable
10509100258SXin LI      Internet servers.  Then configure the other hosts to synchronize to
10609100258SXin LI      the TH directly or indirectly.  A certificate trail is created when
10709100258SXin LI      Autokey asks the immediately ascendant host towards the TH to sign its
10809100258SXin LI      certificate, which is then provided to the immediately descendant host
10909100258SXin LI      on request.  All group hosts should have acyclic certificate trails
11009100258SXin LI      ending on the TH.</p>
11109100258SXin LI    <p>The host key is used to encrypt the cookie when required and so must
11209100258SXin LI      be RSA type.  By default, the host key is also the sign key used to
11309100258SXin LI      encrypt signatures.  A different sign key can be assigned using
11409100258SXin LI      the <tt>-S</tt> option and this can be either RSA or DSA type.  By
11509100258SXin LI      default, the signature message digest type is MD5, but any combination
11609100258SXin LI      of sign key type and message digest type supported by the OpenSSL
11709100258SXin LI      library can be specified using the <tt>-c</tt> option.</p>
11809100258SXin LI    <p>The rules say cryptographic media should be generated with proventic
11909100258SXin LI      filestamps, which means the host should already be synchronized before
12009100258SXin LI      this program is run.  This of course creates a chicken-and-egg problem
12109100258SXin LI      when the host is started for the first time.  Accordingly, the host
12209100258SXin LI      time should be set by some other means, such as
12309100258SXin LI      eyeball-and-wristwatch, at least so that the certificate lifetime is
12409100258SXin LI      within the current year.  After that and when the host is synchronized
12509100258SXin LI      to a proventic source, the certificate should be re-generated.</p>
12609100258SXin LI    <p>Additional information on trusted groups and identity schemes is on
12709100258SXin LI      the <a href="autokey.html">Autokey Public-Key Authentication</a>
12809100258SXin LI      page.</p>
1299c2daa00SOllivier Robert    <h4 id="cmd">Command Line Options</h4>
1309c2daa00SOllivier Robert    <dl>
1312b15cb3dSCy Schubert      <dt><tt>-b <i>modulus</i></tt></dt>
13209100258SXin LI      <dd>Set the modulus for generating identity keys to <i>modulus</i>
13309100258SXin LI	bits.  The modulus defaults to 256, but can be set from 256 (32
13409100258SXin LI	octets) to 2048 (256 octets).  Use the larger moduli with caution,
13509100258SXin LI	as this can consume considerable computing resources and increases
13609100258SXin LI	the size of authenticated packets.</dd>
1372b15cb3dSCy Schubert      <dt><tt>-c [ RSA-MD2 | RSA-MD5 | RSA-SHA | RSA-SHA1 | RSA-MDC2 | RSA-RIPEMD160 | DSA-SHA | DSA-SHA1 ]</tt></dt>
13809100258SXin LI      <dd>Select certificate digital signature and message digest scheme.
13909100258SXin LI	Note that RSA schemes must be used with an RSA sign key and DSA
14009100258SXin LI	schemes must be used with a DSA sign key.  The default without this
14109100258SXin LI	option is <tt>RSA-MD5</tt>.  If compatibility with FIPS 140-2 is
14209100258SXin LI	required, either the <tt>DSA-SHA</tt> or <tt>DSA-SHA1</tt> scheme
14309100258SXin LI	must be used.</dd>
1442b15cb3dSCy Schubert      <dt><tt>-C <i>cipher</i></tt></dt>
14509100258SXin LI      <dd>Select the OpenSSL cipher to use for password-protected keys.
14609100258SXin LI	The <tt>openssl -h</tt> command provided with OpenSSL displays
14709100258SXin LI	available ciphers.  The default without this option
14809100258SXin LI	is <tt>des-ede3-cbc</tt>.</dd>
1492b15cb3dSCy Schubert      <dt><tt>-d</tt></dt>
15009100258SXin LI      <dd>Enable debugging.  This option displays the cryptographic data
15109100258SXin LI	produced for eye-friendly billboards.</dd>
1522b15cb3dSCy Schubert      <dt><tt>-e</tt></dt>
15309100258SXin LI      <dd>Extract the IFF or GQ public parameters from the <tt>IFFkey</tt>
15409100258SXin LI	or <tt>GQkey</tt> keys file previously specified.  Send the
15509100258SXin LI	unencrypted data to the standard output stream <tt>stdout</tt>.</dd>
1562b15cb3dSCy Schubert      <dt><tt>-G</tt></dt>
15709100258SXin LI      <dd>Generate a new encrypted GQ key file for the Guillou-Quisquater
15809100258SXin LI       (GQ) identity scheme.  This option is mutually exclusive with
15909100258SXin LI       the <tt>-I</tt> and <tt>-V</tt> options.</dd>
1602b15cb3dSCy Schubert      <dt><tt>-H</tt></dt>
1612b15cb3dSCy Schubert      <dd>Generate a new encrypted RSA public/private host key file.</dd>
1622b15cb3dSCy Schubert      <dt><tt>-i <i>group</i></tt></dt>
16309100258SXin LI      <dd>Set the optional Autokey group name to <tt><i>group</i></tt>. This
16409100258SXin LI	is used in the identity scheme parameter file names.  In that role,
16509100258SXin LI	the default is the host name if no group is provided.  The group
16609100258SXin LI	name, if specified using <tt>-i</tt> or using <tt>-s</tt> following
16709100258SXin LI	an <tt>@</tt> character, is also used in certificate subject and
16809100258SXin LI	issuer names in the form <tt><i>host</i>@<i>group</i></tt> and
16909100258SXin LI	should match the group specified via <tt>crypto ident</tt>
17009100258SXin LI	or <tt>server ident</tt> in ntpd's configuration file.</dd>
1712b15cb3dSCy Schubert      <dt><tt>-I</tt></dt>
17209100258SXin LI      <dd>Generate a new encrypted IFF key file for the Schnorr (IFF)
17309100258SXin LI	identity scheme.  This option is mutually exclusive with
17409100258SXin LI	the <tt>-G</tt> and <tt>-V</tt> options.</dd>
1752b15cb3dSCy Schubert      <dt><tt>-l <i>days</i></tt></dt>
17609100258SXin LI      <dd>Set the lifetime for certificates to <tt><i>days</i></tt>.  The
17709100258SXin LI      default lifetime is one year (365 d).</dd>
1782b15cb3dSCy Schubert      <dt><tt>-m <i>modulus</i></tt></dt>
17909100258SXin LI      <dd>Set the modulus for generating files to <i>modulus</i> bits.  The
18009100258SXin LI	modulus defaults to 512, but can be set from 256 (32 octets) to 2048
18109100258SXin LI	(256 octets).  Use the larger moduli with caution, as this can
18209100258SXin LI	consume considerable computing resources and increases the size of
18309100258SXin LI	authenticated packets.</dd>
1842b15cb3dSCy Schubert      <dt><tt>-M</tt></dt>
18509100258SXin LI      <dd>Generate a new keys file containing 10 MD5 keys and 10 SHA keys.
18609100258SXin LI	An MD5 key is a string of 20 random printable ASCII characters,
18709100258SXin LI	while a SHA key is a string of 40 random hex digits. The file can be
18809100258SXin LI	edited using a text editor to change the key type or key content.
18909100258SXin LI	This option is mutually exclusive with all other options.</dd>
1902b15cb3dSCy Schubert      <dt><tt>-P</tt></dt>
19109100258SXin LI      <dd>Generate a new private certificate used by the PC identity scheme.
19209100258SXin LI	By default, the program generates public certificates.  Note: the PC
19309100258SXin LI	identity scheme is not recommended for new installations.</dd>
1942b15cb3dSCy Schubert      <dt><tt>-p <i>passwd</i></tt></dt>
19509100258SXin LI      <dd>Set the password for reading and writing encrypted files
19609100258SXin LI	to <tt><i>passwd</i></tt>.  These include the host, sign and
19709100258SXin LI	identify key files.  By default, the password is the string returned
19809100258SXin LI	by the Unix <tt>gethostname()</tt> routine.</dd>
1992b15cb3dSCy Schubert      <dt><tt>-q <i>passwd</i></tt></dt>
20009100258SXin LI      <dd>Set the password for writing encrypted IFF, GQ and MV identity
20109100258SXin LI	files redirected to <tt>stdout</tt> to <tt><i>passwd</i></tt>=.  In
20209100258SXin LI	effect, these files are decrypted with the <tt>-p</tt> password,
20309100258SXin LI	then encrypted with the <tt>-q</tt> password.  By default, the
20409100258SXin LI	password is the string returned by the Unix <tt>gethostname()</tt>
20509100258SXin LI	routine.</dd>
2062b15cb3dSCy Schubert      <dt><tt>-S [ RSA | DSA ]</tt></dt>
20709100258SXin LI      <dd>Generate a new encrypted public/private sign key file of the
20809100258SXin LI	specified type.  By default, the sign key is the host key and has
20909100258SXin LI	the same type.  If compatibly with FIPS 140-2 is required, the sign
21009100258SXin LI	key type must be <tt>DSA</tt>.</dd>
2112b15cb3dSCy Schubert      <dt><tt>-s <i>host</i>[@<i>group</i>]</tt></dt>
21209100258SXin LI      <dd>Specify the Autokey host name, where <tt><i>host</i></tt> is the
21309100258SXin LI	host name and <tt><i>group</i></tt> is the optional group name.  The
21409100258SXin LI	host name, and if provided, group name are used
21509100258SXin LI	in <tt><i>host</i>@<i>group</i></tt> form as certificate subject and
21609100258SXin LI	issuer.  Specifying <tt>-s @<i>group</i></tt> is allowed, and
21709100258SXin LI	results in leaving the host name unchanged, as
21809100258SXin LI	with <tt>-i <i>group</i></tt>.  The group name, or if no group is
21909100258SXin LI	provided, the host name are also used in the file names of IFF, GQ,
22009100258SXin LI	and MV identity scheme parameter files.  If <tt><i>host</i></tt> is
22109100258SXin LI	not specified, the default host name is the string returned by
22209100258SXin LI	the <tt>gethostname()</tt> routine.</dd>
2232b15cb3dSCy Schubert      <dt><tt>-T</tt></dt>
22409100258SXin LI      <dd>Generate a trusted certificate.  By default, the program generates
22509100258SXin LI	nontrusted certificates.</dd>
2262b15cb3dSCy Schubert      <dt><tt>-V <i>nkeys</i></tt></dt>
22709100258SXin LI      <dd>Generate <tt>nkeys</tt> encrypted server keys for the
22809100258SXin LI	Mu-Varadharajan (MV) identity scheme.  This option is mutually
22909100258SXin LI	exclusive with the <tt>-I</tt> and <tt>-G</tt> options.  Note:
23009100258SXin LI	support for this option should be considered a work in
23109100258SXin LI	progress.</dd>
2329c2daa00SOllivier Robert    </dl>
2339c2daa00SOllivier Robert    <h4 id="rand">Random Seed File</h4>
23409100258SXin LI    <p>All cryptographically sound key generation schemes must have means to
23509100258SXin LI      randomize the entropy seed used to initialize the internal
23609100258SXin LI      pseudo-random number generator used by the OpenSSL library routines.
23709100258SXin LI      If a site supports <tt>ssh</tt>, it is very likely that means to do
23809100258SXin LI      this are already available.  The entropy seed used by the OpenSSL
23909100258SXin LI      library is contained in a file, usually called <tt>.rnd</tt>, which
24009100258SXin LI      must be available when starting the <tt>ntp-keygen</tt> program
24109100258SXin LI      or <tt>ntpd</tt> daemon.</p>
24209100258SXin LI    <p>The OpenSSL library looks for the file using the path specified by
24309100258SXin LI      the <tt>RANDFILE</tt> environment variable in the user home directory,
24409100258SXin LI      whether root or some other user.  If the <tt>RANDFILE</tt> environment
24509100258SXin LI      variable is not present, the library looks for the <tt>.rnd</tt> file
24609100258SXin LI      in the user home directory.  Since both the <tt>ntp-keygen</tt>
24709100258SXin LI      program and <tt>ntpd</tt> daemon must run as root, the logical place
24809100258SXin LI      to put this file is in <tt>/.rnd</tt> or <tt>/root/.rnd</tt>.  If the
24909100258SXin LI      file is not available or cannot be written, the program exits with a
25009100258SXin LI      message to the system log.</p>
2512b15cb3dSCy Schubert    <h4 id="fmt">Cryptographic Data Files</h4>
25209100258SXin LI    <p>File and link names are in the
25309100258SXin LI      form <tt>ntpkey_<i>key</i>_<i>name</i>.<i>fstamp</i></tt>,
25409100258SXin LI      where <tt><i>key</i></tt> is the key or parameter
25509100258SXin LI      type, <tt><i>name</i></tt> is the host or group name
25609100258SXin LI      and <tt><i>fstamp</i></tt> is the filestamp (NTP seconds) when the
25709100258SXin LI      file was created).  By convention, <em><tt>key</tt></em> names in
25809100258SXin LI      generated file names include both upper and lower case characters,
25909100258SXin LI      while <em><tt>key</tt></em> names in generated link names include only
26009100258SXin LI      lower case characters.  The filestamp is not used in generated link
26109100258SXin LI      names.</p>
26209100258SXin LI    <p>The <em><tt>key</tt></em> name is a string defining the cryptographic
26309100258SXin LI      key type.  Key types include public/private keys <tt>host</tt>
26409100258SXin LI      and <tt>sign</tt>, certificate <tt>cert</tt> and several
26509100258SXin LI      challenge/response key types.  By convention, client files used for
26609100258SXin LI      challenges have a <tt>par</tt> subtype, as in the IFF
26709100258SXin LI      challenge <tt>IFFpar</tt>, while server files for responses have
26809100258SXin LI      a <tt>key</tt> subtype, as in the GQ response <tt>GQkey</tt>.</p>
26909100258SXin LI    <p>All files begin with two nonencrypted lines.  The first line contains
27009100258SXin LI    the file name in the
27109100258SXin LI    format <tt>ntpkey_<i>key</i>_<i>host</i>.<i>fstamp</i></tt>.  The second
27209100258SXin LI    line contains the datestamp in conventional Unix <tt>date</tt> format.
27309100258SXin LI    Lines beginning with <tt>#</tt> are ignored.</p>
27409100258SXin LI    <p>The remainder of the file contains cryptographic data encoded first
27509100258SXin LI      using ASN.1 rules, then encrypted using the DES-CBC algorithm with
27609100258SXin LI      given password and finally written in PEM-encoded printable ASCII text
27709100258SXin LI      preceded and followed by MIME content identifier lines.</p>
27809100258SXin LI    <p>The format of the symmetric keys file, ordinarily
27909100258SXin LI      named <tt>ntp.keys,</tt> is somewhat different than the other files in
28009100258SXin LI      the interest of backward compatibility.  Ordinarily, the file is
28109100258SXin LI      generated by this program, but it can be constructed and edited using
28209100258SXin LI      an ordinary text editor.</p>
28309100258SXin LI    <table>
28409100258SXin LI      <caption style="caption-side: bottom;">
28509100258SXin LI	Figure 1. Typical Symmetric Key File
28609100258SXin LI      </caption>
28709100258SXin LI      <tr><td style="border: 1px solid black; border-spacing: 0;">
28809100258SXin LI	  <pre style="color:grey;">
28909100258SXin LI	    # ntpkey_MD5key_bk.ntp.org.3595864945
29009100258SXin LI	    # Thu Dec 12 19:22:25 2013
29109100258SXin LI
29209100258SXin LI	    1  MD5 L";Nw&lt;`.I&lt;f4U0)247"i  # MD5 key
29309100258SXin LI	    2  MD5 &amp;&gt;l0%XXK9O'51VwV&lt;xq~  # MD5 key
29409100258SXin LI	    3  MD5 lb4zLW~d^!K:]RsD'qb6  # MD5 key
29509100258SXin LI	    4  MD5 Yue:tL[+vR)M`n~bY,'?  # MD5 key
29609100258SXin LI	    5  MD5 B;fxlKgr/&amp;4ZTbL6=RxA  # MD5 key
29709100258SXin LI	    6  MD5 4eYwa`o}3i@@V@..R9!l  # MD5 key
29809100258SXin LI	    7  MD5 `A.([h+;wTQ|xfi%Sn_!  # MD5 key
29909100258SXin LI	    8  MD5 45:V,r4]l6y^JH6.Sh?F  # MD5 key
30009100258SXin LI	    9  MD5 3-5vcn*6l29DS?Xdsg)*  # MD5 key
30109100258SXin LI	    10 MD5 2late4Me              # MD5 key
30209100258SXin LI	    11 SHA1 a27872d3030a9025b8446c751b4551a7629af65c  # SHA1 key
30309100258SXin LI	    12 SHA1 21bc3b4865dbb9e920902abdccb3e04ff97a5e74  # SHA1 key
30409100258SXin LI	    13 SHA1 2b7736fe24fef5ba85ae11594132ab5d6f6daba9  # SHA1 key
30509100258SXin LI	    14 SHA  a5332809c8878dd3a5b918819108a111509aeceb  # SHA  key
30609100258SXin LI	    15 MD2  2fe16c88c760ff2f16d4267e36c1aa6c926e6964  # MD2  key
30709100258SXin LI	    16 MD4  b2691811dc19cfc0e2f9bcacd74213f29812183d  # MD4  key
30809100258SXin LI	    17 MD5  e4d6735b8bdad58ec5ffcb087300a17f7fef1f7c  # MD5  key
30909100258SXin LI	    18 MDC2 a8d5e2315c025bf3a79174c87fbd10477de2eabc  # MDC2 key
31009100258SXin LI	    19 RIPEMD160 77ca332cafb30e3cafb174dcd5b80ded7ba9b3d2  # RIPEMD160 key
31109100258SXin LI	    20 AES128CMAC f92ff73eee86c1e7dc638d6489a04e4e555af878  # AES128CMAC key
31209100258SXin LI	    21 MD5 sampo 10.1.2.3/24
31309100258SXin LI    </pre></td></tr></table>
31409100258SXin LI    <p>Figure 1 shows a typical symmetric keys file used by the reference
31509100258SXin LI      implementation.  Each line of the file contains three or four fields,
316*4e1ef62aSXin LI      first an integer between 1 and 65535, inclusive, representing the key
31709100258SXin LI      identifier used in the <tt>server</tt> and <tt>peer</tt> configuration
31809100258SXin LI      commands.  Second is the key type for the message digest algorithm,
31909100258SXin LI      which in the absence of the OpenSSL library must be <tt>MD5</tt> to
32009100258SXin LI      designate the MD5 message digest algorithm.  If the OpenSSL library is
32109100258SXin LI      installed, the key type can be any message digest algorithm supported
32209100258SXin LI      by that library.  However, if compatibility with FIPS 140-2 is
32309100258SXin LI      required, the key type must be either <tt>SHA</tt> or <tt>SHA1</tt>.
32409100258SXin LI      The key type can be changed using an ASCII text editor.</p>
32509100258SXin LI    <p>The third field is the key.</p>
32609100258SXin LI    <p>An MD5 key consists of a printable ASCII string less than or equal to
32709100258SXin LI      16 characters and terminated by whitespace or a # character.  An
32809100258SXin LI      OpenSSL key consists of a hex-encoded ASCII string of 40 characters,
32909100258SXin LI      which is truncated as necessary.</p>
33009100258SXin LI    <p>Note that the keys used by the <tt>ntpq</tt> and <tt>ntpdc</tt>
33109100258SXin LI      programs are checked against passwords requested by the programs and
33209100258SXin LI      entered by hand, so it is generally appropriate to specify these keys
33309100258SXin LI      in human readable ASCII format.</p>
33409100258SXin LI    <p>The optional fourth field is one or more IPs, with each IP separated
33509100258SXin LI      with a comma.  An IP may end with an optional <tt>/subnetbits</tt>
33609100258SXin LI      suffix, which limits the acceptance of the key identifier to packets
33709100258SXin LI      claiming to be from the described IP space.</p>
33809100258SXin LI    <p>The <tt>ntp-keygen</tt> program generates a MD5 symmetric keys
33909100258SXin LI      file <tt>ntpkey_MD5key_<i>hostname.filestamp</i></tt>.  Since the file
34009100258SXin LI      contains private shared keys, it should be visible only to root and
34109100258SXin LI      distributed by secure means to other subnet hosts.  The NTP daemon
34209100258SXin LI      loads the file <tt>ntp.keys</tt>, so <tt>ntp-keygen</tt> installs a
34309100258SXin LI      soft link from this name to the generated file.  Subsequently, similar
34409100258SXin LI      soft links must be installed by manual or automated means on the other
34509100258SXin LI      subnet hosts.  While this file is not used with the Autokey Version 2
34609100258SXin LI      protocol, it is needed to authenticate some remote configuration
34709100258SXin LI      commands used by the <a href="ntpq.html"><tt>ntpq</tt></a>
34809100258SXin LI      and <a href="ntpdc.html"><tt>ntpdc</tt></a> utilities.</p>
3499c2daa00SOllivier Robert    <h4 id="bug">Bugs</h4>
35009100258SXin LI    <p>It can take quite a while to generate some cryptographic values.</p>
3519c2daa00SOllivier Robert    <hr>
3529c2daa00SOllivier Robert    <script type="text/javascript" language="javascript" src="scripts/footer.txt"></script>
3539c2daa00SOllivier Robert  </body>
3549c2daa00SOllivier Robert</html>
355