xref: /freebsd/contrib/ntp/util/invoke-ntp-keygen.texi (revision f5f40dd63bc7acbb5312b26ac1ea1103c12352a6)
12b15cb3dSCy Schubert@node ntp-keygen Invocation
22b15cb3dSCy Schubert@section Invoking ntp-keygen
32b15cb3dSCy Schubert@pindex ntp-keygen
42b15cb3dSCy Schubert@cindex Create a NTP host key
52b15cb3dSCy Schubert@ignore
62b15cb3dSCy Schubert#
72b15cb3dSCy Schubert# EDIT THIS FILE WITH CAUTION  (invoke-ntp-keygen.texi)
82b15cb3dSCy Schubert#
9*f5f40dd6SCy Schubert# It has been AutoGen-ed  May 25, 2024 at 12:04:48 AM by AutoGen 5.18.16
102b15cb3dSCy Schubert# From the definitions    ntp-keygen-opts.def
112b15cb3dSCy Schubert# and the template file   agtexi-cmd.tpl
122b15cb3dSCy Schubert@end ignore
132b15cb3dSCy Schubert
142b15cb3dSCy Schubert
152b15cb3dSCy Schubert
162b15cb3dSCy SchubertThis program generates cryptographic data files used by the NTPv4
172b15cb3dSCy Schubertauthentication and identification schemes.
1809100258SXin LIIt can generate message digest keys used in symmetric key cryptography and,
1909100258SXin LIif the OpenSSL software library has been installed, it can generate host keys,
2009100258SXin LIsigning keys, certificates, and identity keys and parameters used in Autokey
2109100258SXin LIpublic key cryptography.
222b15cb3dSCy SchubertThese files are used for cookie encryption,
2309100258SXin LIdigital signature, and challenge/response identification algorithms
242b15cb3dSCy Schubertcompatible with the Internet standard security infrastructure.
252b15cb3dSCy Schubert
2609100258SXin LIThe message digest symmetric keys file is generated in a format
2709100258SXin LIcompatible with NTPv3.
2809100258SXin LIAll other files are in PEM-encoded printable ASCII format,
2909100258SXin LIso they can be embedded as MIME attachments in email to other sites
302b15cb3dSCy Schubertand certificate authorities.
312b15cb3dSCy SchubertBy default, files are not encrypted.
322b15cb3dSCy Schubert
3309100258SXin LIWhen used to generate message digest symmetric keys, the program
3409100258SXin LIproduces a file containing ten pseudo-random printable ASCII strings
3509100258SXin LIsuitable for the MD5 message digest algorithm included in the
3609100258SXin LIdistribution.
372b15cb3dSCy SchubertIf the OpenSSL library is installed, it produces an additional ten
3809100258SXin LIhex-encoded random bit strings suitable for SHA1, AES-128-CMAC, and
3909100258SXin LIother message digest algorithms.
4009100258SXin LIThe message digest symmetric keys file must be distributed and stored
412b15cb3dSCy Schubertusing secure means beyond the scope of NTP itself.
422b15cb3dSCy SchubertBesides the keys used for ordinary NTP associations, additional keys
432b15cb3dSCy Schubertcan be defined as passwords for the
442b15cb3dSCy Schubert@code{ntpq(1ntpqmdoc)}
452b15cb3dSCy Schubertand
462b15cb3dSCy Schubert@code{ntpdc(1ntpdcmdoc)}
472b15cb3dSCy Schubertutility programs.
482b15cb3dSCy Schubert
492b15cb3dSCy SchubertThe remaining generated files are compatible with other OpenSSL
502b15cb3dSCy Schubertapplications and other Public Key Infrastructure (PKI) resources.
512b15cb3dSCy SchubertCertificates generated by this program are compatible with extant
522b15cb3dSCy Schubertindustry practice, although some users might find the interpretation of
532b15cb3dSCy SchubertX509v3 extension fields somewhat liberal.
542b15cb3dSCy SchubertHowever, the identity keys are probably not compatible with anything
552b15cb3dSCy Schubertother than Autokey.
562b15cb3dSCy Schubert
572b15cb3dSCy SchubertSome files used by this program are encrypted using a private password.
582b15cb3dSCy SchubertThe
592b15cb3dSCy Schubert@code{-p}
6009100258SXin LIoption specifies the read password for local encrypted files and the
612b15cb3dSCy Schubert@code{-q}
6209100258SXin LIoption the write password for encrypted files sent to remote sites.
632b15cb3dSCy SchubertIf no password is specified, the host name returned by the Unix
6409100258SXin LI@code{hostname(1)}
6509100258SXin LIcommand, normally the DNS name of the host, is used as the the default read
6609100258SXin LIpassword, for convenience.
6709100258SXin LIThe
6809100258SXin LI@code{ntp-keygen}
6909100258SXin LIprogram prompts for the password if it reads an encrypted file
7009100258SXin LIand the password is missing or incorrect.
7109100258SXin LIIf an encrypted file is read successfully and
7209100258SXin LIno write password is specified, the read password is used
7309100258SXin LIas the write password by default.
742b15cb3dSCy Schubert
752b15cb3dSCy SchubertThe
7609100258SXin LI@code{pw}
772b15cb3dSCy Schubertoption of the
7809100258SXin LI@code{crypto}
7909100258SXin LI@code{ntpd(1ntpdmdoc)}
802b15cb3dSCy Schubertconfiguration command specifies the read
812b15cb3dSCy Schubertpassword for previously encrypted local files.
8209100258SXin LIThis must match the local read password used by this program.
832b15cb3dSCy SchubertIf not specified, the host name is used.
8409100258SXin LIThus, if files are generated by this program without an explicit password,
852b15cb3dSCy Schubertthey can be read back by
8609100258SXin LI@code{ntpd(1ntpdmdoc)}
8709100258SXin LIwithout specifying an explicit password but only on the same host.
8809100258SXin LIIf the write password used for encryption is specified as the host name,
8909100258SXin LIthese files can be read by that host with no explicit password.
902b15cb3dSCy Schubert
912b15cb3dSCy SchubertNormally, encrypted files for each host are generated by that host and
922b15cb3dSCy Schubertused only by that host, although exceptions exist as noted later on
932b15cb3dSCy Schubertthis page.
942b15cb3dSCy SchubertThe symmetric keys file, normally called
9509100258SXin LI@file{ntp.keys},
962b15cb3dSCy Schubertis usually installed in
972b15cb3dSCy Schubert@file{/etc}.
982b15cb3dSCy SchubertOther files and links are usually installed in
992b15cb3dSCy Schubert@file{/usr/local/etc},
1002b15cb3dSCy Schubertwhich is normally in a shared filesystem in
1012b15cb3dSCy SchubertNFS-mounted networks and cannot be changed by shared clients.
10209100258SXin LIIn these cases, NFS clients can specify the files in another
10309100258SXin LIdirectory such as
10409100258SXin LI@file{/etc}
10509100258SXin LIusing the
10609100258SXin LI@code{keysdir}
10709100258SXin LI@code{ntpd(1ntpdmdoc)}
10809100258SXin LIconfiguration file command.
1092b15cb3dSCy Schubert
1102b15cb3dSCy SchubertThis program directs commentary and error messages to the standard
1112b15cb3dSCy Schuberterror stream
11209100258SXin LI@file{stderr}
1132b15cb3dSCy Schubertand remote files to the standard output stream
11409100258SXin LI@file{stdout}
1152b15cb3dSCy Schubertwhere they can be piped to other applications or redirected to files.
1162b15cb3dSCy SchubertThe names used for generated files and links all begin with the
1172b15cb3dSCy Schubertstring
11809100258SXin LI@file{ntpkey*}
1192b15cb3dSCy Schubertand include the file type, generating host and filestamp,
1202b15cb3dSCy Schubertas described in the
12109100258SXin LI@ref{Cryptographic Data Files}
1222b15cb3dSCy Schubertsection below.
12309100258SXin LI
1242b15cb3dSCy Schubert@subsubsection Running the Program
12509100258SXin LIThe safest way to run the
12609100258SXin LI@code{ntp-keygen}
12709100258SXin LIprogram is logged in directly as root.
12809100258SXin LIThe recommended procedure is change to the
12909100258SXin LI@kbd{keys}
13009100258SXin LIdirectory, usually
13109100258SXin LI@file{/usr/local/etc},
13209100258SXin LIthen run the program.
13309100258SXin LI
1342b15cb3dSCy SchubertTo test and gain experience with Autokey concepts, log in as root and
13509100258SXin LIchange to the
13609100258SXin LI@kbd{keys}
13709100258SXin LIdirectory, usually
13809100258SXin LI@file{/usr/local/etc}.
1392b15cb3dSCy SchubertWhen run for the first time, or if all files with names beginning with
14009100258SXin LI@file{ntpkey*}
1412b15cb3dSCy Schuberthave been removed, use the
1422b15cb3dSCy Schubert@code{ntp-keygen}
14309100258SXin LIcommand without arguments to generate a default
14409100258SXin LI@code{RSA}
14509100258SXin LIhost key and matching
14609100258SXin LI@code{RSA-MD5}
14709100258SXin LIcertificate file with expiration date one year hence,
14809100258SXin LIwhich is all that is necessary in many cases.
14909100258SXin LIThe program also generates soft links from the generic names
15009100258SXin LIto the respective files.
1512b15cb3dSCy SchubertIf run again without options, the program uses the
15209100258SXin LIexisting keys and parameters and generates a new certificate file with
15309100258SXin LInew expiration date one year hence, and soft link.
15409100258SXin LI
15509100258SXin LIThe host key is used to encrypt the cookie when required and so must be
15609100258SXin LI@code{RSA}
15709100258SXin LItype.
15809100258SXin LIBy default, the host key is also the sign key used to encrypt signatures.
15909100258SXin LIWhen necessary, a different sign key can be specified and this can be
16009100258SXin LIeither
16109100258SXin LI@code{RSA}
16209100258SXin LIor
16309100258SXin LI@code{DSA}
16409100258SXin LItype.
16509100258SXin LIBy default, the message digest type is
16609100258SXin LI@code{MD5},
16709100258SXin LIbut any combination
16809100258SXin LIof sign key type and message digest type supported by the OpenSSL library
16909100258SXin LIcan be specified, including those using the
17009100258SXin LI@code{AES128CMAC}, @code{MD2}, @code{MD5}, @code{MDC2}, @code{SHA}, @code{SHA1}
17109100258SXin LIand
17209100258SXin LI@code{RIPE160}
17309100258SXin LImessage digest algorithms.
17409100258SXin LIHowever, the scheme specified in the certificate must be compatible
17509100258SXin LIwith the sign key.
17609100258SXin LICertificates using any digest algorithm are compatible with
17709100258SXin LI@code{RSA}
17809100258SXin LIsign keys;
17909100258SXin LIhowever, only
18009100258SXin LI@code{SHA}
18109100258SXin LIand
18209100258SXin LI@code{SHA1}
18309100258SXin LIcertificates are compatible with
18409100258SXin LI@code{DSA}
18509100258SXin LIsign keys.
18609100258SXin LI
18709100258SXin LIPrivate/public key files and certificates are compatible with
18809100258SXin LIother OpenSSL applications and very likely other libraries as well.
18909100258SXin LICertificates or certificate requests derived from them should be compatible
19009100258SXin LIwith extant industry practice, although some users might find
19109100258SXin LIthe interpretation of X509v3 extension fields somewhat liberal.
19209100258SXin LIHowever, the identification parameter files, although encoded
19309100258SXin LIas the other files, are probably not compatible with anything other than Autokey.
19409100258SXin LI
19509100258SXin LIRunning the program as other than root and using the Unix
19609100258SXin LI@code{su(1)}
19709100258SXin LIcommand
19809100258SXin LIto assume root may not work properly, since by default the OpenSSL library
19909100258SXin LIlooks for the random seed file
20009100258SXin LI@file{.rnd}
20109100258SXin LIin the user home directory.
20209100258SXin LIHowever, there should be only one
20309100258SXin LI@file{.rnd},
20409100258SXin LImost conveniently
20509100258SXin LIin the root directory, so it is convenient to define the
20609100258SXin LI.Ev RANDFILE
20709100258SXin LIenvironment variable used by the OpenSSL library as the path to
20809100258SXin LI@file{.rnd}.
20909100258SXin LI
21009100258SXin LIInstalling the keys as root might not work in NFS-mounted
21109100258SXin LIshared file systems, as NFS clients may not be able to write
21209100258SXin LIto the shared keys directory, even as root.
21309100258SXin LIIn this case, NFS clients can specify the files in another
21409100258SXin LIdirectory such as
21509100258SXin LI@file{/etc}
21609100258SXin LIusing the
21709100258SXin LI@code{keysdir}
21809100258SXin LI@code{ntpd(1ntpdmdoc)}
21909100258SXin LIconfiguration file command.
22009100258SXin LIThere is no need for one client to read the keys and certificates
22109100258SXin LIof other clients or servers, as these data are obtained automatically
22209100258SXin LIby the Autokey protocol.
22309100258SXin LI
22409100258SXin LIOrdinarily, cryptographic files are generated by the host that uses them,
22509100258SXin LIbut it is possible for a trusted agent (TA) to generate these files
22609100258SXin LIfor other hosts; however, in such cases files should always be encrypted.
22709100258SXin LIThe subject name and trusted name default to the hostname
22809100258SXin LIof the host generating the files, but can be changed by command line options.
22909100258SXin LIIt is convenient to designate the owner name and trusted name
23009100258SXin LIas the subject and issuer fields, respectively, of the certificate.
23109100258SXin LIThe owner name is also used for the host and sign key files,
23209100258SXin LIwhile the trusted name is used for the identity files.
23309100258SXin LI
23409100258SXin LIAll files are installed by default in the keys directory
23509100258SXin LI@file{/usr/local/etc},
23609100258SXin LIwhich is normally in a shared filesystem
23709100258SXin LIin NFS-mounted networks.
23809100258SXin LIThe actual location of the keys directory
23909100258SXin LIand each file can be overridden by configuration commands,
24009100258SXin LIbut this is not recommended.
24109100258SXin LINormally, the files for each host are generated by that host
24209100258SXin LIand used only by that host, although exceptions exist
24309100258SXin LIas noted later on this page.
24409100258SXin LI
24509100258SXin LINormally, files containing private values,
24609100258SXin LIincluding the host key, sign key and identification parameters,
24709100258SXin LIare permitted root read/write-only;
24809100258SXin LIwhile others containing public values are permitted world readable.
24909100258SXin LIAlternatively, files containing private values can be encrypted
25009100258SXin LIand these files permitted world readable,
25109100258SXin LIwhich simplifies maintenance in shared file systems.
25209100258SXin LISince uniqueness is insured by the
25309100258SXin LI@kbd{hostname}
25409100258SXin LIand
25509100258SXin LI@kbd{filestamp}
25609100258SXin LIfile name extensions, the files for an NTP server and
25709100258SXin LIdependent clients can all be installed in the same shared directory.
25809100258SXin LI
25909100258SXin LIThe recommended practice is to keep the file name extensions
26009100258SXin LIwhen installing a file and to install a soft link
26109100258SXin LIfrom the generic names specified elsewhere on this page
26209100258SXin LIto the generated files.
26309100258SXin LIThis allows new file generations to be activated simply
26409100258SXin LIby changing the link.
26509100258SXin LIIf a link is present,
26609100258SXin LI@code{ntpd(1ntpdmdoc)}
26709100258SXin LIfollows it to the file name to extract the
26809100258SXin LI@kbd{filestamp}.
26909100258SXin LIIf a link is not present,
27009100258SXin LI@code{ntpd(1ntpdmdoc)}
27109100258SXin LIextracts the
27209100258SXin LI@kbd{filestamp}
27309100258SXin LIfrom the file itself.
27409100258SXin LIThis allows clients to verify that the file and generation times
27509100258SXin LIare always current.
27609100258SXin LIThe
27709100258SXin LI@code{ntp-keygen}
27809100258SXin LIprogram uses the same
27909100258SXin LI@kbd{filestamp}
28009100258SXin LIextension for all files generated
28109100258SXin LIat one time, so each generation is distinct and can be readily
28209100258SXin LIrecognized in monitoring data.
2832b15cb3dSCy Schubert
2842b15cb3dSCy SchubertRun the command on as many hosts as necessary.
2852b15cb3dSCy SchubertDesignate one of them as the trusted host (TH) using
2862b15cb3dSCy Schubert@code{ntp-keygen}
2872b15cb3dSCy Schubertwith the
2882b15cb3dSCy Schubert@code{-T}
2892b15cb3dSCy Schubertoption and configure it to synchronize from reliable Internet servers.
2902b15cb3dSCy SchubertThen configure the other hosts to synchronize to the TH directly or
2912b15cb3dSCy Schubertindirectly.
2922b15cb3dSCy SchubertA certificate trail is created when Autokey asks the immediately
2932b15cb3dSCy Schubertascendant host towards the TH to sign its certificate, which is then
2942b15cb3dSCy Schubertprovided to the immediately descendant host on request.
2952b15cb3dSCy SchubertAll group hosts should have acyclic certificate trails ending on the TH.
2962b15cb3dSCy Schubert
2972b15cb3dSCy SchubertThe host key is used to encrypt the cookie when required and so must be
2982b15cb3dSCy SchubertRSA type.
2992b15cb3dSCy SchubertBy default, the host key is also the sign key used to encrypt
3002b15cb3dSCy Schubertsignatures.
3012b15cb3dSCy SchubertA different sign key can be assigned using the
3022b15cb3dSCy Schubert@code{-S}
30309100258SXin LIoption and this can be either
30409100258SXin LI@code{RSA}
30509100258SXin LIor
30609100258SXin LI@code{DSA}
30709100258SXin LItype.
3082b15cb3dSCy SchubertBy default, the signature
30909100258SXin LImessage digest type is
31009100258SXin LI@code{MD5},
31109100258SXin LIbut any combination of sign key type and
3122b15cb3dSCy Schubertmessage digest type supported by the OpenSSL library can be specified
3132b15cb3dSCy Schubertusing the
3142b15cb3dSCy Schubert@code{-c}
3152b15cb3dSCy Schubertoption.
31609100258SXin LI
3172b15cb3dSCy SchubertThe rules say cryptographic media should be generated with proventic
3182b15cb3dSCy Schubertfilestamps, which means the host should already be synchronized before
3192b15cb3dSCy Schubertthis program is run.
3202b15cb3dSCy SchubertThis of course creates a chicken-and-egg problem
3212b15cb3dSCy Schubertwhen the host is started for the first time.
3222b15cb3dSCy SchubertAccordingly, the host time
3232b15cb3dSCy Schubertshould be set by some other means, such as eyeball-and-wristwatch, at
3242b15cb3dSCy Schubertleast so that the certificate lifetime is within the current year.
3252b15cb3dSCy SchubertAfter that and when the host is synchronized to a proventic source, the
3262b15cb3dSCy Schubertcertificate should be re-generated.
3272b15cb3dSCy Schubert
3282b15cb3dSCy SchubertAdditional information on trusted groups and identity schemes is on the
3292b15cb3dSCy Schubert@quotedblleft{}Autokey Public-Key Authentication@quotedblright{}
3302b15cb3dSCy Schubertpage.
3312b15cb3dSCy Schubert
3322b15cb3dSCy SchubertFile names begin with the prefix
33309100258SXin LI@file{ntpkey}_
33409100258SXin LIand end with the suffix
33509100258SXin LI@file{_}@kbd{hostname}. @kbd{filestamp},
3362b15cb3dSCy Schubertwhere
3372b15cb3dSCy Schubert@kbd{hostname}
3382b15cb3dSCy Schubertis the owner name, usually the string returned
33909100258SXin LIby the Unix
34009100258SXin LI@code{hostname(1)}
34109100258SXin LIcommand, and
3422b15cb3dSCy Schubert@kbd{filestamp}
3432b15cb3dSCy Schubertis the NTP seconds when the file was generated, in decimal digits.
3442b15cb3dSCy SchubertThis both guarantees uniqueness and simplifies maintenance
3452b15cb3dSCy Schubertprocedures, since all files can be quickly removed
3462b15cb3dSCy Schubertby a
34709100258SXin LI@code{rm} @file{ntpkey*}
3482b15cb3dSCy Schubertcommand or all files generated
3492b15cb3dSCy Schubertat a specific time can be removed by a
35009100258SXin LI@code{rm} @file{*}@kbd{filestamp}
3512b15cb3dSCy Schubertcommand.
3522b15cb3dSCy SchubertTo further reduce the risk of misconfiguration,
3532b15cb3dSCy Schubertthe first two lines of a file contain the file name
3542b15cb3dSCy Schubertand generation date and time as comments.
3552b15cb3dSCy Schubert
35609100258SXin LI@subsubsection Trusted Hosts and Groups
3572b15cb3dSCy SchubertEach cryptographic configuration involves selection of a signature scheme
3582b15cb3dSCy Schubertand identification scheme, called a cryptotype,
3592b15cb3dSCy Schubertas explained in the
3602b15cb3dSCy Schubert@ref{Authentication Options}
3612b15cb3dSCy Schubertsection of
3622b15cb3dSCy Schubert@code{ntp.conf(5)}.
36309100258SXin LIThe default cryptotype uses
36409100258SXin LI@code{RSA}
36509100258SXin LIencryption,
36609100258SXin LI@code{MD5}
36709100258SXin LImessage digest
36809100258SXin LIand
36909100258SXin LI@code{TC}
37009100258SXin LIidentification.
3712b15cb3dSCy SchubertFirst, configure a NTP subnet including one or more low-stratum
3722b15cb3dSCy Schuberttrusted hosts from which all other hosts derive synchronization
3732b15cb3dSCy Schubertdirectly or indirectly.
3742b15cb3dSCy SchubertTrusted hosts have trusted certificates;
3752b15cb3dSCy Schubertall other hosts have nontrusted certificates.
3762b15cb3dSCy SchubertThese hosts will automatically and dynamically build authoritative
3772b15cb3dSCy Schubertcertificate trails to one or more trusted hosts.
3782b15cb3dSCy SchubertA trusted group is the set of all hosts that have, directly or indirectly,
3792b15cb3dSCy Schuberta certificate trail ending at a trusted host.
3802b15cb3dSCy SchubertThe trail is defined by static configuration file entries
3812b15cb3dSCy Schubertor dynamic means described on the
3822b15cb3dSCy Schubert@ref{Automatic NTP Configuration Options}
3832b15cb3dSCy Schubertsection of
3842b15cb3dSCy Schubert@code{ntp.conf(5)}.
3852b15cb3dSCy Schubert
3862b15cb3dSCy SchubertOn each trusted host as root, change to the keys directory.
3872b15cb3dSCy SchubertTo insure a fresh fileset, remove all
38809100258SXin LI@file{ntpkey}
3892b15cb3dSCy Schubertfiles.
3902b15cb3dSCy SchubertThen run
3912b15cb3dSCy Schubert@code{ntp-keygen}
3922b15cb3dSCy Schubert@code{-T}
3932b15cb3dSCy Schubertto generate keys and a trusted certificate.
3942b15cb3dSCy SchubertOn all other hosts do the same, but leave off the
3952b15cb3dSCy Schubert@code{-T}
3962b15cb3dSCy Schubertflag to generate keys and nontrusted certificates.
3972b15cb3dSCy SchubertWhen complete, start the NTP daemons beginning at the lowest stratum
3982b15cb3dSCy Schubertand working up the tree.
3992b15cb3dSCy SchubertIt may take some time for Autokey to instantiate the certificate trails
4002b15cb3dSCy Schubertthroughout the subnet, but setting up the environment is completely automatic.
4012b15cb3dSCy Schubert
4022b15cb3dSCy SchubertIf it is necessary to use a different sign key or different digest/signature
4032b15cb3dSCy Schubertscheme than the default, run
4042b15cb3dSCy Schubert@code{ntp-keygen}
4052b15cb3dSCy Schubertwith the
4062b15cb3dSCy Schubert@code{-S} @kbd{type}
4072b15cb3dSCy Schubertoption, where
4082b15cb3dSCy Schubert@kbd{type}
4092b15cb3dSCy Schubertis either
4102b15cb3dSCy Schubert@code{RSA}
4112b15cb3dSCy Schubertor
4122b15cb3dSCy Schubert@code{DSA}.
41309100258SXin LIThe most frequent need to do this is when a
41409100258SXin LI@code{DSA}-signed
41509100258SXin LIcertificate is used.
4162b15cb3dSCy SchubertIf it is necessary to use a different certificate scheme than the default,
4172b15cb3dSCy Schubertrun
4182b15cb3dSCy Schubert@code{ntp-keygen}
4192b15cb3dSCy Schubertwith the
4202b15cb3dSCy Schubert@code{-c} @kbd{scheme}
4212b15cb3dSCy Schubertoption and selected
4222b15cb3dSCy Schubert@kbd{scheme}
4232b15cb3dSCy Schubertas needed.
42409100258SXin LIIf
4252b15cb3dSCy Schubert@code{ntp-keygen}
4262b15cb3dSCy Schubertis run again without these options, it generates a new certificate
42709100258SXin LIusing the same scheme and sign key, and soft link.
4282b15cb3dSCy Schubert
4292b15cb3dSCy SchubertAfter setting up the environment it is advisable to update certificates
4302b15cb3dSCy Schubertfrom time to time, if only to extend the validity interval.
4312b15cb3dSCy SchubertSimply run
4322b15cb3dSCy Schubert@code{ntp-keygen}
4332b15cb3dSCy Schubertwith the same flags as before to generate new certificates
43409100258SXin LIusing existing keys, and soft links.
4352b15cb3dSCy SchubertHowever, if the host or sign key is changed,
4362b15cb3dSCy Schubert@code{ntpd(1ntpdmdoc)}
4372b15cb3dSCy Schubertshould be restarted.
4382b15cb3dSCy SchubertWhen
4392b15cb3dSCy Schubert@code{ntpd(1ntpdmdoc)}
4402b15cb3dSCy Schubertis restarted, it loads any new files and restarts the protocol.
4412b15cb3dSCy SchubertOther dependent hosts will continue as usual until signatures are refreshed,
4422b15cb3dSCy Schubertat which time the protocol is restarted.
44309100258SXin LI
4442b15cb3dSCy Schubert@subsubsection Identity Schemes
4452b15cb3dSCy SchubertAs mentioned on the Autonomous Authentication page,
44609100258SXin LIthe default
44709100258SXin LI@code{TC}
44809100258SXin LIidentity scheme is vulnerable to a middleman attack.
4492b15cb3dSCy SchubertHowever, there are more secure identity schemes available,
45009100258SXin LIincluding
45109100258SXin LI@code{PC}, @code{IFF}, @code{GQ}
45209100258SXin LIand
45309100258SXin LI@code{MV}
45409100258SXin LIschemes described below.
4552b15cb3dSCy SchubertThese schemes are based on a TA, one or more trusted hosts
4562b15cb3dSCy Schubertand some number of nontrusted hosts.
4572b15cb3dSCy SchubertTrusted hosts prove identity using values provided by the TA,
4582b15cb3dSCy Schubertwhile the remaining hosts prove identity using values provided
4592b15cb3dSCy Schubertby a trusted host and certificate trails that end on that host.
4602b15cb3dSCy SchubertThe name of a trusted host is also the name of its sugroup
4612b15cb3dSCy Schubertand also the subject and issuer name on its trusted certificate.
4622b15cb3dSCy SchubertThe TA is not necessarily a trusted host in this sense, but often is.
4632b15cb3dSCy Schubert
4642b15cb3dSCy SchubertIn some schemes there are separate keys for servers and clients.
4652b15cb3dSCy SchubertA server can also be a client of another server,
4662b15cb3dSCy Schubertbut a client can never be a server for another client.
4672b15cb3dSCy SchubertIn general, trusted hosts and nontrusted hosts that operate
4682b15cb3dSCy Schubertas both server and client have parameter files that contain
4692b15cb3dSCy Schubertboth server and client keys.
4702b15cb3dSCy SchubertHosts that operate
4712b15cb3dSCy Schubertonly as clients have key files that contain only client keys.
4722b15cb3dSCy Schubert
4732b15cb3dSCy SchubertThe PC scheme supports only one trusted host in the group.
4742b15cb3dSCy SchubertOn trusted host alice run
4752b15cb3dSCy Schubert@code{ntp-keygen}
4762b15cb3dSCy Schubert@code{-P}
4772b15cb3dSCy Schubert@code{-p} @kbd{password}
4782b15cb3dSCy Schubertto generate the host key file
47909100258SXin LI@file{ntpkey}_ @code{RSA} @file{key_alice.} @kbd{filestamp}
4802b15cb3dSCy Schubertand trusted private certificate file
48109100258SXin LI@file{ntpkey}_ @code{RSA-MD5} @code{_} @file{cert_alice.} @kbd{filestamp},
48209100258SXin LIand soft links.
4832b15cb3dSCy SchubertCopy both files to all group hosts;
4842b15cb3dSCy Schubertthey replace the files which would be generated in other schemes.
48509100258SXin LIOn each host
48609100258SXin LI@kbd{bob}
48709100258SXin LIinstall a soft link from the generic name
4882b15cb3dSCy Schubert@file{ntpkey_host_}@kbd{bob}
4892b15cb3dSCy Schubertto the host key file and soft link
4902b15cb3dSCy Schubert@file{ntpkey_cert_}@kbd{bob}
4912b15cb3dSCy Schubertto the private certificate file.
4922b15cb3dSCy SchubertNote the generic links are on bob, but point to files generated
4932b15cb3dSCy Schubertby trusted host alice.
4942b15cb3dSCy SchubertIn this scheme it is not possible to refresh
4952b15cb3dSCy Schuberteither the keys or certificates without copying them
49609100258SXin LIto all other hosts in the group, and recreating the soft links.
4972b15cb3dSCy Schubert
49809100258SXin LIFor the
49909100258SXin LI@code{IFF}
50009100258SXin LIscheme proceed as in the
50109100258SXin LI@code{TC}
50209100258SXin LIscheme to generate keys
5032b15cb3dSCy Schubertand certificates for all group hosts, then for every trusted host in the group,
50409100258SXin LIgenerate the
50509100258SXin LI@code{IFF}
50609100258SXin LIparameter file.
5072b15cb3dSCy SchubertOn trusted host alice run
5082b15cb3dSCy Schubert@code{ntp-keygen}
5092b15cb3dSCy Schubert@code{-T}
5102b15cb3dSCy Schubert@code{-I}
5112b15cb3dSCy Schubert@code{-p} @kbd{password}
5122b15cb3dSCy Schubertto produce her parameter file
51309100258SXin LI@file{ntpkey_IFFpar_alice.}@kbd{filestamp},
5142b15cb3dSCy Schubertwhich includes both server and client keys.
5152b15cb3dSCy SchubertCopy this file to all group hosts that operate as both servers
5162b15cb3dSCy Schubertand clients and install a soft link from the generic
51709100258SXin LI@file{ntpkey_iff_alice}
5182b15cb3dSCy Schubertto this file.
5192b15cb3dSCy SchubertIf there are no hosts restricted to operate only as clients,
5202b15cb3dSCy Schubertthere is nothing further to do.
52109100258SXin LIAs the
52209100258SXin LI@code{IFF}
52309100258SXin LIscheme is independent
5242b15cb3dSCy Schubertof keys and certificates, these files can be refreshed as needed.
5252b15cb3dSCy Schubert
5262b15cb3dSCy SchubertIf a rogue client has the parameter file, it could masquerade
5272b15cb3dSCy Schubertas a legitimate server and present a middleman threat.
5282b15cb3dSCy SchubertTo eliminate this threat, the client keys can be extracted
5292b15cb3dSCy Schubertfrom the parameter file and distributed to all restricted clients.
5302b15cb3dSCy SchubertAfter generating the parameter file, on alice run
5312b15cb3dSCy Schubert@code{ntp-keygen}
5322b15cb3dSCy Schubert@code{-e}
53309100258SXin LIand pipe the output to a file or email program.
53409100258SXin LICopy or email this file to all restricted clients.
5352b15cb3dSCy SchubertOn these clients install a soft link from the generic
53609100258SXin LI@file{ntpkey_iff_alice}
5372b15cb3dSCy Schubertto this file.
5382b15cb3dSCy SchubertTo further protect the integrity of the keys,
5392b15cb3dSCy Schuberteach file can be encrypted with a secret password.
5402b15cb3dSCy Schubert
54109100258SXin LIFor the
54209100258SXin LI@code{GQ}
54309100258SXin LIscheme proceed as in the
54409100258SXin LI@code{TC}
54509100258SXin LIscheme to generate keys
5462b15cb3dSCy Schubertand certificates for all group hosts, then for every trusted host
54709100258SXin LIin the group, generate the
54809100258SXin LI@code{IFF}
54909100258SXin LIparameter file.
5502b15cb3dSCy SchubertOn trusted host alice run
5512b15cb3dSCy Schubert@code{ntp-keygen}
5522b15cb3dSCy Schubert@code{-T}
5532b15cb3dSCy Schubert@code{-G}
5542b15cb3dSCy Schubert@code{-p} @kbd{password}
5552b15cb3dSCy Schubertto produce her parameter file
55609100258SXin LI@file{ntpkey_GQpar_alice.}@kbd{filestamp},
5572b15cb3dSCy Schubertwhich includes both server and client keys.
5582b15cb3dSCy SchubertCopy this file to all group hosts and install a soft link
5592b15cb3dSCy Schubertfrom the generic
56009100258SXin LI@file{ntpkey_gq_alice}
5612b15cb3dSCy Schubertto this file.
56209100258SXin LIIn addition, on each host
56309100258SXin LI@kbd{bob}
56409100258SXin LIinstall a soft link
5652b15cb3dSCy Schubertfrom generic
5662b15cb3dSCy Schubert@file{ntpkey_gq_}@kbd{bob}
5672b15cb3dSCy Schubertto this file.
56809100258SXin LIAs the
56909100258SXin LI@code{GQ}
57009100258SXin LIscheme updates the
57109100258SXin LI@code{GQ}
57209100258SXin LIparameters file and certificate
5732b15cb3dSCy Schubertat the same time, keys and certificates can be regenerated as needed.
5742b15cb3dSCy Schubert
57509100258SXin LIFor the
57609100258SXin LI@code{MV}
57709100258SXin LIscheme, proceed as in the
57809100258SXin LI@code{TC}
57909100258SXin LIscheme to generate keys
5802b15cb3dSCy Schubertand certificates for all group hosts.
5812b15cb3dSCy SchubertFor illustration assume trish is the TA, alice one of several trusted hosts
5822b15cb3dSCy Schubertand bob one of her clients.
5832b15cb3dSCy SchubertOn TA trish run
5842b15cb3dSCy Schubert@code{ntp-keygen}
5852b15cb3dSCy Schubert@code{-V} @kbd{n}
5862b15cb3dSCy Schubert@code{-p} @kbd{password},
5872b15cb3dSCy Schubertwhere
5882b15cb3dSCy Schubert@kbd{n}
5892b15cb3dSCy Schubertis the number of revokable keys (typically 5) to produce
5902b15cb3dSCy Schubertthe parameter file
59109100258SXin LI@file{ntpkeys_MVpar_trish.}@kbd{filestamp}
5922b15cb3dSCy Schubertand client key files
59309100258SXin LI@file{ntpkeys_MVkey}@kbd{d} @kbd{_} @file{trish.} @kbd{filestamp}
5942b15cb3dSCy Schubertwhere
5952b15cb3dSCy Schubert@kbd{d}
5962b15cb3dSCy Schubertis the key number (0 <
5972b15cb3dSCy Schubert@kbd{d}
5982b15cb3dSCy Schubert<
5992b15cb3dSCy Schubert@kbd{n}).
6002b15cb3dSCy SchubertCopy the parameter file to alice and install a soft link
6012b15cb3dSCy Schubertfrom the generic
60209100258SXin LI@file{ntpkey_mv_alice}
6032b15cb3dSCy Schubertto this file.
6042b15cb3dSCy SchubertCopy one of the client key files to alice for later distribution
6052b15cb3dSCy Schubertto her clients.
60609100258SXin LIIt does not matter which client key file goes to alice,
6072b15cb3dSCy Schubertsince they all work the same way.
60809100258SXin LIAlice copies the client key file to all of her clients.
6092b15cb3dSCy SchubertOn client bob install a soft link from generic
61009100258SXin LI@file{ntpkey_mvkey_bob}
6112b15cb3dSCy Schubertto the client key file.
61209100258SXin LIAs the
61309100258SXin LI@code{MV}
61409100258SXin LIscheme is independent of keys and certificates,
6152b15cb3dSCy Schubertthese files can be refreshed as needed.
61609100258SXin LI
6172b15cb3dSCy Schubert@subsubsection Command Line Options
6182b15cb3dSCy Schubert@table @asis
61909100258SXin LI@item @code{-b} @code{--imbits}= @kbd{modulus}
62009100258SXin LISet the number of bits in the identity modulus for generating identity keys to
62109100258SXin LI@kbd{modulus}
62209100258SXin LIbits.
62309100258SXin LIThe number of bits in the identity modulus defaults to 256, but can be set to
62409100258SXin LIvalues from 256 to 2048 (32 to 256 octets).
62509100258SXin LIUse the larger moduli with caution, as this can consume considerable computing
62609100258SXin LIresources and increases the size of authenticated packets.
62709100258SXin LI@item @code{-c} @code{--certificate}= @kbd{scheme}
62809100258SXin LISelect certificate signature encryption/message digest scheme.
6292b15cb3dSCy SchubertThe
6302b15cb3dSCy Schubert@kbd{scheme}
6312b15cb3dSCy Schubertcan be one of the following:
63209100258SXin LI@code{RSA-MD2}, @code{RSA-MD5}, @code{RSA-MDC2}, @code{RSA-SHA}, @code{RSA-SHA1}, @code{RSA-RIPEMD160}, @code{DSA-SHA},
6332b15cb3dSCy Schubertor
6342b15cb3dSCy Schubert@code{DSA-SHA1}.
63509100258SXin LINote that
63609100258SXin LI@code{RSA}
63709100258SXin LIschemes must be used with an
63809100258SXin LI@code{RSA}
63909100258SXin LIsign key and
64009100258SXin LI@code{DSA}
64109100258SXin LIschemes must be used with a
64209100258SXin LI@code{DSA}
64309100258SXin LIsign key.
6442b15cb3dSCy SchubertThe default without this option is
6452b15cb3dSCy Schubert@code{RSA-MD5}.
64609100258SXin LIIf compatibility with FIPS 140-2 is required, either the
64709100258SXin LI@code{DSA-SHA}
64809100258SXin LIor
64909100258SXin LI@code{DSA-SHA1}
65009100258SXin LIscheme must be used.
65109100258SXin LI@item @code{-C} @code{--cipher}= @kbd{cipher}
65209100258SXin LISelect the OpenSSL cipher to encrypt the files containing private keys.
65309100258SXin LIThe default without this option is three-key triple DES in CBC mode,
65409100258SXin LI@code{des-ede3-cbc}.
65509100258SXin LIThe
65609100258SXin LI@code{openssl} @code{-h}
65709100258SXin LIcommand provided with OpenSSL displays available ciphers.
65809100258SXin LI@item @code{-d} @code{--debug-level}
65909100258SXin LIIncrease debugging verbosity level.
6602b15cb3dSCy SchubertThis option displays the cryptographic data produced in eye-friendly billboards.
66109100258SXin LI@item @code{-D} @code{--set-debug-level}= @kbd{level}
66209100258SXin LISet the debugging verbosity to
66309100258SXin LI@kbd{level}.
66409100258SXin LIThis option displays the cryptographic data produced in eye-friendly billboards.
66509100258SXin LI@item @code{-e} @code{--id-key}
66609100258SXin LIWrite the
66709100258SXin LI@code{IFF}
66809100258SXin LIor
66909100258SXin LI@code{GQ}
67009100258SXin LIpublic parameters from the
67109100258SXin LI@kbd{IFFkey} @kbd{or} @kbd{GQkey}
67209100258SXin LIclient keys file previously specified
67309100258SXin LIas unencrypted data to the standard output stream
67409100258SXin LI@file{stdout}.
67509100258SXin LIThis is intended for automatic key distribution by email.
67609100258SXin LI@item @code{-G} @code{--gq-params}
67709100258SXin LIGenerate a new encrypted
67809100258SXin LI@code{GQ}
67909100258SXin LIparameters and key file for the Guillou-Quisquater (GQ) identity scheme.
68009100258SXin LIThis option is mutually exclusive with the
68109100258SXin LI@code{-I}
68209100258SXin LIand
68309100258SXin LI@code{-V}
68409100258SXin LIoptions.
68509100258SXin LI@item @code{-H} @code{--host-key}
68609100258SXin LIGenerate a new encrypted
68709100258SXin LI@code{RSA}
68809100258SXin LIpublic/private host key file.
68909100258SXin LI@item @code{-I} @code{--iffkey}
69009100258SXin LIGenerate a new encrypted
69109100258SXin LI@code{IFF}
69209100258SXin LIkey file for the Schnorr (IFF) identity scheme.
69309100258SXin LIThis option is mutually exclusive with the
69409100258SXin LI@code{-G}
69509100258SXin LIand
69609100258SXin LIFl V
69709100258SXin LIoptions.
69809100258SXin LI@item @code{-i} @code{--ident}= @kbd{group}
69909100258SXin LISet the optional Autokey group name to
70009100258SXin LI@kbd{group}.
70109100258SXin LIThis is used in the identity scheme parameter file names of
70209100258SXin LI@code{IFF}, @code{GQ},
70309100258SXin LIand
70409100258SXin LI@code{MV}
70509100258SXin LIclient parameters files.
70609100258SXin LIIn that role, the default is the host name if no group is provided.
70709100258SXin LIThe group name, if specified using
70809100258SXin LI@code{-i}
70909100258SXin LIor
71009100258SXin LI@code{-s}
71109100258SXin LIfollowing an
71209100258SXin LI@quoteleft{}@@@quoteright{}
71309100258SXin LIcharacter, is also used in certificate subject and issuer names in the form
71409100258SXin LI@kbd{host} @kbd{@@} @kbd{group}
71509100258SXin LIand should match the group specified via
71609100258SXin LI@code{crypto} @code{ident}
71709100258SXin LIor
71809100258SXin LI@code{server} @code{ident}
71909100258SXin LIin the ntpd configuration file.
72009100258SXin LI@item @code{-l} @code{--lifetime}= @kbd{days}
72109100258SXin LISet the lifetime for certificate expiration to
72209100258SXin LI@kbd{days}.
72309100258SXin LIThe default lifetime is one year (365 days).
72409100258SXin LI@item @code{-m} @code{--modulus}= @kbd{bits}
72509100258SXin LISet the number of bits in the prime modulus for generating files to
72609100258SXin LI@kbd{bits}.
72709100258SXin LIThe modulus defaults to 512, but can be set from 256 to 2048 (32 to 256 octets).
72809100258SXin LIUse the larger moduli with caution, as this can consume considerable computing
72909100258SXin LIresources and increases the size of authenticated packets.
73009100258SXin LI@item @code{-M} @code{--md5key}
73109100258SXin LIGenerate a new symmetric keys file containing 10
73209100258SXin LI@code{MD5}
73309100258SXin LIkeys, and if OpenSSL is available, 10
73409100258SXin LI@code{SHA}
73509100258SXin LIkeys.
73609100258SXin LIAn
73709100258SXin LI@code{MD5}
73809100258SXin LIkey is a string of 20 random printable ASCII characters, while a
73909100258SXin LI@code{SHA}
74009100258SXin LIkey is a string of 40 random hex digits.
74109100258SXin LIThe file can be edited using a text editor to change the key type or key content.
74209100258SXin LIThis option is mutually exclusive with all other options.
74309100258SXin LI@item @code{-p} @code{--password}= @kbd{passwd}
74409100258SXin LISet the password for reading and writing encrypted files to
74509100258SXin LI@kbd{passwd}.
74609100258SXin LIThese include the host, sign and identify key files.
74709100258SXin LIBy default, the password is the string returned by the Unix
74809100258SXin LI@code{hostname}
74909100258SXin LIcommand.
75009100258SXin LI@item @code{-P} @code{--pvt-cert}
75109100258SXin LIGenerate a new private certificate used by the
75209100258SXin LI@code{PC}
75309100258SXin LIidentity scheme.
7542b15cb3dSCy SchubertBy default, the program generates public certificates.
75509100258SXin LINote: the PC identity scheme is not recommended for new installations.
75609100258SXin LI@item @code{-q} @code{--export-passwd}= @kbd{passwd}
75709100258SXin LISet the password for writing encrypted
75809100258SXin LI@code{IFF}, @code{GQ} @code{and} @code{MV}
75909100258SXin LIidentity files redirected to
76009100258SXin LI@file{stdout}
76109100258SXin LIto
76209100258SXin LI@kbd{passwd}.
76309100258SXin LIIn effect, these files are decrypted with the
76409100258SXin LI@code{-p}
76509100258SXin LIpassword, then encrypted with the
76609100258SXin LI@code{-q}
76709100258SXin LIpassword.
76809100258SXin LIBy default, the password is the string returned by the Unix
76909100258SXin LI@code{hostname}
77009100258SXin LIcommand.
77109100258SXin LI@item @code{-s} @code{--subject-key}= @code{[host]} @code{[@@ @kbd{group}]}
77209100258SXin LISpecify the Autokey host name, where
77309100258SXin LI@kbd{host}
77409100258SXin LIis the optional host name and
77509100258SXin LI@kbd{group}
77609100258SXin LIis the optional group name.
77709100258SXin LIThe host name, and if provided, group name are used in
77809100258SXin LI@kbd{host} @kbd{@@} @kbd{group}
77909100258SXin LIform as certificate subject and issuer.
78009100258SXin LISpecifying
78109100258SXin LI@code{-s} @code{-@@} @kbd{group}
78209100258SXin LIis allowed, and results in leaving the host name unchanged, as with
78309100258SXin LI@code{-i} @kbd{group}.
78409100258SXin LIThe group name, or if no group is provided, the host name are also used in the
78509100258SXin LIfile names of
78609100258SXin LI@code{IFF}, @code{GQ},
78709100258SXin LIand
78809100258SXin LI@code{MV}
78909100258SXin LIidentity scheme client parameter files.
79009100258SXin LIIf
79109100258SXin LI@kbd{host}
79209100258SXin LIis not specified, the default host name is the string returned by the Unix
79309100258SXin LI@code{hostname}
79409100258SXin LIcommand.
79509100258SXin LI@item @code{-S} @code{--sign-key}= @code{[@code{RSA} | @code{DSA}]}
79609100258SXin LIGenerate a new encrypted public/private sign key file of the specified type.
79709100258SXin LIBy default, the sign key is the host key and has the same type.
79809100258SXin LIIf compatibility with FIPS 140-2 is required, the sign key type must be
79909100258SXin LI@code{DSA}.
80009100258SXin LI@item @code{-T} @code{--trusted-cert}
8012b15cb3dSCy SchubertGenerate a trusted certificate.
8022b15cb3dSCy SchubertBy default, the program generates a non-trusted certificate.
80309100258SXin LI@item @code{-V} @code{--mv-params} @kbd{nkeys}
80409100258SXin LIGenerate
80509100258SXin LI@kbd{nkeys}
80609100258SXin LIencrypted server keys and parameters for the Mu-Varadharajan (MV)
80709100258SXin LIidentity scheme.
80809100258SXin LIThis option is mutually exclusive with the
80909100258SXin LI@code{-I}
81009100258SXin LIand
81109100258SXin LI@code{-G}
81209100258SXin LIoptions.
81309100258SXin LINote: support for this option should be considered a work in progress.
8142b15cb3dSCy Schubert@end table
81509100258SXin LI
8162b15cb3dSCy Schubert@subsubsection Random Seed File
8172b15cb3dSCy SchubertAll cryptographically sound key generation schemes must have means
8182b15cb3dSCy Schubertto randomize the entropy seed used to initialize
8192b15cb3dSCy Schubertthe internal pseudo-random number generator used
8202b15cb3dSCy Schubertby the library routines.
8212b15cb3dSCy SchubertThe OpenSSL library uses a designated random seed file for this purpose.
8222b15cb3dSCy SchubertThe file must be available when starting the NTP daemon and
8232b15cb3dSCy Schubert@code{ntp-keygen}
8242b15cb3dSCy Schubertprogram.
8252b15cb3dSCy SchubertIf a site supports OpenSSL or its companion OpenSSH,
8262b15cb3dSCy Schubertit is very likely that means to do this are already available.
8272b15cb3dSCy Schubert
8282b15cb3dSCy SchubertIt is important to understand that entropy must be evolved
8292b15cb3dSCy Schubertfor each generation, for otherwise the random number sequence
8302b15cb3dSCy Schubertwould be predictable.
8312b15cb3dSCy SchubertVarious means dependent on external events, such as keystroke intervals,
8322b15cb3dSCy Schubertcan be used to do this and some systems have built-in entropy sources.
8332b15cb3dSCy SchubertSuitable means are described in the OpenSSL software documentation,
8342b15cb3dSCy Schubertbut are outside the scope of this page.
8352b15cb3dSCy Schubert
8362b15cb3dSCy SchubertThe entropy seed used by the OpenSSL library is contained in a file,
8372b15cb3dSCy Schubertusually called
83809100258SXin LI@file{.rnd},
8392b15cb3dSCy Schubertwhich must be available when starting the NTP daemon
8402b15cb3dSCy Schubertor the
8412b15cb3dSCy Schubert@code{ntp-keygen}
8422b15cb3dSCy Schubertprogram.
8432b15cb3dSCy SchubertThe NTP daemon will first look for the file
8442b15cb3dSCy Schubertusing the path specified by the
8452b15cb3dSCy Schubert@code{randfile}
8462b15cb3dSCy Schubertsubcommand of the
8472b15cb3dSCy Schubert@code{crypto}
8482b15cb3dSCy Schubertconfiguration command.
8492b15cb3dSCy SchubertIf not specified in this way, or when starting the
8502b15cb3dSCy Schubert@code{ntp-keygen}
8512b15cb3dSCy Schubertprogram,
8522b15cb3dSCy Schubertthe OpenSSL library will look for the file using the path specified
8532b15cb3dSCy Schubertby the
8542b15cb3dSCy Schubert.Ev RANDFILE
8552b15cb3dSCy Schubertenvironment variable in the user home directory,
8562b15cb3dSCy Schubertwhether root or some other user.
8572b15cb3dSCy SchubertIf the
8582b15cb3dSCy Schubert.Ev RANDFILE
8592b15cb3dSCy Schubertenvironment variable is not present,
8602b15cb3dSCy Schubertthe library will look for the
86109100258SXin LI@file{.rnd}
8622b15cb3dSCy Schubertfile in the user home directory.
86309100258SXin LISince both the
86409100258SXin LI@code{ntp-keygen}
86509100258SXin LIprogram and
86609100258SXin LI@code{ntpd(1ntpdmdoc)}
86709100258SXin LIdaemon must run as root, the logical place to put this file is in
86809100258SXin LI@file{/.rnd}
86909100258SXin LIor
87009100258SXin LI@file{/root/.rnd}.
8712b15cb3dSCy SchubertIf the file is not available or cannot be written,
8722b15cb3dSCy Schubertthe daemon exits with a message to the system log and the program
8732b15cb3dSCy Schubertexits with a suitable error message.
87409100258SXin LI
8752b15cb3dSCy Schubert@subsubsection Cryptographic Data Files
87609100258SXin LIAll file formats begin with two nonencrypted lines.
87709100258SXin LIThe first line contains the file name, including the generated host name
87809100258SXin LIand filestamp, in the format
87909100258SXin LI@file{ntpkey_}@kbd{key} @kbd{_} @kbd{name}. @kbd{filestamp},
88009100258SXin LIwhere
88109100258SXin LI@kbd{key}
88209100258SXin LIis the key or parameter type,
88309100258SXin LI@kbd{name}
88409100258SXin LIis the host or group name and
88509100258SXin LI@kbd{filestamp}
88609100258SXin LIis the filestamp (NTP seconds) when the file was created.
88709100258SXin LIBy convention,
88809100258SXin LI@kbd{key}
88909100258SXin LInames in generated file names include both upper and lower case
89009100258SXin LIcharacters, while
89109100258SXin LI@kbd{key}
89209100258SXin LInames in generated link names include only lower case characters.
89309100258SXin LIThe filestamp is not used in generated link names.
89409100258SXin LIThe second line contains the datestamp in conventional Unix
89509100258SXin LI@file{date}
89609100258SXin LIformat.
89709100258SXin LILines beginning with
89809100258SXin LI@quoteleft{}#@quoteright{}
89909100258SXin LIare considered comments and ignored by the
9002b15cb3dSCy Schubert@code{ntp-keygen}
9012b15cb3dSCy Schubertprogram and
9022b15cb3dSCy Schubert@code{ntpd(1ntpdmdoc)}
9032b15cb3dSCy Schubertdaemon.
9042b15cb3dSCy Schubert
90509100258SXin LIThe remainder of the file contains cryptographic data, encoded first using ASN.1
90609100258SXin LIrules, then encrypted if necessary, and finally written in PEM-encoded
90709100258SXin LIprintable ASCII text, preceded and followed by MIME content identifier lines.
90809100258SXin LI
90909100258SXin LIThe format of the symmetric keys file, ordinarily named
91009100258SXin LI@file{ntp.keys},
91109100258SXin LIis somewhat different than the other files in the interest of backward compatibility.
91209100258SXin LIOrdinarily, the file is generated by this program, but it can be constructed
91309100258SXin LIand edited using an ordinary text editor.
91409100258SXin LI@verbatim
91509100258SXin LI# ntpkey_MD5key_bk.ntp.org.3595864945
91609100258SXin LI# Thu Dec 12 19:22:25 2013
91709100258SXin LI
91809100258SXin LI1  MD5 L";Nw<\`.I<f4U0)247"i  # MD5 key
91909100258SXin LI2  MD5 &>l0%XXK9O'51VwV<xq~  # MD5 key
92009100258SXin LI3  MD5 lb4zLW~d^!K:]RsD'qb6  # MD5 key
92109100258SXin LI4  MD5 Yue:tL[+vR)M\`n~bY,'?  # MD5 key
92209100258SXin LI5  MD5 B;fx'Kgr/&4ZTbL6=RxA  # MD5 key
92309100258SXin LI6  MD5 4eYwa\`o@}3i@@@@V@@..R9!l  # MD5 key
92409100258SXin LI7  MD5 \`A.([h+;wTQ|xfi%Sn_!  # MD5 key
92509100258SXin LI8  MD5 45:V,r4]l6y^JH6"Sh?F  # MD5 key
92609100258SXin LI9  MD5 3-5vcn*6l29DS?Xdsg)*  # MD5 key
92709100258SXin LI10 MD5 2late4Me              # MD5 key
92809100258SXin LI11 SHA1 a27872d3030a9025b8446c751b4551a7629af65c  # SHA1 key
92909100258SXin LI12 SHA1 21bc3b4865dbb9e920902abdccb3e04ff97a5e74  # SHA1 key
93009100258SXin LI13 SHA1 2b7736fe24fef5ba85ae11594132ab5d6f6daba9  # SHA1 key
93109100258SXin LI14 SHA  a5332809c8878dd3a5b918819108a111509aeceb  # SHA  key
93209100258SXin LI15 MD2  2fe16c88c760ff2f16d4267e36c1aa6c926e6964  # MD2  key
93309100258SXin LI16 MD4  b2691811dc19cfc0e2f9bcacd74213f29812183d  # MD4  key
93409100258SXin LI17 MD5  e4d6735b8bdad58ec5ffcb087300a17f7fef1f7c  # MD5  key
93509100258SXin LI18 MDC2 a8d5e2315c025bf3a79174c87fbd10477de2eabc  # MDC2 key
93609100258SXin LI19 RIPEMD160 77ca332cafb30e3cafb174dcd5b80ded7ba9b3d2  # RIPEMD160 key
93709100258SXin LI20 AES128CMAC f92ff73eee86c1e7dc638d6489a04e4e555af878  # AES128CMAC key
93809100258SXin LI@end verbatim
93909100258SXin LI@example
94009100258SXin LIFigure 1. Typical Symmetric Key File
94109100258SXin LI@end example
94209100258SXin LI
94309100258SXin LIFigure 1 shows a typical symmetric keys file used by the reference
94409100258SXin LIimplementation.
94509100258SXin LIFollowing the header the keys are entered one per line in the format
9462b15cb3dSCy Schubert@example
9472b15cb3dSCy Schubert@kbd{keyno} @kbd{type} @kbd{key}
9482b15cb3dSCy Schubert@end example
9492b15cb3dSCy Schubertwhere
9502b15cb3dSCy Schubert@kbd{keyno}
9514e1ef62aSXin LIis a positive integer in the range 1-65535;
9522b15cb3dSCy Schubert@kbd{type}
95309100258SXin LIis the key type for the message digest algorithm, which in the absence of the
95409100258SXin LIOpenSSL library must be
95509100258SXin LI@code{MD5}
95609100258SXin LIto designate the MD5 message digest algorithm;
95709100258SXin LIif the OpenSSL library is installed, the key type can be any
95809100258SXin LImessage digest algorithm supported by that library;
95909100258SXin LIhowever, if compatibility with FIPS 140-2 is required,
96009100258SXin LIthe key type must be either
96109100258SXin LI@code{SHA}
96209100258SXin LIor
96309100258SXin LI@code{SHA1};
9642b15cb3dSCy Schubert@kbd{key}
9652b15cb3dSCy Schubertis the key itself,
96609100258SXin LIwhich is a printable ASCII string 20 characters or less in length:
96709100258SXin LIeach character is chosen from the 93 printable characters
96809100258SXin LIin the range 0x21 through 0x7e (
96909100258SXin LI@quoteleft{}@quoteright{}!
97009100258SXin LIthrough
97109100258SXin LI@quoteleft{}~@quoteright{}
97209100258SXin LI) excluding space and the
97309100258SXin LI@quoteleft{}#@quoteright{}
97409100258SXin LIcharacter, and terminated by whitespace or a
9752b15cb3dSCy Schubert@quoteleft{}#@quoteright{}
9762b15cb3dSCy Schubertcharacter.
97709100258SXin LIAn OpenSSL key consists of a hex-encoded ASCII string of 40 characters, which
97809100258SXin LIis truncated as necessary.
9792b15cb3dSCy Schubert
9802b15cb3dSCy SchubertNote that the keys used by the
9812b15cb3dSCy Schubert@code{ntpq(1ntpqmdoc)}
9822b15cb3dSCy Schubertand
9832b15cb3dSCy Schubert@code{ntpdc(1ntpdcmdoc)}
9842b15cb3dSCy Schubertprograms
9852b15cb3dSCy Schubertare checked against passwords requested by the programs
9862b15cb3dSCy Schubertand entered by hand, so it is generally appropriate to specify these keys
9872b15cb3dSCy Schubertin human readable ASCII format.
9882b15cb3dSCy Schubert
9892b15cb3dSCy SchubertThe
9902b15cb3dSCy Schubert@code{ntp-keygen}
99109100258SXin LIprogram generates a symmetric keys file
99209100258SXin LI@file{ntpkey_MD5key_}@kbd{hostname}. @kbd{filestamp}.
9932b15cb3dSCy SchubertSince the file contains private shared keys,
9942b15cb3dSCy Schubertit should be visible only to root and distributed by secure means
9952b15cb3dSCy Schubertto other subnet hosts.
9962b15cb3dSCy SchubertThe NTP daemon loads the file
9972b15cb3dSCy Schubert@file{ntp.keys},
9982b15cb3dSCy Schubertso
9992b15cb3dSCy Schubert@code{ntp-keygen}
10002b15cb3dSCy Schubertinstalls a soft link from this name to the generated file.
10012b15cb3dSCy SchubertSubsequently, similar soft links must be installed by manual
10022b15cb3dSCy Schubertor automated means on the other subnet hosts.
10032b15cb3dSCy SchubertWhile this file is not used with the Autokey Version 2 protocol,
10042b15cb3dSCy Schubertit is needed to authenticate some remote configuration commands
10052b15cb3dSCy Schubertused by the
10062b15cb3dSCy Schubert@code{ntpq(1ntpqmdoc)}
10072b15cb3dSCy Schubertand
10082b15cb3dSCy Schubert@code{ntpdc(1ntpdcmdoc)}
10092b15cb3dSCy Schubertutilities.
10102b15cb3dSCy Schubert
10112b15cb3dSCy SchubertThis section was generated by @strong{AutoGen},
10122b15cb3dSCy Schubertusing the @code{agtexi-cmd} template and the option descriptions for the @code{ntp-keygen} program.
10132b15cb3dSCy SchubertThis software is released under the NTP license, <http://ntp.org/license>.
10142b15cb3dSCy Schubert
10152b15cb3dSCy Schubert@menu
10162b15cb3dSCy Schubert* ntp-keygen usage::                  ntp-keygen help/usage (@option{--help})
10172b15cb3dSCy Schubert* ntp-keygen imbits::                 imbits option (-b)
10182b15cb3dSCy Schubert* ntp-keygen certificate::            certificate option (-c)
10192b15cb3dSCy Schubert* ntp-keygen cipher::                 cipher option (-C)
10202b15cb3dSCy Schubert* ntp-keygen id-key::                 id-key option (-e)
10212b15cb3dSCy Schubert* ntp-keygen gq-params::              gq-params option (-G)
10222b15cb3dSCy Schubert* ntp-keygen host-key::               host-key option (-H)
10232b15cb3dSCy Schubert* ntp-keygen iffkey::                 iffkey option (-I)
10242b15cb3dSCy Schubert* ntp-keygen ident::                  ident option (-i)
10252b15cb3dSCy Schubert* ntp-keygen lifetime::               lifetime option (-l)
10262b15cb3dSCy Schubert* ntp-keygen modulus::                modulus option (-m)
102709100258SXin LI* ntp-keygen md5key::                 md5key option (-M)
10282b15cb3dSCy Schubert* ntp-keygen pvt-cert::               pvt-cert option (-P)
10292b15cb3dSCy Schubert* ntp-keygen password::               password option (-p)
10302b15cb3dSCy Schubert* ntp-keygen export-passwd::          export-passwd option (-q)
10312b15cb3dSCy Schubert* ntp-keygen subject-name::           subject-name option (-s)
103209100258SXin LI* ntp-keygen sign-key::               sign-key option (-S)
10332b15cb3dSCy Schubert* ntp-keygen trusted-cert::           trusted-cert option (-T)
10342b15cb3dSCy Schubert* ntp-keygen mv-params::              mv-params option (-V)
10352b15cb3dSCy Schubert* ntp-keygen mv-keys::                mv-keys option (-v)
10362b15cb3dSCy Schubert* ntp-keygen config::                 presetting/configuring ntp-keygen
10372b15cb3dSCy Schubert* ntp-keygen exit status::            exit status
10382b15cb3dSCy Schubert* ntp-keygen Usage::                  Usage
10392b15cb3dSCy Schubert* ntp-keygen Notes::                  Notes
10402b15cb3dSCy Schubert* ntp-keygen Bugs::                   Bugs
10412b15cb3dSCy Schubert@end menu
10422b15cb3dSCy Schubert
10432b15cb3dSCy Schubert@node ntp-keygen usage
10442b15cb3dSCy Schubert@subsection ntp-keygen help/usage (@option{--help})
10452b15cb3dSCy Schubert@cindex ntp-keygen help
10462b15cb3dSCy Schubert
10472b15cb3dSCy SchubertThis is the automatically generated usage text for ntp-keygen.
10482b15cb3dSCy Schubert
10492b15cb3dSCy SchubertThe text printed is the same whether selected with the @code{help} option
10502b15cb3dSCy Schubert(@option{--help}) or the @code{more-help} option (@option{--more-help}).  @code{more-help} will print
10512b15cb3dSCy Schubertthe usage text by passing it through a pager program.
10522b15cb3dSCy Schubert@code{more-help} is disabled on platforms without a working
10532b15cb3dSCy Schubert@code{fork(2)} function.  The @code{PAGER} environment variable is
10542b15cb3dSCy Schubertused to select the program, defaulting to @file{more}.  Both will exit
10552b15cb3dSCy Schubertwith a status code of 0.
10562b15cb3dSCy Schubert
10572b15cb3dSCy Schubert@exampleindent 0
10582b15cb3dSCy Schubert@example
1059*f5f40dd6SCy Schubertntp-keygen (ntp) - Create a NTP host key - Ver. 4.2.8p18
10604e1ef62aSXin LIUsage:  ntp-keygen [ -<flag> [<val>] | --<name>[@{=| @}<val>] ]...
10612b15cb3dSCy Schubert  Flg Arg Option-Name    Description
10624e1ef62aSXin LI   -b Num imbits         identity modulus bits
10634e1ef62aSXin LI                                - it must be in the range:
10644e1ef62aSXin LI                                  256 to 2048
10652b15cb3dSCy Schubert   -c Str certificate    certificate scheme
10662b15cb3dSCy Schubert   -C Str cipher         privatekey cipher
10672b15cb3dSCy Schubert   -d no  debug-level    Increase debug verbosity level
10682b15cb3dSCy Schubert                                - may appear multiple times
10694e1ef62aSXin LI   -D Num set-debug-level Set the debug verbosity level
10702b15cb3dSCy Schubert                                - may appear multiple times
10712b15cb3dSCy Schubert   -e no  id-key         Write IFF or GQ identity keys
10722b15cb3dSCy Schubert   -G no  gq-params      Generate GQ parameters and keys
10732b15cb3dSCy Schubert   -H no  host-key       generate RSA host key
10742b15cb3dSCy Schubert   -I no  iffkey         generate IFF parameters
10752b15cb3dSCy Schubert   -i Str ident          set Autokey group name
10762b15cb3dSCy Schubert   -l Num lifetime       set certificate lifetime
10774e1ef62aSXin LI   -m Num modulus        prime modulus
10784e1ef62aSXin LI                                - it must be in the range:
10792b15cb3dSCy Schubert                                  256 to 2048
10804e1ef62aSXin LI   -M no  md5key         generate symmetric keys
10812b15cb3dSCy Schubert   -P no  pvt-cert       generate PC private certificate
10824e1ef62aSXin LI   -p Str password       local private password
10834e1ef62aSXin LI   -q Str export-passwd  export IFF or GQ group keys with password
10842b15cb3dSCy Schubert   -s Str subject-name   set host and optionally group name
10854e1ef62aSXin LI   -S Str sign-key       generate sign key (RSA or DSA)
10862b15cb3dSCy Schubert   -T no  trusted-cert   trusted certificate (TC scheme)
10872b15cb3dSCy Schubert   -V Num mv-params      generate <num> MV parameters
10882b15cb3dSCy Schubert   -v Num mv-keys        update <num> MV keys
10894e1ef62aSXin LI      opt version        output version information and exit
10904e1ef62aSXin LI   -? no  help           display extended usage information and exit
10914e1ef62aSXin LI   -! no  more-help      extended usage information passed thru pager
10924e1ef62aSXin LI   -> opt save-opts      save the option state to a config file
10934e1ef62aSXin LI   -< Str load-opts      load options from a config file
10944e1ef62aSXin LI                                - disabled as '--no-load-opts'
10952b15cb3dSCy Schubert                                - may appear multiple times
10962b15cb3dSCy Schubert
10972b15cb3dSCy SchubertOptions are specified by doubled hyphens and their name or by a single
10982b15cb3dSCy Schuberthyphen and the flag character.
10992b15cb3dSCy Schubert
11002b15cb3dSCy Schubert
11012b15cb3dSCy SchubertThe following option preset mechanisms are supported:
11022b15cb3dSCy Schubert - reading file $HOME/.ntprc
11032b15cb3dSCy Schubert - reading file ./.ntprc
11042b15cb3dSCy Schubert - examining environment variables named NTP_KEYGEN_*
11052b15cb3dSCy Schubert
1106a466cc55SCy SchubertPlease send bug reports to:  <https://bugs.ntp.org, bugs@@ntp.org>
11072b15cb3dSCy Schubert@end example
11082b15cb3dSCy Schubert@exampleindent 4
11092b15cb3dSCy Schubert
11102b15cb3dSCy Schubert@node ntp-keygen imbits
11112b15cb3dSCy Schubert@subsection imbits option (-b)
11122b15cb3dSCy Schubert@cindex ntp-keygen-imbits
11132b15cb3dSCy Schubert
11142b15cb3dSCy SchubertThis is the ``identity modulus bits'' option.
11152b15cb3dSCy SchubertThis option takes a number argument @file{imbits}.
11162b15cb3dSCy Schubert
11172b15cb3dSCy Schubert@noindent
11182b15cb3dSCy SchubertThis option has some usage constraints.  It:
11192b15cb3dSCy Schubert@itemize @bullet
11202b15cb3dSCy Schubert@item
11212b15cb3dSCy Schubertmust be compiled in by defining @code{AUTOKEY} during the compilation.
11222b15cb3dSCy Schubert@end itemize
11232b15cb3dSCy Schubert
1124a466cc55SCy SchubertThe number of bits in the identity modulus.  The default is 512.
11252b15cb3dSCy Schubert@node ntp-keygen certificate
11262b15cb3dSCy Schubert@subsection certificate option (-c)
11272b15cb3dSCy Schubert@cindex ntp-keygen-certificate
11282b15cb3dSCy Schubert
11292b15cb3dSCy SchubertThis is the ``certificate scheme'' option.
11302b15cb3dSCy SchubertThis option takes a string argument @file{scheme}.
11312b15cb3dSCy Schubert
11322b15cb3dSCy Schubert@noindent
11332b15cb3dSCy SchubertThis option has some usage constraints.  It:
11342b15cb3dSCy Schubert@itemize @bullet
11352b15cb3dSCy Schubert@item
11362b15cb3dSCy Schubertmust be compiled in by defining @code{AUTOKEY} during the compilation.
11372b15cb3dSCy Schubert@end itemize
11382b15cb3dSCy Schubert
11392b15cb3dSCy Schubertscheme is one of
114009100258SXin LIRSA-MD2, RSA-MD5, RSA-MDC2, RSA-SHA, RSA-SHA1, RSA-RIPEMD160,
11412b15cb3dSCy SchubertDSA-SHA, or DSA-SHA1.
11422b15cb3dSCy Schubert
114309100258SXin LISelect the certificate signature encryption/message digest scheme.
11442b15cb3dSCy SchubertNote that RSA schemes must be used with a RSA sign key and DSA
11452b15cb3dSCy Schubertschemes must be used with a DSA sign key.  The default without
11462b15cb3dSCy Schubertthis option is RSA-MD5.
11472b15cb3dSCy Schubert@node ntp-keygen cipher
11482b15cb3dSCy Schubert@subsection cipher option (-C)
11492b15cb3dSCy Schubert@cindex ntp-keygen-cipher
11502b15cb3dSCy Schubert
11512b15cb3dSCy SchubertThis is the ``privatekey cipher'' option.
11522b15cb3dSCy SchubertThis option takes a string argument @file{cipher}.
11532b15cb3dSCy Schubert
11542b15cb3dSCy Schubert@noindent
11552b15cb3dSCy SchubertThis option has some usage constraints.  It:
11562b15cb3dSCy Schubert@itemize @bullet
11572b15cb3dSCy Schubert@item
11582b15cb3dSCy Schubertmust be compiled in by defining @code{AUTOKEY} during the compilation.
11592b15cb3dSCy Schubert@end itemize
11602b15cb3dSCy Schubert
11612b15cb3dSCy SchubertSelect the cipher which is used to encrypt the files containing
11622b15cb3dSCy Schubertprivate keys.  The default is three-key triple DES in CBC mode,
116309100258SXin LIequivalent to "@code{-C des-ede3-cbc}".  The openssl tool lists ciphers
11642b15cb3dSCy Schubertavailable in "@code{openssl -h}" output.
11652b15cb3dSCy Schubert@node ntp-keygen id-key
11662b15cb3dSCy Schubert@subsection id-key option (-e)
11672b15cb3dSCy Schubert@cindex ntp-keygen-id-key
11682b15cb3dSCy Schubert
11692b15cb3dSCy SchubertThis is the ``write iff or gq identity keys'' option.
11702b15cb3dSCy Schubert
11712b15cb3dSCy Schubert@noindent
11722b15cb3dSCy SchubertThis option has some usage constraints.  It:
11732b15cb3dSCy Schubert@itemize @bullet
11742b15cb3dSCy Schubert@item
11752b15cb3dSCy Schubertmust be compiled in by defining @code{AUTOKEY} during the compilation.
11762b15cb3dSCy Schubert@end itemize
11772b15cb3dSCy Schubert
117809100258SXin LIWrite the public parameters from the IFF or GQ client keys to
117909100258SXin LIthe standard output.
118009100258SXin LIThis is intended for automatic key distribution by email.
11812b15cb3dSCy Schubert@node ntp-keygen gq-params
11822b15cb3dSCy Schubert@subsection gq-params option (-G)
11832b15cb3dSCy Schubert@cindex ntp-keygen-gq-params
11842b15cb3dSCy Schubert
11852b15cb3dSCy SchubertThis is the ``generate gq parameters and keys'' option.
11862b15cb3dSCy Schubert
11872b15cb3dSCy Schubert@noindent
11882b15cb3dSCy SchubertThis option has some usage constraints.  It:
11892b15cb3dSCy Schubert@itemize @bullet
11902b15cb3dSCy Schubert@item
11912b15cb3dSCy Schubertmust be compiled in by defining @code{AUTOKEY} during the compilation.
11922b15cb3dSCy Schubert@end itemize
11932b15cb3dSCy Schubert
11942b15cb3dSCy SchubertGenerate parameters and keys for the GQ identification scheme,
11952b15cb3dSCy Schubertobsoleting any that may exist.
11962b15cb3dSCy Schubert@node ntp-keygen host-key
11972b15cb3dSCy Schubert@subsection host-key option (-H)
11982b15cb3dSCy Schubert@cindex ntp-keygen-host-key
11992b15cb3dSCy Schubert
12002b15cb3dSCy SchubertThis is the ``generate rsa host key'' option.
12012b15cb3dSCy Schubert
12022b15cb3dSCy Schubert@noindent
12032b15cb3dSCy SchubertThis option has some usage constraints.  It:
12042b15cb3dSCy Schubert@itemize @bullet
12052b15cb3dSCy Schubert@item
12062b15cb3dSCy Schubertmust be compiled in by defining @code{AUTOKEY} during the compilation.
12072b15cb3dSCy Schubert@end itemize
12082b15cb3dSCy Schubert
12092b15cb3dSCy SchubertGenerate new host keys, obsoleting any that may exist.
12102b15cb3dSCy Schubert@node ntp-keygen iffkey
12112b15cb3dSCy Schubert@subsection iffkey option (-I)
12122b15cb3dSCy Schubert@cindex ntp-keygen-iffkey
12132b15cb3dSCy Schubert
12142b15cb3dSCy SchubertThis is the ``generate iff parameters'' option.
12152b15cb3dSCy Schubert
12162b15cb3dSCy Schubert@noindent
12172b15cb3dSCy SchubertThis option has some usage constraints.  It:
12182b15cb3dSCy Schubert@itemize @bullet
12192b15cb3dSCy Schubert@item
12202b15cb3dSCy Schubertmust be compiled in by defining @code{AUTOKEY} during the compilation.
12212b15cb3dSCy Schubert@end itemize
12222b15cb3dSCy Schubert
12232b15cb3dSCy SchubertGenerate parameters for the IFF identification scheme, obsoleting
12242b15cb3dSCy Schubertany that may exist.
12252b15cb3dSCy Schubert@node ntp-keygen ident
12262b15cb3dSCy Schubert@subsection ident option (-i)
12272b15cb3dSCy Schubert@cindex ntp-keygen-ident
12282b15cb3dSCy Schubert
12292b15cb3dSCy SchubertThis is the ``set autokey group name'' option.
12302b15cb3dSCy SchubertThis option takes a string argument @file{group}.
12312b15cb3dSCy Schubert
12322b15cb3dSCy Schubert@noindent
12332b15cb3dSCy SchubertThis option has some usage constraints.  It:
12342b15cb3dSCy Schubert@itemize @bullet
12352b15cb3dSCy Schubert@item
12362b15cb3dSCy Schubertmust be compiled in by defining @code{AUTOKEY} during the compilation.
12372b15cb3dSCy Schubert@end itemize
12382b15cb3dSCy Schubert
12392b15cb3dSCy SchubertSet the optional Autokey group name to name.  This is used in
12402b15cb3dSCy Schubertthe file name of IFF, GQ, and MV client parameters files.  In
12412b15cb3dSCy Schubertthat role, the default is the host name if this option is not
12422b15cb3dSCy Schubertprovided.  The group name, if specified using @code{-i/--ident} or
124309100258SXin LIusing @code{-s/--subject-name} following an '@code{@@}' character,
124409100258SXin LIis also a part of the self-signed host certificate subject and
124509100258SXin LIissuer names in the form @code{host@@group} and should match the
124609100258SXin LI'@code{crypto ident}' or '@code{server ident}' configuration in the
124709100258SXin LI@code{ntpd} configuration file.
12482b15cb3dSCy Schubert@node ntp-keygen lifetime
12492b15cb3dSCy Schubert@subsection lifetime option (-l)
12502b15cb3dSCy Schubert@cindex ntp-keygen-lifetime
12512b15cb3dSCy Schubert
12522b15cb3dSCy SchubertThis is the ``set certificate lifetime'' option.
12532b15cb3dSCy SchubertThis option takes a number argument @file{lifetime}.
12542b15cb3dSCy Schubert
12552b15cb3dSCy Schubert@noindent
12562b15cb3dSCy SchubertThis option has some usage constraints.  It:
12572b15cb3dSCy Schubert@itemize @bullet
12582b15cb3dSCy Schubert@item
12592b15cb3dSCy Schubertmust be compiled in by defining @code{AUTOKEY} during the compilation.
12602b15cb3dSCy Schubert@end itemize
12612b15cb3dSCy Schubert
12622b15cb3dSCy SchubertSet the certificate expiration to lifetime days from now.
12632b15cb3dSCy Schubert@node ntp-keygen modulus
12642b15cb3dSCy Schubert@subsection modulus option (-m)
12652b15cb3dSCy Schubert@cindex ntp-keygen-modulus
12662b15cb3dSCy Schubert
126709100258SXin LIThis is the ``prime modulus'' option.
12682b15cb3dSCy SchubertThis option takes a number argument @file{modulus}.
12692b15cb3dSCy Schubert
12702b15cb3dSCy Schubert@noindent
12712b15cb3dSCy SchubertThis option has some usage constraints.  It:
12722b15cb3dSCy Schubert@itemize @bullet
12732b15cb3dSCy Schubert@item
12742b15cb3dSCy Schubertmust be compiled in by defining @code{AUTOKEY} during the compilation.
12752b15cb3dSCy Schubert@end itemize
12762b15cb3dSCy Schubert
12772b15cb3dSCy SchubertThe number of bits in the prime modulus.  The default is 512.
127809100258SXin LI@node ntp-keygen md5key
127909100258SXin LI@subsection md5key option (-M)
128009100258SXin LI@cindex ntp-keygen-md5key
128109100258SXin LI
128209100258SXin LIThis is the ``generate symmetric keys'' option.
128309100258SXin LIGenerate symmetric keys, obsoleting any that may exist.
12842b15cb3dSCy Schubert@node ntp-keygen pvt-cert
12852b15cb3dSCy Schubert@subsection pvt-cert option (-P)
12862b15cb3dSCy Schubert@cindex ntp-keygen-pvt-cert
12872b15cb3dSCy Schubert
12882b15cb3dSCy SchubertThis is the ``generate pc private certificate'' option.
12892b15cb3dSCy Schubert
12902b15cb3dSCy Schubert@noindent
12912b15cb3dSCy SchubertThis option has some usage constraints.  It:
12922b15cb3dSCy Schubert@itemize @bullet
12932b15cb3dSCy Schubert@item
12942b15cb3dSCy Schubertmust be compiled in by defining @code{AUTOKEY} during the compilation.
12952b15cb3dSCy Schubert@end itemize
12962b15cb3dSCy Schubert
12972b15cb3dSCy SchubertGenerate a private certificate.  By default, the program generates
12982b15cb3dSCy Schubertpublic certificates.
12992b15cb3dSCy Schubert@node ntp-keygen password
13002b15cb3dSCy Schubert@subsection password option (-p)
13012b15cb3dSCy Schubert@cindex ntp-keygen-password
13022b15cb3dSCy Schubert
13032b15cb3dSCy SchubertThis is the ``local private password'' option.
13042b15cb3dSCy SchubertThis option takes a string argument @file{passwd}.
13052b15cb3dSCy Schubert
13062b15cb3dSCy Schubert@noindent
13072b15cb3dSCy SchubertThis option has some usage constraints.  It:
13082b15cb3dSCy Schubert@itemize @bullet
13092b15cb3dSCy Schubert@item
13102b15cb3dSCy Schubertmust be compiled in by defining @code{AUTOKEY} during the compilation.
13112b15cb3dSCy Schubert@end itemize
13122b15cb3dSCy Schubert
13132b15cb3dSCy SchubertLocal files containing private data are encrypted with the
13142b15cb3dSCy SchubertDES-CBC algorithm and the specified password.  The same password
13152b15cb3dSCy Schubertmust be specified to the local ntpd via the "crypto pw password"
13162b15cb3dSCy Schubertconfiguration command.  The default password is the local
13172b15cb3dSCy Schuberthostname.
13182b15cb3dSCy Schubert@node ntp-keygen export-passwd
13192b15cb3dSCy Schubert@subsection export-passwd option (-q)
13202b15cb3dSCy Schubert@cindex ntp-keygen-export-passwd
13212b15cb3dSCy Schubert
13222b15cb3dSCy SchubertThis is the ``export iff or gq group keys with password'' option.
13232b15cb3dSCy SchubertThis option takes a string argument @file{passwd}.
13242b15cb3dSCy Schubert
13252b15cb3dSCy Schubert@noindent
13262b15cb3dSCy SchubertThis option has some usage constraints.  It:
13272b15cb3dSCy Schubert@itemize @bullet
13282b15cb3dSCy Schubert@item
13292b15cb3dSCy Schubertmust be compiled in by defining @code{AUTOKEY} during the compilation.
13302b15cb3dSCy Schubert@end itemize
13312b15cb3dSCy Schubert
13322b15cb3dSCy SchubertExport IFF or GQ identity group keys to the standard output,
13332b15cb3dSCy Schubertencrypted with the DES-CBC algorithm and the specified password.
13342b15cb3dSCy SchubertThe same password must be specified to the remote ntpd via the
13352b15cb3dSCy Schubert"crypto pw password" configuration command.  See also the option
13362b15cb3dSCy Schubert--id-key (-e) for unencrypted exports.
133709100258SXin LI@node ntp-keygen subject-name
133809100258SXin LI@subsection subject-name option (-s)
133909100258SXin LI@cindex ntp-keygen-subject-name
134009100258SXin LI
134109100258SXin LIThis is the ``set host and optionally group name'' option.
134209100258SXin LIThis option takes a string argument @file{host@@group}.
134309100258SXin LI
134409100258SXin LI@noindent
134509100258SXin LIThis option has some usage constraints.  It:
134609100258SXin LI@itemize @bullet
134709100258SXin LI@item
134809100258SXin LImust be compiled in by defining @code{AUTOKEY} during the compilation.
134909100258SXin LI@end itemize
135009100258SXin LI
135109100258SXin LISet the Autokey host name, and optionally, group name specified
135209100258SXin LIfollowing an '@code{@@}' character.  The host name is used in the file
135309100258SXin LIname of generated host and signing certificates, without the
135409100258SXin LIgroup name.  The host name, and if provided, group name are used
135509100258SXin LIin @code{host@@group} form for the host certificate subject and issuer
135609100258SXin LIfields.  Specifying '@code{-s @@group}' is allowed, and results in
135709100258SXin LIleaving the host name unchanged while appending @code{@@group} to the
135809100258SXin LIsubject and issuer fields, as with @code{-i group}.  The group name, or
135909100258SXin LIif not provided, the host name are also used in the file names
136009100258SXin LIof IFF, GQ, and MV client parameter files.
13612b15cb3dSCy Schubert@node ntp-keygen sign-key
13622b15cb3dSCy Schubert@subsection sign-key option (-S)
13632b15cb3dSCy Schubert@cindex ntp-keygen-sign-key
13642b15cb3dSCy Schubert
13652b15cb3dSCy SchubertThis is the ``generate sign key (rsa or dsa)'' option.
13662b15cb3dSCy SchubertThis option takes a string argument @file{sign}.
13672b15cb3dSCy Schubert
13682b15cb3dSCy Schubert@noindent
13692b15cb3dSCy SchubertThis option has some usage constraints.  It:
13702b15cb3dSCy Schubert@itemize @bullet
13712b15cb3dSCy Schubert@item
13722b15cb3dSCy Schubertmust be compiled in by defining @code{AUTOKEY} during the compilation.
13732b15cb3dSCy Schubert@end itemize
13742b15cb3dSCy Schubert
13752b15cb3dSCy SchubertGenerate a new sign key of the designated type, obsoleting any
13762b15cb3dSCy Schubertthat may exist.  By default, the program uses the host key as the
13772b15cb3dSCy Schubertsign key.
13782b15cb3dSCy Schubert@node ntp-keygen trusted-cert
13792b15cb3dSCy Schubert@subsection trusted-cert option (-T)
13802b15cb3dSCy Schubert@cindex ntp-keygen-trusted-cert
13812b15cb3dSCy Schubert
13822b15cb3dSCy SchubertThis is the ``trusted certificate (tc scheme)'' option.
13832b15cb3dSCy Schubert
13842b15cb3dSCy Schubert@noindent
13852b15cb3dSCy SchubertThis option has some usage constraints.  It:
13862b15cb3dSCy Schubert@itemize @bullet
13872b15cb3dSCy Schubert@item
13882b15cb3dSCy Schubertmust be compiled in by defining @code{AUTOKEY} during the compilation.
13892b15cb3dSCy Schubert@end itemize
13902b15cb3dSCy Schubert
13912b15cb3dSCy SchubertGenerate a trusted certificate.  By default, the program generates
13922b15cb3dSCy Schuberta non-trusted certificate.
13932b15cb3dSCy Schubert@node ntp-keygen mv-params
13942b15cb3dSCy Schubert@subsection mv-params option (-V)
13952b15cb3dSCy Schubert@cindex ntp-keygen-mv-params
13962b15cb3dSCy Schubert
13972b15cb3dSCy SchubertThis is the ``generate <num> mv parameters'' option.
13982b15cb3dSCy SchubertThis option takes a number argument @file{num}.
13992b15cb3dSCy Schubert
14002b15cb3dSCy Schubert@noindent
14012b15cb3dSCy SchubertThis option has some usage constraints.  It:
14022b15cb3dSCy Schubert@itemize @bullet
14032b15cb3dSCy Schubert@item
14042b15cb3dSCy Schubertmust be compiled in by defining @code{AUTOKEY} during the compilation.
14052b15cb3dSCy Schubert@end itemize
14062b15cb3dSCy Schubert
14072b15cb3dSCy SchubertGenerate parameters and keys for the Mu-Varadharajan (MV)
14082b15cb3dSCy Schubertidentification scheme.
14092b15cb3dSCy Schubert@node ntp-keygen mv-keys
14102b15cb3dSCy Schubert@subsection mv-keys option (-v)
14112b15cb3dSCy Schubert@cindex ntp-keygen-mv-keys
14122b15cb3dSCy Schubert
14132b15cb3dSCy SchubertThis is the ``update <num> mv keys'' option.
14142b15cb3dSCy SchubertThis option takes a number argument @file{num}.
14152b15cb3dSCy Schubert
14162b15cb3dSCy Schubert@noindent
14172b15cb3dSCy SchubertThis option has some usage constraints.  It:
14182b15cb3dSCy Schubert@itemize @bullet
14192b15cb3dSCy Schubert@item
14202b15cb3dSCy Schubertmust be compiled in by defining @code{AUTOKEY} during the compilation.
14212b15cb3dSCy Schubert@end itemize
14222b15cb3dSCy Schubert
14232b15cb3dSCy SchubertThis option has no @samp{doc} documentation.
14242b15cb3dSCy Schubert
14252b15cb3dSCy Schubert
14262b15cb3dSCy Schubert@node ntp-keygen config
14272b15cb3dSCy Schubert@subsection presetting/configuring ntp-keygen
14282b15cb3dSCy Schubert
14292b15cb3dSCy SchubertAny option that is not marked as @i{not presettable} may be preset by
14302b15cb3dSCy Schubertloading values from configuration ("rc" or "ini") files, and values from environment variables named @code{NTP-KEYGEN} and @code{NTP-KEYGEN_<OPTION_NAME>}.  @code{<OPTION_NAME>} must be one of
14312b15cb3dSCy Schubertthe options listed above in upper case and segmented with underscores.
14322b15cb3dSCy SchubertThe @code{NTP-KEYGEN} variable will be tokenized and parsed like
14332b15cb3dSCy Schubertthe command line.  The remaining variables are tested for existence and their
14342b15cb3dSCy Schubertvalues are treated like option arguments.
14352b15cb3dSCy Schubert
14362b15cb3dSCy Schubert
14372b15cb3dSCy Schubert@noindent
14382b15cb3dSCy Schubert@code{libopts} will search in 2 places for configuration files:
14392b15cb3dSCy Schubert@itemize @bullet
14402b15cb3dSCy Schubert@item
14412b15cb3dSCy Schubert$HOME
14422b15cb3dSCy Schubert@item
14432b15cb3dSCy Schubert$PWD
14442b15cb3dSCy Schubert@end itemize
14452b15cb3dSCy SchubertThe environment variables @code{HOME}, and @code{PWD}
14462b15cb3dSCy Schubertare expanded and replaced when @file{ntp-keygen} runs.
14472b15cb3dSCy SchubertFor any of these that are plain files, they are simply processed.
14482b15cb3dSCy SchubertFor any that are directories, then a file named @file{.ntprc} is searched for
14492b15cb3dSCy Schubertwithin that directory and processed.
14502b15cb3dSCy Schubert
14512b15cb3dSCy SchubertConfiguration files may be in a wide variety of formats.
14522b15cb3dSCy SchubertThe basic format is an option name followed by a value (argument) on the
14532b15cb3dSCy Schubertsame line.  Values may be separated from the option name with a colon,
14542b15cb3dSCy Schubertequal sign or simply white space.  Values may be continued across multiple
14552b15cb3dSCy Schubertlines by escaping the newline with a backslash.
14562b15cb3dSCy Schubert
14572b15cb3dSCy SchubertMultiple programs may also share the same initialization file.
14582b15cb3dSCy SchubertCommon options are collected at the top, followed by program specific
14592b15cb3dSCy Schubertsegments.  The segments are separated by lines like:
14602b15cb3dSCy Schubert@example
14612b15cb3dSCy Schubert[NTP-KEYGEN]
14622b15cb3dSCy Schubert@end example
14632b15cb3dSCy Schubert@noindent
14642b15cb3dSCy Schubertor by
14652b15cb3dSCy Schubert@example
14662b15cb3dSCy Schubert<?program ntp-keygen>
14672b15cb3dSCy Schubert@end example
14682b15cb3dSCy Schubert@noindent
14692b15cb3dSCy SchubertDo not mix these styles within one configuration file.
14702b15cb3dSCy Schubert
14712b15cb3dSCy SchubertCompound values and carefully constructed string values may also be
14722b15cb3dSCy Schubertspecified using XML syntax:
14732b15cb3dSCy Schubert@example
14742b15cb3dSCy Schubert<option-name>
14752b15cb3dSCy Schubert   <sub-opt>...&lt;...&gt;...</sub-opt>
14762b15cb3dSCy Schubert</option-name>
14772b15cb3dSCy Schubert@end example
14782b15cb3dSCy Schubert@noindent
14792b15cb3dSCy Schubertyielding an @code{option-name.sub-opt} string value of
14802b15cb3dSCy Schubert@example
14812b15cb3dSCy Schubert"...<...>..."
14822b15cb3dSCy Schubert@end example
14832b15cb3dSCy Schubert@code{AutoOpts} does not track suboptions.  You simply note that it is a
14842b15cb3dSCy Schuberthierarchicly valued option.  @code{AutoOpts} does provide a means for searching
14852b15cb3dSCy Schubertthe associated name/value pair list (see: optionFindValue).
14862b15cb3dSCy Schubert
14872b15cb3dSCy SchubertThe command line options relating to configuration and/or usage help are:
14882b15cb3dSCy Schubert
14892b15cb3dSCy Schubert@subsubheading version (-)
14902b15cb3dSCy Schubert
14912b15cb3dSCy SchubertPrint the program version to standard out, optionally with licensing
14922b15cb3dSCy Schubertinformation, then exit 0.  The optional argument specifies how much licensing
1493a466cc55SCy Schubertdetail to provide.  The default is to print just the version.  The licensing information may be selected with an option argument.
14942b15cb3dSCy SchubertOnly the first letter of the argument is examined:
14952b15cb3dSCy Schubert
14962b15cb3dSCy Schubert@table @samp
14972b15cb3dSCy Schubert@item version
14982b15cb3dSCy SchubertOnly print the version.  This is the default.
14992b15cb3dSCy Schubert@item copyright
15002b15cb3dSCy SchubertName the copyright usage licensing terms.
15012b15cb3dSCy Schubert@item verbose
15022b15cb3dSCy SchubertPrint the full copyright usage licensing terms.
15032b15cb3dSCy Schubert@end table
15042b15cb3dSCy Schubert
15052b15cb3dSCy Schubert@node ntp-keygen exit status
15062b15cb3dSCy Schubert@subsection ntp-keygen exit status
15072b15cb3dSCy Schubert
15082b15cb3dSCy SchubertOne of the following exit values will be returned:
15092b15cb3dSCy Schubert@table @samp
15102b15cb3dSCy Schubert@item 0 (EXIT_SUCCESS)
15112b15cb3dSCy SchubertSuccessful program execution.
15122b15cb3dSCy Schubert@item 1 (EXIT_FAILURE)
15132b15cb3dSCy SchubertThe operation failed or the command syntax was not valid.
15142b15cb3dSCy Schubert@item 66 (EX_NOINPUT)
15152b15cb3dSCy SchubertA specified configuration file could not be loaded.
15162b15cb3dSCy Schubert@item 70 (EX_SOFTWARE)
15172b15cb3dSCy Schubertlibopts had an internal operational error.  Please report
15182b15cb3dSCy Schubertit to autogen-users@@lists.sourceforge.net.  Thank you.
15192b15cb3dSCy Schubert@end table
15202b15cb3dSCy Schubert@node ntp-keygen Usage
15212b15cb3dSCy Schubert@subsection ntp-keygen Usage
15222b15cb3dSCy Schubert@node ntp-keygen Notes
15232b15cb3dSCy Schubert@subsection ntp-keygen Notes
15242b15cb3dSCy Schubert@node ntp-keygen Bugs
15252b15cb3dSCy Schubert@subsection ntp-keygen Bugs
1526