xref: /netbsd-src/external/bsd/ntp/dist/util/ntp-keygen.1ntp-keygenmdoc (revision 897be3a4bac39d8b2e92077bf29f4a2e67d31983)
1*897be3a4Schristos.Dd May 25 2024
28585484eSchristos.Dt NTP_KEYGEN 1ntp-keygenmdoc User Commands
3b8ecfcfeSchristos.Os
48585484eSchristos.\"  EDIT THIS FILE WITH CAUTION  (ntp-keygen-opts.mdoc)
58585484eSchristos.\"
6*897be3a4Schristos.\"  It has been AutoGen-ed  May 25, 2024 at 12:04:46 AM by AutoGen 5.18.16
78585484eSchristos.\"  From the definitions    ntp-keygen-opts.def
88585484eSchristos.\"  and the template file   agmdoc-cmd.tpl
98585484eSchristos.Sh NAME
108585484eSchristos.Nm ntp-keygen
118585484eSchristos.Nd Create a NTP host key
128585484eSchristos.Sh SYNOPSIS
138585484eSchristos.Nm
148585484eSchristos.\" Mixture of short (flag) options and long options
158585484eSchristos.Op Fl flags
168585484eSchristos.Op Fl flag Op Ar value
178585484eSchristos.Op Fl \-option\-name Ns Oo Oo Ns "=| " Oc Ns Ar value Oc
188585484eSchristos.Pp
198585484eSchristosAll arguments must be options.
208585484eSchristos.Pp
218585484eSchristos.Sh DESCRIPTION
228585484eSchristosThis program generates cryptographic data files used by the NTPv4
238585484eSchristosauthentication and identification schemes.
2456f2724eSchristosIt can generate message digest keys used in symmetric key cryptography and,
2556f2724eSchristosif the OpenSSL software library has been installed, it can generate host keys,
2656f2724eSchristossigning keys, certificates, and identity keys and parameters used in Autokey
2756f2724eSchristospublic key cryptography.
288585484eSchristosThese files are used for cookie encryption,
2956f2724eSchristosdigital signature, and challenge/response identification algorithms
308585484eSchristoscompatible with the Internet standard security infrastructure.
318585484eSchristos.Pp
3256f2724eSchristosThe message digest symmetric keys file is generated in a format
3356f2724eSchristoscompatible with NTPv3.
3456f2724eSchristosAll other files are in PEM\-encoded printable ASCII format,
3556f2724eSchristosso they can be embedded as MIME attachments in email to other sites
368585484eSchristosand certificate authorities.
378585484eSchristosBy default, files are not encrypted.
388585484eSchristos.Pp
3956f2724eSchristosWhen used to generate message digest symmetric keys, the program
4056f2724eSchristosproduces a file containing ten pseudo\-random printable ASCII strings
4156f2724eSchristossuitable for the MD5 message digest algorithm included in the
4256f2724eSchristosdistribution.
438585484eSchristosIf the OpenSSL library is installed, it produces an additional ten
4456f2724eSchristoshex\-encoded random bit strings suitable for SHA1, AES\-128\-CMAC, and
4556f2724eSchristosother message digest algorithms.
4656f2724eSchristosThe message digest symmetric keys file must be distributed and stored
478585484eSchristosusing secure means beyond the scope of NTP itself.
488585484eSchristosBesides the keys used for ordinary NTP associations, additional keys
498585484eSchristoscan be defined as passwords for the
508585484eSchristos.Xr ntpq 1ntpqmdoc
518585484eSchristosand
528585484eSchristos.Xr ntpdc 1ntpdcmdoc
538585484eSchristosutility programs.
548585484eSchristos.Pp
558585484eSchristosThe remaining generated files are compatible with other OpenSSL
568585484eSchristosapplications and other Public Key Infrastructure (PKI) resources.
578585484eSchristosCertificates generated by this program are compatible with extant
588585484eSchristosindustry practice, although some users might find the interpretation of
598585484eSchristosX509v3 extension fields somewhat liberal.
608585484eSchristosHowever, the identity keys are probably not compatible with anything
618585484eSchristosother than Autokey.
628585484eSchristos.Pp
638585484eSchristosSome files used by this program are encrypted using a private password.
648585484eSchristosThe
658585484eSchristos.Fl p
6656f2724eSchristosoption specifies the read password for local encrypted files and the
678585484eSchristos.Fl q
6856f2724eSchristosoption the write password for encrypted files sent to remote sites.
698585484eSchristosIf no password is specified, the host name returned by the Unix
7056f2724eSchristos.Xr hostname 1
7156f2724eSchristoscommand, normally the DNS name of the host, is used as the the default read
7256f2724eSchristospassword, for convenience.
7356f2724eSchristosThe
7456f2724eSchristos.Nm
7556f2724eSchristosprogram prompts for the password if it reads an encrypted file
7656f2724eSchristosand the password is missing or incorrect.
7756f2724eSchristosIf an encrypted file is read successfully and
7856f2724eSchristosno write password is specified, the read password is used
7956f2724eSchristosas the write password by default.
808585484eSchristos.Pp
818585484eSchristosThe
8256f2724eSchristos.Cm pw
838585484eSchristosoption of the
8456f2724eSchristos.Ic crypto
8556f2724eSchristos.Xr ntpd 1ntpdmdoc
868585484eSchristosconfiguration command specifies the read
878585484eSchristospassword for previously encrypted local files.
8856f2724eSchristosThis must match the local read password used by this program.
898585484eSchristosIf not specified, the host name is used.
9056f2724eSchristosThus, if files are generated by this program without an explicit password,
918585484eSchristosthey can be read back by
9256f2724eSchristos.Xr ntpd 1ntpdmdoc
9356f2724eSchristoswithout specifying an explicit password but only on the same host.
9456f2724eSchristosIf the write password used for encryption is specified as the host name,
9556f2724eSchristosthese files can be read by that host with no explicit password.
968585484eSchristos.Pp
978585484eSchristosNormally, encrypted files for each host are generated by that host and
988585484eSchristosused only by that host, although exceptions exist as noted later on
998585484eSchristosthis page.
1008585484eSchristosThe symmetric keys file, normally called
10156f2724eSchristos.Pa ntp.keys ,
1028585484eSchristosis usually installed in
1038585484eSchristos.Pa /etc .
1048585484eSchristosOther files and links are usually installed in
1058585484eSchristos.Pa /usr/local/etc ,
1068585484eSchristoswhich is normally in a shared filesystem in
1078585484eSchristosNFS\-mounted networks and cannot be changed by shared clients.
10856f2724eSchristosIn these cases, NFS clients can specify the files in another
10956f2724eSchristosdirectory such as
11056f2724eSchristos.Pa /etc
11156f2724eSchristosusing the
11256f2724eSchristos.Ic keysdir
11356f2724eSchristos.Xr ntpd 1ntpdmdoc
11456f2724eSchristosconfiguration file command.
1158585484eSchristos.Pp
1168585484eSchristosThis program directs commentary and error messages to the standard
1178585484eSchristoserror stream
11856f2724eSchristos.Pa stderr
1198585484eSchristosand remote files to the standard output stream
12056f2724eSchristos.Pa stdout
1218585484eSchristoswhere they can be piped to other applications or redirected to files.
1228585484eSchristosThe names used for generated files and links all begin with the
1238585484eSchristosstring
12456f2724eSchristos.Pa ntpkey\&*
1258585484eSchristosand include the file type, generating host and filestamp,
1268585484eSchristosas described in the
12756f2724eSchristos.Sx "Cryptographic Data Files"
1288585484eSchristossection below.
1298585484eSchristos.Ss Running the Program
13056f2724eSchristosThe safest way to run the
13156f2724eSchristos.Nm
13256f2724eSchristosprogram is logged in directly as root.
13356f2724eSchristosThe recommended procedure is change to the
13456f2724eSchristos.Ar keys
13556f2724eSchristosdirectory, usually
13656f2724eSchristos.Pa /usr/local/etc ,
13756f2724eSchristosthen run the program.
13856f2724eSchristos.Pp
1398585484eSchristosTo test and gain experience with Autokey concepts, log in as root and
14056f2724eSchristoschange to the
14156f2724eSchristos.Ar keys
14256f2724eSchristosdirectory, usually
14356f2724eSchristos.Pa /usr/local/etc .
1448585484eSchristosWhen run for the first time, or if all files with names beginning with
14556f2724eSchristos.Pa ntpkey\&*
1468585484eSchristoshave been removed, use the
1478585484eSchristos.Nm
14856f2724eSchristoscommand without arguments to generate a default
14956f2724eSchristos.Cm RSA
15056f2724eSchristoshost key and matching
15156f2724eSchristos.Cm RSA\-MD5
15256f2724eSchristoscertificate file with expiration date one year hence,
15356f2724eSchristoswhich is all that is necessary in many cases.
15456f2724eSchristosThe program also generates soft links from the generic names
15556f2724eSchristosto the respective files.
1568585484eSchristosIf run again without options, the program uses the
15756f2724eSchristosexisting keys and parameters and generates a new certificate file with
15856f2724eSchristosnew expiration date one year hence, and soft link.
15956f2724eSchristos.Pp
16056f2724eSchristosThe host key is used to encrypt the cookie when required and so must be
16156f2724eSchristos.Cm RSA
16256f2724eSchristostype.
16356f2724eSchristosBy default, the host key is also the sign key used to encrypt signatures.
16456f2724eSchristosWhen necessary, a different sign key can be specified and this can be
16556f2724eSchristoseither
16656f2724eSchristos.Cm RSA
16756f2724eSchristosor
16856f2724eSchristos.Cm DSA
16956f2724eSchristostype.
17056f2724eSchristosBy default, the message digest type is
17156f2724eSchristos.Cm MD5 ,
17256f2724eSchristosbut any combination
17356f2724eSchristosof sign key type and message digest type supported by the OpenSSL library
17456f2724eSchristoscan be specified, including those using the
17556f2724eSchristos.Cm AES128CMAC , MD2 , MD5 , MDC2 , SHA , SHA1
17656f2724eSchristosand
17756f2724eSchristos.Cm RIPE160
17856f2724eSchristosmessage digest algorithms.
17956f2724eSchristosHowever, the scheme specified in the certificate must be compatible
18056f2724eSchristoswith the sign key.
18156f2724eSchristosCertificates using any digest algorithm are compatible with
18256f2724eSchristos.Cm RSA
18356f2724eSchristossign keys;
18456f2724eSchristoshowever, only
18556f2724eSchristos.Cm SHA
18656f2724eSchristosand
18756f2724eSchristos.Cm SHA1
18856f2724eSchristoscertificates are compatible with
18956f2724eSchristos.Cm DSA
19056f2724eSchristossign keys.
19156f2724eSchristos.Pp
19256f2724eSchristosPrivate/public key files and certificates are compatible with
19356f2724eSchristosother OpenSSL applications and very likely other libraries as well.
19456f2724eSchristosCertificates or certificate requests derived from them should be compatible
19556f2724eSchristoswith extant industry practice, although some users might find
19656f2724eSchristosthe interpretation of X509v3 extension fields somewhat liberal.
19756f2724eSchristosHowever, the identification parameter files, although encoded
19856f2724eSchristosas the other files, are probably not compatible with anything other than Autokey.
19956f2724eSchristos.Pp
20056f2724eSchristosRunning the program as other than root and using the Unix
20156f2724eSchristos.Xr su 1
20256f2724eSchristoscommand
20356f2724eSchristosto assume root may not work properly, since by default the OpenSSL library
20456f2724eSchristoslooks for the random seed file
20556f2724eSchristos.Pa .rnd
20656f2724eSchristosin the user home directory.
20756f2724eSchristosHowever, there should be only one
20856f2724eSchristos.Pa .rnd ,
20956f2724eSchristosmost conveniently
21056f2724eSchristosin the root directory, so it is convenient to define the
21156f2724eSchristos.Ev RANDFILE
21256f2724eSchristosenvironment variable used by the OpenSSL library as the path to
21356f2724eSchristos.Pa .rnd .
21456f2724eSchristos.Pp
21556f2724eSchristosInstalling the keys as root might not work in NFS\-mounted
21656f2724eSchristosshared file systems, as NFS clients may not be able to write
21756f2724eSchristosto the shared keys directory, even as root.
21856f2724eSchristosIn this case, NFS clients can specify the files in another
21956f2724eSchristosdirectory such as
22056f2724eSchristos.Pa /etc
22156f2724eSchristosusing the
22256f2724eSchristos.Ic keysdir
22356f2724eSchristos.Xr ntpd 1ntpdmdoc
22456f2724eSchristosconfiguration file command.
22556f2724eSchristosThere is no need for one client to read the keys and certificates
22656f2724eSchristosof other clients or servers, as these data are obtained automatically
22756f2724eSchristosby the Autokey protocol.
22856f2724eSchristos.Pp
22956f2724eSchristosOrdinarily, cryptographic files are generated by the host that uses them,
23056f2724eSchristosbut it is possible for a trusted agent (TA) to generate these files
23156f2724eSchristosfor other hosts; however, in such cases files should always be encrypted.
23256f2724eSchristosThe subject name and trusted name default to the hostname
23356f2724eSchristosof the host generating the files, but can be changed by command line options.
23456f2724eSchristosIt is convenient to designate the owner name and trusted name
23556f2724eSchristosas the subject and issuer fields, respectively, of the certificate.
23656f2724eSchristosThe owner name is also used for the host and sign key files,
23756f2724eSchristoswhile the trusted name is used for the identity files.
23856f2724eSchristos.Pp
23956f2724eSchristosAll files are installed by default in the keys directory
24056f2724eSchristos.Pa /usr/local/etc ,
24156f2724eSchristoswhich is normally in a shared filesystem
24256f2724eSchristosin NFS\-mounted networks.
24356f2724eSchristosThe actual location of the keys directory
24456f2724eSchristosand each file can be overridden by configuration commands,
24556f2724eSchristosbut this is not recommended.
24656f2724eSchristosNormally, the files for each host are generated by that host
24756f2724eSchristosand used only by that host, although exceptions exist
24856f2724eSchristosas noted later on this page.
24956f2724eSchristos.Pp
25056f2724eSchristosNormally, files containing private values,
25156f2724eSchristosincluding the host key, sign key and identification parameters,
25256f2724eSchristosare permitted root read/write\-only;
25356f2724eSchristoswhile others containing public values are permitted world readable.
25456f2724eSchristosAlternatively, files containing private values can be encrypted
25556f2724eSchristosand these files permitted world readable,
25656f2724eSchristoswhich simplifies maintenance in shared file systems.
25756f2724eSchristosSince uniqueness is insured by the
25856f2724eSchristos.Ar hostname
25956f2724eSchristosand
26056f2724eSchristos.Ar filestamp
26156f2724eSchristosfile name extensions, the files for an NTP server and
26256f2724eSchristosdependent clients can all be installed in the same shared directory.
26356f2724eSchristos.Pp
26456f2724eSchristosThe recommended practice is to keep the file name extensions
26556f2724eSchristoswhen installing a file and to install a soft link
26656f2724eSchristosfrom the generic names specified elsewhere on this page
26756f2724eSchristosto the generated files.
26856f2724eSchristosThis allows new file generations to be activated simply
26956f2724eSchristosby changing the link.
27056f2724eSchristosIf a link is present,
27156f2724eSchristos.Xr ntpd 1ntpdmdoc
27256f2724eSchristosfollows it to the file name to extract the
27356f2724eSchristos.Ar filestamp .
27456f2724eSchristosIf a link is not present,
27556f2724eSchristos.Xr ntpd 1ntpdmdoc
27656f2724eSchristosextracts the
27756f2724eSchristos.Ar filestamp
27856f2724eSchristosfrom the file itself.
27956f2724eSchristosThis allows clients to verify that the file and generation times
28056f2724eSchristosare always current.
28156f2724eSchristosThe
28256f2724eSchristos.Nm
28356f2724eSchristosprogram uses the same
28456f2724eSchristos.Ar filestamp
28556f2724eSchristosextension for all files generated
28656f2724eSchristosat one time, so each generation is distinct and can be readily
28756f2724eSchristosrecognized in monitoring data.
2888585484eSchristos.Pp
2898585484eSchristosRun the command on as many hosts as necessary.
2908585484eSchristosDesignate one of them as the trusted host (TH) using
2918585484eSchristos.Nm
2928585484eSchristoswith the
2938585484eSchristos.Fl T
2948585484eSchristosoption and configure it to synchronize from reliable Internet servers.
2958585484eSchristosThen configure the other hosts to synchronize to the TH directly or
2968585484eSchristosindirectly.
2978585484eSchristosA certificate trail is created when Autokey asks the immediately
2988585484eSchristosascendant host towards the TH to sign its certificate, which is then
2998585484eSchristosprovided to the immediately descendant host on request.
3008585484eSchristosAll group hosts should have acyclic certificate trails ending on the TH.
3018585484eSchristos.Pp
3028585484eSchristosThe host key is used to encrypt the cookie when required and so must be
3038585484eSchristosRSA type.
3048585484eSchristosBy default, the host key is also the sign key used to encrypt
3058585484eSchristossignatures.
3068585484eSchristosA different sign key can be assigned using the
3078585484eSchristos.Fl S
30856f2724eSchristosoption and this can be either
30956f2724eSchristos.Cm RSA
31056f2724eSchristosor
31156f2724eSchristos.Cm DSA
31256f2724eSchristostype.
3138585484eSchristosBy default, the signature
31456f2724eSchristosmessage digest type is
31556f2724eSchristos.Cm MD5 ,
31656f2724eSchristosbut any combination of sign key type and
3178585484eSchristosmessage digest type supported by the OpenSSL library can be specified
3188585484eSchristosusing the
3198585484eSchristos.Fl c
3208585484eSchristosoption.
32156f2724eSchristos.Pp
3228585484eSchristosThe rules say cryptographic media should be generated with proventic
3238585484eSchristosfilestamps, which means the host should already be synchronized before
3248585484eSchristosthis program is run.
3258585484eSchristosThis of course creates a chicken\-and\-egg problem
3268585484eSchristoswhen the host is started for the first time.
3278585484eSchristosAccordingly, the host time
3288585484eSchristosshould be set by some other means, such as eyeball\-and\-wristwatch, at
3298585484eSchristosleast so that the certificate lifetime is within the current year.
3308585484eSchristosAfter that and when the host is synchronized to a proventic source, the
3318585484eSchristoscertificate should be re\-generated.
3328585484eSchristos.Pp
3338585484eSchristosAdditional information on trusted groups and identity schemes is on the
3348585484eSchristos.Dq Autokey Public\-Key Authentication
3358585484eSchristospage.
3368585484eSchristos.Pp
3378585484eSchristosFile names begin with the prefix
33856f2724eSchristos.Pa ntpkey Ns _
33956f2724eSchristosand end with the suffix
34056f2724eSchristos.Pa _ Ns Ar hostname . Ar filestamp ,
3418585484eSchristoswhere
3428585484eSchristos.Ar hostname
3438585484eSchristosis the owner name, usually the string returned
34456f2724eSchristosby the Unix
34556f2724eSchristos.Xr hostname 1
34656f2724eSchristoscommand, and
3478585484eSchristos.Ar filestamp
3488585484eSchristosis the NTP seconds when the file was generated, in decimal digits.
3498585484eSchristosThis both guarantees uniqueness and simplifies maintenance
3508585484eSchristosprocedures, since all files can be quickly removed
3518585484eSchristosby a
35256f2724eSchristos.Ic rm Pa ntpkey\&*
3538585484eSchristoscommand or all files generated
3548585484eSchristosat a specific time can be removed by a
35556f2724eSchristos.Ic rm Pa \&* Ns Ar filestamp
3568585484eSchristoscommand.
3578585484eSchristosTo further reduce the risk of misconfiguration,
3588585484eSchristosthe first two lines of a file contain the file name
3598585484eSchristosand generation date and time as comments.
36056f2724eSchristos.Ss Trusted Hosts and Groups
3618585484eSchristosEach cryptographic configuration involves selection of a signature scheme
3628585484eSchristosand identification scheme, called a cryptotype,
3638585484eSchristosas explained in the
3648585484eSchristos.Sx Authentication Options
3658585484eSchristossection of
3668585484eSchristos.Xr ntp.conf 5 .
36756f2724eSchristosThe default cryptotype uses
36856f2724eSchristos.Cm RSA
36956f2724eSchristosencryption,
37056f2724eSchristos.Cm MD5
37156f2724eSchristosmessage digest
37256f2724eSchristosand
37356f2724eSchristos.Cm TC
37456f2724eSchristosidentification.
3758585484eSchristosFirst, configure a NTP subnet including one or more low\-stratum
3768585484eSchristostrusted hosts from which all other hosts derive synchronization
3778585484eSchristosdirectly or indirectly.
3788585484eSchristosTrusted hosts have trusted certificates;
3798585484eSchristosall other hosts have nontrusted certificates.
3808585484eSchristosThese hosts will automatically and dynamically build authoritative
3818585484eSchristoscertificate trails to one or more trusted hosts.
3828585484eSchristosA trusted group is the set of all hosts that have, directly or indirectly,
3838585484eSchristosa certificate trail ending at a trusted host.
3848585484eSchristosThe trail is defined by static configuration file entries
3858585484eSchristosor dynamic means described on the
3868585484eSchristos.Sx Automatic NTP Configuration Options
3878585484eSchristossection of
3888585484eSchristos.Xr ntp.conf 5 .
3898585484eSchristos.Pp
3908585484eSchristosOn each trusted host as root, change to the keys directory.
3918585484eSchristosTo insure a fresh fileset, remove all
39256f2724eSchristos.Pa ntpkey
3938585484eSchristosfiles.
3948585484eSchristosThen run
3958585484eSchristos.Nm
3968585484eSchristos.Fl T
3978585484eSchristosto generate keys and a trusted certificate.
3988585484eSchristosOn all other hosts do the same, but leave off the
3998585484eSchristos.Fl T
4008585484eSchristosflag to generate keys and nontrusted certificates.
4018585484eSchristosWhen complete, start the NTP daemons beginning at the lowest stratum
4028585484eSchristosand working up the tree.
4038585484eSchristosIt may take some time for Autokey to instantiate the certificate trails
4048585484eSchristosthroughout the subnet, but setting up the environment is completely automatic.
4058585484eSchristos.Pp
4068585484eSchristosIf it is necessary to use a different sign key or different digest/signature
4078585484eSchristosscheme than the default, run
4088585484eSchristos.Nm
4098585484eSchristoswith the
4108585484eSchristos.Fl S Ar type
4118585484eSchristosoption, where
4128585484eSchristos.Ar type
4138585484eSchristosis either
4148585484eSchristos.Cm RSA
4158585484eSchristosor
4168585484eSchristos.Cm DSA .
41756f2724eSchristosThe most frequent need to do this is when a
41856f2724eSchristos.Cm DSA Ns \-signed
41956f2724eSchristoscertificate is used.
4208585484eSchristosIf it is necessary to use a different certificate scheme than the default,
4218585484eSchristosrun
4228585484eSchristos.Nm
4238585484eSchristoswith the
4248585484eSchristos.Fl c Ar scheme
4258585484eSchristosoption and selected
4268585484eSchristos.Ar scheme
4278585484eSchristosas needed.
42856f2724eSchristosIf
4298585484eSchristos.Nm
4308585484eSchristosis run again without these options, it generates a new certificate
43156f2724eSchristosusing the same scheme and sign key, and soft link.
4328585484eSchristos.Pp
4338585484eSchristosAfter setting up the environment it is advisable to update certificates
4348585484eSchristosfrom time to time, if only to extend the validity interval.
4358585484eSchristosSimply run
4368585484eSchristos.Nm
4378585484eSchristoswith the same flags as before to generate new certificates
43856f2724eSchristosusing existing keys, and soft links.
4398585484eSchristosHowever, if the host or sign key is changed,
4408585484eSchristos.Xr ntpd 1ntpdmdoc
4418585484eSchristosshould be restarted.
4428585484eSchristosWhen
4438585484eSchristos.Xr ntpd 1ntpdmdoc
4448585484eSchristosis restarted, it loads any new files and restarts the protocol.
4458585484eSchristosOther dependent hosts will continue as usual until signatures are refreshed,
4468585484eSchristosat which time the protocol is restarted.
4478585484eSchristos.Ss Identity Schemes
4488585484eSchristosAs mentioned on the Autonomous Authentication page,
44956f2724eSchristosthe default
45056f2724eSchristos.Cm TC
45156f2724eSchristosidentity scheme is vulnerable to a middleman attack.
4528585484eSchristosHowever, there are more secure identity schemes available,
45356f2724eSchristosincluding
45456f2724eSchristos.Cm PC , IFF , GQ
45556f2724eSchristosand
45656f2724eSchristos.Cm MV
45756f2724eSchristosschemes described below.
4588585484eSchristosThese schemes are based on a TA, one or more trusted hosts
4598585484eSchristosand some number of nontrusted hosts.
4608585484eSchristosTrusted hosts prove identity using values provided by the TA,
4618585484eSchristoswhile the remaining hosts prove identity using values provided
4628585484eSchristosby a trusted host and certificate trails that end on that host.
4638585484eSchristosThe name of a trusted host is also the name of its sugroup
4648585484eSchristosand also the subject and issuer name on its trusted certificate.
4658585484eSchristosThe TA is not necessarily a trusted host in this sense, but often is.
4668585484eSchristos.Pp
4678585484eSchristosIn some schemes there are separate keys for servers and clients.
4688585484eSchristosA server can also be a client of another server,
4698585484eSchristosbut a client can never be a server for another client.
4708585484eSchristosIn general, trusted hosts and nontrusted hosts that operate
4718585484eSchristosas both server and client have parameter files that contain
4728585484eSchristosboth server and client keys.
4738585484eSchristosHosts that operate
4748585484eSchristosonly as clients have key files that contain only client keys.
4758585484eSchristos.Pp
4768585484eSchristosThe PC scheme supports only one trusted host in the group.
4778585484eSchristosOn trusted host alice run
4788585484eSchristos.Nm
4798585484eSchristos.Fl P
4808585484eSchristos.Fl p Ar password
4818585484eSchristosto generate the host key file
48256f2724eSchristos.Pa ntpkey Ns _ Cm RSA Pa key_alice. Ar filestamp
4838585484eSchristosand trusted private certificate file
48456f2724eSchristos.Pa ntpkey Ns _ Cm RSA\-MD5 _ Pa cert_alice. Ar filestamp ,
48556f2724eSchristosand soft links.
4868585484eSchristosCopy both files to all group hosts;
4878585484eSchristosthey replace the files which would be generated in other schemes.
48856f2724eSchristosOn each host
48956f2724eSchristos.Ar bob
49056f2724eSchristosinstall a soft link from the generic name
4918585484eSchristos.Pa ntpkey_host_ Ns Ar bob
4928585484eSchristosto the host key file and soft link
4938585484eSchristos.Pa ntpkey_cert_ Ns Ar bob
4948585484eSchristosto the private certificate file.
4958585484eSchristosNote the generic links are on bob, but point to files generated
4968585484eSchristosby trusted host alice.
4978585484eSchristosIn this scheme it is not possible to refresh
4988585484eSchristoseither the keys or certificates without copying them
49956f2724eSchristosto all other hosts in the group, and recreating the soft links.
5008585484eSchristos.Pp
50156f2724eSchristosFor the
50256f2724eSchristos.Cm IFF
50356f2724eSchristosscheme proceed as in the
50456f2724eSchristos.Cm TC
50556f2724eSchristosscheme to generate keys
5068585484eSchristosand certificates for all group hosts, then for every trusted host in the group,
50756f2724eSchristosgenerate the
50856f2724eSchristos.Cm IFF
50956f2724eSchristosparameter file.
5108585484eSchristosOn trusted host alice run
5118585484eSchristos.Nm
5128585484eSchristos.Fl T
5138585484eSchristos.Fl I
5148585484eSchristos.Fl p Ar password
5158585484eSchristosto produce her parameter file
51656f2724eSchristos.Pa ntpkey_IFFpar_alice. Ns Ar filestamp ,
5178585484eSchristoswhich includes both server and client keys.
5188585484eSchristosCopy this file to all group hosts that operate as both servers
5198585484eSchristosand clients and install a soft link from the generic
52056f2724eSchristos.Pa ntpkey_iff_alice
5218585484eSchristosto this file.
5228585484eSchristosIf there are no hosts restricted to operate only as clients,
5238585484eSchristosthere is nothing further to do.
52456f2724eSchristosAs the
52556f2724eSchristos.Cm IFF
52656f2724eSchristosscheme is independent
5278585484eSchristosof keys and certificates, these files can be refreshed as needed.
5288585484eSchristos.Pp
5298585484eSchristosIf a rogue client has the parameter file, it could masquerade
5308585484eSchristosas a legitimate server and present a middleman threat.
5318585484eSchristosTo eliminate this threat, the client keys can be extracted
5328585484eSchristosfrom the parameter file and distributed to all restricted clients.
5338585484eSchristosAfter generating the parameter file, on alice run
5348585484eSchristos.Nm
5358585484eSchristos.Fl e
53656f2724eSchristosand pipe the output to a file or email program.
53756f2724eSchristosCopy or email this file to all restricted clients.
5388585484eSchristosOn these clients install a soft link from the generic
53956f2724eSchristos.Pa ntpkey_iff_alice
5408585484eSchristosto this file.
5418585484eSchristosTo further protect the integrity of the keys,
5428585484eSchristoseach file can be encrypted with a secret password.
5438585484eSchristos.Pp
54456f2724eSchristosFor the
54556f2724eSchristos.Cm GQ
54656f2724eSchristosscheme proceed as in the
54756f2724eSchristos.Cm TC
54856f2724eSchristosscheme to generate keys
5498585484eSchristosand certificates for all group hosts, then for every trusted host
55056f2724eSchristosin the group, generate the
55156f2724eSchristos.Cm IFF
55256f2724eSchristosparameter file.
5538585484eSchristosOn trusted host alice run
5548585484eSchristos.Nm
5558585484eSchristos.Fl T
5568585484eSchristos.Fl G
5578585484eSchristos.Fl p Ar password
5588585484eSchristosto produce her parameter file
55956f2724eSchristos.Pa ntpkey_GQpar_alice. Ns Ar filestamp ,
5608585484eSchristoswhich includes both server and client keys.
5618585484eSchristosCopy this file to all group hosts and install a soft link
5628585484eSchristosfrom the generic
56356f2724eSchristos.Pa ntpkey_gq_alice
5648585484eSchristosto this file.
56556f2724eSchristosIn addition, on each host
56656f2724eSchristos.Ar bob
56756f2724eSchristosinstall a soft link
5688585484eSchristosfrom generic
5698585484eSchristos.Pa ntpkey_gq_ Ns Ar bob
5708585484eSchristosto this file.
57156f2724eSchristosAs the
57256f2724eSchristos.Cm GQ
57356f2724eSchristosscheme updates the
57456f2724eSchristos.Cm GQ
57556f2724eSchristosparameters file and certificate
5768585484eSchristosat the same time, keys and certificates can be regenerated as needed.
5778585484eSchristos.Pp
57856f2724eSchristosFor the
57956f2724eSchristos.Cm MV
58056f2724eSchristosscheme, proceed as in the
58156f2724eSchristos.Cm TC
58256f2724eSchristosscheme to generate keys
5838585484eSchristosand certificates for all group hosts.
5848585484eSchristosFor illustration assume trish is the TA, alice one of several trusted hosts
5858585484eSchristosand bob one of her clients.
5868585484eSchristosOn TA trish run
5878585484eSchristos.Nm
5888585484eSchristos.Fl V Ar n
5898585484eSchristos.Fl p Ar password ,
5908585484eSchristoswhere
5918585484eSchristos.Ar n
5928585484eSchristosis the number of revokable keys (typically 5) to produce
5938585484eSchristosthe parameter file
59456f2724eSchristos.Pa ntpkeys_MVpar_trish. Ns Ar filestamp
5958585484eSchristosand client key files
59656f2724eSchristos.Pa ntpkeys_MVkey Ns Ar d _ Pa trish. Ar filestamp
5978585484eSchristoswhere
5988585484eSchristos.Ar d
5998585484eSchristosis the key number (0 \&<
6008585484eSchristos.Ar d
6018585484eSchristos\&<
6028585484eSchristos.Ar n ) .
6038585484eSchristosCopy the parameter file to alice and install a soft link
6048585484eSchristosfrom the generic
60556f2724eSchristos.Pa ntpkey_mv_alice
6068585484eSchristosto this file.
6078585484eSchristosCopy one of the client key files to alice for later distribution
6088585484eSchristosto her clients.
60956f2724eSchristosIt does not matter which client key file goes to alice,
6108585484eSchristossince they all work the same way.
61156f2724eSchristosAlice copies the client key file to all of her clients.
6128585484eSchristosOn client bob install a soft link from generic
61356f2724eSchristos.Pa ntpkey_mvkey_bob
6148585484eSchristosto the client key file.
61556f2724eSchristosAs the
61656f2724eSchristos.Cm MV
61756f2724eSchristosscheme is independent of keys and certificates,
6188585484eSchristosthese files can be refreshed as needed.
6198585484eSchristos.Ss Command Line Options
6208585484eSchristos.Bl -tag -width indent
62156f2724eSchristos.It Fl b Fl \-imbits Ns = Ar modulus
62256f2724eSchristosSet the number of bits in the identity modulus for generating identity keys to
62356f2724eSchristos.Ar modulus
62456f2724eSchristosbits.
62556f2724eSchristosThe number of bits in the identity modulus defaults to 256, but can be set to
62656f2724eSchristosvalues from 256 to 2048 (32 to 256 octets).
62756f2724eSchristosUse the larger moduli with caution, as this can consume considerable computing
62856f2724eSchristosresources and increases the size of authenticated packets.
62956f2724eSchristos.It Fl c Fl \-certificate Ns = Ar scheme
63056f2724eSchristosSelect certificate signature encryption/message digest scheme.
6318585484eSchristosThe
6328585484eSchristos.Ar scheme
6338585484eSchristoscan be one of the following:
63456f2724eSchristos.Cm RSA\-MD2 , RSA\-MD5 , RSA\-MDC2 , RSA\-SHA , RSA\-SHA1 , RSA\-RIPEMD160 , DSA\-SHA ,
6358585484eSchristosor
6368585484eSchristos.Cm DSA\-SHA1 .
63756f2724eSchristosNote that
63856f2724eSchristos.Cm RSA
63956f2724eSchristosschemes must be used with an
64056f2724eSchristos.Cm RSA
64156f2724eSchristossign key and
64256f2724eSchristos.Cm DSA
64356f2724eSchristosschemes must be used with a
64456f2724eSchristos.Cm DSA
64556f2724eSchristossign key.
6468585484eSchristosThe default without this option is
6478585484eSchristos.Cm RSA\-MD5 .
64856f2724eSchristosIf compatibility with FIPS 140\-2 is required, either the
64956f2724eSchristos.Cm DSA\-SHA
65056f2724eSchristosor
65156f2724eSchristos.Cm DSA\-SHA1
65256f2724eSchristosscheme must be used.
65356f2724eSchristos.It Fl C Fl \-cipher Ns = Ar cipher
65456f2724eSchristosSelect the OpenSSL cipher to encrypt the files containing private keys.
65556f2724eSchristosThe default without this option is three\-key triple DES in CBC mode,
65656f2724eSchristos.Cm des\-ede3\-cbc .
65756f2724eSchristosThe
65856f2724eSchristos.Ic openssl Fl h
65956f2724eSchristoscommand provided with OpenSSL displays available ciphers.
66056f2724eSchristos.It Fl d Fl \-debug\-level
66156f2724eSchristosIncrease debugging verbosity level.
6628585484eSchristosThis option displays the cryptographic data produced in eye\-friendly billboards.
66356f2724eSchristos.It Fl D Fl \-set\-debug\-level Ns = Ar level
66456f2724eSchristosSet the debugging verbosity to
66556f2724eSchristos.Ar level .
66656f2724eSchristosThis option displays the cryptographic data produced in eye\-friendly billboards.
66756f2724eSchristos.It Fl e Fl \-id\-key
66856f2724eSchristosWrite the
66956f2724eSchristos.Cm IFF
67056f2724eSchristosor
67156f2724eSchristos.Cm GQ
67256f2724eSchristospublic parameters from the
67356f2724eSchristos.Ar IFFkey or GQkey
67456f2724eSchristosclient keys file previously specified
67556f2724eSchristosas unencrypted data to the standard output stream
67656f2724eSchristos.Pa stdout .
67756f2724eSchristosThis is intended for automatic key distribution by email.
67856f2724eSchristos.It Fl G Fl \-gq\-params
67956f2724eSchristosGenerate a new encrypted
68056f2724eSchristos.Cm GQ
68156f2724eSchristosparameters and key file for the Guillou\-Quisquater (GQ) identity scheme.
68256f2724eSchristosThis option is mutually exclusive with the
68356f2724eSchristos.Fl I
68456f2724eSchristosand
68556f2724eSchristos.Fl V
68656f2724eSchristosoptions.
68756f2724eSchristos.It Fl H Fl \-host\-key
68856f2724eSchristosGenerate a new encrypted
68956f2724eSchristos.Cm RSA
69056f2724eSchristospublic/private host key file.
69156f2724eSchristos.It Fl I Fl \-iffkey
69256f2724eSchristosGenerate a new encrypted
69356f2724eSchristos.Cm IFF
69456f2724eSchristoskey file for the Schnorr (IFF) identity scheme.
69556f2724eSchristosThis option is mutually exclusive with the
69656f2724eSchristos.Fl G
69756f2724eSchristosand
69856f2724eSchristosFl V
69956f2724eSchristosoptions.
70056f2724eSchristos.It Fl i Fl \-ident Ns = Ar group
70156f2724eSchristosSet the optional Autokey group name to
70256f2724eSchristos.Ar group .
70356f2724eSchristosThis is used in the identity scheme parameter file names of
70456f2724eSchristos.Cm IFF , GQ ,
70556f2724eSchristosand
70656f2724eSchristos.Cm MV
70756f2724eSchristosclient parameters files.
70856f2724eSchristosIn that role, the default is the host name if no group is provided.
70956f2724eSchristosThe group name, if specified using
71056f2724eSchristos.Fl i
71156f2724eSchristosor
71256f2724eSchristos.Fl s
71356f2724eSchristosfollowing an
71456f2724eSchristos.Ql @
71556f2724eSchristoscharacter, is also used in certificate subject and issuer names in the form
71656f2724eSchristos.Ar host @ group
71756f2724eSchristosand should match the group specified via
71856f2724eSchristos.Ic crypto Cm ident
71956f2724eSchristosor
72056f2724eSchristos.Ic server Cm ident
72156f2724eSchristosin the ntpd configuration file.
72256f2724eSchristos.It Fl l Fl \-lifetime Ns = Ar days
72356f2724eSchristosSet the lifetime for certificate expiration to
72456f2724eSchristos.Ar days .
72556f2724eSchristosThe default lifetime is one year (365 days).
72656f2724eSchristos.It Fl m Fl \-modulus Ns = Ar bits
72756f2724eSchristosSet the number of bits in the prime modulus for generating files to
72856f2724eSchristos.Ar bits .
72956f2724eSchristosThe modulus defaults to 512, but can be set from 256 to 2048 (32 to 256 octets).
73056f2724eSchristosUse the larger moduli with caution, as this can consume considerable computing
73156f2724eSchristosresources and increases the size of authenticated packets.
73256f2724eSchristos.It Fl M Fl \-md5key
73356f2724eSchristosGenerate a new symmetric keys file containing 10
73456f2724eSchristos.Cm MD5
73556f2724eSchristoskeys, and if OpenSSL is available, 10
73656f2724eSchristos.Cm SHA
73756f2724eSchristoskeys.
73856f2724eSchristosAn
73956f2724eSchristos.Cm MD5
74056f2724eSchristoskey is a string of 20 random printable ASCII characters, while a
74156f2724eSchristos.Cm SHA
74256f2724eSchristoskey is a string of 40 random hex digits.
74356f2724eSchristosThe file can be edited using a text editor to change the key type or key content.
74456f2724eSchristosThis option is mutually exclusive with all other options.
74556f2724eSchristos.It Fl p Fl \-password Ns = Ar passwd
74656f2724eSchristosSet the password for reading and writing encrypted files to
74756f2724eSchristos.Ar passwd .
74856f2724eSchristosThese include the host, sign and identify key files.
74956f2724eSchristosBy default, the password is the string returned by the Unix
75056f2724eSchristos.Ic hostname
75156f2724eSchristoscommand.
75256f2724eSchristos.It Fl P Fl \-pvt\-cert
75356f2724eSchristosGenerate a new private certificate used by the
75456f2724eSchristos.Cm PC
75556f2724eSchristosidentity scheme.
7568585484eSchristosBy default, the program generates public certificates.
75756f2724eSchristosNote: the PC identity scheme is not recommended for new installations.
75856f2724eSchristos.It Fl q Fl \-export\-passwd Ns = Ar passwd
75956f2724eSchristosSet the password for writing encrypted
76056f2724eSchristos.Cm IFF , GQ and MV
76156f2724eSchristosidentity files redirected to
76256f2724eSchristos.Pa stdout
76356f2724eSchristosto
76456f2724eSchristos.Ar passwd .
76556f2724eSchristosIn effect, these files are decrypted with the
76656f2724eSchristos.Fl p
76756f2724eSchristospassword, then encrypted with the
76856f2724eSchristos.Fl q
76956f2724eSchristospassword.
77056f2724eSchristosBy default, the password is the string returned by the Unix
77156f2724eSchristos.Ic hostname
77256f2724eSchristoscommand.
77356f2724eSchristos.It Fl s Fl \-subject\-key Ns = Ar Oo host Oc Op @ Ar group
77456f2724eSchristosSpecify the Autokey host name, where
77556f2724eSchristos.Ar host
77656f2724eSchristosis the optional host name and
77756f2724eSchristos.Ar group
77856f2724eSchristosis the optional group name.
77956f2724eSchristosThe host name, and if provided, group name are used in
78056f2724eSchristos.Ar host @ group
78156f2724eSchristosform as certificate subject and issuer.
78256f2724eSchristosSpecifying
78356f2724eSchristos.Fl s @ Ar group
78456f2724eSchristosis allowed, and results in leaving the host name unchanged, as with
78556f2724eSchristos.Fl i Ar group .
78656f2724eSchristosThe group name, or if no group is provided, the host name are also used in the
78756f2724eSchristosfile names of
78856f2724eSchristos.Cm IFF , GQ ,
78956f2724eSchristosand
79056f2724eSchristos.Cm MV
79156f2724eSchristosidentity scheme client parameter files.
79256f2724eSchristosIf
79356f2724eSchristos.Ar host
79456f2724eSchristosis not specified, the default host name is the string returned by the Unix
79556f2724eSchristos.Ic hostname
79656f2724eSchristoscommand.
79756f2724eSchristos.It Fl S Fl \-sign\-key Ns = Op Cm RSA | DSA
79856f2724eSchristosGenerate a new encrypted public/private sign key file of the specified type.
79956f2724eSchristosBy default, the sign key is the host key and has the same type.
80056f2724eSchristosIf compatibility with FIPS 140\-2 is required, the sign key type must be
80156f2724eSchristos.Cm DSA .
80256f2724eSchristos.It Fl T Fl \-trusted\-cert
8038585484eSchristosGenerate a trusted certificate.
8048585484eSchristosBy default, the program generates a non\-trusted certificate.
80556f2724eSchristos.It Fl V Fl \-mv\-params Ar nkeys
80656f2724eSchristosGenerate
80756f2724eSchristos.Ar nkeys
80856f2724eSchristosencrypted server keys and parameters for the Mu\-Varadharajan (MV)
80956f2724eSchristosidentity scheme.
81056f2724eSchristosThis option is mutually exclusive with the
81156f2724eSchristos.Fl I
81256f2724eSchristosand
81356f2724eSchristos.Fl G
81456f2724eSchristosoptions.
81556f2724eSchristosNote: support for this option should be considered a work in progress.
8168585484eSchristos.El
8178585484eSchristos.Ss Random Seed File
8188585484eSchristosAll cryptographically sound key generation schemes must have means
8198585484eSchristosto randomize the entropy seed used to initialize
8208585484eSchristosthe internal pseudo\-random number generator used
8218585484eSchristosby the library routines.
8228585484eSchristosThe OpenSSL library uses a designated random seed file for this purpose.
8238585484eSchristosThe file must be available when starting the NTP daemon and
8248585484eSchristos.Nm
8258585484eSchristosprogram.
8268585484eSchristosIf a site supports OpenSSL or its companion OpenSSH,
8278585484eSchristosit is very likely that means to do this are already available.
8288585484eSchristos.Pp
8298585484eSchristosIt is important to understand that entropy must be evolved
8308585484eSchristosfor each generation, for otherwise the random number sequence
8318585484eSchristoswould be predictable.
8328585484eSchristosVarious means dependent on external events, such as keystroke intervals,
8338585484eSchristoscan be used to do this and some systems have built\-in entropy sources.
8348585484eSchristosSuitable means are described in the OpenSSL software documentation,
8358585484eSchristosbut are outside the scope of this page.
8368585484eSchristos.Pp
8378585484eSchristosThe entropy seed used by the OpenSSL library is contained in a file,
8388585484eSchristosusually called
83956f2724eSchristos.Pa .rnd ,
8408585484eSchristoswhich must be available when starting the NTP daemon
8418585484eSchristosor the
8428585484eSchristos.Nm
8438585484eSchristosprogram.
8448585484eSchristosThe NTP daemon will first look for the file
8458585484eSchristosusing the path specified by the
84656f2724eSchristos.Cm randfile
8478585484eSchristossubcommand of the
8488585484eSchristos.Ic crypto
8498585484eSchristosconfiguration command.
8508585484eSchristosIf not specified in this way, or when starting the
8518585484eSchristos.Nm
8528585484eSchristosprogram,
8538585484eSchristosthe OpenSSL library will look for the file using the path specified
8548585484eSchristosby the
8558585484eSchristos.Ev RANDFILE
8568585484eSchristosenvironment variable in the user home directory,
8578585484eSchristoswhether root or some other user.
8588585484eSchristosIf the
8598585484eSchristos.Ev RANDFILE
8608585484eSchristosenvironment variable is not present,
8618585484eSchristosthe library will look for the
86256f2724eSchristos.Pa .rnd
8638585484eSchristosfile in the user home directory.
86456f2724eSchristosSince both the
86556f2724eSchristos.Nm
86656f2724eSchristosprogram and
86756f2724eSchristos.Xr ntpd 1ntpdmdoc
86856f2724eSchristosdaemon must run as root, the logical place to put this file is in
86956f2724eSchristos.Pa /.rnd
87056f2724eSchristosor
87156f2724eSchristos.Pa /root/.rnd .
8728585484eSchristosIf the file is not available or cannot be written,
8738585484eSchristosthe daemon exits with a message to the system log and the program
8748585484eSchristosexits with a suitable error message.
8758585484eSchristos.Ss Cryptographic Data Files
87656f2724eSchristosAll file formats begin with two nonencrypted lines.
87756f2724eSchristosThe first line contains the file name, including the generated host name
87856f2724eSchristosand filestamp, in the format
87956f2724eSchristos.Pa ntpkey_ Ns Ar key _ Ar name . Ar filestamp ,
88056f2724eSchristoswhere
88156f2724eSchristos.Ar key
88256f2724eSchristosis the key or parameter type,
88356f2724eSchristos.Ar name
88456f2724eSchristosis the host or group name and
88556f2724eSchristos.Ar filestamp
88656f2724eSchristosis the filestamp (NTP seconds) when the file was created.
88756f2724eSchristosBy convention,
88856f2724eSchristos.Ar key
88956f2724eSchristosnames in generated file names include both upper and lower case
89056f2724eSchristoscharacters, while
89156f2724eSchristos.Ar key
89256f2724eSchristosnames in generated link names include only lower case characters.
89356f2724eSchristosThe filestamp is not used in generated link names.
89456f2724eSchristosThe second line contains the datestamp in conventional Unix
89556f2724eSchristos.Pa date
89656f2724eSchristosformat.
89756f2724eSchristosLines beginning with
89856f2724eSchristos.Ql #
89956f2724eSchristosare considered comments and ignored by the
9008585484eSchristos.Nm
9018585484eSchristosprogram and
9028585484eSchristos.Xr ntpd 1ntpdmdoc
9038585484eSchristosdaemon.
9048585484eSchristos.Pp
90556f2724eSchristosThe remainder of the file contains cryptographic data, encoded first using ASN.1
90656f2724eSchristosrules, then encrypted if necessary, and finally written in PEM\-encoded
90756f2724eSchristosprintable ASCII text, preceded and followed by MIME content identifier lines.
90856f2724eSchristos.Pp
90956f2724eSchristosThe format of the symmetric keys file, ordinarily named
91056f2724eSchristos.Pa ntp.keys ,
91156f2724eSchristosis somewhat different than the other files in the interest of backward compatibility.
91256f2724eSchristosOrdinarily, the file is generated by this program, but it can be constructed
91356f2724eSchristosand edited using an ordinary text editor.
91456f2724eSchristos.Bd -literal -unfilled -offset center
91556f2724eSchristos# ntpkey_MD5key_bk.ntp.org.3595864945
91656f2724eSchristos# Thu Dec 12 19:22:25 2013
91756f2724eSchristos1  MD5 L";Nw<\`.I<f4U0)247"i  # MD5 key
91856f2724eSchristos2  MD5 &>l0%XXK9O'51VwV<xq~  # MD5 key
91956f2724eSchristos3  MD5 lb4zLW~d^!K:]RsD'qb6  # MD5 key
92056f2724eSchristos4  MD5 Yue:tL[+vR)M\`n~bY,'?  # MD5 key
92156f2724eSchristos5  MD5 B;fx'Kgr/&4ZTbL6=RxA  # MD5 key
92256f2724eSchristos6  MD5 4eYwa\`o}3i@@V@..R9!l  # MD5 key
92356f2724eSchristos7  MD5 \`A.([h+;wTQ|xfi%Sn_!  # MD5 key
92456f2724eSchristos8  MD5 45:V,r4]l6y^JH6"Sh?F  # MD5 key
92556f2724eSchristos9  MD5 3\-5vcn*6l29DS?Xdsg)*  # MD5 key
92656f2724eSchristos10 MD5 2late4Me              # MD5 key
92756f2724eSchristos11 SHA1 a27872d3030a9025b8446c751b4551a7629af65c  # SHA1 key
92856f2724eSchristos12 SHA1 21bc3b4865dbb9e920902abdccb3e04ff97a5e74  # SHA1 key
92956f2724eSchristos13 SHA1 2b7736fe24fef5ba85ae11594132ab5d6f6daba9  # SHA1 key
93056f2724eSchristos14 SHA  a5332809c8878dd3a5b918819108a111509aeceb  # SHA  key
93156f2724eSchristos15 MD2  2fe16c88c760ff2f16d4267e36c1aa6c926e6964  # MD2  key
93256f2724eSchristos16 MD4  b2691811dc19cfc0e2f9bcacd74213f29812183d  # MD4  key
93356f2724eSchristos17 MD5  e4d6735b8bdad58ec5ffcb087300a17f7fef1f7c  # MD5  key
93456f2724eSchristos18 MDC2 a8d5e2315c025bf3a79174c87fbd10477de2eabc  # MDC2 key
93556f2724eSchristos19 RIPEMD160 77ca332cafb30e3cafb174dcd5b80ded7ba9b3d2  # RIPEMD160 key
93656f2724eSchristos20 AES128CMAC f92ff73eee86c1e7dc638d6489a04e4e555af878  # AES128CMAC key
93756f2724eSchristos.Ed
93856f2724eSchristos.D1 Figure 1. Typical Symmetric Key File
93956f2724eSchristos.Pp
94056f2724eSchristosFigure 1 shows a typical symmetric keys file used by the reference
94156f2724eSchristosimplementation.
94256f2724eSchristosFollowing the header the keys are entered one per line in the format
94356f2724eSchristos.D1 Ar keyno Ar type Ar key
9448585484eSchristoswhere
9458585484eSchristos.Ar keyno
946397d6dd6Schristosis a positive integer in the range 1\-65535;
9478585484eSchristos.Ar type
94856f2724eSchristosis the key type for the message digest algorithm, which in the absence of the
94956f2724eSchristosOpenSSL library must be
95056f2724eSchristos.Cm MD5
95156f2724eSchristosto designate the MD5 message digest algorithm;
95256f2724eSchristosif the OpenSSL library is installed, the key type can be any
95356f2724eSchristosmessage digest algorithm supported by that library;
95456f2724eSchristoshowever, if compatibility with FIPS 140\-2 is required,
95556f2724eSchristosthe key type must be either
95656f2724eSchristos.Cm SHA
95756f2724eSchristosor
95856f2724eSchristos.Cm SHA1 ;
9598585484eSchristos.Ar key
9608585484eSchristosis the key itself,
96156f2724eSchristoswhich is a printable ASCII string 20 characters or less in length:
96256f2724eSchristoseach character is chosen from the 93 printable characters
96356f2724eSchristosin the range 0x21 through 0x7e (
96456f2724eSchristos.Ql !
96556f2724eSchristosthrough
96656f2724eSchristos.Ql ~
96756f2724eSchristos\&) excluding space and the
96856f2724eSchristos.Ql #
96956f2724eSchristoscharacter, and terminated by whitespace or a
9708585484eSchristos.Ql #
9718585484eSchristoscharacter.
97256f2724eSchristosAn OpenSSL key consists of a hex\-encoded ASCII string of 40 characters, which
97356f2724eSchristosis truncated as necessary.
9748585484eSchristos.Pp
9758585484eSchristosNote that the keys used by the
9768585484eSchristos.Xr ntpq 1ntpqmdoc
9778585484eSchristosand
9788585484eSchristos.Xr ntpdc 1ntpdcmdoc
9798585484eSchristosprograms
9808585484eSchristosare checked against passwords requested by the programs
9818585484eSchristosand entered by hand, so it is generally appropriate to specify these keys
9828585484eSchristosin human readable ASCII format.
9838585484eSchristos.Pp
9848585484eSchristosThe
9858585484eSchristos.Nm
98656f2724eSchristosprogram generates a symmetric keys file
98756f2724eSchristos.Pa ntpkey_MD5key_ Ns Ar hostname Ns . Ns Ar filestamp .
9888585484eSchristosSince the file contains private shared keys,
9898585484eSchristosit should be visible only to root and distributed by secure means
9908585484eSchristosto other subnet hosts.
9918585484eSchristosThe NTP daemon loads the file
9928585484eSchristos.Pa ntp.keys ,
9938585484eSchristosso
9948585484eSchristos.Nm
9958585484eSchristosinstalls a soft link from this name to the generated file.
9968585484eSchristosSubsequently, similar soft links must be installed by manual
9978585484eSchristosor automated means on the other subnet hosts.
9988585484eSchristosWhile this file is not used with the Autokey Version 2 protocol,
9998585484eSchristosit is needed to authenticate some remote configuration commands
10008585484eSchristosused by the
10018585484eSchristos.Xr ntpq 1ntpqmdoc
10028585484eSchristosand
10038585484eSchristos.Xr ntpdc 1ntpdcmdoc
10048585484eSchristosutilities.
10058585484eSchristos.Sh "OPTIONS"
10068585484eSchristos.Bl -tag
10078585484eSchristos.It  Fl b Ar imbits , Fl \-imbits Ns = Ns Ar imbits
10088585484eSchristosidentity modulus bits.
10098585484eSchristosThis option takes an integer number as its argument.
10108585484eSchristosThe value of
10118585484eSchristos.Ar imbits
10128585484eSchristosis constrained to being:
10138585484eSchristos.in +4
10148585484eSchristos.nf
10158585484eSchristos.na
10168585484eSchristosin the range  256 through 2048
10178585484eSchristos.fi
10188585484eSchristos.in -4
10198585484eSchristos.sp
1020*897be3a4SchristosThe number of bits in the identity modulus.  The default is 512.
10218585484eSchristos.It  Fl c Ar scheme , Fl \-certificate Ns = Ns Ar scheme
10228585484eSchristoscertificate scheme.
10238585484eSchristos.sp
10248585484eSchristosscheme is one of
102556f2724eSchristosRSA\-MD2, RSA\-MD5, RSA\-MDC2, RSA\-SHA, RSA\-SHA1, RSA\-RIPEMD160,
10268585484eSchristosDSA\-SHA, or DSA\-SHA1.
10278585484eSchristos.sp
102856f2724eSchristosSelect the certificate signature encryption/message digest scheme.
10298585484eSchristosNote that RSA schemes must be used with a RSA sign key and DSA
10308585484eSchristosschemes must be used with a DSA sign key.  The default without
10318585484eSchristosthis option is RSA\-MD5.
10328585484eSchristos.It  Fl C Ar cipher , Fl \-cipher Ns = Ns Ar cipher
10338585484eSchristosprivatekey cipher.
10348585484eSchristos.sp
10358585484eSchristosSelect the cipher which is used to encrypt the files containing
10368585484eSchristosprivate keys.  The default is three\-key triple DES in CBC mode,
103756f2724eSchristosequivalent to "\fB\-C des\-ede3\-cbc\fP".  The openssl tool lists ciphers
10388585484eSchristosavailable in "\fBopenssl \-h\fP" output.
10398585484eSchristos.It  Fl d , Fl \-debug\-level
10408585484eSchristosIncrease debug verbosity level.
10418585484eSchristosThis option may appear an unlimited number of times.
10428585484eSchristos.sp
10438585484eSchristos.It  Fl D Ar number , Fl \-set\-debug\-level Ns = Ns Ar number
10448585484eSchristosSet the debug verbosity level.
10458585484eSchristosThis option may appear an unlimited number of times.
10468585484eSchristosThis option takes an integer number as its argument.
10478585484eSchristos.sp
10488585484eSchristos.It  Fl e , Fl \-id\-key
10498585484eSchristosWrite IFF or GQ identity keys.
10508585484eSchristos.sp
105156f2724eSchristosWrite the public parameters from the IFF or GQ client keys to
105256f2724eSchristosthe standard output.
105356f2724eSchristosThis is intended for automatic key distribution by email.
10548585484eSchristos.It  Fl G , Fl \-gq\-params
10558585484eSchristosGenerate GQ parameters and keys.
10568585484eSchristos.sp
10578585484eSchristosGenerate parameters and keys for the GQ identification scheme,
10588585484eSchristosobsoleting any that may exist.
10598585484eSchristos.It  Fl H , Fl \-host\-key
10608585484eSchristosgenerate RSA host key.
10618585484eSchristos.sp
10628585484eSchristosGenerate new host keys, obsoleting any that may exist.
10638585484eSchristos.It  Fl I , Fl \-iffkey
10648585484eSchristosgenerate IFF parameters.
10658585484eSchristos.sp
10668585484eSchristosGenerate parameters for the IFF identification scheme, obsoleting
10678585484eSchristosany that may exist.
10688585484eSchristos.It  Fl i Ar group , Fl \-ident Ns = Ns Ar group
10698585484eSchristosset Autokey group name.
10708585484eSchristos.sp
10718585484eSchristosSet the optional Autokey group name to name.  This is used in
10728585484eSchristosthe file name of IFF, GQ, and MV client parameters files.  In
10738585484eSchristosthat role, the default is the host name if this option is not
10748585484eSchristosprovided.  The group name, if specified using \fB\-i/\-\-ident\fP or
10758585484eSchristosusing \fB\-s/\-\-subject\-name\fP following an '\fB@\fP' character,
107656f2724eSchristosis also a part of the self\-signed host certificate subject and
10778585484eSchristosissuer names in the form \fBhost@group\fP and should match the
107856f2724eSchristos\'\fBcrypto ident\fP' or '\fBserver ident\fP' configuration in the
107956f2724eSchristos\fBntpd\fP configuration file.
10808585484eSchristos.It  Fl l Ar lifetime , Fl \-lifetime Ns = Ns Ar lifetime
10818585484eSchristosset certificate lifetime.
10828585484eSchristosThis option takes an integer number as its argument.
10838585484eSchristos.sp
10848585484eSchristosSet the certificate expiration to lifetime days from now.
10858585484eSchristos.It  Fl m Ar modulus , Fl \-modulus Ns = Ns Ar modulus
108656f2724eSchristosprime modulus.
10878585484eSchristosThis option takes an integer number as its argument.
10888585484eSchristosThe value of
10898585484eSchristos.Ar modulus
10908585484eSchristosis constrained to being:
10918585484eSchristos.in +4
10928585484eSchristos.nf
10938585484eSchristos.na
10948585484eSchristosin the range  256 through 2048
10958585484eSchristos.fi
10968585484eSchristos.in -4
10978585484eSchristos.sp
10988585484eSchristosThe number of bits in the prime modulus.  The default is 512.
109956f2724eSchristos.It  Fl M , Fl \-md5key
110056f2724eSchristosgenerate symmetric keys.
110156f2724eSchristos.sp
110256f2724eSchristosGenerate symmetric keys, obsoleting any that may exist.
11038585484eSchristos.It  Fl P , Fl \-pvt\-cert
11048585484eSchristosgenerate PC private certificate.
11058585484eSchristos.sp
11068585484eSchristosGenerate a private certificate.  By default, the program generates
11078585484eSchristospublic certificates.
1108b8ecfcfeSchristos.It  Fl p Ar passwd , Fl \-password Ns = Ns Ar passwd
1109b8ecfcfeSchristoslocal private password.
11108585484eSchristos.sp
1111b8ecfcfeSchristosLocal files containing private data are encrypted with the
1112b8ecfcfeSchristosDES\-CBC algorithm and the specified password.  The same password
1113b8ecfcfeSchristosmust be specified to the local ntpd via the "crypto pw password"
1114b8ecfcfeSchristosconfiguration command.  The default password is the local
1115b8ecfcfeSchristoshostname.
1116b8ecfcfeSchristos.It  Fl q Ar passwd , Fl \-export\-passwd Ns = Ns Ar passwd
1117b8ecfcfeSchristosexport IFF or GQ group keys with password.
11188585484eSchristos.sp
1119b8ecfcfeSchristosExport IFF or GQ identity group keys to the standard output,
1120b8ecfcfeSchristosencrypted with the DES\-CBC algorithm and the specified password.
1121b8ecfcfeSchristosThe same password must be specified to the remote ntpd via the
1122b8ecfcfeSchristos"crypto pw password" configuration command.  See also the option
1123b8ecfcfeSchristos-\-id\-key (\-e) for unencrypted exports.
11248585484eSchristos.It  Fl s Ar host@group , Fl \-subject\-name Ns = Ns Ar host@group
11258585484eSchristosset host and optionally group name.
11268585484eSchristos.sp
11278585484eSchristosSet the Autokey host name, and optionally, group name specified
11288585484eSchristosfollowing an '\fB@\fP' character.  The host name is used in the file
11298585484eSchristosname of generated host and signing certificates, without the
11308585484eSchristosgroup name.  The host name, and if provided, group name are used
113156f2724eSchristosin \fBhost@group\fP form for the host certificate subject and issuer
11328585484eSchristosfields.  Specifying '\fB\-s @group\fP' is allowed, and results in
11338585484eSchristosleaving the host name unchanged while appending \fB@group\fP to the
11348585484eSchristossubject and issuer fields, as with \fB\-i group\fP.  The group name, or
11358585484eSchristosif not provided, the host name are also used in the file names
11368585484eSchristosof IFF, GQ, and MV client parameter files.
113756f2724eSchristos.It  Fl S Ar sign , Fl \-sign\-key Ns = Ns Ar sign
113856f2724eSchristosgenerate sign key (RSA or DSA).
113956f2724eSchristos.sp
114056f2724eSchristosGenerate a new sign key of the designated type, obsoleting any
114156f2724eSchristosthat may exist.  By default, the program uses the host key as the
114256f2724eSchristossign key.
11438585484eSchristos.It  Fl T , Fl \-trusted\-cert
11448585484eSchristostrusted certificate (TC scheme).
11458585484eSchristos.sp
11468585484eSchristosGenerate a trusted certificate.  By default, the program generates
11478585484eSchristosa non\-trusted certificate.
11488585484eSchristos.It  Fl V Ar num , Fl \-mv\-params Ns = Ns Ar num
11498585484eSchristosgenerate <num> MV parameters.
11508585484eSchristosThis option takes an integer number as its argument.
11518585484eSchristos.sp
11528585484eSchristosGenerate parameters and keys for the Mu\-Varadharajan (MV)
11538585484eSchristosidentification scheme.
11548585484eSchristos.It  Fl v Ar num , Fl \-mv\-keys Ns = Ns Ar num
11558585484eSchristosupdate <num> MV keys.
11568585484eSchristosThis option takes an integer number as its argument.
11578585484eSchristos.sp
11588585484eSchristosThis option has not been fully documented.
11598585484eSchristos.It Fl \&? , Fl \-help
11608585484eSchristosDisplay usage information and exit.
11618585484eSchristos.It Fl \&! , Fl \-more\-help
11628585484eSchristosPass the extended usage information through a pager.
11638585484eSchristos.It Fl > Oo Ar cfgfile Oc , Fl \-save\-opts Oo Ns = Ns Ar cfgfile Oc
11648585484eSchristosSave the option state to \fIcfgfile\fP.  The default is the \fIlast\fP
11658585484eSchristosconfiguration file listed in the \fBOPTION PRESETS\fP section, below.
11668585484eSchristosThe command will exit after updating the config file.
11678585484eSchristos.It Fl < Ar cfgfile , Fl \-load\-opts Ns = Ns Ar cfgfile , Fl \-no\-load\-opts
11688585484eSchristosLoad options from \fIcfgfile\fP.
11698585484eSchristosThe \fIno\-load\-opts\fP form will disable the loading
11708585484eSchristosof earlier config/rc/ini files.  \fI\-\-no\-load\-opts\fP is handled early,
11718585484eSchristosout of order.
11728585484eSchristos.It Fl \-version Op Brq Ar v|c|n
11738585484eSchristosOutput version of program and exit.  The default mode is `v', a simple
11748585484eSchristosversion.  The `c' mode will print copyright information and `n' will
11758585484eSchristosprint the full copyright notice.
11768585484eSchristos.El
11778585484eSchristos.Sh "OPTION PRESETS"
11788585484eSchristosAny option that is not marked as \fInot presettable\fP may be preset
11798585484eSchristosby loading values from configuration ("RC" or ".INI") file(s) and values from
11808585484eSchristosenvironment variables named:
11818585484eSchristos.nf
11828585484eSchristos  \fBNTP_KEYGEN_<option\-name>\fP or \fBNTP_KEYGEN\fP
11838585484eSchristos.fi
11848585484eSchristos.ad
11858585484eSchristosThe environmental presets take precedence (are processed later than)
11868585484eSchristosthe configuration files.
11878585484eSchristosThe \fIhomerc\fP files are "\fI$HOME\fP", and "\fI.\fP".
11888585484eSchristosIf any of these are directories, then the file \fI.ntprc\fP
11898585484eSchristosis searched for within those directories.
11908585484eSchristos.Sh USAGE
11918585484eSchristos.Sh "ENVIRONMENT"
11928585484eSchristosSee \fBOPTION PRESETS\fP for configuration environment variables.
11938585484eSchristos.Sh "FILES"
11948585484eSchristosSee \fBOPTION PRESETS\fP for configuration files.
11958585484eSchristos.Sh "EXIT STATUS"
11968585484eSchristosOne of the following exit values will be returned:
11978585484eSchristos.Bl -tag
11988585484eSchristos.It 0 " (EXIT_SUCCESS)"
11998585484eSchristosSuccessful program execution.
12008585484eSchristos.It 1 " (EXIT_FAILURE)"
12018585484eSchristosThe operation failed or the command syntax was not valid.
12028585484eSchristos.It 66 " (EX_NOINPUT)"
12038585484eSchristosA specified configuration file could not be loaded.
12048585484eSchristos.It 70 " (EX_SOFTWARE)"
12058585484eSchristoslibopts had an internal operational error.  Please report
12068585484eSchristosit to autogen\-users@lists.sourceforge.net.  Thank you.
12078585484eSchristos.El
12088585484eSchristos.Sh "AUTHORS"
1209b5bbe2e3SchristosThe University of Delaware and Network Time Foundation
12108585484eSchristos.Sh "COPYRIGHT"
1211*897be3a4SchristosCopyright (C) 1992\-2024 The University of Delaware and Network Time Foundation all rights reserved.
12128585484eSchristosThis program is released under the terms of the NTP license, <http://ntp.org/license>.
12138585484eSchristos.Sh BUGS
121456f2724eSchristosIt can take quite a while to generate some cryptographic values.
12158585484eSchristos.Pp
12168585484eSchristosPlease report bugs to http://bugs.ntp.org .
12178585484eSchristos.Pp
1218*897be3a4SchristosPlease send bug reports to: https://bugs.ntp.org, bugs@ntp.org
12198585484eSchristos.Sh NOTES
12208585484eSchristosPortions of this document came from FreeBSD.
12218585484eSchristos.Pp
12228585484eSchristosThis manual page was \fIAutoGen\fP\-erated from the \fBntp\-keygen\fP
12238585484eSchristosoption definitions.
1224