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