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