ntp-keygen.html revision 285169
1139804Simp<html lang="en">
213675Sdyson<head>
3232055Skmacy<title>Ntp-keygen User's Manual</title>
413675Sdyson<meta http-equiv="Content-Type" content="text/html">
513675Sdyson<meta name="description" content="Ntp-keygen User's Manual">
613675Sdyson<meta name="generator" content="makeinfo 4.7">
713675Sdyson<link title="Top" rel="top" href="#Top">
813675Sdyson<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
913675Sdyson<meta http-equiv="Content-Style-Type" content="text/css">
1013675Sdyson<style type="text/css"><!--
1113675Sdyson  pre.display { font-family:inherit }
1213675Sdyson  pre.format  { font-family:inherit }
1313675Sdyson  pre.smalldisplay { font-family:inherit; font-size:smaller }
1413675Sdyson  pre.smallformat  { font-family:inherit; font-size:smaller }
1513675Sdyson  pre.smallexample { font-size:smaller }
1613675Sdyson  pre.smalllisp    { font-size:smaller }
1714037Sdyson  span.sc { font-variant:small-caps }
1813675Sdyson  span.roman { font-family: serif; font-weight: normal; } 
1913675Sdyson--></style>
2013675Sdyson</head>
2113675Sdyson<body>
2213675Sdyson<h1 class="settitle">Ntp-keygen User's Manual</h1>
2313675Sdyson  <div class="shortcontents">
2413675Sdyson<h2>Short Contents</h2>
2513675Sdyson<ul>
2613675Sdyson<a href="#Top">Top</a>
2713675Sdyson<a href="#Top">NTP Key Generation Program User Manual</a>
2813907Sdyson</ul>
2913907Sdyson</div>
3013907Sdyson
3113907Sdyson
3213907Sdyson
33219801Salc<div class="node">
34219801Salc<p><hr>
35219801Salc<a name="Top"></a>Up:&nbsp;<a rel="up" accesskey="u" href="#dir">(dir)</a>
3613907Sdyson<br>
3713907Sdyson</div>
3813913Sdyson
3913907Sdyson<h2 class="unnumbered">Top</h2>
4013907Sdyson
4113907Sdyson<ul class="menu">
4213907Sdyson<li><a accesskey="1" href="#Description">Description</a>
4313907Sdyson<li><a accesskey="2" href="#ntp_002dkeygen-Invocation">ntp-keygen Invocation</a>: 	Invoking ntp-keygen
4413907Sdyson<li><a accesskey="3" href="#Running-the-Program">Running the Program</a>
4513907Sdyson<li><a accesskey="4" href="#Random-Seed-File">Random Seed File</a>
4613907Sdyson<li><a accesskey="5" href="#Cryptographic-Data-Files">Cryptographic Data Files</a>
47118764Ssilby</ul>
48117325Ssilby
49118764Ssilby<div class="node">
50117325Ssilby<p><hr>
51118764Ssilby<a name="Top"></a>Next:&nbsp;<a rel="next" accesskey="n" href="#Description">Description</a>,
52133790SsilbyPrevious:&nbsp;<a rel="previous" accesskey="p" href="#dir">(dir)</a>,
53133790SsilbyUp:&nbsp;<a rel="up" accesskey="u" href="#dir">(dir)</a>
54117325Ssilby<br>
55133790Ssilby</div>
56133790Ssilby
57117325Ssilby<h2 class="unnumbered">NTP Key Generation Program User Manual</h2>
58133790Ssilby
59133790Ssilby<p>This document describes the use of the NTP Project's <code>ntp-keygen</code>
60117325Ssilbyprogram, that generates cryptographic data files used by the NTPv4
61133790Ssilbyauthentication and identity schemes. 
62133790SsilbyIt can generate message digest keys used in symmetric key cryptography and,
63133790Ssilbyif the OpenSSL software
64133790Ssilbylibrary has been installed, it can generate host keys, sign keys,
65133790Ssilbycertificates, and identity keys and parameters used by the Autokey
66133790Ssilbypublic key cryptography. 
67133790SsilbyThe message digest keys file is generated in a
68133790Ssilbyformat compatible with NTPv3. 
69133790SsilbyAll other files are in PEM-encoded
70133049Ssilbyprintable ASCII format so they can be embedded as MIME attachments in
71133790Ssilbymail to other sites.
72133790Ssilby
73133790Ssilby  <p>This document applies to version 4.2.8p3 of <code>ntp-keygen</code>.
74133790Ssilby
75133790Ssilby<div class="node">
76133790Ssilby<p><hr>
77133790Ssilby<a name="Description"></a>Next:&nbsp;<a rel="next" accesskey="n" href="#Running-the-Program">Running the Program</a>,
78133790SsilbyPrevious:&nbsp;<a rel="previous" accesskey="p" href="#Top">Top</a>,
79133790SsilbyUp:&nbsp;<a rel="up" accesskey="u" href="#Top">Top</a>
80133049Ssilby<br>
81133049Ssilby</div>
82133049Ssilby
83133049Ssilby<!-- node-name,  next,  previous,  up -->
84133790Ssilby<h3 class="section">Description</h3>
85133790Ssilby
86133049Ssilby<p>This program generates cryptographic data files used by the NTPv4
87133049Ssilbyauthentication and identity schemes. It can generate message digest
88133049Ssilbykeys used in symmetric key cryptography and, if the OpenSSL software
89133049Ssilbylibrary has been installed, it can generate host keys, sign keys,
9013907Sdysoncertificates, and identity keys and parameters used by the Autokey
9113907Sdysonpublic key cryptography. The message digest keys file is generated in a
92302095Sbrooksformat compatible with NTPv3. All other files are in PEM-encoded
93302095Sbrooksprintable ASCII format so they can be embedded as MIME attachments in
94116182Sobrienmail to other sites.
95116182Sobrien
96116182Sobrien  <p>When used to generate message digest keys, the program produces a file
9713675Sdysoncontaining ten pseudo-random printable ASCII strings suitable for the
9813675SdysonMD5 message digest algorithm included in the distribution. 
99226042SkibIf the
10024131SbdeOpenSSL library is installed, it produces an additional ten hex-encoded
10113675Sdysonrandom bit strings suitable for the SHA1 and other message digest
10213675Sdysonalgorithms. 
10324206SbdeThe message digest keys file must be distributed and stored
10491372Salfredusing secure means beyond the scope of NTP itself. 
10576166SmarkmBesides the keys
10676827Salfredused for ordinary NTP associations, additional keys can be defined as
10724206Sbdepasswords for the ntpq and ntpdc utility programs.
10813675Sdyson
10991968Salfred  <p>The remaining generated files are compatible with other OpenSSL
11029356Speterapplications and other Public Key Infrastructure (PKI) resources. 
11170834SwollmanCertificates generated by this program are compatible with extant
11213675Sdysonindustry practice, although some users might find the interpretation of
113184849SedX509v3 extension fields somewhat liberal. 
114117325SsilbyHowever, the identity keys
11513675Sdysonare probably not compatible with anything other than Autokey.
11613675Sdyson
11776166Smarkm  <p>Some files used by this program are encrypted using a private password. 
11855112SbdeThe <code>-p</code> option specifies the password for local encrypted files and the
11934924Sbde<code>-q</code> option the password for encrypted files sent to remote sites. 
120271976SjhbIf no password is specified, the host name returned by the Unix
12159288Sjlemon<code>gethostname()</code> function, normally the DNS name of the host, is used.
12213675Sdyson
123163606Srwatson  <p>The <kbd>pw</kbd> option of the <code>crypto</code> configuration command
124163606Srwatsonspecifies the read password for previously encrypted local files. 
12513675SdysonThis must match the local password used by this program. 
12613675SdysonIf not specified, the host name is used. 
12713675SdysonThus, if files are generated by this program without password,
12813675Sdysonthey can be read back by ntpd without password, but only on the same
12913675Sdysonhost.
13013675Sdyson
13113675Sdyson  <p>Normally, encrypted files for each host are generated by that host and
13213907Sdysonused only by that host, although exceptions exist as noted later on
13392751Sjeffthis page. 
13413675SdysonThe symmetric keys file, normally called <code>ntp.keys</code>, is
13514037Sdysonusually installed in <code>/etc</code>. 
13614037SdysonOther files and links are usually installed
13714037Sdysonin <code>/usr/local/etc</code>, which is normally in a shared filesystem in
13814037SdysonNFS-mounted networks and cannot be changed by shared clients. 
13914037SdysonThe location of the keys directory can be changed by the keysdir
14014037Sdysonconfiguration command in such cases. 
14114037SdysonNormally, this is in <code>/etc</code>.
142232055Skmacy
143232055Skmacy  <p>This program directs commentary and error messages to the standard
144232055Skmacyerror stream <code>stderr</code> and remote files to the standard output stream
14514037Sdyson<code>stdout</code> where they can be piped to other applications or redirected to
14614037Sdysonfiles. 
14714037SdysonThe names used for generated files and links all begin with the
148108255Sphkstring <code>ntpkey</code> and include the file type,
149108255Sphkgenerating host and filestamp,
150175140Sjhbas described in the <a href="#Cryptographic-Data-Files">Cryptographic Data Files</a> section below.
151108255Sphk
152108255Sphk<div class="node">
153108255Sphk<p><hr>
154108255Sphk<a name="Running-the-Program"></a>Next:&nbsp;<a rel="next" accesskey="n" href="#Random-Seed-File">Random Seed File</a>,
155108255SphkPrevious:&nbsp;<a rel="previous" accesskey="p" href="#Description">Description</a>,
156232183SjillesUp:&nbsp;<a rel="up" accesskey="u" href="#Top">Top</a>
157232183Sjilles<br>
158271976Sjhb</div>
15913675Sdyson
160232055Skmacy<!-- node-name,  next,  previous,  up -->
161116546Sphk<h3 class="section">Running the Program</h3>
162116546Sphk
163175140Sjhb<p>To test and gain experience with Autokey concepts, log in as root and
164116546Sphkchange to the keys directory, usually <code>/usr/local/etc</code>. 
165116546SphkWhen run for the
166116546Sphkfirst time, or if all files with names beginning <code>ntpkey</code>] have been
167116546Sphkremoved, use the <code>ntp-keygen</code> command without arguments to generate a
168116546Sphkdefault RSA host key and matching RSA-MD5 certificate with expiration
169232183Sjillesdate one year hence. 
170232183SjillesIf run again without options, the program uses the
171254356Sglebiusexisting keys and parameters and generates only a new certificate with
172271976Sjhbnew expiration date one year hence.
173116546Sphk
17472521Sjlemon  <p>Run the command on as many hosts as necessary. 
17513675SdysonDesignate one of them as the trusted host (TH) using <code>ntp-keygen</code>
17659288Sjlemonwith the <code>-T</code> option and configure
177232055Skmacyit to synchronize from reliable Internet servers. 
178232055SkmacyThen configure the other hosts to synchronize to the TH directly or indirectly. 
17959288SjlemonA certificate trail is created when Autokey asks the immediately
18059288Sjlemonascendant host towards the TH to sign its certificate, which is then
18159288Sjlemonprovided to the immediately descendant host on request. 
182232055SkmacyAll group hosts should have acyclic certificate trails ending on the TH.
183232055Skmacy
184232055Skmacy  <p>The host key is used to encrypt the cookie when required and so must be
185232055SkmacyRSA type. 
186232055SkmacyBy default, the host key is also the sign key used to encrypt signatures. 
187197134SrwatsonA different sign key can be assigned using the <code>-S</code> option
188197134Srwatsonand this can be either RSA or DSA type. 
189197134SrwatsonBy default, the signature
190197134Srwatsonmessage digest type is MD5, but any combination of sign key type and
191197134Srwatsonmessage digest type supported by the OpenSSL library can be specified
192197134Srwatsonusing the <code>-c</code> option.
193197134Srwatson
194197134Srwatson  <p>The rules say cryptographic media should be generated with proventic
195197134Srwatsonfilestamps, which means the host should already be synchronized before
196197134Srwatsonthis program is run. 
19759288SjlemonThis of course creates a chicken-and-egg problem
19813675Sdysonwhen the host is started for the first time. 
19913675SdysonAccordingly, the host time
20013675Sdysonshould be set by some other means, such as eyeball-and-wristwatch, at
20113675Sdysonleast so that the certificate lifetime is within the current year. 
20213675SdysonAfter that and when the host is synchronized to a proventic source, the
20313675Sdysoncertificate should be re-generated.
20413907Sdyson
20513907Sdyson  <p>Additional information on trusted groups and identity schemes is on the
20613675SdysonAutokey Public-Key Authentication page.
207189649Sjhb
208133790Ssilby<div class="node">
209133790Ssilby<p><hr>
210133790Ssilby<a name="ntp_002dkeygen-Invocation"></a>
211133790Ssilby<br>
21213907Sdyson</div>
213267992Shselasky
214117325Ssilby<h3 class="section">Invoking ntp-keygen</h3>
215189649Sjhb
216117325Ssilby<p><a name="index-ntp_002dkeygen-1"></a><a name="index-Create-a-NTP-host-key-2"></a>
217133790Ssilby
218133790Ssilby  <p>This program generates cryptographic data files used by the NTPv4
219133790Ssilbyauthentication and identification schemes. 
220133790SsilbyIt generates MD5 key files used in symmetric key cryptography. 
221133790SsilbyIn addition, if the OpenSSL software library has been installed,
222133790Ssilbyit generates keys, certificate and identity files used in public key
223133790Ssilbycryptography. 
224133790SsilbyThese files are used for cookie encryption,
225117325Ssilbydigital signature and challenge/response identification algorithms
22691413Salfredcompatible with the Internet standard security infrastructure.
22791413Salfred
22891413Salfred  <p>All files are in PEM-encoded printable ASCII format,
229265206Smjgso they can be embedded as MIME attachments in mail to other sites
230265206Smjgand certificate authorities. 
23191413SalfredBy default, files are not encrypted.
23291413Salfred
23314037Sdyson  <p>When used to generate message digest keys, the program produces a file
23491413Salfredcontaining ten pseudo-random printable ASCII strings suitable for the
23591413SalfredMD5 message digest algorithm included in the distribution. 
23691413SalfredIf the OpenSSL library is installed, it produces an additional ten
23791413Salfredhex-encoded random bit strings suitable for the SHA1 and other message
23814037Sdysondigest algorithms. 
23991413SalfredThe message digest keys file must be distributed and stored
240132579Srwatsonusing secure means beyond the scope of NTP itself. 
24113675SdysonBesides the keys used for ordinary NTP associations, additional keys
242132987Sgreencan be defined as passwords for the
243132987Sgreen<code>ntpq(1ntpqmdoc)</code>
244125293Srwatsonand
245125293Srwatson<code>ntpdc(1ntpdcmdoc)</code>
24692751Sjeffutility programs.
247226042Skib
248226042Skib  <p>The remaining generated files are compatible with other OpenSSL
24927899Sdysonapplications and other Public Key Infrastructure (PKI) resources. 
25091372SalfredCertificates generated by this program are compatible with extant
25191372Salfredindustry practice, although some users might find the interpretation of
25291372SalfredX509v3 extension fields somewhat liberal. 
25391372SalfredHowever, the identity keys are probably not compatible with anything
25491372Salfredother than Autokey.
255118880Salc
256170022Srwatson  <p>Some files used by this program are encrypted using a private password. 
257170022SrwatsonThe
258125293Srwatson<code>-p</code>
259118880Salcoption specifies the password for local encrypted files and the
260226042Skib<code>-q</code>
261226042Skiboption the password for encrypted files sent to remote sites. 
262226042SkibIf no password is specified, the host name returned by the Unix
263226042Skib<code>gethostname()</code>
26491372Salfredfunction, normally the DNS name of the host is used.
26591372Salfred
266132987Sgreen  <p>The
267132987Sgreen<kbd>pw</kbd>
268125293Srwatsonoption of the
269125293Srwatson<kbd>crypto</kbd>
270125293Srwatsonconfiguration command specifies the read
271125293Srwatsonpassword for previously encrypted local files. 
272125293SrwatsonThis must match the local password used by this program. 
273125293SrwatsonIf not specified, the host name is used. 
274125293SrwatsonThus, if files are generated by this program without password,
275125293Srwatsonthey can be read back by
276125293Srwatson<kbd>ntpd</kbd>
277125293Srwatsonwithout password but only on the same host.
278125293Srwatson
279125293Srwatson  <p>Normally, encrypted files for each host are generated by that host and
280125293Srwatsonused only by that host, although exceptions exist as noted later on
281125293Srwatsonthis page. 
282125293SrwatsonThe symmetric keys file, normally called
283125293Srwatson<kbd>ntp.keys</kbd>,
284125293Srwatsonis usually installed in
285125293Srwatson<span class="file">/etc</span>. 
286125293SrwatsonOther files and links are usually installed in
287125293Srwatson<span class="file">/usr/local/etc</span>,
288125293Srwatsonwhich is normally in a shared filesystem in
289125293SrwatsonNFS-mounted networks and cannot be changed by shared clients. 
290125293SrwatsonThe location of the keys directory can be changed by the
291125293Srwatson<kbd>keysdir</kbd>
292125293Srwatsonconfiguration command in such cases. 
293125293SrwatsonNormally, this is in
294125293Srwatson<span class="file">/etc</span>.
295125293Srwatson
296125293Srwatson  <p>This program directs commentary and error messages to the standard
297125293Srwatsonerror stream
298125293Srwatson<kbd>stderr</kbd>
299125293Srwatsonand remote files to the standard output stream
300125293Srwatson<kbd>stdout</kbd>
301179243Skibwhere they can be piped to other applications or redirected to files. 
302179243SkibThe names used for generated files and links all begin with the
303125293Srwatsonstring
304125293Srwatson<kbd>ntpkey</kbd>
305125293Srwatsonand include the file type, generating host and filestamp,
306125293Srwatsonas described in the
307125293SrwatsonCryptographic Data Files
308125293Srwatsonsection below.
309125293Srwatson
310125293Srwatson<h5 class="subsubsection">Running the Program</h5>
311132987Sgreen
312125293Srwatson<p>To test and gain experience with Autokey concepts, log in as root and
313125293Srwatsonchange to the keys directory, usually
314132987Sgreen<span class="file">/usr/local/etc</span>
315132987SgreenWhen run for the first time, or if all files with names beginning with
316125293Srwatson<kbd>ntpkey</kbd>
317125293Srwatsonhave been removed, use the
318125293Srwatson<code>ntp-keygen</code>
319125293Srwatsoncommand without arguments to generate a
320125293Srwatsondefault RSA host key and matching RSA-MD5 certificate with expiration
321125293Srwatsondate one year hence. 
322125293SrwatsonIf run again without options, the program uses the
323277489Skibexisting keys and parameters and generates only a new certificate with
324132987Sgreennew expiration date one year hence.
325125293Srwatson
326125293Srwatson  <p>Run the command on as many hosts as necessary. 
327125293SrwatsonDesignate one of them as the trusted host (TH) using
328125293Srwatson<code>ntp-keygen</code>
329125293Srwatsonwith the
330125293Srwatson<code>-T</code>
331125293Srwatsonoption and configure it to synchronize from reliable Internet servers. 
332125293SrwatsonThen configure the other hosts to synchronize to the TH directly or
333125293Srwatsonindirectly. 
334125293SrwatsonA certificate trail is created when Autokey asks the immediately
335125293Srwatsonascendant host towards the TH to sign its certificate, which is then
336125293Srwatsonprovided to the immediately descendant host on request. 
337125293SrwatsonAll group hosts should have acyclic certificate trails ending on the TH.
338125293Srwatson
339265206Smjg  <p>The host key is used to encrypt the cookie when required and so must be
340232055SkmacyRSA type. 
34113675SdysonBy default, the host key is also the sign key used to encrypt
342125293Srwatsonsignatures. 
34313675SdysonA different sign key can be assigned using the
34427899Sdyson<code>-S</code>
345232055Skmacyoption and this can be either RSA or DSA type. 
346125293SrwatsonBy default, the signature
347125293Srwatsonmessage digest type is MD5, but any combination of sign key type and
348126249Srwatsonmessage digest type supported by the OpenSSL library can be specified
349172930Srwatsonusing the
350126249Srwatson<code>-c</code>
351125293Srwatsonoption. 
352172930SrwatsonThe rules say cryptographic media should be generated with proventic
353172930Srwatsonfilestamps, which means the host should already be synchronized before
354125293Srwatsonthis program is run. 
355125293SrwatsonThis of course creates a chicken-and-egg problem
356125293Srwatsonwhen the host is started for the first time. 
357125293SrwatsonAccordingly, the host time
358193951Skibshould be set by some other means, such as eyeball-and-wristwatch, at
359193951Skibleast so that the certificate lifetime is within the current year. 
360140369SsilbyAfter that and when the host is synchronized to a proventic source, the
361133790Ssilbycertificate should be re-generated.
362265206Smjg
363265206Smjg  <p>Additional information on trusted groups and identity schemes is on the
364124394SdesAutokey Public-Key Authentication
36513907Sdysonpage.
36613907Sdyson
367232055Skmacy  <p>The
36813675Sdyson<code>ntpd(1ntpdmdoc)</code>
369265206Smjgconfiguration command
370232055Skmacy<code>crypto</code> <code>pw</code> <kbd>password</kbd>
371232055Skmacyspecifies the read password for previously encrypted files. 
372232055SkmacyThe daemon expires on the spot if the password is missing
373232055Skmacyor incorrect. 
374265206SmjgFor convenience, if a file has been previously encrypted,
375232055Skmacythe default read password is the name of the host running
376232055Skmacythe program. 
377232055SkmacyIf the previous write password is specified as the host name,
378232055Skmacythese files can be read by that host with no explicit password.
379232055Skmacy
380232055Skmacy  <p>File names begin with the prefix
381232055Skmacy<code>ntpkey_</code>
382278145Skiband end with the postfix
383232055Skmacy<kbd>_hostname.filestamp</kbd>,
384232055Skmacywhere
385232055Skmacy<kbd>hostname</kbd>
386278145Skibis the owner name, usually the string returned
387232055Skmacyby the Unix gethostname() routine, and
388232055Skmacy<kbd>filestamp</kbd>
389278145Skibis the NTP seconds when the file was generated, in decimal digits. 
390278145SkibThis both guarantees uniqueness and simplifies maintenance
391278145Skibprocedures, since all files can be quickly removed
392232055Skmacyby a
393232055Skmacy<code>rm</code> <code>ntpkey*</code>
394232055Skmacycommand or all files generated
395232055Skmacyat a specific time can be removed by a
396232055Skmacy<code>rm</code>
397232055Skmacy<kbd>*filestamp</kbd>
398232055Skmacycommand. 
399232055SkmacyTo further reduce the risk of misconfiguration,
400232055Skmacythe first two lines of a file contain the file name
401232055Skmacyand generation date and time as comments.
402286021Sed
403286021Sed  <p>All files are installed by default in the keys directory
404232055Skmacy<span class="file">/usr/local/etc</span>,
405232055Skmacywhich is normally in a shared filesystem
406232055Skmacyin NFS-mounted networks. 
407232055SkmacyThe actual location of the keys directory
408234352Sjkimand each file can be overridden by configuration commands,
409232055Skmacybut this is not recommended. 
410265206SmjgNormally, the files for each host are generated by that host
411232055Skmacyand used only by that host, although exceptions exist
412232055Skmacyas noted later on this page.
413286021Sed
41470915Sdwmalone  <p>Normally, files containing private values,
41570915Sdwmaloneincluding the host key, sign key and identification parameters,
41670915Sdwmaloneare permitted root read/write-only;
41770915Sdwmalonewhile others containing public values are permitted world readable. 
41870915SdwmaloneAlternatively, files containing private values can be encrypted
419286021Sedand these files permitted world readable,
420184849Sedwhich simplifies maintenance in shared file systems. 
42170915SdwmaloneSince uniqueness is insured by the hostname and
422234352Sjkimfile name extensions, the files for a NFS server and
423234352Sjkimdependent clients can all be installed in the same shared directory.
424234352Sjkim
425234352Sjkim  <p>The recommended practice is to keep the file name extensions
42670803Sdwmalonewhen installing a file and to install a soft link
42770803Sdwmalonefrom the generic names specified elsewhere on this page
42870803Sdwmaloneto the generated files. 
42970803SdwmaloneThis allows new file generations to be activated simply
43070803Sdwmaloneby changing the link. 
43170803SdwmaloneIf a link is present, ntpd follows it to the file name
432234352Sjkimto extract the filestamp. 
433286021SedIf a link is not present,
43470915Sdwmalone<code>ntpd(1ntpdmdoc)</code>
435281436Smjgextracts the filestamp from the file itself. 
43683366SjulianThis allows clients to verify that the file and generation times
43770915Sdwmaloneare always current. 
43870915SdwmaloneThe
43970915Sdwmalone<code>ntp-keygen</code>
44070915Sdwmaloneprogram uses the same timestamp extension for all files generated
441286021Sedat one time, so each generation is distinct and can be readily
442234352Sjkimrecognized in monitoring data.
443121256Sdwmalone
444184849Sed<h5 class="subsubsection">Running the program</h5>
44583366Sjulian
44613675Sdyson<p>The safest way to run the
44713675Sdyson<code>ntp-keygen</code>
44813675Sdysonprogram is logged in directly as root. 
44913675SdysonThe recommended procedure is change to the keys directory,
450302095Sbrooksusually
451184849Sed<span class="file">/usr/local/etc</span>,
452184849Sedthen run the program. 
453302095SbrooksWhen run for the first time,
454184849Sedor if all
455184849Sed<code>ntpkey</code>
456184849Sedfiles have been removed,
457184849Sedthe program generates a RSA host key file and matching RSA-MD5 certificate file,
458286021Sedwhich is all that is necessary in many cases. 
459184849SedThe program also generates soft links from the generic names
460184849Sedto the respective files. 
461246907SpjdIf run again, the program uses the same host key file,
462184849Sedbut generates a new certificate file and link.
463184849Sed
464184849Sed  <p>The host key is used to encrypt the cookie when required and so must be RSA type. 
465184849SedBy default, the host key is also the sign key used to encrypt signatures. 
466184849SedWhen necessary, a different sign key can be specified and this can be
467302095Sbrookseither RSA or DSA type. 
468184849SedBy default, the message digest type is MD5, but any combination
469250159Sjillesof sign key type and message digest type supported by the OpenSSL library
470250159Sjillescan be specified, including those using the MD2, MD5, SHA, SHA1, MDC2
471250159Sjillesand RIPE160 message digest algorithms. 
472250159SjillesHowever, the scheme specified in the certificate must be compatible
473250159Sjilleswith the sign key. 
474250159SjillesCertificates using any digest algorithm are compatible with RSA sign keys;
475250159Sjilleshowever, only SHA and SHA1 certificates are compatible with DSA sign keys.
476286021Sed
477250159Sjilles  <p>Private/public key files and certificates are compatible with
478250159Sjillesother OpenSSL applications and very likely other libraries as well. 
479250159SjillesCertificates or certificate requests derived from them should be compatible
480250159Sjilleswith extant industry practice, although some users might find
481250159Sjillesthe interpretation of X509v3 extension fields somewhat liberal. 
482250159SjillesHowever, the identification parameter files, although encoded
483250159Sjillesas the other files, are probably not compatible with anything other than Autokey.
484250159Sjilles
485250159Sjilles  <p>Running the program as other than root and using the Unix
486250159Sjilles<code>su</code>
48713909Sdysoncommand
48813909Sdysonto assume root may not work properly, since by default the OpenSSL library
48976364Salfredlooks for the random seed file
49076364Salfred<code>.rnd</code>
49176364Salfredin the user home directory. 
49213909SdysonHowever, there should be only one
49376364Salfred<code>.rnd</code>,
494132579Srwatsonmost conveniently
49513675Sdysonin the root directory, so it is convenient to define the
49676364Salfred<code>$RANDFILE</code>
49713675Sdysonenvironment variable used by the OpenSSL library as the path to
49876364Salfred<code>/.rnd</code>.
499133790Ssilby
500117325Ssilby  <p>Installing the keys as root might not work in NFS-mounted
501117325Ssilbyshared file systems, as NFS clients may not be able to write
50213675Sdysonto the shared keys directory, even as root. 
503125293SrwatsonIn this case, NFS clients can specify the files in another
504133790Ssilbydirectory such as
505133790Ssilby<span class="file">/etc</span>
506133790Ssilbyusing the
507133790Ssilby<code>keysdir</code>
508133790Ssilbycommand. 
509133790SsilbyThere is no need for one client to read the keys and certificates
51079224Sdillonof other clients or servers, as these data are obtained automatically
511118764Ssilbyby the Autokey protocol.
512118764Ssilby
51313675Sdyson  <p>Ordinarily, cryptographic files are generated by the host that uses them,
514340660Smarkjbut it is possible for a trusted agent (TA) to generate these files
515340660Smarkjfor other hosts; however, in such cases files should always be encrypted. 
51676364SalfredThe subject name and trusted name default to the hostname
517133790Ssilbyof the host generating the files, but can be changed by command line options. 
518133790SsilbyIt is convenient to designate the owner name and trusted name
519133790Ssilbyas the subject and issuer fields, respectively, of the certificate. 
520133790SsilbyThe owner name is also used for the host and sign key files,
521133790Ssilbywhile the trusted name is used for the identity files.
522133790Ssilby
523133790Ssilby  <p>All files are installed by default in the keys directory
524133790Ssilby<span class="file">/usr/local/etc</span>,
525133790Ssilbywhich is normally in a shared filesystem
526133790Ssilbyin NFS-mounted networks. 
527133790SsilbyThe actual location of the keys directory
528133790Ssilbyand each file can be overridden by configuration commands,
529133790Ssilbybut this is not recommended. 
53076364SalfredNormally, the files for each host are generated by that host
53176364Salfredand used only by that host, although exceptions exist
53276364Salfredas noted later on this page.
533133790Ssilby
534133790Ssilby  <p>Normally, files containing private values,
535133790Ssilbyincluding the host key, sign key and identification parameters,
536133790Ssilbyare permitted root read/write-only;
537133790Ssilbywhile others containing public values are permitted world readable. 
538133790SsilbyAlternatively, files containing private values can be encrypted
539133790Ssilbyand these files permitted world readable,
540133790Ssilbywhich simplifies maintenance in shared file systems. 
541133790SsilbySince uniqueness is insured by the hostname and
542133790Ssilbyfile name extensions, the files for a NFS server and
543133790Ssilbydependent clients can all be installed in the same shared directory.
544133790Ssilby
545133790Ssilby  <p>The recommended practice is to keep the file name extensions
546133790Ssilbywhen installing a file and to install a soft link
54776364Salfredfrom the generic names specified elsewhere on this page
54876364Salfredto the generated files. 
54976364SalfredThis allows new file generations to be activated simply
550133790Ssilbyby changing the link. 
55176364SalfredIf a link is present, ntpd follows it to the file name
552133790Ssilbyto extract the filestamp. 
553189649SjhbIf a link is not present,
55476364Salfred<code>ntpd(1ntpdmdoc)</code>
55513907Sdysonextracts the filestamp from the file itself. 
55613688SdysonThis allows clients to verify that the file and generation times
55713907Sdysonare always current. 
558132579SrwatsonThe
559132579Srwatson<code>ntp-keygen</code>
560132579Srwatsonprogram uses the same timestamp extension for all files generated
561132579Srwatsonat one time, so each generation is distinct and can be readily
562132579Srwatsonrecognized in monitoring data.
563132579Srwatson
564132579Srwatson<h5 class="subsubsection">Running the program</h5>
565132579Srwatson
566133049Ssilby<p>The safest way to run the
567133049Ssilby<code>ntp-keygen</code>
568132579Srwatsonprogram is logged in directly as root. 
569132579SrwatsonThe recommended procedure is change to the keys directory,
570132579Srwatsonusually
571132579Srwatson<span class="file">/usr/local/etc</span>,
57213675Sdysonthen run the program. 
57313675SdysonWhen run for the first time,
57413675Sdysonor if all
57513907Sdyson<code>ntpkey</code>
57613675Sdysonfiles have been removed,
57713907Sdysonthe program generates a RSA host key file and matching RSA-MD5 certificate file,
57813675Sdysonwhich is all that is necessary in many cases. 
57913776SdysonThe program also generates soft links from the generic names
58076364Salfredto the respective files. 
58191362SalfredIf run again, the program uses the same host key file,
58291362Salfredbut generates a new certificate file and link.
58313675Sdyson
58491362Salfred  <p>The host key is used to encrypt the cookie when required and so must be RSA type. 
58591362SalfredBy default, the host key is also the sign key used to encrypt signatures. 
58676760SalfredWhen necessary, a different sign key can be specified and this can be
587124394Sdeseither RSA or DSA type. 
58876760SalfredBy default, the message digest type is MD5, but any combination
58913675Sdysonof sign key type and message digest type supported by the OpenSSL library
59091362Salfredcan be specified, including those using the MD2, MD5, SHA, SHA1, MDC2
59176760Salfredand RIPE160 message digest algorithms. 
59213675SdysonHowever, the scheme specified in the certificate must be compatible
59313675Sdysonwith the sign key. 
59413675SdysonCertificates using any digest algorithm are compatible with RSA sign keys;
59513675Sdysonhowever, only SHA and SHA1 certificates are compatible with DSA sign keys.
59613675Sdyson
59713675Sdyson  <p>Private/public key files and certificates are compatible with
59813675Sdysonother OpenSSL applications and very likely other libraries as well. 
59913675SdysonCertificates or certificate requests derived from them should be compatible
60013675Sdysonwith extant industry practice, although some users might find
60176364Salfredthe interpretation of X509v3 extension fields somewhat liberal. 
60291362SalfredHowever, the identification parameter files, although encoded
603133049Ssilbyas the other files, are probably not compatible with anything other than Autokey.
604133049Ssilby
60591362Salfred  <p>Running the program as other than root and using the Unix
60613675Sdyson<code>su</code>
60713675Sdysoncommand
60814177Sdysonto assume root may not work properly, since by default the OpenSSL library
60913675Sdysonlooks for the random seed file
61013675Sdyson<code>.rnd</code>
61113675Sdysonin the user home directory. 
612238928SdavidxuHowever, there should be only one
61314037Sdyson<code>.rnd</code>,
61414037Sdysonmost conveniently
61514037Sdysonin the root directory, so it is convenient to define the
61676364Salfred<code>$RANDFILE</code>
617126252Srwatsonenvironment variable used by the OpenSSL library as the path to
61814037Sdyson<code>/.rnd</code>.
619122352Stanimura
620174647Sjeff  <p>Installing the keys as root might not work in NFS-mounted
621174647Sjeffshared file systems, as NFS clients may not be able to write
62214037Sdysonto the shared keys directory, even as root. 
62341086StruckmanIn this case, NFS clients can specify the files in another
62495883Salfreddirectory such as
625133741Sjmg<span class="file">/etc</span>
62614037Sdysonusing the
62714037Sdyson<code>keysdir</code>
628126131Sgreencommand. 
629126131SgreenThere is no need for one client to read the keys and certificates
630126131Sgreenof other clients or servers, as these data are obtained automatically
631126131Sgreenby the Autokey protocol.
632265206Smjg
633133790Ssilby  <p>Ordinarily, cryptographic files are generated by the host that uses them,
634126131Sgreenbut it is possible for a trusted agent (TA) to generate these files
635133790Ssilbyfor other hosts; however, in such cases files should always be encrypted. 
636126131SgreenThe subject name and trusted name default to the hostname
637126131Sgreenof the host generating the files, but can be changed by command line options. 
638133790SsilbyIt is convenient to designate the owner name and trusted name
639265206Smjgas the subject and issuer fields, respectively, of the certificate. 
640265206SmjgThe owner name is also used for the host and sign key files,
641265206Smjgwhile the trusted name is used for the identity files. 
642265206Smjgseconds. 
643265206Smjgseconds.
644265206Smjg
645265206Smjg  <p>s Trusted Hosts and Groups
646133790SsilbyEach cryptographic configuration involves selection of a signature scheme
647265206Smjgand identification scheme, called a cryptotype,
648133790Ssilbyas explained in the
649265206Smjg<a href="#Authentication-Options">Authentication Options</a>
650133790Ssilbysection of
651265206Smjg<code>ntp.conf(5)</code>. 
652228306SkibThe default cryptotype uses RSA encryption, MD5 message digest
653126131Sgreenand TC identification. 
654126131SgreenFirst, configure a NTP subnet including one or more low-stratum
65513675Sdysontrusted hosts from which all other hosts derive synchronization
65613675Sdysondirectly or indirectly. 
657101941SrwatsonTrusted hosts have trusted certificates;
65813675Sdysonall other hosts have nontrusted certificates. 
65913675SdysonThese hosts will automatically and dynamically build authoritative
660101941Srwatsoncertificate trails to one or more trusted hosts. 
66183366SjulianA trusted group is the set of all hosts that have, directly or indirectly,
66245311Sdta certificate trail ending at a trusted host. 
66313675SdysonThe trail is defined by static configuration file entries
664232055Skmacyor dynamic means described on the
66547748Salc<a href="#Automatic-NTP-Configuration-Options">Automatic NTP Configuration Options</a>
66613675Sdysonsection of
667232495Skib<code>ntp.conf(5)</code>.
66813675Sdyson
669232055Skmacy  <p>On each trusted host as root, change to the keys directory. 
67091362SalfredTo insure a fresh fileset, remove all
67113675Sdyson<code>ntpkey</code>
67247748Salcfiles. 
67347748SalcThen run
67447748Salc<code>ntp-keygen</code>
67547748Salc<code>-T</code>
676101768Srwatsonto generate keys and a trusted certificate. 
677172930SrwatsonOn all other hosts do the same, but leave off the
678101768Srwatson<code>-T</code>
679101768Srwatsonflag to generate keys and nontrusted certificates. 
680101768SrwatsonWhen complete, start the NTP daemons beginning at the lowest stratum
681133790Ssilbyand working up the tree. 
682133790SsilbyIt may take some time for Autokey to instantiate the certificate trails
683133790Ssilbythroughout the subnet, but setting up the environment is completely automatic.
684133790Ssilby
685133790Ssilby  <p>If it is necessary to use a different sign key or different digest/signature
686133790Ssilbyscheme than the default, run
687133790Ssilby<code>ntp-keygen</code>
688133790Ssilbywith the
689133790Ssilby<code>-S</code> <kbd>type</kbd>
690133790Ssilbyoption, where
691101768Srwatson<kbd>type</kbd>
69213675Sdysonis either
69313907Sdyson<code>RSA</code>
69413907Sdysonor
69513907Sdyson<code>DSA</code>. 
69613675SdysonThe most often need to do this is when a DSA-signed certificate is used. 
69718863SdysonIf it is necessary to use a different certificate scheme than the default,
69813675Sdysonrun
69913675Sdyson<code>ntp-keygen</code>
700231949Skibwith the
701232495Skib<code>-c</code> <kbd>scheme</kbd>
70247748Salcoption and selected
70391362Salfred<kbd>scheme</kbd>
704116127Smuxas needed. 
705116127Smuxf
706116127Smux<code>ntp-keygen</code>
70791362Salfredis run again without these options, it generates a new certificate
70876760Salfredusing the same scheme and sign key.
70913675Sdyson
71076760Salfred  <p>After setting up the environment it is advisable to update certificates
71113675Sdysonfrom time to time, if only to extend the validity interval. 
71213675SdysonSimply run
71313675Sdyson<code>ntp-keygen</code>
71413675Sdysonwith the same flags as before to generate new certificates
71513675Sdysonusing existing keys. 
71647748SalcHowever, if the host or sign key is changed,
71747748Salc<code>ntpd(1ntpdmdoc)</code>
71847748Salcshould be restarted. 
71947748SalcWhen
72047748Salc<code>ntpd(1ntpdmdoc)</code>
72147748Salcis restarted, it loads any new files and restarts the protocol. 
72247748SalcOther dependent hosts will continue as usual until signatures are refreshed,
72347748Salcat which time the protocol is restarted.
72447748Salc
72547748Salc<h5 class="subsubsection">Identity Schemes</h5>
72613675Sdyson
72714037Sdyson<p>As mentioned on the Autonomous Authentication page,
72813907Sdysonthe default TC identity scheme is vulnerable to a middleman attack. 
72913907SdysonHowever, there are more secure identity schemes available,
73013907Sdysonincluding PC, IFF, GQ and MV described on the
73113907Sdyson"Identification Schemes"
73247748Salcpage
733231949Skib(maybe available at
73418863Sdyson<code>http://www.eecis.udel.edu/%7emills/keygen.html</code>). 
73547748SalcThese schemes are based on a TA, one or more trusted hosts
73691362Salfredand some number of nontrusted hosts. 
737127501SalcTrusted hosts prove identity using values provided by the TA,
738127501Salcwhile the remaining hosts prove identity using values provided
73991362Salfredby a trusted host and certificate trails that end on that host. 
74013907SdysonThe name of a trusted host is also the name of its sugroup
74113907Sdysonand also the subject and issuer name on its trusted certificate. 
74213907SdysonThe TA is not necessarily a trusted host in this sense, but often is.
74313907Sdyson
74413907Sdyson  <p>In some schemes there are separate keys for servers and clients. 
74513907SdysonA server can also be a client of another server,
746349774Smarkjbut a client can never be a server for another client. 
74713907SdysonIn general, trusted hosts and nontrusted hosts that operate
74813907Sdysonas both server and client have parameter files that contain
74914037Sdysonboth server and client keys. 
75013675SdysonHosts that operate
75113675Sdysononly as clients have key files that contain only client keys.
75213675Sdyson
75376760Salfred  <p>The PC scheme supports only one trusted host in the group. 
75413675SdysonOn trusted host alice run
75576760Salfred<code>ntp-keygen</code>
75613675Sdyson<code>-P</code>
75743623Sdillon<code>-p</code> <kbd>password</kbd>
75813675Sdysonto generate the host key file
75913675Sdyson<span class="file">ntpkey_RSAkey_</span><kbd>alice.filestamp</kbd>
76013675Sdysonand trusted private certificate file
76113675Sdyson<span class="file">ntpkey_RSA-MD5_cert_</span><kbd>alice.filestamp</kbd>. 
76213675SdysonCopy both files to all group hosts;
76313675Sdysonthey replace the files which would be generated in other schemes. 
76413675SdysonOn each host bob install a soft link from the generic name
76543623Sdillon<span class="file">ntpkey_host_</span><kbd>bob</kbd>
76643623Sdillonto the host key file and soft link
76747748Salc<span class="file">ntpkey_cert_</span><kbd>bob</kbd>
76843623Sdillonto the private certificate file. 
76947748SalcNote the generic links are on bob, but point to files generated
77013675Sdysonby trusted host alice. 
77116960SdysonIn this scheme it is not possible to refresh
77243623Sdilloneither the keys or certificates without copying them
773124394Sdesto all other hosts in the group.
774116127Smux
775116127Smux  <p>For the IFF scheme proceed as in the TC scheme to generate keys
77643623Sdillonand certificates for all group hosts, then for every trusted host in the group,
77747748Salcgenerate the IFF parameter file. 
77843623SdillonOn trusted host alice run
77913675Sdyson<code>ntp-keygen</code>
78047748Salc<code>-T</code>
78147748Salc<code>-I</code>
78213675Sdyson<code>-p</code> <kbd>password</kbd>
78376760Salfredto produce her parameter file
78447748Salc<span class="file">ntpkey_IFFpar_</span><kbd>alice.filestamp</kbd>,
78576760Salfredwhich includes both server and client keys. 
78647748SalcCopy this file to all group hosts that operate as both servers
78791362Salfredand clients and install a soft link from the generic
78891362Salfred<span class="file">ntpkey_iff_</span><kbd>alice</kbd>
78977140Salfredto this file. 
79047748SalcIf there are no hosts restricted to operate only as clients,
79113675Sdysonthere is nothing further to do. 
79247748SalcAs the IFF scheme is independent
79347748Salcof keys and certificates, these files can be refreshed as needed.
79413675Sdyson
79513675Sdyson  <p>If a rogue client has the parameter file, it could masquerade
796101768Srwatsonas a legitimate server and present a middleman threat. 
797101768SrwatsonTo eliminate this threat, the client keys can be extracted
798101768Srwatsonfrom the parameter file and distributed to all restricted clients. 
79947748SalcAfter generating the parameter file, on alice run
80013675Sdyson<code>ntp-keygen</code>
80191362Salfred<code>-e</code>
80224101Sbdeand pipe the output to a file or mail program. 
80355112SbdeCopy or mail this file to all restricted clients. 
80447748SalcOn these clients install a soft link from the generic
80547748Salc<span class="file">ntpkey_iff_</span><kbd>alice</kbd>
80613913Sdysonto this file. 
80747748SalcTo further protect the integrity of the keys,
80847748Salceach file can be encrypted with a secret password.
80947748Salc
81013675Sdyson  <p>For the GQ scheme proceed as in the TC scheme to generate keys
81113675Sdysonand certificates for all group hosts, then for every trusted host
81213675Sdysonin the group, generate the IFF parameter file. 
81313675SdysonOn trusted host alice run
81413675Sdyson<code>ntp-keygen</code>
81547748Salc<code>-T</code>
81613675Sdyson<code>-G</code>
81713675Sdyson<code>-p</code> <kbd>password</kbd>
81813675Sdysonto produce her parameter file
81913675Sdyson<span class="file">ntpkey_GQpar_</span><kbd>alice.filestamp</kbd>,
82013675Sdysonwhich includes both server and client keys. 
82113675SdysonCopy this file to all group hosts and install a soft link
82214037Sdysonfrom the generic
82314802Sdyson<span class="file">ntpkey_gq_</span><kbd>alice</kbd>
82414037Sdysonto this file. 
82514037SdysonIn addition, on each host bob install a soft link
82691362Salfredfrom generic
82776760Salfred<span class="file">ntpkey_gq_</span><kbd>bob</kbd>
82813675Sdysonto this file. 
82913675SdysonAs the GQ scheme updates the GQ parameters file and certificate
83014037Sdysonat the same time, keys and certificates can be regenerated as needed.
83113907Sdyson
83213907Sdyson  <p>For the MV scheme, proceed as in the TC scheme to generate keys
83313907Sdysonand certificates for all group hosts. 
83413907SdysonFor illustration assume trish is the TA, alice one of several trusted hosts
83513675Sdysonand bob one of her clients. 
83613907SdysonOn TA trish run
83713907Sdyson<code>ntp-keygen</code>
83813675Sdyson<code>-V</code> <kbd>n</kbd>
83913675Sdyson<code>-p</code> <kbd>password</kbd>,
84018863Sdysonwhere
841216511Salc<kbd>n</kbd>
84213907Sdysonis the number of revokable keys (typically 5) to produce
84391412Salfredthe parameter file
844133790Ssilby<span class="file">ntpkeys_MVpar_</span><kbd>trish.filestamp</kbd>
845133790Ssilbyand client key files
84679224Sdillon<span class="file">ntpkeys_MVkeyd_</span><kbd>trish.filestamp</kbd>
847231949Skibwhere
848231949Skib<kbd>d</kbd>
849231949Skibis the key number (0 &lt;
850231949Skib<kbd>d</kbd>
85113907Sdyson&lt;
852216699Salc<kbd>n</kbd>). 
853216699SalcCopy the parameter file to alice and install a soft link
854216699Salcfrom the generic
855193893Scperciva<span class="file">ntpkey_mv_</span><kbd>alice</kbd>
85613907Sdysonto this file. 
85713907SdysonCopy one of the client key files to alice for later distribution
85813907Sdysonto her clients. 
85913907SdysonIt doesn't matter which client key file goes to alice,
86013907Sdysonsince they all work the same way. 
86176760SalfredAlice copies the client key file to all of her cliens. 
86276760SalfredOn client bob install a soft link from generic
86313907Sdyson<span class="file">ntpkey_mvkey_</span><kbd>bob</kbd>
86413907Sdysonto the client key file. 
86513907SdysonAs the MV scheme is independent of keys and certificates,
86613907Sdysonthese files can be refreshed as needed.
86713907Sdyson
86813907Sdyson<h5 class="subsubsection">Command Line Options</h5>
86913907Sdyson
870104908Smike     <dl>
87113907Sdyson<dt><code>-c</code> <kbd>scheme</kbd><dd>Select certificate message digest/signature encryption scheme. 
87213907SdysonThe
87313907Sdyson<kbd>scheme</kbd>
87413907Sdysoncan be one of the following:
87576760Salfred. Cm RSA-MD2 , RSA-MD5 , RSA-SHA , RSA-SHA1 , RSA-MDC2 , RSA-RIPEMD160 , DSA-SHA ,
87613907Sdysonor
87713907Sdyson<code>DSA-SHA1</code>. 
87813907SdysonNote that RSA schemes must be used with a RSA sign key and DSA
879349774Smarkjschemes must be used with a DSA sign key. 
88013907SdysonThe default without this option is
88113907Sdyson<code>RSA-MD5</code>. 
88213907Sdyson<br><dt><code>-d</code><dd>Enable debugging. 
88376760SalfredThis option displays the cryptographic data produced in eye-friendly billboards. 
88413907Sdyson<br><dt><code>-e</code><dd>Write the IFF client keys to the standard output. 
88576364SalfredThis is intended for automatic key distribution by mail. 
886127501Salc<br><dt><code>-G</code><dd>Generate parameters and keys for the GQ identification scheme,
887349774Smarkjobsoleting any that may exist. 
888349774Smarkj<br><dt><code>-g</code><dd>Generate keys for the GQ identification scheme
889349774Smarkjusing the existing GQ parameters. 
890349774SmarkjIf the GQ parameters do not yet exist, create them first. 
891216511Salc<br><dt><code>-H</code><dd>Generate new host keys, obsoleting any that may exist. 
89291653Stanimura<br><dt><code>-I</code><dd>Generate parameters for the IFF identification scheme,
89313907Sdysonobsoleting any that may exist. 
89413907Sdyson<br><dt><code>-i</code> <kbd>name</kbd><dd>Set the suject name to
89513907Sdyson<kbd>name</kbd>. 
89613907SdysonThis is used as the subject field in certificates
89713907Sdysonand in the file name for host and sign keys. 
89813907Sdyson<br><dt><code>-M</code><dd>Generate MD5 keys, obsoleting any that may exist. 
89913907Sdyson<br><dt><code>-P</code><dd>Generate a private certificate. 
90013907SdysonBy default, the program generates public certificates. 
90113907Sdyson<br><dt><code>-p</code> <kbd>password</kbd><dd>Encrypt generated files containing private data with
90276364Salfred<kbd>password</kbd>
90313907Sdysonand the DES-CBC algorithm. 
904127501Salc<br><dt><code>-q</code><dd>Set the password for reading files to password. 
905127501Salc<br><dt><code>-S</code> <code>[RSA | DSA]</code><dd>Generate a new sign key of the designated type,
90613907Sdysonobsoleting any that may exist. 
90713907SdysonBy default, the program uses the host key as the sign key. 
90813907Sdyson<br><dt><code>-s</code> <kbd>name</kbd><dd>Set the issuer name to
90991362Salfred<kbd>name</kbd>. 
910349774SmarkjThis is used for the issuer field in certificates
911349774Smarkjand in the file name for identity files. 
912349774Smarkj<br><dt><code>-T</code><dd>Generate a trusted certificate. 
91313907SdysonBy default, the program generates a non-trusted certificate. 
91413907Sdyson<br><dt><code>-V</code> <kbd>nkeys</kbd><dd>Generate parameters and keys for the Mu-Varadharajan (MV) identification scheme. 
91513907Sdyson</dl>
91613907Sdyson
91713907Sdyson<h5 class="subsubsection">Random Seed File</h5>
91813907Sdyson
91913907Sdyson<p>All cryptographically sound key generation schemes must have means
920119811Salcto randomize the entropy seed used to initialize
921127501Salcthe internal pseudo-random number generator used
922127501Salcby the library routines. 
923127501SalcThe OpenSSL library uses a designated random seed file for this purpose. 
924127501SalcThe file must be available when starting the NTP daemon and
925127501Salc<code>ntp-keygen</code>
926127501Salcprogram. 
927127501SalcIf a site supports OpenSSL or its companion OpenSSH,
928127501Salcit is very likely that means to do this are already available.
929127501Salc
930127501Salc  <p>It is important to understand that entropy must be evolved
931127501Salcfor each generation, for otherwise the random number sequence
93213907Sdysonwould be predictable. 
93313907SdysonVarious means dependent on external events, such as keystroke intervals,
93413907Sdysoncan be used to do this and some systems have built-in entropy sources. 
93513907SdysonSuitable means are described in the OpenSSL software documentation,
93613907Sdysonbut are outside the scope of this page.
93713907Sdyson
93813907Sdyson  <p>The entropy seed used by the OpenSSL library is contained in a file,
93913907Sdysonusually called
94013907Sdyson<code>.rnd</code>,
94113907Sdysonwhich must be available when starting the NTP daemon
94213907Sdysonor the
94313907Sdyson<code>ntp-keygen</code>
94413907Sdysonprogram. 
94513907SdysonThe NTP daemon will first look for the file
94613907Sdysonusing the path specified by the
94713907Sdyson<code>randfile</code>
94876364Salfredsubcommand of the
94913951Sdyson<code>crypto</code>
95091362Salfredconfiguration command. 
951133049SsilbyIf not specified in this way, or when starting the
952285483Scem<code>ntp-keygen</code>
953285483Scemprogram,
954285483Scemthe OpenSSL library will look for the file using the path specified
955133049Ssilbyby the
956133049Ssilby.Ev RANDFILE
957133049Ssilbyenvironment variable in the user home directory,
958133049Ssilbywhether root or some other user. 
959349774SmarkjIf the
96076760Salfred.Ev RANDFILE
96113951Sdysonenvironment variable is not present,
96213951Sdysonthe library will look for the
96313951Sdyson<code>.rnd</code>
964173750Sdumbbellfile in the user home directory. 
96513992SdysonIf the file is not available or cannot be written,
966133049Ssilbythe daemon exits with a message to the system log and the program
96791362Salfredexits with a suitable error message.
96891362Salfred
96914802Sdyson<h5 class="subsubsection">Cryptographic Data Files</h5>
97013907Sdyson
971133049Ssilby<p>All other file formats begin with two lines. 
972133049SsilbyThe first contains the file name, including the generated host name
97313907Sdysonand filestamp. 
97413907SdysonThe second contains the datestamp in conventional Unix date format. 
97513951SdysonLines beginning with # are considered comments and ignored by the
97676760Salfred<code>ntp-keygen</code>
97713951Sdysonprogram and
97813951Sdyson<code>ntpd(1ntpdmdoc)</code>
97913951Sdysondaemon. 
980173750SdumbbellCryptographic values are encoded first using ASN.1 rules,
98113992Sdysonthen encrypted if necessary, and finally written PEM-encoded
982133049Ssilbyprintable ASCII format preceded and followed by MIME content identifier lines.
98391362Salfred
98491362Salfred  <p>The format of the symmetric keys file is somewhat different
98514802Sdysonthan the other files in the interest of backward compatibility. 
98613907SdysonSince DES-CBC is deprecated in NTPv4, the only key format of interest
987133049Ssilbyis MD5 alphanumeric strings. 
988133049SsilbyFollowing hte heard the keys are
98913907Sdysonentered one per line in the format
99013907Sdyson<pre class="example">     <kbd>keyno</kbd> <kbd>type</kbd> <kbd>key</kbd>
99113951Sdyson</pre>
99213951Sdyson  <p>where
993119872Salc<kbd>keyno</kbd>
99413907Sdysonis a positive integer in the range 1-65,535,
995119872Salc<kbd>type</kbd>
99613907Sdysonis the string MD5 defining the key format and
99713907Sdyson<kbd>key</kbd>
998133049Ssilbyis the key itself,
99913907Sdysonwhich is a printable ASCII string 16 characters or less in length. 
100013907SdysonEach character is chosen from the 93 printable characters
100113907Sdysonin the range 0x21 through 0x7f excluding space and the
1002349774Smarkj#
100313907Sdysoncharacter.
100413907Sdyson
1005112981Shsu  <p>Note that the keys used by the
100613907Sdyson<code>ntpq(1ntpqmdoc)</code>
100714802Sdysonand
100814802Sdyson<code>ntpdc(1ntpdcmdoc)</code>
100913907Sdysonprograms
101013992Sdysonare checked against passwords requested by the programs
101113992Sdysonand entered by hand, so it is generally appropriate to specify these keys
101213992Sdysonin human readable ASCII format.
101313992Sdyson
101414037Sdyson  <p>The
1015238928Sdavidxu<code>ntp-keygen</code>
1016133049Ssilbyprogram generates a MD5 symmetric keys file
101791362Salfred<span class="file">ntpkey_MD5key_</span><kbd>hostname.filestamp</kbd>. 
101891362SalfredSince the file contains private shared keys,
1019133049Ssilbyit should be visible only to root and distributed by secure means
1020349774Smarkjto other subnet hosts. 
1021349774SmarkjThe NTP daemon loads the file
102213907Sdyson<span class="file">ntp.keys</span>,
102313907Sdysonso
1024126131Sgreen<code>ntp-keygen</code>
1025126131Sgreeninstalls a soft link from this name to the generated file. 
1026349774SmarkjSubsequently, similar soft links must be installed by manual
102713907Sdysonor automated means on the other subnet hosts. 
1028349774SmarkjWhile this file is not used with the Autokey Version 2 protocol,
102913907Sdysonit is needed to authenticate some remote configuration commands
103013907Sdysonused by the
1031349774Smarkj<code>ntpq(1ntpqmdoc)</code>
1032349774Smarkjand
103376760Salfred<code>ntpdc(1ntpdcmdoc)</code>
103413907Sdysonutilities.
103513907Sdyson
103613907Sdyson  <p>This section was generated by <strong>AutoGen</strong>,
103776760Salfredusing the <code>agtexi-cmd</code> template and the option descriptions for the <code>ntp-keygen</code> program. 
103813907SdysonThis software is released under the NTP license, &lt;http://ntp.org/license>;.
103914037Sdyson
1040124394Sdes<ul class="menu">
104116960Sdyson<li><a accesskey="1" href="#ntp_002dkeygen-usage">ntp-keygen usage</a>:                   ntp-keygen help/usage (<span class="option">--help</span>)
1042101941Srwatson<li><a accesskey="2" href="#ntp_002dkeygen-imbits">ntp-keygen imbits</a>:                  imbits option (-b)
104316960Sdyson<li><a accesskey="3" href="#ntp_002dkeygen-certificate">ntp-keygen certificate</a>:             certificate option (-c)
104413907Sdyson<li><a accesskey="4" href="#ntp_002dkeygen-cipher">ntp-keygen cipher</a>:                  cipher option (-C)
1045101941Srwatson<li><a accesskey="5" href="#ntp_002dkeygen-id_002dkey">ntp-keygen id-key</a>:                  id-key option (-e)
104683366Sjulian<li><a accesskey="6" href="#ntp_002dkeygen-gq_002dparams">ntp-keygen gq-params</a>:               gq-params option (-G)
104745311Sdt<li><a accesskey="7" href="#ntp_002dkeygen-host_002dkey">ntp-keygen host-key</a>:                host-key option (-H)
104813907Sdyson<li><a accesskey="8" href="#ntp_002dkeygen-iffkey">ntp-keygen iffkey</a>:                  iffkey option (-I)
1049232495Skib<li><a accesskey="9" href="#ntp_002dkeygen-ident">ntp-keygen ident</a>:                   ident option (-i)
1050232495Skib<li><a href="#ntp_002dkeygen-lifetime">ntp-keygen lifetime</a>:                lifetime option (-l)
1051232495Skib<li><a href="#ntp_002dkeygen-md5key">ntp-keygen md5key</a>:                  md5key option (-M)
105216960Sdyson<li><a href="#ntp_002dkeygen-modulus">ntp-keygen modulus</a>:                 modulus option (-m)
105316960Sdyson<li><a href="#ntp_002dkeygen-pvt_002dcert">ntp-keygen pvt-cert</a>:                pvt-cert option (-P)
1054109153Sdillon<li><a href="#ntp_002dkeygen-password">ntp-keygen password</a>:                password option (-p)
1055232055Skmacy<li><a href="#ntp_002dkeygen-export_002dpasswd">ntp-keygen export-passwd</a>:           export-passwd option (-q)
105691395Salfred<li><a href="#ntp_002dkeygen-sign_002dkey">ntp-keygen sign-key</a>:                sign-key option (-S)
1057133049Ssilby<li><a href="#ntp_002dkeygen-subject_002dname">ntp-keygen subject-name</a>:            subject-name option (-s)
1058133049Ssilby<li><a href="#ntp_002dkeygen-trusted_002dcert">ntp-keygen trusted-cert</a>:            trusted-cert option (-T)
1059133049Ssilby<li><a href="#ntp_002dkeygen-mv_002dparams">ntp-keygen mv-params</a>:               mv-params option (-V)
1060133049Ssilby<li><a href="#ntp_002dkeygen-mv_002dkeys">ntp-keygen mv-keys</a>:                 mv-keys option (-v)
1061133049Ssilby<li><a href="#ntp_002dkeygen-config">ntp-keygen config</a>:                  presetting/configuring ntp-keygen
106213675Sdyson<li><a href="#ntp_002dkeygen-exit-status">ntp-keygen exit status</a>:             exit status
106313675Sdyson<li><a href="#ntp_002dkeygen-Usage">ntp-keygen Usage</a>:                   Usage
106413675Sdyson<li><a href="#ntp_002dkeygen-Notes">ntp-keygen Notes</a>:                   Notes
1065179243Skib<li><a href="#ntp_002dkeygen-Bugs">ntp-keygen Bugs</a>:                    Bugs
1066179243Skib</ul>
1067133049Ssilby
106891395Salfred<div class="node">
106976760Salfred<p><hr>
107013675Sdyson<a name="ntp_002dkeygen-usage"></a>Next:&nbsp;<a rel="next" accesskey="n" href="#ntp_002dkeygen-imbits">ntp-keygen imbits</a>,
1071101768SrwatsonUp:&nbsp;<a rel="up" accesskey="u" href="#ntp_002dkeygen-Invocation">ntp-keygen Invocation</a>
1072172930Srwatson<br>
1073101768Srwatson</div>
1074133049Ssilby
1075101768Srwatson<h4 class="subsection">ntp-keygen help/usage (<span class="option">--help</span>)</h4>
1076101768Srwatson
1077101768Srwatson<p><a name="index-ntp_002dkeygen-help-3"></a>
1078101768SrwatsonThis is the automatically generated usage text for ntp-keygen.
107977676Sdillon
108013675Sdyson  <p>The text printed is the same whether selected with the <code>help</code> option
1081133790Ssilby(<span class="option">--help</span>) or the <code>more-help</code> option (<span class="option">--more-help</span>).  <code>more-help</code> will print
1082133790Ssilbythe usage text by passing it through a pager program. 
1083133790Ssilby<code>more-help</code> is disabled on platforms without a working
1084133790Ssilby<code>fork(2)</code> function.  The <code>PAGER</code> environment variable is
1085133790Ssilbyused to select the program, defaulting to <span class="file">more</span>.  Both will exit
1086133790Ssilbywith a status code of 0.
1087133790Ssilby
1088133790Ssilby<pre class="example">ntp-keygen (ntp) - Create a NTP host key - Ver. 4.2.8p3-RC3
1089133790SsilbyUsage:  ntp-keygen [ -&lt;flag&gt; [&lt;val&gt;] | --&lt;name&gt;[{=| }&lt;val&gt;] ]...
1090133790Ssilby  Flg Arg Option-Name    Description
1091133790Ssilby   -b Num imbits         identity modulus bits
109217163Sdyson                                - it must be in the range:
1093133790Ssilby                                  256 to 2048
1094133790Ssilby   -c Str certificate    certificate scheme
1095133790Ssilby   -C Str cipher         privatekey cipher
1096133790Ssilby   -d no  debug-level    Increase debug verbosity level
1097133790Ssilby                                - may appear multiple times
1098133790Ssilby   -D Num set-debug-level Set the debug verbosity level
1099133790Ssilby                                - may appear multiple times
1100133790Ssilby   -e no  id-key         Write IFF or GQ identity keys
1101133790Ssilby   -G no  gq-params      Generate GQ parameters and keys
1102133790Ssilby   -H no  host-key       generate RSA host key
1103133049Ssilby   -I no  iffkey         generate IFF parameters
1104133790Ssilby   -i Str ident          set Autokey group name
1105133049Ssilby   -l Num lifetime       set certificate lifetime
110613907Sdyson   -M no  md5key         generate MD5 keys
1107133790Ssilby   -m Num modulus        modulus
1108133790Ssilby                                - it must be in the range:
1109133790Ssilby                                  256 to 2048
1110133790Ssilby   -P no  pvt-cert       generate PC private certificate
1111133790Ssilby   -p Str password       local private password
1112133790Ssilby   -q Str export-passwd  export IFF or GQ group keys with password
1113133790Ssilby   -S Str sign-key       generate sign key (RSA or DSA)
1114133790Ssilby   -s Str subject-name   set host and optionally group name
1115133790Ssilby   -T no  trusted-cert   trusted certificate (TC scheme)
1116133790Ssilby   -V Num mv-params      generate &lt;num&gt; MV parameters
1117133790Ssilby   -v Num mv-keys        update &lt;num&gt; MV keys
111877676Sdillon      opt version        output version information and exit
1119133049Ssilby   -? no  help           display extended usage information and exit
1120124394Sdes   -! no  more-help      extended usage information passed thru pager
112113913Sdyson   -&gt; opt save-opts      save the option state to a config file
112277676Sdillon   -&lt; Str load-opts      load options from a config file
112313675Sdyson                                - disabled as '--no-load-opts'
112413907Sdyson                                - may appear multiple times
112576760Salfred
1126133049SsilbyOptions are specified by doubled hyphens and their name or by a single
1127133049Ssilbyhyphen and the flag character.
1128133049Ssilby
1129133049Ssilby
1130133049SsilbyThe following option preset mechanisms are supported:
1131133049Ssilby - reading file $HOME/.ntprc
113214037Sdyson - reading file ./.ntprc
113313907Sdyson - examining environment variables named NTP_KEYGEN_*
113413907Sdyson
113513907SdysonPlease send bug reports to:  &lt;http://bugs.ntp.org, bugs@ntp.org&gt;
113616416Sdyson</pre>
113716416Sdyson  <div class="node">
113858505Sdillon<p><hr>
113958505Sdillon<a name="ntp_002dkeygen-imbits"></a>Next:&nbsp;<a rel="next" accesskey="n" href="#ntp_002dkeygen-certificate">ntp-keygen certificate</a>,
114058505SdillonPrevious:&nbsp;<a rel="previous" accesskey="p" href="#ntp_002dkeygen-usage">ntp-keygen usage</a>,
114113907SdysonUp:&nbsp;<a rel="up" accesskey="u" href="#ntp_002dkeygen-Invocation">ntp-keygen Invocation</a>
1142165347Spjd<br>
1143165347Spjd</div>
1144165347Spjd
1145127501Salc<h4 class="subsection">imbits option (-b)</h4>
1146133049Ssilby
1147105009Salfred<p><a name="index-ntp_002dkeygen_002dimbits-4"></a>
114876760SalfredThis is the &ldquo;identity modulus bits&rdquo; option. 
114913907SdysonThis option takes a number argument <span class="file">imbits</span>.
115013907Sdyson
115191362Salfred<p class="noindent">This option has some usage constraints.  It:
115214037Sdyson     <ul>
115313907Sdyson<li>must be compiled in by defining <code>AUTOKEY</code> during the compilation. 
115413907Sdyson</ul>
115513907Sdyson
115613907Sdyson  <p>The number of bits in the identity modulus.  The default is 256. 
115713907Sdyson<div class="node">
115858505Sdillon<p><hr>
115958505Sdillon<a name="ntp_002dkeygen-certificate"></a>Next:&nbsp;<a rel="next" accesskey="n" href="#ntp_002dkeygen-cipher">ntp-keygen cipher</a>,
116013907SdysonPrevious:&nbsp;<a rel="previous" accesskey="p" href="#ntp_002dkeygen-imbits">ntp-keygen imbits</a>,
1161133049SsilbyUp:&nbsp;<a rel="up" accesskey="u" href="#ntp_002dkeygen-Invocation">ntp-keygen Invocation</a>
116213992Sdyson<br>
116313992Sdyson</div>
116413992Sdyson
116513992Sdyson<h4 class="subsection">certificate option (-c)</h4>
1166173750Sdumbbell
1167173750Sdumbbell<p><a name="index-ntp_002dkeygen_002dcertificate-5"></a>
1168133049SsilbyThis is the &ldquo;certificate scheme&rdquo; option. 
116991395SalfredThis option takes a string argument <span class="file">scheme</span>.
117091362Salfred
117113907Sdyson<p class="noindent">This option has some usage constraints.  It:
117213907Sdyson     <ul>
1173133049Ssilby<li>must be compiled in by defining <code>AUTOKEY</code> during the compilation. 
1174133049Ssilby</ul>
117513907Sdyson
117613907Sdyson  <p>scheme is one of
117713907SdysonRSA-MD2, RSA-MD5, RSA-SHA, RSA-SHA1, RSA-MDC2, RSA-RIPEMD160,
117814644SdysonDSA-SHA, or DSA-SHA1.
117914644Sdyson
118013913Sdyson  <p>Select the certificate message digest/signature encryption scheme. 
118113913SdysonNote that RSA schemes must be used with a RSA sign key and DSA
118213907Sdysonschemes must be used with a DSA sign key.  The default without
1183118230Spbthis option is RSA-MD5. 
1184133049Ssilby<div class="node">
1185133049Ssilby<p><hr>
118676760Salfred<a name="ntp_002dkeygen-cipher"></a>Next:&nbsp;<a rel="next" accesskey="n" href="#ntp_002dkeygen-id_002dkey">ntp-keygen id-key</a>,
1187133049SsilbyPrevious:&nbsp;<a rel="previous" accesskey="p" href="#ntp_002dkeygen-certificate">ntp-keygen certificate</a>,
1188133049SsilbyUp:&nbsp;<a rel="up" accesskey="u" href="#ntp_002dkeygen-Invocation">ntp-keygen Invocation</a>
1189133049Ssilby<br>
1190133049Ssilby</div>
1191133049Ssilby
1192133049Ssilby<h4 class="subsection">cipher option (-C)</h4>
1193133049Ssilby
1194133049Ssilby<p><a name="index-ntp_002dkeygen_002dcipher-6"></a>
1195133049SsilbyThis is the &ldquo;privatekey cipher&rdquo; option. 
1196133049SsilbyThis option takes a string argument <span class="file">cipher</span>.
1197133049Ssilby
1198133049Ssilby<p class="noindent">This option has some usage constraints.  It:
1199133049Ssilby     <ul>
1200133049Ssilby<li>must be compiled in by defining <code>AUTOKEY</code> during the compilation. 
1201133049Ssilby</ul>
1202133049Ssilby
1203133049Ssilby  <p>Select the cipher which is used to encrypt the files containing
1204133049Ssilbyprivate keys.  The default is three-key triple DES in CBC mode,
1205133049Ssilbyequivalent to "<code>-C des-ede3-cbc".  The openssl tool lists ciphers
120654534Steggeavailable in "openssl -h" output. 
1207133049Ssilby</code><div class="node">
1208133049Ssilby<p><hr>
1209133049Ssilby<a name="ntp_002dkeygen-id_002dkey"></a>Next:&nbsp;<a rel="next" accesskey="n" href="#ntp_002dkeygen-gq_002dparams">ntp-keygen gq-params</a>,
1210133049SsilbyPrevious:&nbsp;<a rel="previous" accesskey="p" href="#ntp_002dkeygen-cipher">ntp-keygen cipher</a>,
1211133049SsilbyUp:&nbsp;<a rel="up" accesskey="u" href="#ntp_002dkeygen-Invocation">ntp-keygen Invocation</a>
1212133049Ssilby<br>
1213133049Ssilby</div>
1214133049Ssilby
1215133049Ssilby<h4 class="subsection">id-key option (-e)</h4>
1216133049Ssilby
1217133049Ssilby<p><a name="index-ntp_002dkeygen_002did_002dkey-7"></a>
121854534SteggeThis is the &ldquo;write iff or gq identity keys&rdquo; option.
1219133049Ssilby
1220133049Ssilby<p class="noindent">This option has some usage constraints.  It:
1221133049Ssilby     <ul>
122254534Stegge<li>must be compiled in by defining <code>AUTOKEY</code> during the compilation. 
1223124394Sdes</ul>
122491395Salfred
1225133049Ssilby  <p>Write the IFF or GQ client keys to the standard output.  This is
1226133049Ssilbyintended for automatic key distribution by mail. 
1227133049Ssilby<div class="node">
122891395Salfred<p><hr>
1229133049Ssilby<a name="ntp_002dkeygen-gq_002dparams"></a>Next:&nbsp;<a rel="next" accesskey="n" href="#ntp_002dkeygen-host_002dkey">ntp-keygen host-key</a>,
1230133049SsilbyPrevious:&nbsp;<a rel="previous" accesskey="p" href="#ntp_002dkeygen-id_002dkey">ntp-keygen id-key</a>,
1231133049SsilbyUp:&nbsp;<a rel="up" accesskey="u" href="#ntp_002dkeygen-Invocation">ntp-keygen Invocation</a>
1232133049Ssilby<br>
1233133049Ssilby</div>
1234133049Ssilby
1235133049Ssilby<h4 class="subsection">gq-params option (-G)</h4>
1236133049Ssilby
1237133049Ssilby<p><a name="index-ntp_002dkeygen_002dgq_002dparams-8"></a>
1238133049SsilbyThis is the &ldquo;generate gq parameters and keys&rdquo; option.
123954534Stegge
1240124394Sdes<p class="noindent">This option has some usage constraints.  It:
1241133049Ssilby     <ul>
1242133049Ssilby<li>must be compiled in by defining <code>AUTOKEY</code> during the compilation. 
1243133049Ssilby</ul>
1244133049Ssilby
124513675Sdyson  <p>Generate parameters and keys for the GQ identification scheme,
1246133049Ssilbyobsoleting any that may exist. 
1247153484Sdelphij<div class="node">
1248153484Sdelphij<p><hr>
124913675Sdyson<a name="ntp_002dkeygen-host_002dkey"></a>Next:&nbsp;<a rel="next" accesskey="n" href="#ntp_002dkeygen-iffkey">ntp-keygen iffkey</a>,
125013675SdysonPrevious:&nbsp;<a rel="previous" accesskey="p" href="#ntp_002dkeygen-gq_002dparams">ntp-keygen gq-params</a>,
125113675SdysonUp:&nbsp;<a rel="up" accesskey="u" href="#ntp_002dkeygen-Invocation">ntp-keygen Invocation</a>
125213675Sdyson<br>
125313675Sdyson</div>
125413675Sdyson
125513675Sdyson<h4 class="subsection">host-key option (-H)</h4>
125613675Sdyson
125714037Sdyson<p><a name="index-ntp_002dkeygen_002dhost_002dkey-9"></a>
125813675SdysonThis is the &ldquo;generate rsa host key&rdquo; option.
125913675Sdyson
126013675Sdyson<p class="noindent">This option has some usage constraints.  It:
126116960Sdyson     <ul>
126213907Sdyson<li>must be compiled in by defining <code>AUTOKEY</code> during the compilation. 
1263133049Ssilby</ul>
126413675Sdyson
126513675Sdyson  <p>Generate new host keys, obsoleting any that may exist. 
126613907Sdyson<div class="node">
126714037Sdyson<p><hr>
126814037Sdyson<a name="ntp_002dkeygen-iffkey"></a>Next:&nbsp;<a rel="next" accesskey="n" href="#ntp_002dkeygen-ident">ntp-keygen ident</a>,
126929356SpeterPrevious:&nbsp;<a rel="previous" accesskey="p" href="#ntp_002dkeygen-host_002dkey">ntp-keygen host-key</a>,
127014037SdysonUp:&nbsp;<a rel="up" accesskey="u" href="#ntp_002dkeygen-Invocation">ntp-keygen Invocation</a>
127114037Sdyson<br>
127214037Sdyson</div>
127313675Sdyson
1274133049Ssilby<h4 class="subsection">iffkey option (-I)</h4>
127591395Salfred
127691362Salfred<p><a name="index-ntp_002dkeygen_002diffkey-10"></a>
127776760SalfredThis is the &ldquo;generate iff parameters&rdquo; option.
127813675Sdyson
127913675Sdyson<p class="noindent">This option has some usage constraints.  It:
128013675Sdyson     <ul>
128113675Sdyson<li>must be compiled in by defining <code>AUTOKEY</code> during the compilation. 
1282133049Ssilby</ul>
128314644Sdyson
128477676Sdillon  <p>Generate parameters for the IFF identification scheme, obsoleting
128576760Salfredany that may exist. 
128676760Salfred<div class="node">
128713675Sdyson<p><hr>
128813675Sdyson<a name="ntp_002dkeygen-ident"></a>Next:&nbsp;<a rel="next" accesskey="n" href="#ntp_002dkeygen-lifetime">ntp-keygen lifetime</a>,
128913675SdysonPrevious:&nbsp;<a rel="previous" accesskey="p" href="#ntp_002dkeygen-iffkey">ntp-keygen iffkey</a>,
129013675SdysonUp:&nbsp;<a rel="up" accesskey="u" href="#ntp_002dkeygen-Invocation">ntp-keygen Invocation</a>
129113675Sdyson<br>
129213675Sdyson</div>
129313675Sdyson
129413675Sdyson<h4 class="subsection">ident option (-i)</h4>
129513675Sdyson
129613675Sdyson<p><a name="index-ntp_002dkeygen_002dident-11"></a>
129713675SdysonThis is the &ldquo;set autokey group name&rdquo; option. 
129813909SdysonThis option takes a string argument <span class="file">group</span>.
129913909Sdyson
1300274023Skib<p class="noindent">This option has some usage constraints.  It:
1301274023Skib     <ul>
1302274023Skib<li>must be compiled in by defining <code>AUTOKEY</code> during the compilation. 
1303274023Skib</ul>
130413909Sdyson
1305274023Skib  <p>Set the optional Autokey group name to name.  This is used in
130613907Sdysonthe file name of IFF, GQ, and MV client parameters files.  In
130713913Sdysonthat role, the default is the host name if this option is not
130824101Sbdeprovided.  The group name, if specified using <code>-i/--ident</code> or
130955112Sbdeusing <code>-s/--subject-name</code> following an '<code>}' character,
131024101Sbdeis also a part of the self-signed host certificate's subject and
131114037Sdysonissuer names in the form host
131214037Sdyson  <p>'crypto ident' or 'server ident' configuration in
131329356Speterntpd's configuration file. 
131414037Sdyson</code><div class="node">
131514177Sdyson<p><hr>
131614037Sdyson<a name="ntp_002dkeygen-lifetime"></a>Next:&nbsp;<a rel="next" accesskey="n" href="#ntp_002dkeygen-md5key">ntp-keygen md5key</a>,
131713907SdysonPrevious:&nbsp;<a rel="previous" accesskey="p" href="#ntp_002dkeygen-ident">ntp-keygen ident</a>,
1318133049SsilbyUp:&nbsp;<a rel="up" accesskey="u" href="#ntp_002dkeygen-Invocation">ntp-keygen Invocation</a>
131991395Salfred<br>
132076760Salfred</div>
132113675Sdyson
132213675Sdyson<h4 class="subsection">lifetime option (-l)</h4>
1323175140Sjhb
1324175140Sjhb<p><a name="index-ntp_002dkeygen_002dlifetime-12"></a>
1325175140SjhbThis is the ``set certificate lifetime'' option. 
1326175140SjhbThis option takes a number argument <span class="file">lifetime</span>.
1327175140Sjhb
1328175140Sjhb<p class="noindent">This option has some usage constraints.  It:
1329175140Sjhb     <ul>
1330175140Sjhb<li>must be compiled in by defining <code>AUTOKEY</code> during the compilation. 
1331271488Sjhb</ul>
1332271488Sjhb
1333175140Sjhb  <p>Set the certificate expiration to lifetime days from now. 
1334271488Sjhb<div class="node">
1335271488Sjhb<p><hr>
1336271488Sjhb<a name="ntp_002dkeygen-md5key"></a>Next:&nbsp;<a rel="next" accesskey="n" href="#ntp_002dkeygen-modulus">ntp-keygen modulus</a>,
1337271488SjhbPrevious:&nbsp;<a rel="previous" accesskey="p" href="#ntp_002dkeygen-lifetime">ntp-keygen lifetime</a>,
1338271488SjhbUp:&nbsp;<a rel="up" accesskey="u" href="#ntp_002dkeygen-Invocation">ntp-keygen Invocation</a>
1339271488Sjhb<br>
1340175140Sjhb</div>
1341175140Sjhb
134213675Sdyson<h4 class="subsection">md5key option (-M)</h4>
134313675Sdyson
134413675Sdyson<p><a name="index-ntp_002dkeygen_002dmd5key-13"></a>
1345104094SphkThis is the ``generate md5 keys'' option. 
1346102003SrwatsonGenerate MD5 keys, obsoleting any that may exist. 
134713675Sdyson<div class="node">
134836735Sdfr<p><hr>
134999009Salfred<a name="ntp_002dkeygen-modulus"></a>Next:&nbsp;<a rel="next" accesskey="n" href="#ntp_002dkeygen-pvt_002dcert">ntp-keygen pvt-cert</a>,
1350102003SrwatsonPrevious:&nbsp;<a rel="previous" accesskey="p" href="#ntp_002dkeygen-md5key">ntp-keygen md5key</a>,
135183366SjulianUp:&nbsp;<a rel="up" accesskey="u" href="#ntp_002dkeygen-Invocation">ntp-keygen Invocation</a>
135213675Sdyson<br>
1353109153Sdillon</div>
1354101768Srwatson
135513675Sdyson<h4 class="subsection">modulus option (-m)</h4>
1356104269Srwatson
1357104269Srwatson<p><a name="index-ntp_002dkeygen_002dmodulus-14"></a>
1358104269SrwatsonThis is the ``modulus'' option. 
1359172930SrwatsonThis option takes a number argument <span class="file">modulus</span>.
1360121970Srwatson
1361121970Srwatson<p class="noindent">This option has some usage constraints.  It:
1362101768Srwatson     <ul>
1363121970Srwatson<li>must be compiled in by defining <code>AUTOKEY</code> during the compilation. 
1364101768Srwatson</ul>
1365101768Srwatson
1366137752Sphk  <p>The number of bits in the prime modulus.  The default is 512. 
136713675Sdyson<div class="node">
136813675Sdyson<p><hr>
136913675Sdyson<a name="ntp_002dkeygen-pvt_002dcert"></a>Next:&nbsp;<a rel="next" accesskey="n" href="#ntp_002dkeygen-password">ntp-keygen password</a>,
1370137752SphkPrevious:&nbsp;<a rel="previous" accesskey="p" href="#ntp_002dkeygen-modulus">ntp-keygen modulus</a>,
137113675SdysonUp:&nbsp;<a rel="up" accesskey="u" href="#ntp_002dkeygen-Invocation">ntp-keygen Invocation</a>
137213675Sdyson<br>
137313675Sdyson</div>
137413675Sdyson
137513675Sdyson<h4 class="subsection">pvt-cert option (-P)</h4>
137613675Sdyson
137713675Sdyson<p><a name="index-ntp_002dkeygen_002dpvt_002dcert-15"></a>
1378137752SphkThis is the ``generate pc private certificate'' option.
137913675Sdyson
138013675Sdyson<p class="noindent">This option has some usage constraints.  It:
1381232055Skmacy     <ul>
1382232055Skmacy<li>must be compiled in by defining <code>AUTOKEY</code> during the compilation. 
1383232055Skmacy</ul>
1384232055Skmacy
1385232055Skmacy  <p>Generate a private certificate.  By default, the program generates
138614037Sdysonpublic certificates. 
138714037Sdyson<div class="node">
138814037Sdyson<p><hr>
138914037Sdyson<a name="ntp_002dkeygen-password"></a>Next:&nbsp;<a rel="next" accesskey="n" href="#ntp_002dkeygen-export_002dpasswd">ntp-keygen export-passwd</a>,
1390137752SphkPrevious:&nbsp;<a rel="previous" accesskey="p" href="#ntp_002dkeygen-pvt_002dcert">ntp-keygen pvt-cert</a>,
139113675SdysonUp:&nbsp;<a rel="up" accesskey="u" href="#ntp_002dkeygen-Invocation">ntp-keygen Invocation</a>
139241086Struckman<br>
1393138032Srwatson</div>
1394137752Sphk
1395138032Srwatson<h4 class="subsection">password option (-p)</h4>
139641086Struckman
139741086Struckman<p><a name="index-ntp_002dkeygen_002dpassword-16"></a>
1398104393StruckmanThis is the ``local private password'' option. 
1399137752SphkThis option takes a string argument <span class="file">passwd</span>.
140013675Sdyson
140141086Struckman<p class="noindent">This option has some usage constraints.  It:
140241086Struckman     <ul>
1403138032Srwatson<li>must be compiled in by defining <code>AUTOKEY</code> during the compilation. 
1404137752Sphk</ul>
1405138032Srwatson
140641086Struckman  <p>Local files containing private data are encrypted with the
140741086StruckmanDES-CBC algorithm and the specified password.  The same password
140818863Sdysonmust be specified to the local ntpd via the "crypto pw password"
1409104393Struckmanconfiguration command.  The default password is the local
1410137752Sphkhostname. 
141113675Sdyson<div class="node">
1412137752Sphk<p><hr>
1413137752Sphk<a name="ntp_002dkeygen-export_002dpasswd"></a>Next:&nbsp;<a rel="next" accesskey="n" href="#ntp_002dkeygen-sign_002dkey">ntp-keygen sign-key</a>,
1414137764SphkPrevious:&nbsp;<a rel="previous" accesskey="p" href="#ntp_002dkeygen-password">ntp-keygen password</a>,
141513675SdysonUp:&nbsp;<a rel="up" accesskey="u" href="#ntp_002dkeygen-Invocation">ntp-keygen Invocation</a>
1416104269Srwatson<br>
1417138032Srwatson</div>
1418137752Sphk
141913675Sdyson<h4 class="subsection">export-passwd option (-q)</h4>
142013675Sdyson
1421104094Sphk<p><a name="index-ntp_002dkeygen_002dexport_002dpasswd-17"></a>
1422101983SrwatsonThis is the ``export iff or gq group keys with password'' option. 
142313675SdysonThis option takes a string argument <span class="file">passwd</span>.
142429356Speter
1425101983Srwatson<p class="noindent">This option has some usage constraints.  It:
142683366Sjulian     <ul>
142713675Sdyson<li>must be compiled in by defining <code>AUTOKEY</code> during the compilation. 
1428232055Skmacy</ul>
142913675Sdyson
1430232055Skmacy  <p>Export IFF or GQ identity group keys to the standard output,
1431101768Srwatsonencrypted with the DES-CBC algorithm and the specified password. 
1432101768SrwatsonThe same password must be specified to the remote ntpd via the
1433101768Srwatson"crypto pw password" configuration command.  See also the option
143413675Sdyson--id-key (-e) for unencrypted exports. 
1435232055Skmacy<div class="node">
1436232055Skmacy<p><hr>
1437232055Skmacy<a name="ntp_002dkeygen-sign_002dkey"></a>Next:&nbsp;<a rel="next" accesskey="n" href="#ntp_002dkeygen-subject_002dname">ntp-keygen subject-name</a>,
143891362SalfredPrevious:&nbsp;<a rel="previous" accesskey="p" href="#ntp_002dkeygen-export_002dpasswd">ntp-keygen export-passwd</a>,
1439101768SrwatsonUp:&nbsp;<a rel="up" accesskey="u" href="#ntp_002dkeygen-Invocation">ntp-keygen Invocation</a>
1440172930Srwatson<br>
1441101768Srwatson</div>
1442101768Srwatson
1443101768Srwatson<h4 class="subsection">sign-key option (-S)</h4>
1444232055Skmacy
144529356Speter<p><a name="index-ntp_002dkeygen_002dsign_002dkey-18"></a>
1446195423SkibThis is the ``generate sign key (rsa or dsa)'' option. 
144729356SpeterThis option takes a string argument <span class="file">sign</span>.
144813675Sdyson
1449232055Skmacy<p class="noindent">This option has some usage constraints.  It:
1450179243Skib     <ul>
1451179243Skib<li>must be compiled in by defining <code>AUTOKEY</code> during the compilation. 
145243311Sdillon</ul>
1453228510Sjilles
1454228510Sjilles  <p>Generate a new sign key of the designated type, obsoleting any
145529356Speterthat may exist.  By default, the program uses the host key as the
145613675Sdysonsign key. 
1457232055Skmacy<div class="node">
1458232055Skmacy<p><hr>
1459232055Skmacy<a name="ntp_002dkeygen-subject_002dname"></a>Next:&nbsp;<a rel="next" accesskey="n" href="#ntp_002dkeygen-trusted_002dcert">ntp-keygen trusted-cert</a>,
1460238936SdavidxuPrevious:&nbsp;<a rel="previous" accesskey="p" href="#ntp_002dkeygen-sign_002dkey">ntp-keygen sign-key</a>,
1461232055SkmacyUp:&nbsp;<a rel="up" accesskey="u" href="#ntp_002dkeygen-Invocation">ntp-keygen Invocation</a>
1462232055Skmacy<br>
1463195423Skib</div>
1464195423Skib
1465195423Skib<h4 class="subsection">subject-name option (-s)</h4>
1466195423Skib
1467195423Skib<p><a name="index-ntp_002dkeygen_002dsubject_002dname-19"></a>
1468195423SkibThis is the ``set host and optionally group name'' option. 
1469195423SkibThis option takes a string argument <span class="file">host@group</span>.
1470195423Skib
147129356Speter<p class="noindent">This option has some usage constraints.  It:
147229356Speter     <ul>
1473232055Skmacy<li>must be compiled in by defining <code>AUTOKEY</code> during the compilation. 
147483805Sjhb</ul>
1475174647Sjeff
1476174647Sjeff  <p>Set the Autokey host name, and optionally, group name specified
147713675Sdysonfollowing an '<code>}' character.  The host name is used in the file
147813675Sdysonname of generated host and signing certificates, without the
1479232055Skmacygroup name.  The host name, and if provided, group name are used
148083805Sjhbin host
1481174647Sjeff  <p>fields.  Specifying '-s
1482174647Sjeff  <p>leaving the host name unchanged while appending
148313907Sdyson  <p>subject and issuer fields, as with -i group.  The group name, or
148413675Sdysonif not provided, the host name are also used in the file names
1485101768Srwatsonof IFF, GQ, and MV client parameter files. 
1486101768Srwatson</code><div class="node">
1487101768Srwatson<p><hr>
148891362Salfred<a name="ntp_002dkeygen-trusted_002dcert"></a>Next:&nbsp;<a rel="next" accesskey="n" href="#ntp_002dkeygen-mv_002dparams">ntp-keygen mv-params</a>,
148929356SpeterPrevious:&nbsp;<a rel="previous" accesskey="p" href="#ntp_002dkeygen-subject_002dname">ntp-keygen subject-name</a>,
149029356SpeterUp:&nbsp;<a rel="up" accesskey="u" href="#ntp_002dkeygen-Invocation">ntp-keygen Invocation</a>
149113675Sdyson<br>
149213675Sdyson</div>
149398989Salfred
149498989Salfred<h4 class="subsection">trusted-cert option (-T)</h4>
149598989Salfred
149698989Salfred<p><a name="index-ntp_002dkeygen_002dtrusted_002dcert-20"></a>
149752983SpeterThis is the ``trusted certificate (tc scheme)'' option.
1498101983Srwatson
149952983Speter<p class="noindent">This option has some usage constraints.  It:
150052983Speter     <ul>
1501101983Srwatson<li>must be compiled in by defining <code>AUTOKEY</code> during the compilation. 
150283366Sjulian</ul>
150313675Sdyson
1504228306Skib  <p>Generate a trusted certificate.  By default, the program generates
1505228306Skiba non-trusted certificate. 
1506101768Srwatson<div class="node">
1507101768Srwatson<p><hr>
1508228306Skib<a name="ntp_002dkeygen-mv_002dparams"></a>Next:&nbsp;<a rel="next" accesskey="n" href="#ntp_002dkeygen-mv_002dkeys">ntp-keygen mv-keys</a>,
150952983SpeterPrevious:&nbsp;<a rel="previous" accesskey="p" href="#ntp_002dkeygen-trusted_002dcert">ntp-keygen trusted-cert</a>,
1510228306SkibUp:&nbsp;<a rel="up" accesskey="u" href="#ntp_002dkeygen-Invocation">ntp-keygen Invocation</a>
1511104269Srwatson<br>
1512228306Skib</div>
1513172930Srwatson
1514228306Skib<h4 class="subsection">mv-params option (-V)</h4>
1515228306Skib
1516101768Srwatson<p><a name="index-ntp_002dkeygen_002dmv_002dparams-21"></a>
1517228306SkibThis is the ``generate &lt;num&gt; mv parameters'' option. 
1518101768SrwatsonThis option takes a number argument <span class="file">num</span>.
1519232055Skmacy
1520232055Skmacy<p class="noindent">This option has some usage constraints.  It:
1521232055Skmacy     <ul>
1522232055Skmacy<li>must be compiled in by defining <code>AUTOKEY</code> during the compilation. 
1523232055Skmacy</ul>
1524232055Skmacy
1525232055Skmacy  <p>Generate parameters and keys for the Mu-Varadharajan (MV)
1526228306Skibidentification scheme. 
1527228306Skib<div class="node">
1528228306Skib<p><hr>
1529228306Skib<a name="ntp_002dkeygen-mv_002dkeys"></a>Next:&nbsp;<a rel="next" accesskey="n" href="#ntp_002dkeygen-config">ntp-keygen config</a>,
1530228306SkibPrevious:&nbsp;<a rel="previous" accesskey="p" href="#ntp_002dkeygen-mv_002dparams">ntp-keygen mv-params</a>,
1531228306SkibUp:&nbsp;<a rel="up" accesskey="u" href="#ntp_002dkeygen-Invocation">ntp-keygen Invocation</a>
1532228306Skib<br>
1533228306Skib</div>
1534228306Skib
1535228306Skib<h4 class="subsection">mv-keys option (-v)</h4>
1536228306Skib
1537228306Skib<p><a name="index-ntp_002dkeygen_002dmv_002dkeys-22"></a>
1538228306SkibThis is the ``update &lt;num&gt; mv keys'' option. 
1539228306SkibThis option takes a number argument <span class="file">num</span>.
1540228306Skib
1541228306Skib<p class="noindent">This option has some usage constraints.  It:
1542228306Skib     <ul>
1543228306Skib<li>must be compiled in by defining <code>AUTOKEY</code> during the compilation. 
1544228306Skib</ul>
1545100527Salfred
154617124Sbde  <p>This option has no <span class="samp">doc</span> documentation.
1547133790Ssilby
1548132436Ssilby<div class="node">
1549132436Ssilby<p><hr>
1550132436Ssilby<a name="ntp_002dkeygen-config"></a>Next:&nbsp;<a rel="next" accesskey="n" href="#ntp_002dkeygen-exit-status">ntp-keygen exit status</a>,
1551132436SsilbyPrevious:&nbsp;<a rel="previous" accesskey="p" href="#ntp_002dkeygen-mv_002dkeys">ntp-keygen mv-keys</a>,
1552298649SpfgUp:&nbsp;<a rel="up" accesskey="u" href="#ntp_002dkeygen-Invocation">ntp-keygen Invocation</a>
1553205792Sed<br>
1554205792Sed</div>
1555205792Sed
155660404Schris<h4 class="subsection">presetting/configuring ntp-keygen</h4>
155760404Schris
1558226042Skib<p>Any option that is not marked as <i>not presettable</i> may be preset by
1559226042Skibloading values from configuration ("rc" or "ini") files, and values from environment variables named <code>NTP-KEYGEN</code> and <code>NTP-KEYGEN_&lt;OPTION_NAME&gt;</code>.  <code>&lt;OPTION_NAME&gt;</code> must be one of
156017124Sbdethe options listed above in upper case and segmented with underscores. 
1561226042SkibThe <code>NTP-KEYGEN</code> variable will be tokenized and parsed like
156217124Sbdethe command line.  The remaining variables are tested for existence and their
156376760Salfredvalues are treated like option arguments.
156413675Sdyson
156513675Sdyson<p class="noindent"><code>libopts</code> will search in 2 places for configuration files:
156613675Sdyson     <ul>
156713675Sdyson<li>$HOME
156883366Sjulian<li>$PWD
156913675Sdyson</ul>
157083366Sjulian  The environment variables <code>HOME</code>, and <code>PWD</code>
157113675Sdysonare expanded and replaced when <span class="file">ntp-keygen</span> runs. 
157216322SgpalmerFor any of these that are plain files, they are simply processed. 
1573232055SkmacyFor any that are directories, then a file named <span class="file">.ntprc</span> is searched for
1574232055Skmacywithin that directory and processed.
157549413Sgreen
1576232055Skmacy  <p>Configuration files may be in a wide variety of formats. 
1577109153SdillonThe basic format is an option name followed by a value (argument) on the
157876760Salfredsame line.  Values may be separated from the option name with a colon,
157913675Sdysonequal sign or simply white space.  Values may be continued across multiple
158013675Sdysonlines by escaping the newline with a backslash.
1581232183Sjilles
1582232271Sdim  <p>Multiple programs may also share the same initialization file. 
1583232183SjillesCommon options are collected at the top, followed by program specific
1584232183Sjillessegments.  The segments are separated by lines like:
1585232183Sjilles<pre class="example">    [NTP-KEYGEN]
1586232183Sjilles</pre>
1587232183Sjilles  <p class="noindent">or by
1588232183Sjilles<pre class="example">    &lt;?program ntp-keygen&gt;
1589232183Sjilles</pre>
1590232183Sjilles  <p class="noindent">Do not mix these styles within one configuration file.
1591232183Sjilles
1592232183Sjilles  <p>Compound values and carefully constructed string values may also be
1593232183Sjillesspecified using XML syntax:
1594232183Sjilles<pre class="example">    &lt;option-name&gt;
1595232183Sjilles       &lt;sub-opt&gt;...&amp;lt;...&amp;gt;...&lt;/sub-opt&gt;
1596232183Sjilles    &lt;/option-name&gt;
1597232183Sjilles</pre>
1598232183Sjilles  <p class="noindent">yielding an <code>option-name.sub-opt</code> string value of
1599232183Sjilles<pre class="example">    "...&lt;...&gt;..."
1600232183Sjilles</pre>
1601232183Sjilles  <p><code>AutoOpts</code> does not track suboptions.  You simply note that it is a
1602232183Sjilleshierarchicly valued option.  <code>AutoOpts</code> does provide a means for searching
1603232183Sjillesthe associated name/value pair list (see: optionFindValue).
1604232183Sjilles
1605232183Sjilles  <p>The command line options relating to configuration and/or usage help are:
1606232183Sjilles
1607232183Sjilles<h5 class="subsubheading">version (-)</h5>
1608232183Sjilles
1609232183Sjilles<p>Print the program version to standard out, optionally with licensing
1610232183Sjillesinformation, then exit 0.  The optional argument specifies how much licensing
1611232183Sjillesdetail to provide.  The default is to print just the version.  The licensing infomation may be selected with an option argument. 
1612232183SjillesOnly the first letter of the argument is examined:
1613232183Sjilles
1614271976Sjhb     <dl>
1615271976Sjhb<dt><span class="samp">version</span><dd>Only print the version.  This is the default. 
1616271976Sjhb<br><dt><span class="samp">copyright</span><dd>Name the copyright usage licensing terms. 
1617271976Sjhb<br><dt><span class="samp">verbose</span><dd>Print the full copyright usage licensing terms. 
1618271976Sjhb</dl>
1619271976Sjhb
1620271976Sjhb<div class="node">
1621271976Sjhb<p><hr>
1622271976Sjhb<a name="ntp_002dkeygen-exit-status"></a>Next:&nbsp;<a rel="next" accesskey="n" href="#ntp_002dkeygen-Usage">ntp-keygen Usage</a>,
1623271976SjhbPrevious:&nbsp;<a rel="previous" accesskey="p" href="#ntp_002dkeygen-config">ntp-keygen config</a>,
1624271976SjhbUp:&nbsp;<a rel="up" accesskey="u" href="#ntp_002dkeygen-Invocation">ntp-keygen Invocation</a>
1625271976Sjhb<br>
1626271976Sjhb</div>
1627271976Sjhb
1628271976Sjhb<h4 class="subsection">ntp-keygen exit status</h4>
162976364Salfred
163076364Salfred<p>One of the following exit values will be returned:
163176364Salfred     <dl>
163276364Salfred<dt><span class="samp">0 (EXIT_SUCCESS)</span><dd>Successful program execution. 
163391412Salfred<br><dt><span class="samp">1 (EXIT_FAILURE)</span><dd>The operation failed or the command syntax was not valid. 
1634125293Srwatson<br><dt><span class="samp">66 (EX_NOINPUT)</span><dd>A specified configuration file could not be loaded. 
1635125293Srwatson<br><dt><span class="samp">70 (EX_SOFTWARE)</span><dd>libopts had an internal operational error.  Please report
163676364Salfredit to autogen-users@lists.sourceforge.net.  Thank you. 
163776364Salfred</dl>
1638189649Sjhb  <div class="node">
1639118764Ssilby<p><hr>
1640118764Ssilby<a name="ntp_002dkeygen-Usage"></a>Next:&nbsp;<a rel="next" accesskey="n" href="#ntp_002dkeygen-Notes">ntp-keygen Notes</a>,
1641118764SsilbyPrevious:&nbsp;<a rel="previous" accesskey="p" href="#ntp_002dkeygen-exit-status">ntp-keygen exit status</a>,
164276364SalfredUp:&nbsp;<a rel="up" accesskey="u" href="#ntp_002dkeygen-Invocation">ntp-keygen Invocation</a>
164376364Salfred<br>
164476364Salfred</div>
1645127501Salc
164676364Salfred<h4 class="subsection">ntp-keygen Usage</h4>
164776364Salfred
164876364Salfred<div class="node">
164976364Salfred<p><hr>
165076364Salfred<a name="ntp_002dkeygen-Notes"></a>Next:&nbsp;<a rel="next" accesskey="n" href="#ntp_002dkeygen-Bugs">ntp-keygen Bugs</a>,
165176364SalfredPrevious:&nbsp;<a rel="previous" accesskey="p" href="#ntp_002dkeygen-Usage">ntp-keygen Usage</a>,
165276364SalfredUp:&nbsp;<a rel="up" accesskey="u" href="#ntp_002dkeygen-Invocation">ntp-keygen Invocation</a>
165313675Sdyson<br>
165413675Sdyson</div>
165513675Sdyson
165613675Sdyson<h4 class="subsection">ntp-keygen Notes</h4>
165713675Sdyson
165813675Sdyson<div class="node">
165913675Sdyson<p><hr>
1660125293Srwatson<a name="ntp_002dkeygen-Bugs"></a>Previous:&nbsp;<a rel="previous" accesskey="p" href="#ntp_002dkeygen-Notes">ntp-keygen Notes</a>,
166113907SdysonUp:&nbsp;<a rel="up" accesskey="u" href="#ntp_002dkeygen-Invocation">ntp-keygen Invocation</a>
166276364Salfred<br>
1663125293Srwatson</div>
166491968Salfred
1665125293Srwatson<h4 class="subsection">ntp-keygen Bugs</h4>
1666133049Ssilby
1667125293Srwatson<div class="node">
166891968Salfred<p><hr>
166991968Salfred<a name="Random-Seed-File"></a>Next:&nbsp;<a rel="next" accesskey="n" href="#Cryptographic-Data-Files">Cryptographic Data Files</a>,
167013907SdysonPrevious:&nbsp;<a rel="previous" accesskey="p" href="#Running-the-Program">Running the Program</a>,
167191968SalfredUp:&nbsp;<a rel="up" accesskey="u" href="#Top">Top</a>
167291968Salfred<br>
167391968Salfred</div>
167491968Salfred
1675126131Sgreen<!-- node-name,  next,  previous,  up -->
167691968Salfred<h3 class="section">Random Seed File</h3>
167791968Salfred
1678126131Sgreen<p>All cryptographically sound key generation schemes must have means to
1679133049Ssilbyrandomize the entropy seed used to initialize the internal
168091968Salfredpseudo-random number generator used by the OpenSSL library routines. 
1681133049SsilbyIf a site supports ssh, it is very likely that means to do this are
168291968Salfredalready available. 
168313675SdysonThe entropy seed used by the OpenSSL library is contained in a file,
1684101768Srwatsonusually called <code>.rnd</code>, which must be available when
168591968Salfredstarting the <code>ntp-keygen</code> program or <code>ntpd</code> daemon.
1686125293Srwatson
168791968Salfred  <p>The OpenSSL library looks for the file using the path specified by the
1688125293Srwatson<code>RANDFILE</code> environment variable in the user home directory, whether root
1689179243Skibor some other user. 
169091968SalfredIf the <code>RANDFILE</code> environment variable is not
169113907Sdysonpresent, the library looks for the <code>.rnd</code> file in the user home
169291968Salfreddirectory. 
169391968SalfredSince both the <code>ntp-keygen</code> program and <code>ntpd</code> daemon must run
1694133741Sjmgas root, the logical place to put this file is in <code>/.rnd</code> or
169591968Salfred<code>/root/.rnd</code>. 
1696125293SrwatsonIf the file is not available or cannot be written, the program exits
169791968Salfredwith a message to the system log.
1698125293Srwatson
1699125293Srwatson<div class="node">
1700125293Srwatson<p><hr>
1701125293Srwatson<a name="Cryptographic-Data-Files"></a>Previous:&nbsp;<a rel="previous" accesskey="p" href="#Random-Seed-File">Random Seed File</a>,
170291968SalfredUp:&nbsp;<a rel="up" accesskey="u" href="#Top">Top</a>
1703125293Srwatson<br>
1704125293Srwatson</div>
1705125293Srwatson
1706179243Skib<!-- node-name,  next,  previous,  up -->
1707126131Sgreen<h3 class="section">Cryptographic Data Files</h3>
1708179243Skib
1709179243Skib<p>File and link names are in the <code>form ntpkey_key_name.fstamp</code>,
1710179243Skibwhere <code>key</code> is the key or parameter type,
1711179243Skib<code>name</code> is the host or group name and
1712179243Skib<code>fstamp</code> is the filestamp (NTP seconds) when the file was created). 
1713179243SkibBy convention, key names in generated file names include both upper and
1714133741Sjmglower case characters, while key names in generated link names include
1715179243Skibonly lower case characters. The filestamp is not used in generated link
1716225177Sattilionames.
1717133741Sjmg
1718125293Srwatson  <p>The key name is a string defining the cryptographic key type. 
1719125293SrwatsonKey types include public/private keys host and sign, certificate cert
1720125293Srwatsonand several challenge/response key types. 
1721125293SrwatsonBy convention, client files used for
1722125293Srwatsonchallenges have a par subtype, as in the IFF challenge IFFpar, while
1723179243Skibserver files for responses have a key subtype, as in the GQ response
172491968SalfredGQkey.
1725125293Srwatson
1726172930Srwatson  <p>All files begin with two nonencrypted lines. The first line contains
1727125293Srwatsonthe file name in the format <code>ntpkey_key_host.fstamp</code>. 
1728125293SrwatsonThe second line contains the datestamp in conventional Unix date format. 
1729125293SrwatsonLines beginning with <code>#</code> are ignored.
1730125293Srwatson
173113675Sdyson  <p>The remainder of the file contains cryptographic data encoded first
173259288Sjlemonusing ASN.1 rules, then encrypted using the DES-CBC algorithm with
173372521Sjlemongiven password and finally written in PEM-encoded printable ASCII text
173459288Sjlemonpreceded and followed by MIME content identifier lines.
173572521Sjlemon
173659288Sjlemon  <p>The format of the symmetric keys file, ordinarily named <code>ntp.keys</code>,
173789306Salfredis somewhat different than the other files in the interest of backward
173859288Sjlemoncompatibility. 
1739232055SkmacyOrdinarily, the file is generated by this program, but
1740232055Skmacyit can be constructed and edited using an ordinary text editor.
1741232055Skmacy
1742232055Skmacy<pre class="example">    # ntpkey_MD5key_hms.local.3564038757
1743232055Skmacy    # Sun Dec  9 02:45:57 2012
1744232055Skmacy    
1745232055Skmacy     1 MD5 "]!ghT%O;3)WJ,/Nc:&gt;I  # MD5 key
1746232055Skmacy     2 MD5 lu+H^tF46BKR-6~pV_5  # MD5 key
1747232055Skmacy     3 MD5 :lnoVsE%Yz*avh%EtNC  # MD5 key
1748232055Skmacy     4 MD5 |fdZrf0sF~^V  # MD5 key
1749232055Skmacy     5 MD5 IyAG&gt;O"y"LmCRS!*bHC  # MD5 key
1750232055Skmacy     6 MD5 "&gt;e\A  # MD5 key
1751232055Skmacy     7 MD5 c9x=M'CfLxax9v)PV-si  # MD5 key
1752232055Skmacy     8 MD5 E|=jvFVov?Bn|Ev=&amp;aK\  # MD5 key
1753126131Sgreen     9 MD5 T!c4UT&amp;`(m$+m+B6,`Q0  # MD5 key
175472521Sjlemon    10 MD5 JVF/1=)=IFbHbJQz..Cd  # MD5 key
175572521Sjlemon    11 SHA1 6dea311109529e436c2b4fccae9bc753c16d1b48  # SHA1 key
175672521Sjlemon    12 SHA1 7076f373d86c4848c59ff8046e49cb7d614ec394  # SHA1 key
175772521Sjlemon    13 SHA1 5f48b1b60591eb01b7cf1d33b7774f08d20262d3  # SHA1 key
175872521Sjlemon    14 SHA1 eed5ab9d9497319ec60cf3781d52607e76720178  # SHA1 key
175972521Sjlemon    15 SHA1 f283562611a04c964da8126296f5f8e58c3f85de  # SHA1 key
1760179243Skib    16 SHA1 1930da171297dd63549af50b29449de17dcf341f  # SHA1 key
1761101382Sdes    17 SHA1 fee892110358cd4382322b889869e750db8e8a8f  # SHA1 key
1762126131Sgreen    18 SHA1 b5520c9fadd7ad3fd8bfa061c8821b65d029bb37  # SHA1 key
1763118929Sjmg    19 SHA1 8c74fb440ec80f453ec6aaa62b9baed0ab723b92  # SHA1 key
1764126131Sgreen    20 SHA1 6bc05f734306a189326000970c19b3910f403795  # SHA1 key
1765232055Skmacy</pre>
176672521Sjlemon  <p>Figure 1. Typical Symmetric Key File
176772521Sjlemon
1768126131Sgreen  <p>Figure 1 shows a typical symmetric keys file used by the reference
1769133741Sjmgimplementation. 
177072521SjlemonEach line of the file contains three fields, first an
177178292Sjlemoninteger between 1 and 65534, inclusive, representing the key identifier
1772232055Skmacyused in the server and peer configuration commands. 
1773133741SjmgNext is the key type for the message digest algorithm,
177491372Salfredwhich in the absence of the
177559288SjlemonOpenSSL library must be MD5 to designate the MD5 message digest
177659288Sjlemonalgorithm. 
177759288SjlemonIf the OpenSSL library is installed, the key type can be any
177859288Sjlemonmessage digest algorithm supported by that library. 
177959288SjlemonHowever, if
178059288Sjlemoncompatibility with FIPS 140-2 is required, the key type must be either
1781232055SkmacySHA or SHA1. 
178259288SjlemonThe key type can be changed using an ASCII text editor.
1783126131Sgreen
1784133741Sjmg  <p>An MD5 key consists of a printable ASCII string less than or equal to
178591372Salfred16 characters and terminated by whitespace or a # character. 
178659288SjlemonAn OpenSSL
178759288Sjlemonkey consists of a hex-encoded ASCII string of 40 characters, which is
178859288Sjlemontruncated as necessary.
178959288Sjlemon
179059288Sjlemon  <p>Note that the keys used by the <code>ntpq</code> and <code>ntpdc</code> programs are
179159288Sjlemonchecked against passwords requested by the programs and entered by hand,
1792232055Skmacyso it
179359288Sjlemonis generally appropriate to specify these keys in human readable ASCII
1794133741Sjmgformat.
179559288Sjlemon
1796275260Skib  <p>The <code>ntp-keygen</code> program generates a MD5 symmetric keys file
179759288Sjlemon<code>ntpkey_MD5key_hostname.filestamp</code>. 
179859288SjlemonSince the file contains private
179959288Sjlemonshared keys, it should be visible only to root and distributed by
180059288Sjlemonsecure means to other subnet hosts. 
180159288SjlemonThe NTP daemon loads the file <code>ntp.keys</code>, so <code>ntp-keygen</code>
1802179243Skibinstalls a soft link from this name to the generated file. 
1803179243SkibSubsequently, similar soft links must be installed by
180491372Salfredmanual or automated means on the other subnet hosts. 
180559288SjlemonWhile this file is
180659288Sjlemonnot used with the Autokey Version 2 protocol, it is needed to
1807133741Sjmgauthenticate some remote configuration commands used by the <code>ntpq</code> and
1808133741Sjmg<code>ntpdc</code> utilities.
180959288Sjlemon
181059288Sjlemon</body></html>
181159288Sjlemon
181259288Sjlemon