Home | History | Annotate | Line # | Download | only in ntpd
ntp.conf.def revision 1.1.1.1.6.2.2.4
      1 /* -*- Mode: Text -*- */
      2 
      3 autogen definitions options;
      4 
      5 #include copyright.def
      6 
      7 // We want the synopsis to be "/etc/ntp.conf" but we need the prog-name
      8 // to be ntp.conf - the latter is also how autogen produces the output
      9 // file name.
     10 prog-name	= "ntp.conf";
     11 file-path	= "/etc/ntp.conf";
     12 prog-title	= "Network Time Protocol (NTP) daemon configuration file format";
     13 
     14 /* explain: Additional information whenever the usage routine is invoked */
     15 explain = <<- _END_EXPLAIN
     16 	_END_EXPLAIN;
     17 
     18 doc-section	= {
     19   ds-type	= 'DESCRIPTION';
     20   ds-format	= 'mdoc';
     21   ds-text	= <<- _END_PROG_MDOC_DESCRIP
     22 The
     23 .Nm
     24 configuration file is read at initial startup by the
     25 .Xr ntpd 1ntpdmdoc
     26 daemon in order to specify the synchronization sources,
     27 modes and other related information.
     28 Usually, it is installed in the
     29 .Pa /etc
     30 directory,
     31 but could be installed elsewhere
     32 (see the daemon's
     33 .Fl c
     34 command line option).
     35 .Pp
     36 The file format is similar to other
     37 .Ux
     38 configuration files.
     39 Comments begin with a
     40 .Ql #
     41 character and extend to the end of the line;
     42 blank lines are ignored.
     43 Configuration commands consist of an initial keyword
     44 followed by a list of arguments,
     45 some of which may be optional, separated by whitespace.
     46 Commands may not be continued over multiple lines.
     47 Arguments may be host names,
     48 host addresses written in numeric, dotted-quad form,
     49 integers, floating point numbers (when specifying times in seconds)
     50 and text strings.
     51 .Pp
     52 The rest of this page describes the configuration and control options.
     53 The
     54 .Qq Notes on Configuring NTP and Setting up an NTP Subnet
     55 page
     56 (available as part of the HTML documentation
     57 provided in
     58 .Pa /usr/share/doc/ntp )
     59 contains an extended discussion of these options.
     60 In addition to the discussion of general
     61 .Sx Configuration Options ,
     62 there are sections describing the following supported functionality
     63 and the options used to control it:
     64 .Bl -bullet -offset indent
     65 .It
     66 .Sx Authentication Support
     67 .It
     68 .Sx Monitoring Support
     69 .It
     70 .Sx Access Control Support
     71 .It
     72 .Sx Automatic NTP Configuration Options
     73 .It
     74 .Sx Reference Clock Support
     75 .It
     76 .Sx Miscellaneous Options
     77 .El
     78 .Pp
     79 Following these is a section describing
     80 .Sx Miscellaneous Options .
     81 While there is a rich set of options available,
     82 the only required option is one or more
     83 .Ic pool ,
     84 .Ic server ,
     85 .Ic peer ,
     86 .Ic broadcast
     87 or
     88 .Ic manycastclient
     89 commands.
     90 .Sh Configuration Support
     91 Following is a description of the configuration commands in
     92 NTPv4.
     93 These commands have the same basic functions as in NTPv3 and
     94 in some cases new functions and new arguments.
     95 There are two
     96 classes of commands, configuration commands that configure a
     97 persistent association with a remote server or peer or reference
     98 clock, and auxiliary commands that specify environmental variables
     99 that control various related operations.
    100 .Ss Configuration Commands
    101 The various modes are determined by the command keyword and the
    102 type of the required IP address.
    103 Addresses are classed by type as
    104 (s) a remote server or peer (IPv4 class A, B and C), (b) the
    105 broadcast address of a local interface, (m) a multicast address (IPv4
    106 class D), or (r) a reference clock address (127.127.x.x).
    107 Note that
    108 only those options applicable to each command are listed below.
    109 Use
    110 of options not listed may not be caught as an error, but may result
    111 in some weird and even destructive behavior.
    112 .Pp
    113 If the Basic Socket Interface Extensions for IPv6 (RFC-2553)
    114 is detected, support for the IPv6 address family is generated
    115 in addition to the default support of the IPv4 address family.
    116 In a few cases, including the
    117 .Cm reslist
    118 billboard generated
    119 by
    120 .Xr ntpq 1ntpqmdoc
    121 or
    122 .Xr ntpdc 1ntpdcmdoc ,
    123 IPv6 addresses are automatically generated.
    124 IPv6 addresses can be identified by the presence of colons
    125 .Dq \&:
    126 in the address field.
    127 IPv6 addresses can be used almost everywhere where
    128 IPv4 addresses can be used,
    129 with the exception of reference clock addresses,
    130 which are always IPv4.
    131 .Pp
    132 Note that in contexts where a host name is expected, a
    133 .Fl 4
    134 qualifier preceding
    135 the host name forces DNS resolution to the IPv4 namespace,
    136 while a
    137 .Fl 6
    138 qualifier forces DNS resolution to the IPv6 namespace.
    139 See IPv6 references for the
    140 equivalent classes for that address family.
    141 .Bl -tag -width indent
    142 .It Xo Ic pool Ar address
    143 .Op Cm burst
    144 .Op Cm iburst
    145 .Op Cm version Ar version
    146 .Op Cm prefer
    147 .Op Cm minpoll Ar minpoll
    148 .Op Cm maxpoll Ar maxpoll
    149 .Xc
    150 .It Xo Ic server Ar address
    151 .Op Cm key Ar key \&| Cm autokey
    152 .Op Cm burst
    153 .Op Cm iburst
    154 .Op Cm version Ar version
    155 .Op Cm prefer
    156 .Op Cm minpoll Ar minpoll
    157 .Op Cm maxpoll Ar maxpoll
    158 .Op Cm true
    159 .Xc
    160 .It Xo Ic peer Ar address
    161 .Op Cm key Ar key \&| Cm autokey
    162 .Op Cm version Ar version
    163 .Op Cm prefer
    164 .Op Cm minpoll Ar minpoll
    165 .Op Cm maxpoll Ar maxpoll
    166 .Op Cm true
    167 .Op Cm xleave
    168 .Xc
    169 .It Xo Ic broadcast Ar address
    170 .Op Cm key Ar key \&| Cm autokey
    171 .Op Cm version Ar version
    172 .Op Cm prefer
    173 .Op Cm minpoll Ar minpoll
    174 .Op Cm ttl Ar ttl
    175 .Op Cm xleave
    176 .Xc
    177 .It Xo Ic manycastclient Ar address
    178 .Op Cm key Ar key \&| Cm autokey
    179 .Op Cm version Ar version
    180 .Op Cm prefer
    181 .Op Cm minpoll Ar minpoll
    182 .Op Cm maxpoll Ar maxpoll
    183 .Op Cm ttl Ar ttl
    184 .Xc
    185 .El
    186 .Pp
    187 These five commands specify the time server name or address to
    188 be used and the mode in which to operate.
    189 The
    190 .Ar address
    191 can be
    192 either a DNS name or an IP address in dotted-quad notation.
    193 Additional information on association behavior can be found in the
    194 .Qq Association Management
    195 page
    196 (available as part of the HTML documentation
    197 provided in
    198 .Pa /usr/share/doc/ntp ) .
    199 .Bl -tag -width indent
    200 .It Ic pool
    201 For type s addresses, this command mobilizes a persistent
    202 client mode association with a number of remote servers.
    203 In this mode the local clock can synchronized to the
    204 remote server, but the remote server can never be synchronized to
    205 the local clock.
    206 .It Ic server
    207 For type s and r addresses, this command mobilizes a persistent
    208 client mode association with the specified remote server or local
    209 radio clock.
    210 In this mode the local clock can synchronized to the
    211 remote server, but the remote server can never be synchronized to
    212 the local clock.
    213 This command should
    214 .Em not
    215 be used for type
    216 b or m addresses.
    217 .It Ic peer
    218 For type s addresses (only), this command mobilizes a
    219 persistent symmetric-active mode association with the specified
    220 remote peer.
    221 In this mode the local clock can be synchronized to
    222 the remote peer or the remote peer can be synchronized to the local
    223 clock.
    224 This is useful in a network of servers where, depending on
    225 various failure scenarios, either the local or remote peer may be
    226 the better source of time.
    227 This command should NOT be used for type
    228 b, m or r addresses.
    229 .It Ic broadcast
    230 For type b and m addresses (only), this
    231 command mobilizes a persistent broadcast mode association.
    232 Multiple
    233 commands can be used to specify multiple local broadcast interfaces
    234 (subnets) and/or multiple multicast groups.
    235 Note that local
    236 broadcast messages go only to the interface associated with the
    237 subnet specified, but multicast messages go to all interfaces.
    238 In broadcast mode the local server sends periodic broadcast
    239 messages to a client population at the
    240 .Ar address
    241 specified, which is usually the broadcast address on (one of) the
    242 local network(s) or a multicast address assigned to NTP.
    243 The IANA
    244 has assigned the multicast group address IPv4 224.0.1.1 and
    245 IPv6 ff05::101 (site local) exclusively to
    246 NTP, but other nonconflicting addresses can be used to contain the
    247 messages within administrative boundaries.
    248 Ordinarily, this
    249 specification applies only to the local server operating as a
    250 sender; for operation as a broadcast client, see the
    251 .Ic broadcastclient
    252 or
    253 .Ic multicastclient
    254 commands
    255 below.
    256 .It Ic manycastclient
    257 For type m addresses (only), this command mobilizes a
    258 manycast client mode association for the multicast address
    259 specified.
    260 In this case a specific address must be supplied which
    261 matches the address used on the
    262 .Ic manycastserver
    263 command for
    264 the designated manycast servers.
    265 The NTP multicast address
    266 224.0.1.1 assigned by the IANA should NOT be used, unless specific
    267 means are taken to avoid spraying large areas of the Internet with
    268 these messages and causing a possibly massive implosion of replies
    269 at the sender.
    270 The
    271 .Ic manycastserver
    272 command specifies that the local server
    273 is to operate in client mode with the remote servers that are
    274 discovered as the result of broadcast/multicast messages.
    275 The
    276 client broadcasts a request message to the group address associated
    277 with the specified
    278 .Ar address
    279 and specifically enabled
    280 servers respond to these messages.
    281 The client selects the servers
    282 providing the best time and continues as with the
    283 .Ic server
    284 command.
    285 The remaining servers are discarded as if never
    286 heard.
    287 .El
    288 .Pp
    289 Options:
    290 .Bl -tag -width indent
    291 .It Cm autokey
    292 All packets sent to and received from the server or peer are to
    293 include authentication fields encrypted using the autokey scheme
    294 described in
    295 .Sx Authentication Options .
    296 .It Cm burst
    297 when the server is reachable, send a burst of eight packets
    298 instead of the usual one.
    299 The packet spacing is normally 2 s;
    300 however, the spacing between the first and second packets
    301 can be changed with the
    302 .Ic calldelay
    303 command to allow
    304 additional time for a modem or ISDN call to complete.
    305 This is designed to improve timekeeping quality
    306 with the
    307 .Ic server
    308 command and s addresses.
    309 .It Cm iburst
    310 When the server is unreachable, send a burst of eight packets
    311 instead of the usual one.
    312 The packet spacing is normally 2 s;
    313 however, the spacing between the first two packets can be
    314 changed with the
    315 .Ic calldelay
    316 command to allow
    317 additional time for a modem or ISDN call to complete.
    318 This is designed to speed the initial synchronization
    319 acquisition with the
    320 .Ic server
    321 command and s addresses and when
    322 .Xr ntpd 1ntpdmdoc
    323 is started with the
    324 .Fl q
    325 option.
    326 .It Cm key Ar key
    327 All packets sent to and received from the server or peer are to
    328 include authentication fields encrypted using the specified
    329 .Ar key
    330 identifier with values from 1 to 65534, inclusive.
    331 The
    332 default is to include no encryption field.
    333 .It Cm minpoll Ar minpoll
    334 .It Cm maxpoll Ar maxpoll
    335 These options specify the minimum and maximum poll intervals
    336 for NTP messages, as a power of 2 in seconds
    337 The maximum poll
    338 interval defaults to 10 (1,024 s), but can be increased by the
    339 .Cm maxpoll
    340 option to an upper limit of 17 (36.4 h).
    341 The
    342 minimum poll interval defaults to 6 (64 s), but can be decreased by
    343 the
    344 .Cm minpoll
    345 option to a lower limit of 4 (16 s).
    346 .It Cm noselect
    347 Marks the server as unused, except for display purposes.
    348 The server is discarded by the selection algroithm.
    349 .It Cm preempt
    350 Says the association can be preempted.
    351 .It Cm true
    352 Marks the server as a truechimer.
    353 Use this option only for testing.
    354 .It Cm prefer
    355 Marks the server as preferred.
    356 All other things being equal,
    357 this host will be chosen for synchronization among a set of
    358 correctly operating hosts.
    359 See the
    360 .Qq Mitigation Rules and the prefer Keyword
    361 page
    362 (available as part of the HTML documentation
    363 provided in
    364 .Pa /usr/share/doc/ntp )
    365 for further information.
    366 .It Cm true
    367 Forces the association to always survive the selection and clustering algorithms.
    368 This option should almost certainly
    369 .Em only
    370 be used while testing an association.
    371 .It Cm ttl Ar ttl
    372 This option is used only with broadcast server and manycast
    373 client modes.
    374 It specifies the time-to-live
    375 .Ar ttl
    376 to
    377 use on broadcast server and multicast server and the maximum
    378 .Ar ttl
    379 for the expanding ring search with manycast
    380 client packets.
    381 Selection of the proper value, which defaults to
    382 127, is something of a black art and should be coordinated with the
    383 network administrator.
    384 .It Cm version Ar version
    385 Specifies the version number to be used for outgoing NTP
    386 packets.
    387 Versions 1-4 are the choices, with version 4 the
    388 default.
    389 .It Cm xleave
    390 Valid in
    391 .Cm peer
    392 and
    393 .Cm broadcast
    394 modes only, this flag enables interleave mode.
    395 .El
    396 .Ss Auxiliary Commands
    397 .Bl -tag -width indent
    398 .It Ic broadcastclient
    399 This command enables reception of broadcast server messages to
    400 any local interface (type b) address.
    401 Upon receiving a message for
    402 the first time, the broadcast client measures the nominal server
    403 propagation delay using a brief client/server exchange with the
    404 server, then enters the broadcast client mode, in which it
    405 synchronizes to succeeding broadcast messages.
    406 Note that, in order
    407 to avoid accidental or malicious disruption in this mode, both the
    408 server and client should operate using symmetric-key or public-key
    409 authentication as described in
    410 .Sx Authentication Options .
    411 .It Ic manycastserver Ar address ...
    412 This command enables reception of manycast client messages to
    413 the multicast group address(es) (type m) specified.
    414 At least one
    415 address is required, but the NTP multicast address 224.0.1.1
    416 assigned by the IANA should NOT be used, unless specific means are
    417 taken to limit the span of the reply and avoid a possibly massive
    418 implosion at the original sender.
    419 Note that, in order to avoid
    420 accidental or malicious disruption in this mode, both the server
    421 and client should operate using symmetric-key or public-key
    422 authentication as described in
    423 .Sx Authentication Options .
    424 .It Ic multicastclient Ar address ...
    425 This command enables reception of multicast server messages to
    426 the multicast group address(es) (type m) specified.
    427 Upon receiving
    428 a message for the first time, the multicast client measures the
    429 nominal server propagation delay using a brief client/server
    430 exchange with the server, then enters the broadcast client mode, in
    431 which it synchronizes to succeeding multicast messages.
    432 Note that,
    433 in order to avoid accidental or malicious disruption in this mode,
    434 both the server and client should operate using symmetric-key or
    435 public-key authentication as described in
    436 .Sx Authentication Options .
    437 .It Ic mdnstries Ar number
    438 If we are participating in mDNS,
    439 after we have synched for the first time
    440 we attempt to register with the mDNS system.
    441 If that registration attempt fails,
    442 we try again at one minute intervals for up to
    443 .Ic mdnstries
    444 times.
    445 After all,
    446 .Ic ntpd
    447 may be starting before mDNS.
    448 The default value for
    449 .Ic mdnstries
    450 is 5.
    451 .El
    452 .Sh Authentication Support
    453 Authentication support allows the NTP client to verify that the
    454 server is in fact known and trusted and not an intruder intending
    455 accidentally or on purpose to masquerade as that server.
    456 The NTPv3
    457 specification RFC-1305 defines a scheme which provides
    458 cryptographic authentication of received NTP packets.
    459 Originally,
    460 this was done using the Data Encryption Standard (DES) algorithm
    461 operating in Cipher Block Chaining (CBC) mode, commonly called
    462 DES-CBC.
    463 Subsequently, this was replaced by the RSA Message Digest
    464 5 (MD5) algorithm using a private key, commonly called keyed-MD5.
    465 Either algorithm computes a message digest, or one-way hash, which
    466 can be used to verify the server has the correct private key and
    467 key identifier.
    468 .Pp
    469 NTPv4 retains the NTPv3 scheme, properly described as symmetric key
    470 cryptography and, in addition, provides a new Autokey scheme
    471 based on public key cryptography.
    472 Public key cryptography is generally considered more secure
    473 than symmetric key cryptography, since the security is based
    474 on a private value which is generated by each server and
    475 never revealed.
    476 With Autokey all key distribution and
    477 management functions involve only public values, which
    478 considerably simplifies key distribution and storage.
    479 Public key management is based on X.509 certificates,
    480 which can be provided by commercial services or
    481 produced by utility programs in the OpenSSL software library
    482 or the NTPv4 distribution.
    483 .Pp
    484 While the algorithms for symmetric key cryptography are
    485 included in the NTPv4 distribution, public key cryptography
    486 requires the OpenSSL software library to be installed
    487 before building the NTP distribution.
    488 Directions for doing that
    489 are on the Building and Installing the Distribution page.
    490 .Pp
    491 Authentication is configured separately for each association
    492 using the
    493 .Cm key
    494 or
    495 .Cm autokey
    496 subcommand on the
    497 .Ic peer ,
    498 .Ic server ,
    499 .Ic broadcast
    500 and
    501 .Ic manycastclient
    502 configuration commands as described in
    503 .Sx Configuration Options
    504 page.
    505 The authentication
    506 options described below specify the locations of the key files,
    507 if other than default, which symmetric keys are trusted
    508 and the interval between various operations, if other than default.
    509 .Pp
    510 Authentication is always enabled,
    511 although ineffective if not configured as
    512 described below.
    513 If a NTP packet arrives
    514 including a message authentication
    515 code (MAC), it is accepted only if it
    516 passes all cryptographic checks.
    517 The
    518 checks require correct key ID, key value
    519 and message digest.
    520 If the packet has
    521 been modified in any way or replayed
    522 by an intruder, it will fail one or more
    523 of these checks and be discarded.
    524 Furthermore, the Autokey scheme requires a
    525 preliminary protocol exchange to obtain
    526 the server certificate, verify its
    527 credentials and initialize the protocol
    528 .Pp
    529 The
    530 .Cm auth
    531 flag controls whether new associations or
    532 remote configuration commands require cryptographic authentication.
    533 This flag can be set or reset by the
    534 .Ic enable
    535 and
    536 .Ic disable
    537 commands and also by remote
    538 configuration commands sent by a
    539 .Xr ntpdc 1ntpdcmdoc
    540 program running on
    541 another machine.
    542 If this flag is enabled, which is the default
    543 case, new broadcast client and symmetric passive associations and
    544 remote configuration commands must be cryptographically
    545 authenticated using either symmetric key or public key cryptography.
    546 If this
    547 flag is disabled, these operations are effective
    548 even if not cryptographic
    549 authenticated.
    550 It should be understood
    551 that operating with the
    552 .Ic auth
    553 flag disabled invites a significant vulnerability
    554 where a rogue hacker can
    555 masquerade as a falseticker and seriously
    556 disrupt system timekeeping.
    557 It is
    558 important to note that this flag has no purpose
    559 other than to allow or disallow
    560 a new association in response to new broadcast
    561 and symmetric active messages
    562 and remote configuration commands and, in particular,
    563 the flag has no effect on
    564 the authentication process itself.
    565 .Pp
    566 An attractive alternative where multicast support is available
    567 is manycast mode, in which clients periodically troll
    568 for servers as described in the
    569 .Sx Automatic NTP Configuration Options
    570 page.
    571 Either symmetric key or public key
    572 cryptographic authentication can be used in this mode.
    573 The principle advantage
    574 of manycast mode is that potential servers need not be
    575 configured in advance,
    576 since the client finds them during regular operation,
    577 and the configuration
    578 files for all clients can be identical.
    579 .Pp
    580 The security model and protocol schemes for
    581 both symmetric key and public key
    582 cryptography are summarized below;
    583 further details are in the briefings, papers
    584 and reports at the NTP project page linked from
    585 .Li http://www.ntp.org/ .
    586 .Ss Symmetric-Key Cryptography
    587 The original RFC-1305 specification allows any one of possibly
    588 65,534 keys, each distinguished by a 32-bit key identifier, to
    589 authenticate an association.
    590 The servers and clients involved must
    591 agree on the key and key identifier to
    592 authenticate NTP packets.
    593 Keys and
    594 related information are specified in a key
    595 file, usually called
    596 .Pa ntp.keys ,
    597 which must be distributed and stored using
    598 secure means beyond the scope of the NTP protocol itself.
    599 Besides the keys used
    600 for ordinary NTP associations,
    601 additional keys can be used as passwords for the
    602 .Xr ntpq 1ntpqmdoc
    603 and
    604 .Xr ntpdc 1ntpdcmdoc
    605 utility programs.
    606 .Pp
    607 When
    608 .Xr ntpd 1ntpdmdoc
    609 is first started, it reads the key file specified in the
    610 .Ic keys
    611 configuration command and installs the keys
    612 in the key cache.
    613 However,
    614 individual keys must be activated with the
    615 .Ic trusted
    616 command before use.
    617 This
    618 allows, for instance, the installation of possibly
    619 several batches of keys and
    620 then activating or deactivating each batch
    621 remotely using
    622 .Xr ntpdc 1ntpdcmdoc .
    623 This also provides a revocation capability that can be used
    624 if a key becomes compromised.
    625 The
    626 .Ic requestkey
    627 command selects the key used as the password for the
    628 .Xr ntpdc 1ntpdcmdoc
    629 utility, while the
    630 .Ic controlkey
    631 command selects the key used as the password for the
    632 .Xr ntpq 1ntpqmdoc
    633 utility.
    634 .Ss Public Key Cryptography
    635 NTPv4 supports the original NTPv3 symmetric key scheme
    636 described in RFC-1305 and in addition the Autokey protocol,
    637 which is based on public key cryptography.
    638 The Autokey Version 2 protocol described on the Autokey Protocol
    639 page verifies packet integrity using MD5 message digests
    640 and verifies the source with digital signatures and any of several
    641 digest/signature schemes.
    642 Optional identity schemes described on the Identity Schemes
    643 page and based on cryptographic challenge/response algorithms
    644 are also available.
    645 Using all of these schemes provides strong security against
    646 replay with or without modification, spoofing, masquerade
    647 and most forms of clogging attacks.
    648 .\" .Pp
    649 .\" The cryptographic means necessary for all Autokey operations
    650 .\" is provided by the OpenSSL software library.
    651 .\" This library is available from http://www.openssl.org/
    652 .\" and can be installed using the procedures outlined
    653 .\" in the Building and Installing the Distribution page.
    654 .\" Once installed,
    655 .\" the configure and build
    656 .\" process automatically detects the library and links
    657 .\" the library routines required.
    658 .Pp
    659 The Autokey protocol has several modes of operation
    660 corresponding to the various NTP modes supported.
    661 Most modes use a special cookie which can be
    662 computed independently by the client and server,
    663 but encrypted in transmission.
    664 All modes use in addition a variant of the S-KEY scheme,
    665 in which a pseudo-random key list is generated and used
    666 in reverse order.
    667 These schemes are described along with an executive summary,
    668 current status, briefing slides and reading list on the
    669 .Sx Autonomous Authentication
    670 page.
    671 .Pp
    672 The specific cryptographic environment used by Autokey servers
    673 and clients is determined by a set of files
    674 and soft links generated by the
    675 .Xr ntp-keygen 1ntpkeygenmdoc
    676 program.
    677 This includes a required host key file,
    678 required certificate file and optional sign key file,
    679 leapsecond file and identity scheme files.
    680 The
    681 digest/signature scheme is specified in the X.509 certificate
    682 along with the matching sign key.
    683 There are several schemes
    684 available in the OpenSSL software library, each identified
    685 by a specific string such as
    686 .Cm md5WithRSAEncryption ,
    687 which stands for the MD5 message digest with RSA
    688 encryption scheme.
    689 The current NTP distribution supports
    690 all the schemes in the OpenSSL library, including
    691 those based on RSA and DSA digital signatures.
    692 .Pp
    693 NTP secure groups can be used to define cryptographic compartments
    694 and security hierarchies.
    695 It is important that every host
    696 in the group be able to construct a certificate trail to one
    697 or more trusted hosts in the same group.
    698 Each group
    699 host runs the Autokey protocol to obtain the certificates
    700 for all hosts along the trail to one or more trusted hosts.
    701 This requires the configuration file in all hosts to be
    702 engineered so that, even under anticipated failure conditions,
    703 the NTP subnet will form such that every group host can find
    704 a trail to at least one trusted host.
    705 .Ss Naming and Addressing
    706 It is important to note that Autokey does not use DNS to
    707 resolve addresses, since DNS can't be completely trusted
    708 until the name servers have synchronized clocks.
    709 The cryptographic name used by Autokey to bind the host identity
    710 credentials and cryptographic values must be independent
    711 of interface, network and any other naming convention.
    712 The name appears in the host certificate in either or both
    713 the subject and issuer fields, so protection against
    714 DNS compromise is essential.
    715 .Pp
    716 By convention, the name of an Autokey host is the name returned
    717 by the Unix
    718 .Xr gethostname 2
    719 system call or equivalent in other systems.
    720 By the system design
    721 model, there are no provisions to allow alternate names or aliases.
    722 However, this is not to say that DNS aliases, different names
    723 for each interface, etc., are constrained in any way.
    724 .Pp
    725 It is also important to note that Autokey verifies authenticity
    726 using the host name, network address and public keys,
    727 all of which are bound together by the protocol specifically
    728 to deflect masquerade attacks.
    729 For this reason Autokey
    730 includes the source and destination IP addresses in message digest
    731 computations and so the same addresses must be available
    732 at both the server and client.
    733 For this reason operation
    734 with network address translation schemes is not possible.
    735 This reflects the intended robust security model where government
    736 and corporate NTP servers are operated outside firewall perimeters.
    737 .Ss Operation
    738 A specific combination of authentication scheme (none,
    739 symmetric key, public key) and identity scheme is called
    740 a cryptotype, although not all combinations are compatible.
    741 There may be management configurations where the clients,
    742 servers and peers may not all support the same cryptotypes.
    743 A secure NTPv4 subnet can be configured in many ways while
    744 keeping in mind the principles explained above and
    745 in this section.
    746 Note however that some cryptotype
    747 combinations may successfully interoperate with each other,
    748 but may not represent good security practice.
    749 .Pp
    750 The cryptotype of an association is determined at the time
    751 of mobilization, either at configuration time or some time
    752 later when a message of appropriate cryptotype arrives.
    753 When mobilized by a
    754 .Ic server
    755 or
    756 .Ic peer
    757 configuration command and no
    758 .Ic key
    759 or
    760 .Ic autokey
    761 subcommands are present, the association is not
    762 authenticated; if the
    763 .Ic key
    764 subcommand is present, the association is authenticated
    765 using the symmetric key ID specified; if the
    766 .Ic autokey
    767 subcommand is present, the association is authenticated
    768 using Autokey.
    769 .Pp
    770 When multiple identity schemes are supported in the Autokey
    771 protocol, the first message exchange determines which one is used.
    772 The client request message contains bits corresponding
    773 to which schemes it has available.
    774 The server response message
    775 contains bits corresponding to which schemes it has available.
    776 Both server and client match the received bits with their own
    777 and select a common scheme.
    778 .Pp
    779 Following the principle that time is a public value,
    780 a server responds to any client packet that matches
    781 its cryptotype capabilities.
    782 Thus, a server receiving
    783 an unauthenticated packet will respond with an unauthenticated
    784 packet, while the same server receiving a packet of a cryptotype
    785 it supports will respond with packets of that cryptotype.
    786 However, unconfigured broadcast or manycast client
    787 associations or symmetric passive associations will not be
    788 mobilized unless the server supports a cryptotype compatible
    789 with the first packet received.
    790 By default, unauthenticated associations will not be mobilized
    791 unless overridden in a decidedly dangerous way.
    792 .Pp
    793 Some examples may help to reduce confusion.
    794 Client Alice has no specific cryptotype selected.
    795 Server Bob has both a symmetric key file and minimal Autokey files.
    796 Alice's unauthenticated messages arrive at Bob, who replies with
    797 unauthenticated messages.
    798 Cathy has a copy of Bob's symmetric
    799 key file and has selected key ID 4 in messages to Bob.
    800 Bob verifies the message with his key ID 4.
    801 If it's the
    802 same key and the message is verified, Bob sends Cathy a reply
    803 authenticated with that key.
    804 If verification fails,
    805 Bob sends Cathy a thing called a crypto-NAK, which tells her
    806 something broke.
    807 She can see the evidence using the
    808 .Xr ntpq 1ntpqmdoc
    809 program.
    810 .Pp
    811 Denise has rolled her own host key and certificate.
    812 She also uses one of the identity schemes as Bob.
    813 She sends the first Autokey message to Bob and they
    814 both dance the protocol authentication and identity steps.
    815 If all comes out okay, Denise and Bob continue as described above.
    816 .Pp
    817 It should be clear from the above that Bob can support
    818 all the girls at the same time, as long as he has compatible
    819 authentication and identity credentials.
    820 Now, Bob can act just like the girls in his own choice of servers;
    821 he can run multiple configured associations with multiple different
    822 servers (or the same server, although that might not be useful).
    823 But, wise security policy might preclude some cryptotype
    824 combinations; for instance, running an identity scheme
    825 with one server and no authentication with another might not be wise.
    826 .Ss Key Management
    827 The cryptographic values used by the Autokey protocol are
    828 incorporated as a set of files generated by the
    829 .Xr ntp-keygen 1ntpkeygenmdoc
    830 utility program, including symmetric key, host key and
    831 public certificate files, as well as sign key, identity parameters
    832 and leapseconds files.
    833 Alternatively, host and sign keys and
    834 certificate files can be generated by the OpenSSL utilities
    835 and certificates can be imported from public certificate
    836 authorities.
    837 Note that symmetric keys are necessary for the
    838 .Xr ntpq 1ntpqmdoc
    839 and
    840 .Xr ntpdc 1ntpdcmdoc
    841 utility programs.
    842 The remaining files are necessary only for the
    843 Autokey protocol.
    844 .Pp
    845 Certificates imported from OpenSSL or public certificate
    846 authorities have certian limitations.
    847 The certificate should be in ASN.1 syntax, X.509 Version 3
    848 format and encoded in PEM, which is the same format
    849 used by OpenSSL.
    850 The overall length of the certificate encoded
    851 in ASN.1 must not exceed 1024 bytes.
    852 The subject distinguished
    853 name field (CN) is the fully qualified name of the host
    854 on which it is used; the remaining subject fields are ignored.
    855 The certificate extension fields must not contain either
    856 a subject key identifier or a issuer key identifier field;
    857 however, an extended key usage field for a trusted host must
    858 contain the value
    859 .Cm trustRoot ; .
    860 Other extension fields are ignored.
    861 .Ss Authentication Commands
    862 .Bl -tag -width indent
    863 .It Ic autokey Op Ar logsec
    864 Specifies the interval between regenerations of the session key
    865 list used with the Autokey protocol.
    866 Note that the size of the key
    867 list for each association depends on this interval and the current
    868 poll interval.
    869 The default value is 12 (4096 s or about 1.1 hours).
    870 For poll intervals above the specified interval, a session key list
    871 with a single entry will be regenerated for every message
    872 sent.
    873 .It Ic controlkey Ar key
    874 Specifies the key identifier to use with the
    875 .Xr ntpq 1ntpqmdoc
    876 utility, which uses the standard
    877 protocol defined in RFC-1305.
    878 The
    879 .Ar key
    880 argument is
    881 the key identifier for a trusted key, where the value can be in the
    882 range 1 to 65,534, inclusive.
    883 .It Xo Ic crypto
    884 .Op Cm cert Ar file
    885 .Op Cm leap Ar file
    886 .Op Cm randfile Ar file
    887 .Op Cm host Ar file
    888 .Op Cm sign Ar file
    889 .Op Cm gq Ar file
    890 .Op Cm gqpar Ar file
    891 .Op Cm iffpar Ar file
    892 .Op Cm mvpar Ar file
    893 .Op Cm pw Ar password
    894 .Xc
    895 This command requires the OpenSSL library.
    896 It activates public key
    897 cryptography, selects the message digest and signature
    898 encryption scheme and loads the required private and public
    899 values described above.
    900 If one or more files are left unspecified,
    901 the default names are used as described above.
    902 Unless the complete path and name of the file are specified, the
    903 location of a file is relative to the keys directory specified
    904 in the
    905 .Ic keysdir
    906 command or default
    907 .Pa /usr/local/etc .
    908 Following are the subcommands:
    909 .Bl -tag -width indent
    910 .It Cm cert Ar file
    911 Specifies the location of the required host public certificate file.
    912 This overrides the link
    913 .Pa ntpkey_cert_ Ns Ar hostname
    914 in the keys directory.
    915 .It Cm gqpar Ar file
    916 Specifies the location of the optional GQ parameters file.
    917 This
    918 overrides the link
    919 .Pa ntpkey_gq_ Ns Ar hostname
    920 in the keys directory.
    921 .It Cm host Ar file
    922 Specifies the location of the required host key file.
    923 This overrides
    924 the link
    925 .Pa ntpkey_key_ Ns Ar hostname
    926 in the keys directory.
    927 .It Cm iffpar Ar file
    928 Specifies the location of the optional IFF parameters file.
    929 This overrides the link
    930 .Pa ntpkey_iff_ Ns Ar hostname
    931 in the keys directory.
    932 .It Cm leap Ar file
    933 Specifies the location of the optional leapsecond file.
    934 This overrides the link
    935 .Pa ntpkey_leap
    936 in the keys directory.
    937 .It Cm mvpar Ar file
    938 Specifies the location of the optional MV parameters file.
    939 This overrides the link
    940 .Pa ntpkey_mv_ Ns Ar hostname
    941 in the keys directory.
    942 .It Cm pw Ar password
    943 Specifies the password to decrypt files containing private keys and
    944 identity parameters.
    945 This is required only if these files have been
    946 encrypted.
    947 .It Cm randfile Ar file
    948 Specifies the location of the random seed file used by the OpenSSL
    949 library.
    950 The defaults are described in the main text above.
    951 .It Cm sign Ar file
    952 Specifies the location of the optional sign key file.
    953 This overrides
    954 the link
    955 .Pa ntpkey_sign_ Ns Ar hostname
    956 in the keys directory.
    957 If this file is
    958 not found, the host key is also the sign key.
    959 .El
    960 .It Ic keys Ar keyfile
    961 Specifies the complete path and location of the MD5 key file
    962 containing the keys and key identifiers used by
    963 .Xr ntpd 1ntpdmdoc ,
    964 .Xr ntpq 1ntpqmdoc
    965 and
    966 .Xr ntpdc 1ntpdcmdoc
    967 when operating with symmetric key cryptography.
    968 This is the same operation as the
    969 .Fl k
    970 command line option.
    971 .It Ic keysdir Ar path
    972 This command specifies the default directory path for
    973 cryptographic keys, parameters and certificates.
    974 The default is
    975 .Pa /usr/local/etc/ .
    976 .It Ic requestkey Ar key
    977 Specifies the key identifier to use with the
    978 .Xr ntpdc 1ntpdcmdoc
    979 utility program, which uses a
    980 proprietary protocol specific to this implementation of
    981 .Xr ntpd 1ntpdmdoc .
    982 The
    983 .Ar key
    984 argument is a key identifier
    985 for the trusted key, where the value can be in the range 1 to
    986 65,534, inclusive.
    987 .It Ic revoke Ar logsec
    988 Specifies the interval between re-randomization of certain
    989 cryptographic values used by the Autokey scheme, as a power of 2 in
    990 seconds.
    991 These values need to be updated frequently in order to
    992 deflect brute-force attacks on the algorithms of the scheme;
    993 however, updating some values is a relatively expensive operation.
    994 The default interval is 16 (65,536 s or about 18 hours).
    995 For poll
    996 intervals above the specified interval, the values will be updated
    997 for every message sent.
    998 .It Ic trustedkey Ar key ...
    999 Specifies the key identifiers which are trusted for the
   1000 purposes of authenticating peers with symmetric key cryptography,
   1001 as well as keys used by the
   1002 .Xr ntpq 1ntpqmdoc
   1003 and
   1004 .Xr ntpdc 1ntpdcmdoc
   1005 programs.
   1006 The authentication procedures require that both the local
   1007 and remote servers share the same key and key identifier for this
   1008 purpose, although different keys can be used with different
   1009 servers.
   1010 The
   1011 .Ar key
   1012 arguments are 32-bit unsigned
   1013 integers with values from 1 to 65,534.
   1014 .El
   1015 .Ss Error Codes
   1016 The following error codes are reported via the NTP control
   1017 and monitoring protocol trap mechanism.
   1018 .Bl -tag -width indent
   1019 .It 101
   1020 .Pq bad field format or length
   1021 The packet has invalid version, length or format.
   1022 .It 102
   1023 .Pq bad timestamp
   1024 The packet timestamp is the same or older than the most recent received.
   1025 This could be due to a replay or a server clock time step.
   1026 .It 103
   1027 .Pq bad filestamp
   1028 The packet filestamp is the same or older than the most recent received.
   1029 This could be due to a replay or a key file generation error.
   1030 .It 104
   1031 .Pq bad or missing public key
   1032 The public key is missing, has incorrect format or is an unsupported type.
   1033 .It 105
   1034 .Pq unsupported digest type
   1035 The server requires an unsupported digest/signature scheme.
   1036 .It 106
   1037 .Pq mismatched digest types
   1038 Not used.
   1039 .It 107
   1040 .Pq bad signature length
   1041 The signature length does not match the current public key.
   1042 .It 108
   1043 .Pq signature not verified
   1044 The message fails the signature check.
   1045 It could be bogus or signed by a
   1046 different private key.
   1047 .It 109
   1048 .Pq certificate not verified
   1049 The certificate is invalid or signed with the wrong key.
   1050 .It 110
   1051 .Pq certificate not verified
   1052 The certificate is not yet valid or has expired or the signature could not
   1053 be verified.
   1054 .It 111
   1055 .Pq bad or missing cookie
   1056 The cookie is missing, corrupted or bogus.
   1057 .It 112
   1058 .Pq bad or missing leapseconds table
   1059 The leapseconds table is missing, corrupted or bogus.
   1060 .It 113
   1061 .Pq bad or missing certificate
   1062 The certificate is missing, corrupted or bogus.
   1063 .It 114
   1064 .Pq bad or missing identity
   1065 The identity key is missing, corrupt or bogus.
   1066 .El
   1067 .Sh Monitoring Support
   1068 .Xr ntpd 1ntpdmdoc
   1069 includes a comprehensive monitoring facility suitable
   1070 for continuous, long term recording of server and client
   1071 timekeeping performance.
   1072 See the
   1073 .Ic statistics
   1074 command below
   1075 for a listing and example of each type of statistics currently
   1076 supported.
   1077 Statistic files are managed using file generation sets
   1078 and scripts in the
   1079 .Pa ./scripts
   1080 directory of the source code distribution.
   1081 Using
   1082 these facilities and
   1083 .Ux
   1084 .Xr cron 8
   1085 jobs, the data can be
   1086 automatically summarized and archived for retrospective analysis.
   1087 .Ss Monitoring Commands
   1088 .Bl -tag -width indent
   1089 .It Ic statistics Ar name ...
   1090 Enables writing of statistics records.
   1091 Currently, eight kinds of
   1092 .Ar name
   1093 statistics are supported.
   1094 .Bl -tag -width indent
   1095 .It Cm clockstats
   1096 Enables recording of clock driver statistics information.
   1097 Each update
   1098 received from a clock driver appends a line of the following form to
   1099 the file generation set named
   1100 .Cm clockstats :
   1101 .Bd -literal
   1102 49213 525.624 127.127.4.1 93 226 00:08:29.606 D
   1103 .Ed
   1104 .Pp
   1105 The first two fields show the date (Modified Julian Day) and time
   1106 (seconds and fraction past UTC midnight).
   1107 The next field shows the
   1108 clock address in dotted-quad notation.
   1109 The final field shows the last
   1110 timecode received from the clock in decoded ASCII format, where
   1111 meaningful.
   1112 In some clock drivers a good deal of additional information
   1113 can be gathered and displayed as well.
   1114 See information specific to each
   1115 clock for further details.
   1116 .It Cm cryptostats
   1117 This option requires the OpenSSL cryptographic software library.
   1118 It
   1119 enables recording of cryptographic public key protocol information.
   1120 Each message received by the protocol module appends a line of the
   1121 following form to the file generation set named
   1122 .Cm cryptostats :
   1123 .Bd -literal
   1124 49213 525.624 127.127.4.1 message
   1125 .Ed
   1126 .Pp
   1127 The first two fields show the date (Modified Julian Day) and time
   1128 (seconds and fraction past UTC midnight).
   1129 The next field shows the peer
   1130 address in dotted-quad notation, The final message field includes the
   1131 message type and certain ancillary information.
   1132 See the
   1133 .Sx Authentication Options
   1134 section for further information.
   1135 .It Cm loopstats
   1136 Enables recording of loop filter statistics information.
   1137 Each
   1138 update of the local clock outputs a line of the following form to
   1139 the file generation set named
   1140 .Cm loopstats :
   1141 .Bd -literal
   1142 50935 75440.031 0.000006019 13.778190 0.000351733 0.0133806
   1143 .Ed
   1144 .Pp
   1145 The first two fields show the date (Modified Julian Day) and
   1146 time (seconds and fraction past UTC midnight).
   1147 The next five fields
   1148 show time offset (seconds), frequency offset (parts per million -
   1149 PPM), RMS jitter (seconds), Allan deviation (PPM) and clock
   1150 discipline time constant.
   1151 .It Cm peerstats
   1152 Enables recording of peer statistics information.
   1153 This includes
   1154 statistics records of all peers of a NTP server and of special
   1155 signals, where present and configured.
   1156 Each valid update appends a
   1157 line of the following form to the current element of a file
   1158 generation set named
   1159 .Cm peerstats :
   1160 .Bd -literal
   1161 48773 10847.650 127.127.4.1 9714 -0.001605376 0.000000000 0.001424877 0.000958674
   1162 .Ed
   1163 .Pp
   1164 The first two fields show the date (Modified Julian Day) and
   1165 time (seconds and fraction past UTC midnight).
   1166 The next two fields
   1167 show the peer address in dotted-quad notation and status,
   1168 respectively.
   1169 The status field is encoded in hex in the format
   1170 described in Appendix A of the NTP specification RFC 1305.
   1171 The final four fields show the offset,
   1172 delay, dispersion and RMS jitter, all in seconds.
   1173 .It Cm rawstats
   1174 Enables recording of raw-timestamp statistics information.
   1175 This
   1176 includes statistics records of all peers of a NTP server and of
   1177 special signals, where present and configured.
   1178 Each NTP message
   1179 received from a peer or clock driver appends a line of the
   1180 following form to the file generation set named
   1181 .Cm rawstats :
   1182 .Bd -literal
   1183 50928 2132.543 128.4.1.1 128.4.1.20 3102453281.584327000 3102453281.58622800031 02453332.540806000 3102453332.541458000
   1184 .Ed
   1185 .Pp
   1186 The first two fields show the date (Modified Julian Day) and
   1187 time (seconds and fraction past UTC midnight).
   1188 The next two fields
   1189 show the remote peer or clock address followed by the local address
   1190 in dotted-quad notation.
   1191 The final four fields show the originate,
   1192 receive, transmit and final NTP timestamps in order.
   1193 The timestamp
   1194 values are as received and before processing by the various data
   1195 smoothing and mitigation algorithms.
   1196 .It Cm sysstats
   1197 Enables recording of ntpd statistics counters on a periodic basis.
   1198 Each
   1199 hour a line of the following form is appended to the file generation
   1200 set named
   1201 .Cm sysstats :
   1202 .Bd -literal
   1203 50928 2132.543 36000 81965 0 9546 56 71793 512 540 10 147
   1204 .Ed
   1205 .Pp
   1206 The first two fields show the date (Modified Julian Day) and time
   1207 (seconds and fraction past UTC midnight).
   1208 The remaining ten fields show
   1209 the statistics counter values accumulated since the last generated
   1210 line.
   1211 .Bl -tag -width indent
   1212 .It Time since restart Cm 36000
   1213 Time in hours since the system was last rebooted.
   1214 .It Packets received Cm 81965
   1215 Total number of packets received.
   1216 .It Packets processed Cm 0
   1217 Number of packets received in response to previous packets sent
   1218 .It Current version Cm 9546
   1219 Number of packets matching the current NTP version.
   1220 .It Previous version Cm 56
   1221 Number of packets matching the previous NTP version.
   1222 .It Bad version Cm 71793
   1223 Number of packets matching neither NTP version.
   1224 .It Access denied Cm 512
   1225 Number of packets denied access for any reason.
   1226 .It Bad length or format Cm 540
   1227 Number of packets with invalid length, format or port number.
   1228 .It Bad authentication Cm 10
   1229 Number of packets not verified as authentic.
   1230 .It Rate exceeded Cm 147
   1231 Number of packets discarded due to rate limitation.
   1232 .El
   1233 .It Cm statsdir Ar directory_path
   1234 Indicates the full path of a directory where statistics files
   1235 should be created (see below).
   1236 This keyword allows
   1237 the (otherwise constant)
   1238 .Cm filegen
   1239 filename prefix to be modified for file generation sets, which
   1240 is useful for handling statistics logs.
   1241 .It Cm filegen Ar name Xo
   1242 .Op Cm file Ar filename
   1243 .Op Cm type Ar typename
   1244 .Op Cm link | nolink
   1245 .Op Cm enable | disable
   1246 .Xc
   1247 Configures setting of generation file set name.
   1248 Generation
   1249 file sets provide a means for handling files that are
   1250 continuously growing during the lifetime of a server.
   1251 Server statistics are a typical example for such files.
   1252 Generation file sets provide access to a set of files used
   1253 to store the actual data.
   1254 At any time at most one element
   1255 of the set is being written to.
   1256 The type given specifies
   1257 when and how data will be directed to a new element of the set.
   1258 This way, information stored in elements of a file set
   1259 that are currently unused are available for administrational
   1260 operations without the risk of disturbing the operation of ntpd.
   1261 (Most important: they can be removed to free space for new data
   1262 produced.)
   1263 .Pp
   1264 Note that this command can be sent from the
   1265 .Xr ntpdc 1ntpdcmdoc
   1266 program running at a remote location.
   1267 .Bl -tag -width indent
   1268 .It Cm name
   1269 This is the type of the statistics records, as shown in the
   1270 .Cm statistics
   1271 command.
   1272 .It Cm file Ar filename
   1273 This is the file name for the statistics records.
   1274 Filenames of set
   1275 members are built from three concatenated elements
   1276 .Ar Cm prefix ,
   1277 .Ar Cm filename
   1278 and
   1279 .Ar Cm suffix :
   1280 .Bl -tag -width indent
   1281 .It Cm prefix
   1282 This is a constant filename path.
   1283 It is not subject to
   1284 modifications via the
   1285 .Ar filegen
   1286 option.
   1287 It is defined by the
   1288 server, usually specified as a compile-time constant.
   1289 It may,
   1290 however, be configurable for individual file generation sets
   1291 via other commands.
   1292 For example, the prefix used with
   1293 .Ar loopstats
   1294 and
   1295 .Ar peerstats
   1296 generation can be configured using the
   1297 .Ar statsdir
   1298 option explained above.
   1299 .It Cm filename
   1300 This string is directly concatenated to the prefix mentioned
   1301 above (no intervening
   1302 .Ql / ) .
   1303 This can be modified using
   1304 the file argument to the
   1305 .Ar filegen
   1306 statement.
   1307 No
   1308 .Pa ..
   1309 elements are
   1310 allowed in this component to prevent filenames referring to
   1311 parts outside the filesystem hierarchy denoted by
   1312 .Ar prefix .
   1313 .It Cm suffix
   1314 This part is reflects individual elements of a file set.
   1315 It is
   1316 generated according to the type of a file set.
   1317 .El
   1318 .It Cm type Ar typename
   1319 A file generation set is characterized by its type.
   1320 The following
   1321 types are supported:
   1322 .Bl -tag -width indent
   1323 .It Cm none
   1324 The file set is actually a single plain file.
   1325 .It Cm pid
   1326 One element of file set is used per incarnation of a ntpd
   1327 server.
   1328 This type does not perform any changes to file set
   1329 members during runtime, however it provides an easy way of
   1330 separating files belonging to different
   1331 .Xr ntpd 1ntpdmdoc
   1332 server incarnations.
   1333 The set member filename is built by appending a
   1334 .Ql \&.
   1335 to concatenated
   1336 .Ar prefix
   1337 and
   1338 .Ar filename
   1339 strings, and
   1340 appending the decimal representation of the process ID of the
   1341 .Xr ntpd 1ntpdmdoc
   1342 server process.
   1343 .It Cm day
   1344 One file generation set element is created per day.
   1345 A day is
   1346 defined as the period between 00:00 and 24:00 UTC.
   1347 The file set
   1348 member suffix consists of a
   1349 .Ql \&.
   1350 and a day specification in
   1351 the form
   1352 .Cm YYYYMMdd .
   1353 .Cm YYYY
   1354 is a 4-digit year number (e.g., 1992).
   1355 .Cm MM
   1356 is a two digit month number.
   1357 .Cm dd
   1358 is a two digit day number.
   1359 Thus, all information written at 10 December 1992 would end up
   1360 in a file named
   1361 .Ar prefix
   1362 .Ar filename Ns .19921210 .
   1363 .It Cm week
   1364 Any file set member contains data related to a certain week of
   1365 a year.
   1366 The term week is defined by computing day-of-year
   1367 modulo 7.
   1368 Elements of such a file generation set are
   1369 distinguished by appending the following suffix to the file set
   1370 filename base: A dot, a 4-digit year number, the letter
   1371 .Cm W ,
   1372 and a 2-digit week number.
   1373 For example, information from January,
   1374 10th 1992 would end up in a file with suffix
   1375 .No . Ns Ar 1992W1 .
   1376 .It Cm month
   1377 One generation file set element is generated per month.
   1378 The
   1379 file name suffix consists of a dot, a 4-digit year number, and
   1380 a 2-digit month.
   1381 .It Cm year
   1382 One generation file element is generated per year.
   1383 The filename
   1384 suffix consists of a dot and a 4 digit year number.
   1385 .It Cm age
   1386 This type of file generation sets changes to a new element of
   1387 the file set every 24 hours of server operation.
   1388 The filename
   1389 suffix consists of a dot, the letter
   1390 .Cm a ,
   1391 and an 8-digit number.
   1392 This number is taken to be the number of seconds the server is
   1393 running at the start of the corresponding 24-hour period.
   1394 Information is only written to a file generation by specifying
   1395 .Cm enable ;
   1396 output is prevented by specifying
   1397 .Cm disable .
   1398 .El
   1399 .It Cm link | nolink
   1400 It is convenient to be able to access the current element of a file
   1401 generation set by a fixed name.
   1402 This feature is enabled by
   1403 specifying
   1404 .Cm link
   1405 and disabled using
   1406 .Cm nolink .
   1407 If link is specified, a
   1408 hard link from the current file set element to a file without
   1409 suffix is created.
   1410 When there is already a file with this name and
   1411 the number of links of this file is one, it is renamed appending a
   1412 dot, the letter
   1413 .Cm C ,
   1414 and the pid of the
   1415 .Xr ntpd 1ntpdmdoc
   1416 server process.
   1417 When the
   1418 number of links is greater than one, the file is unlinked.
   1419 This
   1420 allows the current file to be accessed by a constant name.
   1421 .It Cm enable \&| Cm disable
   1422 Enables or disables the recording function.
   1423 .El
   1424 .El
   1425 .El
   1426 .Sh Access Control Support
   1427 The
   1428 .Xr ntpd 1ntpdmdoc
   1429 daemon implements a general purpose address/mask based restriction
   1430 list.
   1431 The list contains address/match entries sorted first
   1432 by increasing address values and and then by increasing mask values.
   1433 A match occurs when the bitwise AND of the mask and the packet
   1434 source address is equal to the bitwise AND of the mask and
   1435 address in the list.
   1436 The list is searched in order with the
   1437 last match found defining the restriction flags associated
   1438 with the entry.
   1439 Additional information and examples can be found in the
   1440 .Qq Notes on Configuring NTP and Setting up a NTP Subnet
   1441 page
   1442 (available as part of the HTML documentation
   1443 provided in
   1444 .Pa /usr/share/doc/ntp ) .
   1445 .Pp
   1446 The restriction facility was implemented in conformance
   1447 with the access policies for the original NSFnet backbone
   1448 time servers.
   1449 Later the facility was expanded to deflect
   1450 cryptographic and clogging attacks.
   1451 While this facility may
   1452 be useful for keeping unwanted or broken or malicious clients
   1453 from congesting innocent servers, it should not be considered
   1454 an alternative to the NTP authentication facilities.
   1455 Source address based restrictions are easily circumvented
   1456 by a determined cracker.
   1457 .Pp
   1458 Clients can be denied service because they are explicitly
   1459 included in the restrict list created by the
   1460 .Ic restrict
   1461 command
   1462 or implicitly as the result of cryptographic or rate limit
   1463 violations.
   1464 Cryptographic violations include certificate
   1465 or identity verification failure; rate limit violations generally
   1466 result from defective NTP implementations that send packets
   1467 at abusive rates.
   1468 Some violations cause denied service
   1469 only for the offending packet, others cause denied service
   1470 for a timed period and others cause the denied service for
   1471 an indefinite period.
   1472 When a client or network is denied access
   1473 for an indefinite period, the only way at present to remove
   1474 the restrictions is by restarting the server.
   1475 .Ss The Kiss-of-Death Packet
   1476 Ordinarily, packets denied service are simply dropped with no
   1477 further action except incrementing statistics counters.
   1478 Sometimes a
   1479 more proactive response is needed, such as a server message that
   1480 explicitly requests the client to stop sending and leave a message
   1481 for the system operator.
   1482 A special packet format has been created
   1483 for this purpose called the "kiss-of-death" (KoD) packet.
   1484 KoD packets have the leap bits set unsynchronized and stratum set
   1485 to zero and the reference identifier field set to a four-byte
   1486 ASCII code.
   1487 If the
   1488 .Cm noserve
   1489 or
   1490 .Cm notrust
   1491 flag of the matching restrict list entry is set,
   1492 the code is "DENY"; if the
   1493 .Cm limited
   1494 flag is set and the rate limit
   1495 is exceeded, the code is "RATE".
   1496 Finally, if a cryptographic violation occurs, the code is "CRYP".
   1497 .Pp
   1498 A client receiving a KoD performs a set of sanity checks to
   1499 minimize security exposure, then updates the stratum and
   1500 reference identifier peer variables, sets the access
   1501 denied (TEST4) bit in the peer flash variable and sends
   1502 a message to the log.
   1503 As long as the TEST4 bit is set,
   1504 the client will send no further packets to the server.
   1505 The only way at present to recover from this condition is
   1506 to restart the protocol at both the client and server.
   1507 This
   1508 happens automatically at the client when the association times out.
   1509 It will happen at the server only if the server operator cooperates.
   1510 .Ss Access Control Commands
   1511 .Bl -tag -width indent
   1512 .It Xo Ic discard
   1513 .Op Cm average Ar avg
   1514 .Op Cm minimum Ar min
   1515 .Op Cm monitor Ar prob
   1516 .Xc
   1517 Set the parameters of the
   1518 .Cm limited
   1519 facility which protects the server from
   1520 client abuse.
   1521 The
   1522 .Cm average
   1523 subcommand specifies the minimum average packet
   1524 spacing, while the
   1525 .Cm minimum
   1526 subcommand specifies the minimum packet spacing.
   1527 Packets that violate these minima are discarded
   1528 and a kiss-o'-death packet returned if enabled.
   1529 The default
   1530 minimum average and minimum are 5 and 2, respectively.
   1531 The
   1532 .Ic monitor
   1533 subcommand specifies the probability of discard
   1534 for packets that overflow the rate-control window.
   1535 .It Xo Ic restrict address
   1536 .Op Cm mask Ar mask
   1537 .Op Ar flag ...
   1538 .Xc
   1539 The
   1540 .Ar address
   1541 argument expressed in
   1542 dotted-quad form is the address of a host or network.
   1543 Alternatively, the
   1544 .Ar address
   1545 argument can be a valid host DNS name.
   1546 The
   1547 .Ar mask
   1548 argument expressed in dotted-quad form defaults to
   1549 .Cm 255.255.255.255 ,
   1550 meaning that the
   1551 .Ar address
   1552 is treated as the address of an individual host.
   1553 A default entry (address
   1554 .Cm 0.0.0.0 ,
   1555 mask
   1556 .Cm 0.0.0.0 )
   1557 is always included and is always the first entry in the list.
   1558 Note that text string
   1559 .Cm default ,
   1560 with no mask option, may
   1561 be used to indicate the default entry.
   1562 In the current implementation,
   1563 .Cm flag
   1564 always
   1565 restricts access, i.e., an entry with no flags indicates that free
   1566 access to the server is to be given.
   1567 The flags are not orthogonal,
   1568 in that more restrictive flags will often make less restrictive
   1569 ones redundant.
   1570 The flags can generally be classed into two
   1571 categories, those which restrict time service and those which
   1572 restrict informational queries and attempts to do run-time
   1573 reconfiguration of the server.
   1574 One or more of the following flags
   1575 may be specified:
   1576 .Bl -tag -width indent
   1577 .It Cm ignore
   1578 Deny packets of all kinds, including
   1579 .Xr ntpq 1ntpqmdoc
   1580 and
   1581 .Xr ntpdc 1ntpdcmdoc
   1582 queries.
   1583 .It Cm kod
   1584 If this flag is set when an access violation occurs, a kiss-o'-death
   1585 (KoD) packet is sent.
   1586 KoD packets are rate limited to no more than one
   1587 per second.
   1588 If another KoD packet occurs within one second after the
   1589 last one, the packet is dropped.
   1590 .It Cm limited
   1591 Deny service if the packet spacing violates the lower limits specified
   1592 in the
   1593 .Ic discard
   1594 command.
   1595 A history of clients is kept using the
   1596 monitoring capability of
   1597 .Xr ntpd 1ntpdmdoc .
   1598 Thus, monitoring is always active as
   1599 long as there is a restriction entry with the
   1600 .Cm limited
   1601 flag.
   1602 .It Cm lowpriotrap
   1603 Declare traps set by matching hosts to be low priority.
   1604 The
   1605 number of traps a server can maintain is limited (the current limit
   1606 is 3).
   1607 Traps are usually assigned on a first come, first served
   1608 basis, with later trap requestors being denied service.
   1609 This flag
   1610 modifies the assignment algorithm by allowing low priority traps to
   1611 be overridden by later requests for normal priority traps.
   1612 .It Cm nomodify
   1613 Deny
   1614 .Xr ntpq 1ntpqmdoc
   1615 and
   1616 .Xr ntpdc 1ntpdcmdoc
   1617 queries which attempt to modify the state of the
   1618 server (i.e., run time reconfiguration).
   1619 Queries which return
   1620 information are permitted.
   1621 .It Cm noquery
   1622 Deny
   1623 .Xr ntpq 1ntpqmdoc
   1624 and
   1625 .Xr ntpdc 1ntpdcmdoc
   1626 queries.
   1627 Time service is not affected.
   1628 .It Cm nopeer
   1629 Deny packets which would result in mobilizing a new association.
   1630 This
   1631 includes broadcast and symmetric active packets when a configured
   1632 association does not exist.
   1633 It also includes
   1634 .Cm pool
   1635 associations, so if you want to use servers from a
   1636 .Cm pool
   1637 directive and also want to use
   1638 .Cm nopeer
   1639 by default, you'll want a
   1640 .Cm "restrict source ..." line as well that does
   1641 .It not
   1642 include the
   1643 .Cm nopeer
   1644 directive.
   1645 .It Cm noserve
   1646 Deny all packets except
   1647 .Xr ntpq 1ntpqmdoc
   1648 and
   1649 .Xr ntpdc 1ntpdcmdoc
   1650 queries.
   1651 .It Cm notrap
   1652 Decline to provide mode 6 control message trap service to matching
   1653 hosts.
   1654 The trap service is a subsystem of the
   1655 .Xr ntpq 1ntpqmdoc
   1656 control message
   1657 protocol which is intended for use by remote event logging programs.
   1658 .It Cm notrust
   1659 Deny service unless the packet is cryptographically authenticated.
   1660 .It Cm ntpport
   1661 This is actually a match algorithm modifier, rather than a
   1662 restriction flag.
   1663 Its presence causes the restriction entry to be
   1664 matched only if the source port in the packet is the standard NTP
   1665 UDP port (123).
   1666 Both
   1667 .Cm ntpport
   1668 and
   1669 .Cm non-ntpport
   1670 may
   1671 be specified.
   1672 The
   1673 .Cm ntpport
   1674 is considered more specific and
   1675 is sorted later in the list.
   1676 .It Cm version
   1677 Deny packets that do not match the current NTP version.
   1678 .El
   1679 .Pp
   1680 Default restriction list entries with the flags ignore, interface,
   1681 ntpport, for each of the local host's interface addresses are
   1682 inserted into the table at startup to prevent the server
   1683 from attempting to synchronize to its own time.
   1684 A default entry is also always present, though if it is
   1685 otherwise unconfigured; no flags are associated
   1686 with the default entry (i.e., everything besides your own
   1687 NTP server is unrestricted).
   1688 .El
   1689 .Sh Automatic NTP Configuration Options
   1690 .Ss Manycasting
   1691 Manycasting is a automatic discovery and configuration paradigm
   1692 new to NTPv4.
   1693 It is intended as a means for a multicast client
   1694 to troll the nearby network neighborhood to find cooperating
   1695 manycast servers, validate them using cryptographic means
   1696 and evaluate their time values with respect to other servers
   1697 that might be lurking in the vicinity.
   1698 The intended result is that each manycast client mobilizes
   1699 client associations with some number of the "best"
   1700 of the nearby manycast servers, yet automatically reconfigures
   1701 to sustain this number of servers should one or another fail.
   1702 .Pp
   1703 Note that the manycasting paradigm does not coincide
   1704 with the anycast paradigm described in RFC-1546,
   1705 which is designed to find a single server from a clique
   1706 of servers providing the same service.
   1707 The manycast paradigm is designed to find a plurality
   1708 of redundant servers satisfying defined optimality criteria.
   1709 .Pp
   1710 Manycasting can be used with either symmetric key
   1711 or public key cryptography.
   1712 The public key infrastructure (PKI)
   1713 offers the best protection against compromised keys
   1714 and is generally considered stronger, at least with relatively
   1715 large key sizes.
   1716 It is implemented using the Autokey protocol and
   1717 the OpenSSL cryptographic library available from
   1718 .Li http://www.openssl.org/ .
   1719 The library can also be used with other NTPv4 modes
   1720 as well and is highly recommended, especially for broadcast modes.
   1721 .Pp
   1722 A persistent manycast client association is configured
   1723 using the
   1724 .Ic manycastclient
   1725 command, which is similar to the
   1726 .Ic server
   1727 command but with a multicast (IPv4 class
   1728 .Cm D
   1729 or IPv6 prefix
   1730 .Cm FF )
   1731 group address.
   1732 The IANA has designated IPv4 address 224.1.1.1
   1733 and IPv6 address FF05::101 (site local) for NTP.
   1734 When more servers are needed, it broadcasts manycast
   1735 client messages to this address at the minimum feasible rate
   1736 and minimum feasible time-to-live (TTL) hops, depending
   1737 on how many servers have already been found.
   1738 There can be as many manycast client associations
   1739 as different group address, each one serving as a template
   1740 for a future ephemeral unicast client/server association.
   1741 .Pp
   1742 Manycast servers configured with the
   1743 .Ic manycastserver
   1744 command listen on the specified group address for manycast
   1745 client messages.
   1746 Note the distinction between manycast client,
   1747 which actively broadcasts messages, and manycast server,
   1748 which passively responds to them.
   1749 If a manycast server is
   1750 in scope of the current TTL and is itself synchronized
   1751 to a valid source and operating at a stratum level equal
   1752 to or lower than the manycast client, it replies to the
   1753 manycast client message with an ordinary unicast server message.
   1754 .Pp
   1755 The manycast client receiving this message mobilizes
   1756 an ephemeral client/server association according to the
   1757 matching manycast client template, but only if cryptographically
   1758 authenticated and the server stratum is less than or equal
   1759 to the client stratum.
   1760 Authentication is explicitly required
   1761 and either symmetric key or public key (Autokey) can be used.
   1762 Then, the client polls the server at its unicast address
   1763 in burst mode in order to reliably set the host clock
   1764 and validate the source.
   1765 This normally results
   1766 in a volley of eight client/server at 2-s intervals
   1767 during which both the synchronization and cryptographic
   1768 protocols run concurrently.
   1769 Following the volley,
   1770 the client runs the NTP intersection and clustering
   1771 algorithms, which act to discard all but the "best"
   1772 associations according to stratum and synchronization
   1773 distance.
   1774 The surviving associations then continue
   1775 in ordinary client/server mode.
   1776 .Pp
   1777 The manycast client polling strategy is designed to reduce
   1778 as much as possible the volume of manycast client messages
   1779 and the effects of implosion due to near-simultaneous
   1780 arrival of manycast server messages.
   1781 The strategy is determined by the
   1782 .Ic manycastclient ,
   1783 .Ic tos
   1784 and
   1785 .Ic ttl
   1786 configuration commands.
   1787 The manycast poll interval is
   1788 normally eight times the system poll interval,
   1789 which starts out at the
   1790 .Cm minpoll
   1791 value specified in the
   1792 .Ic manycastclient ,
   1793 command and, under normal circumstances, increments to the
   1794 .Cm maxpolll
   1795 value specified in this command.
   1796 Initially, the TTL is
   1797 set at the minimum hops specified by the
   1798 .Ic ttl
   1799 command.
   1800 At each retransmission the TTL is increased until reaching
   1801 the maximum hops specified by this command or a sufficient
   1802 number client associations have been found.
   1803 Further retransmissions use the same TTL.
   1804 .Pp
   1805 The quality and reliability of the suite of associations
   1806 discovered by the manycast client is determined by the NTP
   1807 mitigation algorithms and the
   1808 .Cm minclock
   1809 and
   1810 .Cm minsane
   1811 values specified in the
   1812 .Ic tos
   1813 configuration command.
   1814 At least
   1815 .Cm minsane
   1816 candidate servers must be available and the mitigation
   1817 algorithms produce at least
   1818 .Cm minclock
   1819 survivors in order to synchronize the clock.
   1820 Byzantine agreement principles require at least four
   1821 candidates in order to correctly discard a single falseticker.
   1822 For legacy purposes,
   1823 .Cm minsane
   1824 defaults to 1 and
   1825 .Cm minclock
   1826 defaults to 3.
   1827 For manycast service
   1828 .Cm minsane
   1829 should be explicitly set to 4, assuming at least that
   1830 number of servers are available.
   1831 .Pp
   1832 If at least
   1833 .Cm minclock
   1834 servers are found, the manycast poll interval is immediately
   1835 set to eight times
   1836 .Cm maxpoll .
   1837 If less than
   1838 .Cm minclock
   1839 servers are found when the TTL has reached the maximum hops,
   1840 the manycast poll interval is doubled.
   1841 For each transmission
   1842 after that, the poll interval is doubled again until
   1843 reaching the maximum of eight times
   1844 .Cm maxpoll .
   1845 Further transmissions use the same poll interval and
   1846 TTL values.
   1847 Note that while all this is going on,
   1848 each client/server association found is operating normally
   1849 it the system poll interval.
   1850 .Pp
   1851 Administratively scoped multicast boundaries are normally
   1852 specified by the network router configuration and,
   1853 in the case of IPv6, the link/site scope prefix.
   1854 By default, the increment for TTL hops is 32 starting
   1855 from 31; however, the
   1856 .Ic ttl
   1857 configuration command can be
   1858 used to modify the values to match the scope rules.
   1859 .Pp
   1860 It is often useful to narrow the range of acceptable
   1861 servers which can be found by manycast client associations.
   1862 Because manycast servers respond only when the client
   1863 stratum is equal to or greater than the server stratum,
   1864 primary (stratum 1) servers fill find only primary servers
   1865 in TTL range, which is probably the most common objective.
   1866 However, unless configured otherwise, all manycast clients
   1867 in TTL range will eventually find all primary servers
   1868 in TTL range, which is probably not the most common
   1869 objective in large networks.
   1870 The
   1871 .Ic tos
   1872 command can be used to modify this behavior.
   1873 Servers with stratum below
   1874 .Cm floor
   1875 or above
   1876 .Cm ceiling
   1877 specified in the
   1878 .Ic tos
   1879 command are strongly discouraged during the selection
   1880 process; however, these servers may be temporally
   1881 accepted if the number of servers within TTL range is
   1882 less than
   1883 .Cm minclock .
   1884 .Pp
   1885 The above actions occur for each manycast client message,
   1886 which repeats at the designated poll interval.
   1887 However, once the ephemeral client association is mobilized,
   1888 subsequent manycast server replies are discarded,
   1889 since that would result in a duplicate association.
   1890 If during a poll interval the number of client associations
   1891 falls below
   1892 .Cm minclock ,
   1893 all manycast client prototype associations are reset
   1894 to the initial poll interval and TTL hops and operation
   1895 resumes from the beginning.
   1896 It is important to avoid
   1897 frequent manycast client messages, since each one requires
   1898 all manycast servers in TTL range to respond.
   1899 The result could well be an implosion, either minor or major,
   1900 depending on the number of servers in range.
   1901 The recommended value for
   1902 .Cm maxpoll
   1903 is 12 (4,096 s).
   1904 .Pp
   1905 It is possible and frequently useful to configure a host
   1906 as both manycast client and manycast server.
   1907 A number of hosts configured this way and sharing a common
   1908 group address will automatically organize themselves
   1909 in an optimum configuration based on stratum and
   1910 synchronization distance.
   1911 For example, consider an NTP
   1912 subnet of two primary servers and a hundred or more
   1913 dependent clients.
   1914 With two exceptions, all servers
   1915 and clients have identical configuration files including both
   1916 .Ic multicastclient
   1917 and
   1918 .Ic multicastserver
   1919 commands using, for instance, multicast group address
   1920 239.1.1.1.
   1921 The only exception is that each primary server
   1922 configuration file must include commands for the primary
   1923 reference source such as a GPS receiver.
   1924 .Pp
   1925 The remaining configuration files for all secondary
   1926 servers and clients have the same contents, except for the
   1927 .Ic tos
   1928 command, which is specific for each stratum level.
   1929 For stratum 1 and stratum 2 servers, that command is
   1930 not necessary.
   1931 For stratum 3 and above servers the
   1932 .Cm floor
   1933 value is set to the intended stratum number.
   1934 Thus, all stratum 3 configuration files are identical,
   1935 all stratum 4 files are identical and so forth.
   1936 .Pp
   1937 Once operations have stabilized in this scenario,
   1938 the primary servers will find the primary reference source
   1939 and each other, since they both operate at the same
   1940 stratum (1), but not with any secondary server or client,
   1941 since these operate at a higher stratum.
   1942 The secondary
   1943 servers will find the servers at the same stratum level.
   1944 If one of the primary servers loses its GPS receiver,
   1945 it will continue to operate as a client and other clients
   1946 will time out the corresponding association and
   1947 re-associate accordingly.
   1948 .Pp
   1949 Some administrators prefer to avoid running
   1950 .Xr ntpd 1ntpdmdoc
   1951 continuously and run either
   1952 .Xr sntp 1sntpmdoc
   1953 or
   1954 .Xr ntpd 1ntpdmdoc
   1955 .Fl q
   1956 as a cron job.
   1957 In either case the servers must be
   1958 configured in advance and the program fails if none are
   1959 available when the cron job runs.
   1960 A really slick
   1961 application of manycast is with
   1962 .Xr ntpd 1ntpdmdoc
   1963 .Fl q .
   1964 The program wakes up, scans the local landscape looking
   1965 for the usual suspects, selects the best from among
   1966 the rascals, sets the clock and then departs.
   1967 Servers do not have to be configured in advance and
   1968 all clients throughout the network can have the same
   1969 configuration file.
   1970 .Ss Manycast Interactions with Autokey
   1971 Each time a manycast client sends a client mode packet
   1972 to a multicast group address, all manycast servers
   1973 in scope generate a reply including the host name
   1974 and status word.
   1975 The manycast clients then run
   1976 the Autokey protocol, which collects and verifies
   1977 all certificates involved.
   1978 Following the burst interval
   1979 all but three survivors are cast off,
   1980 but the certificates remain in the local cache.
   1981 It often happens that several complete signing trails
   1982 from the client to the primary servers are collected in this way.
   1983 .Pp
   1984 About once an hour or less often if the poll interval
   1985 exceeds this, the client regenerates the Autokey key list.
   1986 This is in general transparent in client/server mode.
   1987 However, about once per day the server private value
   1988 used to generate cookies is refreshed along with all
   1989 manycast client associations.
   1990 In this case all
   1991 cryptographic values including certificates is refreshed.
   1992 If a new certificate has been generated since
   1993 the last refresh epoch, it will automatically revoke
   1994 all prior certificates that happen to be in the
   1995 certificate cache.
   1996 At the same time, the manycast
   1997 scheme starts all over from the beginning and
   1998 the expanding ring shrinks to the minimum and increments
   1999 from there while collecting all servers in scope.
   2000 .Ss Broadcast Options
   2001 .Bl -tag -width indent
   2002 .It Xo Ic tos
   2003 .Oo
   2004 .Cm bcpollbstep Ar gate
   2005 .Oc
   2006 .Xc
   2007 This command provides a way to delay,
   2008 by the specified number of broadcast poll intervals,
   2009 believing backward time steps from a broadcast server.
   2010 Broadcast time networks are expected to be trusted.
   2011 In the event a broadcast server's time is stepped backwards,
   2012 there is clear benefit to having the clients notice this change
   2013 as soon as possible.
   2014 Attacks such as replay attacks can happen, however,
   2015 and even though there are a number of protections built in to
   2016 broadcast mode, attempts to perform  a replay attack are possible.
   2017 This value defaults to 0, but can be changed
   2018 to any number of poll intervals between 0 and 4.
   2019 .Ss Manycast Options
   2020 .Bl -tag -width indent
   2021 .It Xo Ic tos
   2022 .Oo
   2023 .Cm ceiling Ar ceiling |
   2024 .Cm cohort { 0 | 1 } |
   2025 .Cm floor Ar floor |
   2026 .Cm minclock Ar minclock |
   2027 .Cm minsane Ar minsane
   2028 .Oc
   2029 .Xc
   2030 This command affects the clock selection and clustering
   2031 algorithms.
   2032 It can be used to select the quality and
   2033 quantity of peers used to synchronize the system clock
   2034 and is most useful in manycast mode.
   2035 The variables operate
   2036 as follows:
   2037 .Bl -tag -width indent
   2038 .It Cm ceiling Ar ceiling
   2039 Peers with strata above
   2040 .Cm ceiling
   2041 will be discarded if there are at least
   2042 .Cm minclock
   2043 peers remaining.
   2044 This value defaults to 15, but can be changed
   2045 to any number from 1 to 15.
   2046 .It Cm cohort Bro 0 | 1 Brc
   2047 This is a binary flag which enables (0) or disables (1)
   2048 manycast server replies to manycast clients with the same
   2049 stratum level.
   2050 This is useful to reduce implosions where
   2051 large numbers of clients with the same stratum level
   2052 are present.
   2053 The default is to enable these replies.
   2054 .It Cm floor Ar floor
   2055 Peers with strata below
   2056 .Cm floor
   2057 will be discarded if there are at least
   2058 .Cm minclock
   2059 peers remaining.
   2060 This value defaults to 1, but can be changed
   2061 to any number from 1 to 15.
   2062 .It Cm minclock Ar minclock
   2063 The clustering algorithm repeatedly casts out outlier
   2064 associations until no more than
   2065 .Cm minclock
   2066 associations remain.
   2067 This value defaults to 3,
   2068 but can be changed to any number from 1 to the number of
   2069 configured sources.
   2070 .It Cm minsane Ar minsane
   2071 This is the minimum number of candidates available
   2072 to the clock selection algorithm in order to produce
   2073 one or more truechimers for the clustering algorithm.
   2074 If fewer than this number are available, the clock is
   2075 undisciplined and allowed to run free.
   2076 The default is 1
   2077 for legacy purposes.
   2078 However, according to principles of
   2079 Byzantine agreement,
   2080 .Cm minsane
   2081 should be at least 4 in order to detect and discard
   2082 a single falseticker.
   2083 .El
   2084 .It Cm ttl Ar hop ...
   2085 This command specifies a list of TTL values in increasing
   2086 order, up to 8 values can be specified.
   2087 In manycast mode these values are used in turn
   2088 in an expanding-ring search.
   2089 The default is eight
   2090 multiples of 32 starting at 31.
   2091 .El
   2092 .Sh Reference Clock Support
   2093 The NTP Version 4 daemon supports some three dozen different radio,
   2094 satellite and modem reference clocks plus a special pseudo-clock
   2095 used for backup or when no other clock source is available.
   2096 Detailed descriptions of individual device drivers and options can
   2097 be found in the
   2098 .Qq Reference Clock Drivers
   2099 page
   2100 (available as part of the HTML documentation
   2101 provided in
   2102 .Pa /usr/share/doc/ntp ) .
   2103 Additional information can be found in the pages linked
   2104 there, including the
   2105 .Qq Debugging Hints for Reference Clock Drivers
   2106 and
   2107 .Qq How To Write a Reference Clock Driver
   2108 pages
   2109 (available as part of the HTML documentation
   2110 provided in
   2111 .Pa /usr/share/doc/ntp ) .
   2112 In addition, support for a PPS
   2113 signal is available as described in the
   2114 .Qq Pulse-per-second (PPS) Signal Interfacing
   2115 page
   2116 (available as part of the HTML documentation
   2117 provided in
   2118 .Pa /usr/share/doc/ntp ) .
   2119 Many
   2120 drivers support special line discipline/streams modules which can
   2121 significantly improve the accuracy using the driver.
   2122 These are
   2123 described in the
   2124 .Qq Line Disciplines and Streams Drivers
   2125 page
   2126 (available as part of the HTML documentation
   2127 provided in
   2128 .Pa /usr/share/doc/ntp ) .
   2129 .Pp
   2130 A reference clock will generally (though not always) be a radio
   2131 timecode receiver which is synchronized to a source of standard
   2132 time such as the services offered by the NRC in Canada and NIST and
   2133 USNO in the US.
   2134 The interface between the computer and the timecode
   2135 receiver is device dependent, but is usually a serial port.
   2136 A
   2137 device driver specific to each reference clock must be selected and
   2138 compiled in the distribution; however, most common radio, satellite
   2139 and modem clocks are included by default.
   2140 Note that an attempt to
   2141 configure a reference clock when the driver has not been compiled
   2142 or the hardware port has not been appropriately configured results
   2143 in a scalding remark to the system log file, but is otherwise non
   2144 hazardous.
   2145 .Pp
   2146 For the purposes of configuration,
   2147 .Xr ntpd 1ntpdmdoc
   2148 treats
   2149 reference clocks in a manner analogous to normal NTP peers as much
   2150 as possible.
   2151 Reference clocks are identified by a syntactically
   2152 correct but invalid IP address, in order to distinguish them from
   2153 normal NTP peers.
   2154 Reference clock addresses are of the form
   2155 .Sm off
   2156 .Li 127.127. Ar t . Ar u ,
   2157 .Sm on
   2158 where
   2159 .Ar t
   2160 is an integer
   2161 denoting the clock type and
   2162 .Ar u
   2163 indicates the unit
   2164 number in the range 0-3.
   2165 While it may seem overkill, it is in fact
   2166 sometimes useful to configure multiple reference clocks of the same
   2167 type, in which case the unit numbers must be unique.
   2168 .Pp
   2169 The
   2170 .Ic server
   2171 command is used to configure a reference
   2172 clock, where the
   2173 .Ar address
   2174 argument in that command
   2175 is the clock address.
   2176 The
   2177 .Cm key ,
   2178 .Cm version
   2179 and
   2180 .Cm ttl
   2181 options are not used for reference clock support.
   2182 The
   2183 .Cm mode
   2184 option is added for reference clock support, as
   2185 described below.
   2186 The
   2187 .Cm prefer
   2188 option can be useful to
   2189 persuade the server to cherish a reference clock with somewhat more
   2190 enthusiasm than other reference clocks or peers.
   2191 Further
   2192 information on this option can be found in the
   2193 .Qq Mitigation Rules and the prefer Keyword
   2194 (available as part of the HTML documentation
   2195 provided in
   2196 .Pa /usr/share/doc/ntp )
   2197 page.
   2198 The
   2199 .Cm minpoll
   2200 and
   2201 .Cm maxpoll
   2202 options have
   2203 meaning only for selected clock drivers.
   2204 See the individual clock
   2205 driver document pages for additional information.
   2206 .Pp
   2207 The
   2208 .Ic fudge
   2209 command is used to provide additional
   2210 information for individual clock drivers and normally follows
   2211 immediately after the
   2212 .Ic server
   2213 command.
   2214 The
   2215 .Ar address
   2216 argument specifies the clock address.
   2217 The
   2218 .Cm refid
   2219 and
   2220 .Cm stratum
   2221 options can be used to
   2222 override the defaults for the device.
   2223 There are two optional
   2224 device-dependent time offsets and four flags that can be included
   2225 in the
   2226 .Ic fudge
   2227 command as well.
   2228 .Pp
   2229 The stratum number of a reference clock is by default zero.
   2230 Since the
   2231 .Xr ntpd 1ntpdmdoc
   2232 daemon adds one to the stratum of each
   2233 peer, a primary server ordinarily displays an external stratum of
   2234 one.
   2235 In order to provide engineered backups, it is often useful to
   2236 specify the reference clock stratum as greater than zero.
   2237 The
   2238 .Cm stratum
   2239 option is used for this purpose.
   2240 Also, in cases
   2241 involving both a reference clock and a pulse-per-second (PPS)
   2242 discipline signal, it is useful to specify the reference clock
   2243 identifier as other than the default, depending on the driver.
   2244 The
   2245 .Cm refid
   2246 option is used for this purpose.
   2247 Except where noted,
   2248 these options apply to all clock drivers.
   2249 .Ss Reference Clock Commands
   2250 .Bl -tag -width indent
   2251 .It Xo Ic server
   2252 .Sm off
   2253 .Li 127.127. Ar t . Ar u
   2254 .Sm on
   2255 .Op Cm prefer
   2256 .Op Cm mode Ar int
   2257 .Op Cm minpoll Ar int
   2258 .Op Cm maxpoll Ar int
   2259 .Xc
   2260 This command can be used to configure reference clocks in
   2261 special ways.
   2262 The options are interpreted as follows:
   2263 .Bl -tag -width indent
   2264 .It Cm prefer
   2265 Marks the reference clock as preferred.
   2266 All other things being
   2267 equal, this host will be chosen for synchronization among a set of
   2268 correctly operating hosts.
   2269 See the
   2270 .Qq Mitigation Rules and the prefer Keyword
   2271 page
   2272 (available as part of the HTML documentation
   2273 provided in
   2274 .Pa /usr/share/doc/ntp )
   2275 for further information.
   2276 .It Cm mode Ar int
   2277 Specifies a mode number which is interpreted in a
   2278 device-specific fashion.
   2279 For instance, it selects a dialing
   2280 protocol in the ACTS driver and a device subtype in the
   2281 parse
   2282 drivers.
   2283 .It Cm minpoll Ar int
   2284 .It Cm maxpoll Ar int
   2285 These options specify the minimum and maximum polling interval
   2286 for reference clock messages, as a power of 2 in seconds
   2287 For
   2288 most directly connected reference clocks, both
   2289 .Cm minpoll
   2290 and
   2291 .Cm maxpoll
   2292 default to 6 (64 s).
   2293 For modem reference clocks,
   2294 .Cm minpoll
   2295 defaults to 10 (17.1 m) and
   2296 .Cm maxpoll
   2297 defaults to 14 (4.5 h).
   2298 The allowable range is 4 (16 s) to 17 (36.4 h) inclusive.
   2299 .El
   2300 .It Xo Ic fudge
   2301 .Sm off
   2302 .Li 127.127. Ar t . Ar u
   2303 .Sm on
   2304 .Op Cm time1 Ar sec
   2305 .Op Cm time2 Ar sec
   2306 .Op Cm stratum Ar int
   2307 .Op Cm refid Ar string
   2308 .Op Cm mode Ar int
   2309 .Op Cm flag1 Cm 0 \&| Cm 1
   2310 .Op Cm flag2 Cm 0 \&| Cm 1
   2311 .Op Cm flag3 Cm 0 \&| Cm 1
   2312 .Op Cm flag4 Cm 0 \&| Cm 1
   2313 .Xc
   2314 This command can be used to configure reference clocks in
   2315 special ways.
   2316 It must immediately follow the
   2317 .Ic server
   2318 command which configures the driver.
   2319 Note that the same capability
   2320 is possible at run time using the
   2321 .Xr ntpdc 1ntpdcmdoc
   2322 program.
   2323 The options are interpreted as
   2324 follows:
   2325 .Bl -tag -width indent
   2326 .It Cm time1 Ar sec
   2327 Specifies a constant to be added to the time offset produced by
   2328 the driver, a fixed-point decimal number in seconds.
   2329 This is used
   2330 as a calibration constant to adjust the nominal time offset of a
   2331 particular clock to agree with an external standard, such as a
   2332 precision PPS signal.
   2333 It also provides a way to correct a
   2334 systematic error or bias due to serial port or operating system
   2335 latencies, different cable lengths or receiver internal delay.
   2336 The
   2337 specified offset is in addition to the propagation delay provided
   2338 by other means, such as internal DIPswitches.
   2339 Where a calibration
   2340 for an individual system and driver is available, an approximate
   2341 correction is noted in the driver documentation pages.
   2342 Note: in order to facilitate calibration when more than one
   2343 radio clock or PPS signal is supported, a special calibration
   2344 feature is available.
   2345 It takes the form of an argument to the
   2346 .Ic enable
   2347 command described in
   2348 .Sx Miscellaneous Options
   2349 page and operates as described in the
   2350 .Qq Reference Clock Drivers
   2351 page
   2352 (available as part of the HTML documentation
   2353 provided in
   2354 .Pa /usr/share/doc/ntp ) .
   2355 .It Cm time2 Ar secs
   2356 Specifies a fixed-point decimal number in seconds, which is
   2357 interpreted in a driver-dependent way.
   2358 See the descriptions of
   2359 specific drivers in the
   2360 .Qq Reference Clock Drivers
   2361 page
   2362 (available as part of the HTML documentation
   2363 provided in
   2364 .Pa /usr/share/doc/ntp ) .
   2365 .It Cm stratum Ar int
   2366 Specifies the stratum number assigned to the driver, an integer
   2367 between 0 and 15.
   2368 This number overrides the default stratum number
   2369 ordinarily assigned by the driver itself, usually zero.
   2370 .It Cm refid Ar string
   2371 Specifies an ASCII string of from one to four characters which
   2372 defines the reference identifier used by the driver.
   2373 This string
   2374 overrides the default identifier ordinarily assigned by the driver
   2375 itself.
   2376 .It Cm mode Ar int
   2377 Specifies a mode number which is interpreted in a
   2378 device-specific fashion.
   2379 For instance, it selects a dialing
   2380 protocol in the ACTS driver and a device subtype in the
   2381 parse
   2382 drivers.
   2383 .It Cm flag1 Cm 0 \&| Cm 1
   2384 .It Cm flag2 Cm 0 \&| Cm 1
   2385 .It Cm flag3 Cm 0 \&| Cm 1
   2386 .It Cm flag4 Cm 0 \&| Cm 1
   2387 These four flags are used for customizing the clock driver.
   2388 The
   2389 interpretation of these values, and whether they are used at all,
   2390 is a function of the particular clock driver.
   2391 However, by
   2392 convention
   2393 .Cm flag4
   2394 is used to enable recording monitoring
   2395 data to the
   2396 .Cm clockstats
   2397 file configured with the
   2398 .Ic filegen
   2399 command.
   2400 Further information on the
   2401 .Ic filegen
   2402 command can be found in
   2403 .Sx Monitoring Options .
   2404 .El
   2405 .El
   2406 .Sh Miscellaneous Options
   2407 .Bl -tag -width indent
   2408 .It Ic broadcastdelay Ar seconds
   2409 The broadcast and multicast modes require a special calibration
   2410 to determine the network delay between the local and remote
   2411 servers.
   2412 Ordinarily, this is done automatically by the initial
   2413 protocol exchanges between the client and server.
   2414 In some cases,
   2415 the calibration procedure may fail due to network or server access
   2416 controls, for example.
   2417 This command specifies the default delay to
   2418 be used under these circumstances.
   2419 Typically (for Ethernet), a
   2420 number between 0.003 and 0.007 seconds is appropriate.
   2421 The default
   2422 when this command is not used is 0.004 seconds.
   2423 .It Ic calldelay Ar delay
   2424 This option controls the delay in seconds between the first and second
   2425 packets sent in burst or iburst mode to allow additional time for a modem
   2426 or ISDN call to complete.
   2427 .It Ic driftfile Ar driftfile
   2428 This command specifies the complete path and name of the file used to
   2429 record the frequency of the local clock oscillator.
   2430 This is the same
   2431 operation as the
   2432 .Fl f
   2433 command line option.
   2434 If the file exists, it is read at
   2435 startup in order to set the initial frequency and then updated once per
   2436 hour with the current frequency computed by the daemon.
   2437 If the file name is
   2438 specified, but the file itself does not exist, the starts with an initial
   2439 frequency of zero and creates the file when writing it for the first time.
   2440 If this command is not given, the daemon will always start with an initial
   2441 frequency of zero.
   2442 .Pp
   2443 The file format consists of a single line containing a single
   2444 floating point number, which records the frequency offset measured
   2445 in parts-per-million (PPM).
   2446 The file is updated by first writing
   2447 the current drift value into a temporary file and then renaming
   2448 this file to replace the old version.
   2449 This implies that
   2450 .Xr ntpd 1ntpdmdoc
   2451 must have write permission for the directory the
   2452 drift file is located in, and that file system links, symbolic or
   2453 otherwise, should be avoided.
   2454 .It Ic dscp Ar value
   2455 This option specifies the Differentiated Services Control Point (DSCP) value,
   2456 a 6-bit code.
   2457 The default value is 46, signifying Expedited Forwarding.
   2458 .It Xo Ic enable
   2459 .Oo
   2460 .Cm auth | Cm bclient |
   2461 .Cm calibrate | Cm kernel |
   2462 .Cm mode7 | Cm monitor |
   2463 .Cm ntp | Cm stats |
   2464 .Cm peer_clear_digest_early |
   2465 .Cm unpeer_crypto_early | Cm unpeer_crypto_nak_early | Cm unpeer_digest_early
   2466 .Oc
   2467 .Xc
   2468 .It Xo Ic disable
   2469 .Oo
   2470 .Cm auth | Cm bclient |
   2471 .Cm calibrate | Cm kernel |
   2472 .Cm mode7 | Cm monitor |
   2473 .Cm ntp | Cm stats |
   2474 .Cm peer_clear_digest_early |
   2475 .Cm unpeer_crypto_early | Cm unpeer_crypto_nak_early | Cm unpeer_digest_early
   2476 .Oc
   2477 .Xc
   2478 Provides a way to enable or disable various server options.
   2479 Flags not mentioned are unaffected.
   2480 Note that all of these flags
   2481 can be controlled remotely using the
   2482 .Xr ntpdc 1ntpdcmdoc
   2483 utility program.
   2484 .Bl -tag -width indent
   2485 .It Cm auth
   2486 Enables the server to synchronize with unconfigured peers only if the
   2487 peer has been correctly authenticated using either public key or
   2488 private key cryptography.
   2489 The default for this flag is
   2490 .Ic enable .
   2491 .It Cm bclient
   2492 Enables the server to listen for a message from a broadcast or
   2493 multicast server, as in the
   2494 .Ic multicastclient
   2495 command with default
   2496 address.
   2497 The default for this flag is
   2498 .Ic disable .
   2499 .It Cm calibrate
   2500 Enables the calibrate feature for reference clocks.
   2501 The default for
   2502 this flag is
   2503 .Ic disable .
   2504 .It Cm kernel
   2505 Enables the kernel time discipline, if available.
   2506 The default for this
   2507 flag is
   2508 .Ic enable
   2509 if support is available, otherwise
   2510 .Ic disable .
   2511 .It Cm mode7
   2512 Enables processing of NTP mode 7 implementation-specific requests
   2513 which are used by the deprecated
   2514 .Xr ntpdc 1ntpdcmdoc
   2515 program.
   2516 The default for this flag is disable.
   2517 This flag is excluded from runtime configuration using
   2518 .Xr ntpq 1ntpqmdoc .
   2519 The
   2520 .Xr ntpq 1ntpqmdoc
   2521 program provides the same capabilities as
   2522 .Xr ntpdc 1ntpdcmdoc
   2523 using standard mode 6 requests.
   2524 .It Cm monitor
   2525 Enables the monitoring facility.
   2526 See the
   2527 .Xr ntpdc 1ntpdcmdoc
   2528 program
   2529 and the
   2530 .Ic monlist
   2531 command or further information.
   2532 The
   2533 default for this flag is
   2534 .Ic enable .
   2535 .It Cm ntp
   2536 Enables time and frequency discipline.
   2537 In effect, this switch opens and
   2538 closes the feedback loop, which is useful for testing.
   2539 The default for
   2540 this flag is
   2541 .Ic enable .
   2542 .It Cm peer_clear_digest_early
   2543 By default, if
   2544 .Xr ntpd 1ntpdmdoc
   2545 is using autokey and it
   2546 receives a crypto-NAK packet that
   2547 passes the duplicate packet and origin timestamp checks
   2548 the peer variables are immediately cleared.
   2549 While this is generally a feature
   2550 as it allows for quick recovery if a server key has changed,
   2551 a properly forged and appropriately delivered crypto-NAK packet
   2552 can be used in a DoS attack.
   2553 If you have active noticable problems with this type of DoS attack
   2554 then you should consider
   2555 disabling this option.
   2556 You can check your
   2557 .Cm peerstats
   2558 file for evidence of any of these attacks.
   2559 The
   2560 default for this flag is
   2561 .Ic enable .
   2562 .It Cm stats
   2563 Enables the statistics facility.
   2564 See the
   2565 .Sx Monitoring Options
   2566 section for further information.
   2567 The default for this flag is
   2568 .Ic disable .
   2569 .It Cm unpeer_crypto_early
   2570 By default, if
   2571 .Xr ntpd 1ntpdmdoc
   2572 receives an autokey packet that fails TEST9,
   2573 a crypto failure,
   2574 the association is immediately cleared.
   2575 This is almost certainly a feature,
   2576 but if, in spite of the current recommendation of not using autokey,
   2577 you are
   2578 .B still
   2579 using autokey
   2580 .B and
   2581 you are seeing this sort of DoS attack
   2582 disabling this flag will delay
   2583 tearing down the association until the reachability counter
   2584 becomes zero.
   2585 You can check your
   2586 .Cm peerstats
   2587 file for evidence of any of these attacks.
   2588 The
   2589 default for this flag is
   2590 .Ic enable .
   2591 .It Cm unpeer_crypto_nak_early
   2592 By default, if
   2593 .Xr ntpd 1ntpdmdoc
   2594 receives a crypto-NAK packet that
   2595 passes the duplicate packet and origin timestamp checks
   2596 the association is immediately cleared.
   2597 While this is generally a feature
   2598 as it allows for quick recovery if a server key has changed,
   2599 a properly forged and appropriately delivered crypto-NAK packet
   2600 can be used in a DoS attack.
   2601 If you have active noticable problems with this type of DoS attack
   2602 then you should consider
   2603 disabling this option.
   2604 You can check your
   2605 .Cm peerstats
   2606 file for evidence of any of these attacks.
   2607 The
   2608 default for this flag is
   2609 .Ic enable .
   2610 .It Cm unpeer_digest_early
   2611 By default, if
   2612 .Xr ntpd 1ntpdmdoc
   2613 receives what should be an authenticated packet
   2614 that passes other packet sanity checks but
   2615 contains an invalid digest
   2616 the association is immediately cleared.
   2617 While this is generally a feature
   2618 as it allows for quick recovery,
   2619 if this type of packet is carefully forged and sent
   2620 during an appropriate window it can be used for a DoS attack.
   2621 If you have active noticable problems with this type of DoS attack
   2622 then you should consider
   2623 disabling this option.
   2624 You can check your
   2625 .Cm peerstats
   2626 file for evidence of any of these attacks.
   2627 The
   2628 default for this flag is
   2629 .Ic enable .
   2630 .El
   2631 .It Ic includefile Ar includefile
   2632 This command allows additional configuration commands
   2633 to be included from a separate file.
   2634 Include files may
   2635 be nested to a depth of five; upon reaching the end of any
   2636 include file, command processing resumes in the previous
   2637 configuration file.
   2638 This option is useful for sites that run
   2639 .Xr ntpd 1ntpdmdoc
   2640 on multiple hosts, with (mostly) common options (e.g., a
   2641 restriction list).
   2642 .It Ic leapsmearinterval Ar seconds
   2643 This EXPERIMENTAL option is only available if
   2644 .Xr ntpd 1ntpdmdoc
   2645 was built with the
   2646 .Cm --enable-leap-smear
   2647 option to the
   2648 .Cm configure
   2649 script.
   2650 It specifies the interval over which a leap second correction will be applied.
   2651 Recommended values for this option are between
   2652 7200 (2 hours) and 86400 (24 hours).
   2653 .Sy DO NOT USE THIS OPTION ON PUBLIC-ACCESS SERVERS!
   2654 See http://bugs.ntp.org/2855 for more information.
   2655 .It Ic logconfig Ar configkeyword
   2656 This command controls the amount and type of output written to
   2657 the system
   2658 .Xr syslog 3
   2659 facility or the alternate
   2660 .Ic logfile
   2661 log file.
   2662 By default, all output is turned on.
   2663 All
   2664 .Ar configkeyword
   2665 keywords can be prefixed with
   2666 .Ql = ,
   2667 .Ql +
   2668 and
   2669 .Ql - ,
   2670 where
   2671 .Ql =
   2672 sets the
   2673 .Xr syslog 3
   2674 priority mask,
   2675 .Ql +
   2676 adds and
   2677 .Ql -
   2678 removes
   2679 messages.
   2680 .Xr syslog 3
   2681 messages can be controlled in four
   2682 classes
   2683 .Po
   2684 .Cm clock ,
   2685 .Cm peer ,
   2686 .Cm sys
   2687 and
   2688 .Cm sync
   2689 .Pc .
   2690 Within these classes four types of messages can be
   2691 controlled: informational messages
   2692 .Po
   2693 .Cm info
   2694 .Pc ,
   2695 event messages
   2696 .Po
   2697 .Cm events
   2698 .Pc ,
   2699 statistics messages
   2700 .Po
   2701 .Cm statistics
   2702 .Pc
   2703 and
   2704 status messages
   2705 .Po
   2706 .Cm status
   2707 .Pc .
   2708 .Pp
   2709 Configuration keywords are formed by concatenating the message class with
   2710 the event class.
   2711 The
   2712 .Cm all
   2713 prefix can be used instead of a message class.
   2714 A
   2715 message class may also be followed by the
   2716 .Cm all
   2717 keyword to enable/disable all
   2718 messages of the respective message class.
   2719 Thus, a minimal log configuration
   2720 could look like this:
   2721 .Bd -literal
   2722 logconfig =syncstatus +sysevents
   2723 .Ed
   2724 .Pp
   2725 This would just list the synchronizations state of
   2726 .Xr ntpd 1ntpdmdoc
   2727 and the major system events.
   2728 For a simple reference server, the
   2729 following minimum message configuration could be useful:
   2730 .Bd -literal
   2731 logconfig =syncall +clockall
   2732 .Ed
   2733 .Pp
   2734 This configuration will list all clock information and
   2735 synchronization information.
   2736 All other events and messages about
   2737 peers, system events and so on is suppressed.
   2738 .It Ic logfile Ar logfile
   2739 This command specifies the location of an alternate log file to
   2740 be used instead of the default system
   2741 .Xr syslog 3
   2742 facility.
   2743 This is the same operation as the
   2744 .Fl l
   2745 command line option.
   2746 .It Ic setvar Ar variable Op Cm default
   2747 This command adds an additional system variable.
   2748 These
   2749 variables can be used to distribute additional information such as
   2750 the access policy.
   2751 If the variable of the form
   2752 .Sm off
   2753 .Va name = Ar value
   2754 .Sm on
   2755 is followed by the
   2756 .Cm default
   2757 keyword, the
   2758 variable will be listed as part of the default system variables
   2759 .Po
   2760 .Xr ntpq 1ntpqmdoc
   2761 .Ic rv
   2762 command
   2763 .Pc ) .
   2764 These additional variables serve
   2765 informational purposes only.
   2766 They are not related to the protocol
   2767 other that they can be listed.
   2768 The known protocol variables will
   2769 always override any variables defined via the
   2770 .Ic setvar
   2771 mechanism.
   2772 There are three special variables that contain the names
   2773 of all variable of the same group.
   2774 The
   2775 .Va sys_var_list
   2776 holds
   2777 the names of all system variables.
   2778 The
   2779 .Va peer_var_list
   2780 holds
   2781 the names of all peer variables and the
   2782 .Va clock_var_list
   2783 holds the names of the reference clock variables.
   2784 .It Xo Ic tinker
   2785 .Oo
   2786 .Cm allan Ar allan |
   2787 .Cm dispersion Ar dispersion |
   2788 .Cm freq Ar freq |
   2789 .Cm huffpuff Ar huffpuff |
   2790 .Cm panic Ar panic |
   2791 .Cm step Ar step |
   2792 .Cm stepback Ar stepback |
   2793 .Cm stepfwd Ar stepfwd |
   2794 .Cm stepout Ar stepout
   2795 .Oc
   2796 .Xc
   2797 This command can be used to alter several system variables in
   2798 very exceptional circumstances.
   2799 It should occur in the
   2800 configuration file before any other configuration options.
   2801 The
   2802 default values of these variables have been carefully optimized for
   2803 a wide range of network speeds and reliability expectations.
   2804 In
   2805 general, they interact in intricate ways that are hard to predict
   2806 and some combinations can result in some very nasty behavior.
   2807 Very
   2808 rarely is it necessary to change the default values; but, some
   2809 folks cannot resist twisting the knobs anyway and this command is
   2810 for them.
   2811 Emphasis added: twisters are on their own and can expect
   2812 no help from the support group.
   2813 .Pp
   2814 The variables operate as follows:
   2815 .Bl -tag -width indent
   2816 .It Cm allan Ar allan
   2817 The argument becomes the new value for the minimum Allan
   2818 intercept, which is a parameter of the PLL/FLL clock discipline
   2819 algorithm.
   2820 The value in log2 seconds defaults to 7 (1024 s), which is also the lower
   2821 limit.
   2822 .It Cm dispersion Ar dispersion
   2823 The argument becomes the new value for the dispersion increase rate,
   2824 normally .000015 s/s.
   2825 .It Cm freq Ar freq
   2826 The argument becomes the initial value of the frequency offset in
   2827 parts-per-million.
   2828 This overrides the value in the frequency file, if
   2829 present, and avoids the initial training state if it is not.
   2830 .It Cm huffpuff Ar huffpuff
   2831 The argument becomes the new value for the experimental
   2832 huff-n'-puff filter span, which determines the most recent interval
   2833 the algorithm will search for a minimum delay.
   2834 The lower limit is
   2835 900 s (15 m), but a more reasonable value is 7200 (2 hours).
   2836 There
   2837 is no default, since the filter is not enabled unless this command
   2838 is given.
   2839 .It Cm panic Ar panic
   2840 The argument is the panic threshold, normally 1000 s.
   2841 If set to zero,
   2842 the panic sanity check is disabled and a clock offset of any value will
   2843 be accepted.
   2844 .It Cm step Ar step
   2845 The argument is the step threshold, which by default is 0.128 s.
   2846 It can
   2847 be set to any positive number in seconds.
   2848 If set to zero, step
   2849 adjustments will never occur.
   2850 Note: The kernel time discipline is
   2851 disabled if the step threshold is set to zero or greater than the
   2852 default.
   2853 .It Cm stepback Ar stepback
   2854 The argument is the step threshold for the backward direction,
   2855 which by default is 0.128 s.
   2856 It can
   2857 be set to any positive number in seconds.
   2858 If both the forward and backward step thresholds are set to zero, step
   2859 adjustments will never occur.
   2860 Note: The kernel time discipline is
   2861 disabled if
   2862 each direction of step threshold are either
   2863 set to zero or greater than .5 second.
   2864 .It Cm stepfwd Ar stepfwd
   2865 As for stepback, but for the forward direction.
   2866 .It Cm stepout Ar stepout
   2867 The argument is the stepout timeout, which by default is 900 s.
   2868 It can
   2869 be set to any positive number in seconds.
   2870 If set to zero, the stepout
   2871 pulses will not be suppressed.
   2872 .El
   2873 .It Xo Ic rlimit
   2874 .Oo
   2875 .Cm memlock Ar Nmegabytes |
   2876 .Cm stacksize Ar N4kPages
   2877 .Cm filenum Ar Nfiledescriptors
   2878 .Oc
   2879 .Xc
   2880 .Bl -tag -width indent
   2881 .It Cm memlock Ar Nmegabytes
   2882 Specify the number of megabytes of memory that should be
   2883 allocated and locked.
   2884 Probably only available under Linux, this option may be useful
   2885 when dropping root (the
   2886 .Fl i
   2887 option).
   2888 The default is 32 megabytes on non-Linux machines, and -1 under Linux.
   2889 -1 means "do not lock the process into memory".
   2890 0 means "lock whatever memory the process wants into memory".
   2891 .It Cm stacksize Ar N4kPages
   2892 Specifies the maximum size of the process stack on systems with the
   2893 .Fn mlockall
   2894 function.
   2895 Defaults to 50 4k pages (200 4k pages in OpenBSD).
   2896 .It Cm filenum Ar Nfiledescriptors
   2897 Specifies the maximum number of file descriptors ntpd may have open at once.
   2898 Defaults to the system default.
   2899 .El
   2900 .It Xo Ic trap Ar host_address
   2901 .Op Cm port Ar port_number
   2902 .Op Cm interface Ar interface_address
   2903 .Xc
   2904 This command configures a trap receiver at the given host
   2905 address and port number for sending messages with the specified
   2906 local interface address.
   2907 If the port number is unspecified, a value
   2908 of 18447 is used.
   2909 If the interface address is not specified, the
   2910 message is sent with a source address of the local interface the
   2911 message is sent through.
   2912 Note that on a multihomed host the
   2913 interface used may vary from time to time with routing changes.
   2914 .Pp
   2915 The trap receiver will generally log event messages and other
   2916 information from the server in a log file.
   2917 While such monitor
   2918 programs may also request their own trap dynamically, configuring a
   2919 trap receiver will ensure that no messages are lost when the server
   2920 is started.
   2921 .It Cm hop Ar ...
   2922 This command specifies a list of TTL values in increasing order, up to 8
   2923 values can be specified.
   2924 In manycast mode these values are used in turn in
   2925 an expanding-ring search.
   2926 The default is eight multiples of 32 starting at
   2927 31.
   2928 .El
   2929 	_END_PROG_MDOC_DESCRIP;
   2930 };
   2931 
   2932 doc-section	= {
   2933   ds-type	= 'FILES';
   2934   ds-format	= 'mdoc';
   2935   ds-text	= <<- _END_MDOC_FILES
   2936 .Bl -tag -width /etc/ntp.drift -compact
   2937 .It Pa /etc/ntp.conf
   2938 the default name of the configuration file
   2939 .It Pa ntp.keys
   2940 private MD5 keys
   2941 .It Pa ntpkey
   2942 RSA private key
   2943 .It Pa ntpkey_ Ns Ar host
   2944 RSA public key
   2945 .It Pa ntp_dh
   2946 Diffie-Hellman agreement parameters
   2947 .El
   2948 	_END_MDOC_FILES;
   2949 };
   2950 
   2951 doc-section	= {
   2952   ds-type	= 'SEE ALSO';
   2953   ds-format	= 'mdoc';
   2954   ds-text	= <<- _END_MDOC_SEE_ALSO
   2955 .Xr ntpd 1ntpdmdoc ,
   2956 .Xr ntpdc 1ntpdcmdoc ,
   2957 .Xr ntpq 1ntpqmdoc
   2958 .Pp
   2959 In addition to the manual pages provided,
   2960 comprehensive documentation is available on the world wide web
   2961 at
   2962 .Li http://www.ntp.org/ .
   2963 A snapshot of this documentation is available in HTML format in
   2964 .Pa /usr/share/doc/ntp .
   2965 .Rs
   2966 .%A David L. Mills
   2967 .%T Network Time Protocol (Version 4)
   2968 .%O RFC5905
   2969 .Re
   2970 	_END_MDOC_SEE_ALSO;
   2971 };
   2972 
   2973 doc-section	= {
   2974   ds-type	= 'BUGS';
   2975   ds-format	= 'mdoc';
   2976   ds-text	= <<- _END_MDOC_BUGS
   2977 The syntax checking is not picky; some combinations of
   2978 ridiculous and even hilarious options and modes may not be
   2979 detected.
   2980 .Pp
   2981 The
   2982 .Pa ntpkey_ Ns Ar host
   2983 files are really digital
   2984 certificates.
   2985 These should be obtained via secure directory
   2986 services when they become universally available.
   2987 	_END_MDOC_BUGS;
   2988 };
   2989 
   2990 doc-section	= {
   2991   ds-type	= 'NOTES';
   2992   ds-format	= 'mdoc';
   2993   ds-text	= <<- _END_MDOC_NOTES
   2994 This document was derived from FreeBSD.
   2995 	_END_MDOC_NOTES;
   2996 };
   2997