ntp.conf.def revision 1.1.1.1.4.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, four 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 Cm noserve
1583 Deny all packets except
1584 .Xr ntpq 1ntpqmdoc
1585 and
1586 .Xr ntpdc 1ntpdcmdoc
1587 queries.
1588 .It Cm notrap
1589 Decline to provide mode 6 control message trap service to matching
1590 hosts.
1591 The trap service is a subsystem of the ntpdq control message
1592 protocol which is intended for use by remote event logging programs.
1593 .It Cm notrust
1594 Deny service unless the packet is cryptographically authenticated.
1595 .It Cm ntpport
1596 This is actually a match algorithm modifier, rather than a
1597 restriction flag.
1598 Its presence causes the restriction entry to be
1599 matched only if the source port in the packet is the standard NTP
1600 UDP port (123).
1601 Both
1602 .Cm ntpport
1603 and
1604 .Cm non-ntpport
1605 may
1606 be specified.
1607 The
1608 .Cm ntpport
1609 is considered more specific and
1610 is sorted later in the list.
1611 .It Cm version
1612 Deny packets that do not match the current NTP version.
1613 .El
1614 .Pp
1615 Default restriction list entries with the flags ignore, interface,
1616 ntpport, for each of the local host's interface addresses are
1617 inserted into the table at startup to prevent the server
1618 from attempting to synchronize to its own time.
1619 A default entry is also always present, though if it is
1620 otherwise unconfigured; no flags are associated
1621 with the default entry (i.e., everything besides your own
1622 NTP server is unrestricted).
1623 .El
1624 .Sh Automatic NTP Configuration Options
1625 .Ss Manycasting
1626 Manycasting is a automatic discovery and configuration paradigm
1627 new to NTPv4.
1628 It is intended as a means for a multicast client
1629 to troll the nearby network neighborhood to find cooperating
1630 manycast servers, validate them using cryptographic means
1631 and evaluate their time values with respect to other servers
1632 that might be lurking in the vicinity.
1633 The intended result is that each manycast client mobilizes
1634 client associations with some number of the "best"
1635 of the nearby manycast servers, yet automatically reconfigures
1636 to sustain this number of servers should one or another fail.
1637 .Pp
1638 Note that the manycasting paradigm does not coincide
1639 with the anycast paradigm described in RFC-1546,
1640 which is designed to find a single server from a clique
1641 of servers providing the same service.
1642 The manycast paradigm is designed to find a plurality
1643 of redundant servers satisfying defined optimality criteria.
1644 .Pp
1645 Manycasting can be used with either symmetric key
1646 or public key cryptography.
1647 The public key infrastructure (PKI)
1648 offers the best protection against compromised keys
1649 and is generally considered stronger, at least with relatively
1650 large key sizes.
1651 It is implemented using the Autokey protocol and
1652 the OpenSSL cryptographic library available from
1653 .Li http://www.openssl.org/ .
1654 The library can also be used with other NTPv4 modes
1655 as well and is highly recommended, especially for broadcast modes.
1656 .Pp
1657 A persistent manycast client association is configured
1658 using the manycastclient command, which is similar to the
1659 server command but with a multicast (IPv4 class
1660 .Cm D
1661 or IPv6 prefix
1662 .Cm FF )
1663 group address.
1664 The IANA has designated IPv4 address 224.1.1.1
1665 and IPv6 address FF05::101 (site local) for NTP.
1666 When more servers are needed, it broadcasts manycast
1667 client messages to this address at the minimum feasible rate
1668 and minimum feasible time-to-live (TTL) hops, depending
1669 on how many servers have already been found.
1670 There can be as many manycast client associations
1671 as different group address, each one serving as a template
1672 for a future ephemeral unicast client/server association.
1673 .Pp
1674 Manycast servers configured with the
1675 .Ic manycastserver
1676 command listen on the specified group address for manycast
1677 client messages.
1678 Note the distinction between manycast client,
1679 which actively broadcasts messages, and manycast server,
1680 which passively responds to them.
1681 If a manycast server is
1682 in scope of the current TTL and is itself synchronized
1683 to a valid source and operating at a stratum level equal
1684 to or lower than the manycast client, it replies to the
1685 manycast client message with an ordinary unicast server message.
1686 .Pp
1687 The manycast client receiving this message mobilizes
1688 an ephemeral client/server association according to the
1689 matching manycast client template, but only if cryptographically
1690 authenticated and the server stratum is less than or equal
1691 to the client stratum.
1692 Authentication is explicitly required
1693 and either symmetric key or public key (Autokey) can be used.
1694 Then, the client polls the server at its unicast address
1695 in burst mode in order to reliably set the host clock
1696 and validate the source.
1697 This normally results
1698 in a volley of eight client/server at 2-s intervals
1699 during which both the synchronization and cryptographic
1700 protocols run concurrently.
1701 Following the volley,
1702 the client runs the NTP intersection and clustering
1703 algorithms, which act to discard all but the "best"
1704 associations according to stratum and synchronization
1705 distance.
1706 The surviving associations then continue
1707 in ordinary client/server mode.
1708 .Pp
1709 The manycast client polling strategy is designed to reduce
1710 as much as possible the volume of manycast client messages
1711 and the effects of implosion due to near-simultaneous
1712 arrival of manycast server messages.
1713 The strategy is determined by the
1714 .Ic manycastclient ,
1715 .Ic tos
1716 and
1717 .Ic ttl
1718 configuration commands.
1719 The manycast poll interval is
1720 normally eight times the system poll interval,
1721 which starts out at the
1722 .Cm minpoll
1723 value specified in the
1724 .Ic manycastclient ,
1725 command and, under normal circumstances, increments to the
1726 .Cm maxpolll
1727 value specified in this command.
1728 Initially, the TTL is
1729 set at the minimum hops specified by the ttl command.
1730 At each retransmission the TTL is increased until reaching
1731 the maximum hops specified by this command or a sufficient
1732 number client associations have been found.
1733 Further retransmissions use the same TTL.
1734 .Pp
1735 The quality and reliability of the suite of associations
1736 discovered by the manycast client is determined by the NTP
1737 mitigation algorithms and the
1738 .Cm minclock
1739 and
1740 .Cm minsane
1741 values specified in the
1742 .Ic tos
1743 configuration command.
1744 At least
1745 .Cm minsane
1746 candidate servers must be available and the mitigation
1747 algorithms produce at least
1748 .Cm minclock
1749 survivors in order to synchronize the clock.
1750 Byzantine agreement principles require at least four
1751 candidates in order to correctly discard a single falseticker.
1752 For legacy purposes,
1753 .Cm minsane
1754 defaults to 1 and
1755 .Cm minclock
1756 defaults to 3.
1757 For manycast service
1758 .Cm minsane
1759 should be explicitly set to 4, assuming at least that
1760 number of servers are available.
1761 .Pp
1762 If at least
1763 .Cm minclock
1764 servers are found, the manycast poll interval is immediately
1765 set to eight times
1766 .Cm maxpoll .
1767 If less than
1768 .Cm minclock
1769 servers are found when the TTL has reached the maximum hops,
1770 the manycast poll interval is doubled.
1771 For each transmission
1772 after that, the poll interval is doubled again until
1773 reaching the maximum of eight times
1774 .Cm maxpoll .
1775 Further transmissions use the same poll interval and
1776 TTL values.
1777 Note that while all this is going on,
1778 each client/server association found is operating normally
1779 it the system poll interval.
1780 .Pp
1781 Administratively scoped multicast boundaries are normally
1782 specified by the network router configuration and,
1783 in the case of IPv6, the link/site scope prefix.
1784 By default, the increment for TTL hops is 32 starting
1785 from 31; however, the
1786 .Ic ttl
1787 configuration command can be
1788 used to modify the values to match the scope rules.
1789 .Pp
1790 It is often useful to narrow the range of acceptable
1791 servers which can be found by manycast client associations.
1792 Because manycast servers respond only when the client
1793 stratum is equal to or greater than the server stratum,
1794 primary (stratum 1) servers fill find only primary servers
1795 in TTL range, which is probably the most common objective.
1796 However, unless configured otherwise, all manycast clients
1797 in TTL range will eventually find all primary servers
1798 in TTL range, which is probably not the most common
1799 objective in large networks.
1800 The
1801 .Ic tos
1802 command can be used to modify this behavior.
1803 Servers with stratum below
1804 .Cm floor
1805 or above
1806 .Cm ceiling
1807 specified in the
1808 .Ic tos
1809 command are strongly discouraged during the selection
1810 process; however, these servers may be temporally
1811 accepted if the number of servers within TTL range is
1812 less than
1813 .Cm minclock .
1814 .Pp
1815 The above actions occur for each manycast client message,
1816 which repeats at the designated poll interval.
1817 However, once the ephemeral client association is mobilized,
1818 subsequent manycast server replies are discarded,
1819 since that would result in a duplicate association.
1820 If during a poll interval the number of client associations
1821 falls below
1822 .Cm minclock ,
1823 all manycast client prototype associations are reset
1824 to the initial poll interval and TTL hops and operation
1825 resumes from the beginning.
1826 It is important to avoid
1827 frequent manycast client messages, since each one requires
1828 all manycast servers in TTL range to respond.
1829 The result could well be an implosion, either minor or major,
1830 depending on the number of servers in range.
1831 The recommended value for
1832 .Cm maxpoll
1833 is 12 (4,096 s).
1834 .Pp
1835 It is possible and frequently useful to configure a host
1836 as both manycast client and manycast server.
1837 A number of hosts configured this way and sharing a common
1838 group address will automatically organize themselves
1839 in an optimum configuration based on stratum and
1840 synchronization distance.
1841 For example, consider an NTP
1842 subnet of two primary servers and a hundred or more
1843 dependent clients.
1844 With two exceptions, all servers
1845 and clients have identical configuration files including both
1846 .Ic multicastclient
1847 and
1848 .Ic multicastserver
1849 commands using, for instance, multicast group address
1850 239.1.1.1.
1851 The only exception is that each primary server
1852 configuration file must include commands for the primary
1853 reference source such as a GPS receiver.
1854 .Pp
1855 The remaining configuration files for all secondary
1856 servers and clients have the same contents, except for the
1857 .Ic tos
1858 command, which is specific for each stratum level.
1859 For stratum 1 and stratum 2 servers, that command is
1860 not necessary.
1861 For stratum 3 and above servers the
1862 .Cm floor
1863 value is set to the intended stratum number.
1864 Thus, all stratum 3 configuration files are identical,
1865 all stratum 4 files are identical and so forth.
1866 .Pp
1867 Once operations have stabilized in this scenario,
1868 the primary servers will find the primary reference source
1869 and each other, since they both operate at the same
1870 stratum (1), but not with any secondary server or client,
1871 since these operate at a higher stratum.
1872 The secondary
1873 servers will find the servers at the same stratum level.
1874 If one of the primary servers loses its GPS receiver,
1875 it will continue to operate as a client and other clients
1876 will time out the corresponding association and
1877 re-associate accordingly.
1878 .Pp
1879 Some administrators prefer to avoid running
1880 .Xr ntpd 1ntpdmdoc
1881 continuously and run either
1882 .Xr ntpdate 8
1883 or
1884 .Xr ntpd 1ntpdmdoc
1885 .Fl q
1886 as a cron job.
1887 In either case the servers must be
1888 configured in advance and the program fails if none are
1889 available when the cron job runs.
1890 A really slick
1891 application of manycast is with
1892 .Xr ntpd 1ntpdmdoc
1893 .Fl q .
1894 The program wakes up, scans the local landscape looking
1895 for the usual suspects, selects the best from among
1896 the rascals, sets the clock and then departs.
1897 Servers do not have to be configured in advance and
1898 all clients throughout the network can have the same
1899 configuration file.
1900 .Ss Manycast Interactions with Autokey
1901 Each time a manycast client sends a client mode packet
1902 to a multicast group address, all manycast servers
1903 in scope generate a reply including the host name
1904 and status word.
1905 The manycast clients then run
1906 the Autokey protocol, which collects and verifies
1907 all certificates involved.
1908 Following the burst interval
1909 all but three survivors are cast off,
1910 but the certificates remain in the local cache.
1911 It often happens that several complete signing trails
1912 from the client to the primary servers are collected in this way.
1913 .Pp
1914 About once an hour or less often if the poll interval
1915 exceeds this, the client regenerates the Autokey key list.
1916 This is in general transparent in client/server mode.
1917 However, about once per day the server private value
1918 used to generate cookies is refreshed along with all
1919 manycast client associations.
1920 In this case all
1921 cryptographic values including certificates is refreshed.
1922 If a new certificate has been generated since
1923 the last refresh epoch, it will automatically revoke
1924 all prior certificates that happen to be in the
1925 certificate cache.
1926 At the same time, the manycast
1927 scheme starts all over from the beginning and
1928 the expanding ring shrinks to the minimum and increments
1929 from there while collecting all servers in scope.
1930 .Ss Manycast Options
1931 .Bl -tag -width indent
1932 .It Xo Ic tos
1933 .Oo
1934 .Cm ceiling Ar ceiling |
1935 .Cm cohort { 0 | 1 } |
1936 .Cm floor Ar floor |
1937 .Cm minclock Ar minclock |
1938 .Cm minsane Ar minsane
1939 .Oc
1940 .Xc
1941 This command affects the clock selection and clustering
1942 algorithms.
1943 It can be used to select the quality and
1944 quantity of peers used to synchronize the system clock
1945 and is most useful in manycast mode.
1946 The variables operate
1947 as follows:
1948 .Bl -tag -width indent
1949 .It Cm ceiling Ar ceiling
1950 Peers with strata above
1951 .Cm ceiling
1952 will be discarded if there are at least
1953 .Cm minclock
1954 peers remaining.
1955 This value defaults to 15, but can be changed
1956 to any number from 1 to 15.
1957 .It Cm cohort Bro 0 | 1 Brc
1958 This is a binary flag which enables (0) or disables (1)
1959 manycast server replies to manycast clients with the same
1960 stratum level.
1961 This is useful to reduce implosions where
1962 large numbers of clients with the same stratum level
1963 are present.
1964 The default is to enable these replies.
1965 .It Cm floor Ar floor
1966 Peers with strata below
1967 .Cm floor
1968 will be discarded if there are at least
1969 .Cm minclock
1970 peers remaining.
1971 This value defaults to 1, but can be changed
1972 to any number from 1 to 15.
1973 .It Cm minclock Ar minclock
1974 The clustering algorithm repeatedly casts out outlyer
1975 associations until no more than
1976 .Cm minclock
1977 associations remain.
1978 This value defaults to 3,
1979 but can be changed to any number from 1 to the number of
1980 configured sources.
1981 .It Cm minsane Ar minsane
1982 This is the minimum number of candidates available
1983 to the clock selection algorithm in order to produce
1984 one or more truechimers for the clustering algorithm.
1985 If fewer than this number are available, the clock is
1986 undisciplined and allowed to run free.
1987 The default is 1
1988 for legacy purposes.
1989 However, according to principles of
1990 Byzantine agreement,
1991 .Cm minsane
1992 should be at least 4 in order to detect and discard
1993 a single falseticker.
1994 .El
1995 .It Cm ttl Ar hop ...
1996 This command specifies a list of TTL values in increasing
1997 order, up to 8 values can be specified.
1998 In manycast mode these values are used in turn
1999 in an expanding-ring search.
2000 The default is eight
2001 multiples of 32 starting at 31.
2002 .El
2003 .Sh Reference Clock Support
2004 The NTP Version 4 daemon supports some three dozen different radio,
2005 satellite and modem reference clocks plus a special pseudo-clock
2006 used for backup or when no other clock source is available.
2007 Detailed descriptions of individual device drivers and options can
2008 be found in the
2009 .Qq Reference Clock Drivers
2010 page
2011 (available as part of the HTML documentation
2012 provided in
2013 .Pa /usr/share/doc/ntp ) .
2014 Additional information can be found in the pages linked
2015 there, including the
2016 .Qq Debugging Hints for Reference Clock Drivers
2017 and
2018 .Qq How To Write a Reference Clock Driver
2019 pages
2020 (available as part of the HTML documentation
2021 provided in
2022 .Pa /usr/share/doc/ntp ) .
2023 In addition, support for a PPS
2024 signal is available as described in the
2025 .Qq Pulse-per-second (PPS) Signal Interfacing
2026 page
2027 (available as part of the HTML documentation
2028 provided in
2029 .Pa /usr/share/doc/ntp ) .
2030 Many
2031 drivers support special line discipline/streams modules which can
2032 significantly improve the accuracy using the driver.
2033 These are
2034 described in the
2035 .Qq Line Disciplines and Streams Drivers
2036 page
2037 (available as part of the HTML documentation
2038 provided in
2039 .Pa /usr/share/doc/ntp ) .
2040 .Pp
2041 A reference clock will generally (though not always) be a radio
2042 timecode receiver which is synchronized to a source of standard
2043 time such as the services offered by the NRC in Canada and NIST and
2044 USNO in the US.
2045 The interface between the computer and the timecode
2046 receiver is device dependent, but is usually a serial port.
2047 A
2048 device driver specific to each reference clock must be selected and
2049 compiled in the distribution; however, most common radio, satellite
2050 and modem clocks are included by default.
2051 Note that an attempt to
2052 configure a reference clock when the driver has not been compiled
2053 or the hardware port has not been appropriately configured results
2054 in a scalding remark to the system log file, but is otherwise non
2055 hazardous.
2056 .Pp
2057 For the purposes of configuration,
2058 .Xr ntpd 1ntpdmdoc
2059 treats
2060 reference clocks in a manner analogous to normal NTP peers as much
2061 as possible.
2062 Reference clocks are identified by a syntactically
2063 correct but invalid IP address, in order to distinguish them from
2064 normal NTP peers.
2065 Reference clock addresses are of the form
2066 .Sm off
2067 .Li 127.127. Ar t . Ar u ,
2068 .Sm on
2069 where
2070 .Ar t
2071 is an integer
2072 denoting the clock type and
2073 .Ar u
2074 indicates the unit
2075 number in the range 0-3.
2076 While it may seem overkill, it is in fact
2077 sometimes useful to configure multiple reference clocks of the same
2078 type, in which case the unit numbers must be unique.
2079 .Pp
2080 The
2081 .Ic server
2082 command is used to configure a reference
2083 clock, where the
2084 .Ar address
2085 argument in that command
2086 is the clock address.
2087 The
2088 .Cm key ,
2089 .Cm version
2090 and
2091 .Cm ttl
2092 options are not used for reference clock support.
2093 The
2094 .Cm mode
2095 option is added for reference clock support, as
2096 described below.
2097 The
2098 .Cm prefer
2099 option can be useful to
2100 persuade the server to cherish a reference clock with somewhat more
2101 enthusiasm than other reference clocks or peers.
2102 Further
2103 information on this option can be found in the
2104 .Qq Mitigation Rules and the prefer Keyword
2105 (available as part of the HTML documentation
2106 provided in
2107 .Pa /usr/share/doc/ntp )
2108 page.
2109 The
2110 .Cm minpoll
2111 and
2112 .Cm maxpoll
2113 options have
2114 meaning only for selected clock drivers.
2115 See the individual clock
2116 driver document pages for additional information.
2117 .Pp
2118 The
2119 .Ic fudge
2120 command is used to provide additional
2121 information for individual clock drivers and normally follows
2122 immediately after the
2123 .Ic server
2124 command.
2125 The
2126 .Ar address
2127 argument specifies the clock address.
2128 The
2129 .Cm refid
2130 and
2131 .Cm stratum
2132 options can be used to
2133 override the defaults for the device.
2134 There are two optional
2135 device-dependent time offsets and four flags that can be included
2136 in the
2137 .Ic fudge
2138 command as well.
2139 .Pp
2140 The stratum number of a reference clock is by default zero.
2141 Since the
2142 .Xr ntpd 1ntpdmdoc
2143 daemon adds one to the stratum of each
2144 peer, a primary server ordinarily displays an external stratum of
2145 one.
2146 In order to provide engineered backups, it is often useful to
2147 specify the reference clock stratum as greater than zero.
2148 The
2149 .Cm stratum
2150 option is used for this purpose.
2151 Also, in cases
2152 involving both a reference clock and a pulse-per-second (PPS)
2153 discipline signal, it is useful to specify the reference clock
2154 identifier as other than the default, depending on the driver.
2155 The
2156 .Cm refid
2157 option is used for this purpose.
2158 Except where noted,
2159 these options apply to all clock drivers.
2160 .Ss Reference Clock Commands
2161 .Bl -tag -width indent
2162 .It Xo Ic server
2163 .Sm off
2164 .Li 127.127. Ar t . Ar u
2165 .Sm on
2166 .Op Cm prefer
2167 .Op Cm mode Ar int
2168 .Op Cm minpoll Ar int
2169 .Op Cm maxpoll Ar int
2170 .Xc
2171 This command can be used to configure reference clocks in
2172 special ways.
2173 The options are interpreted as follows:
2174 .Bl -tag -width indent
2175 .It Cm prefer
2176 Marks the reference clock as preferred.
2177 All other things being
2178 equal, this host will be chosen for synchronization among a set of
2179 correctly operating hosts.
2180 See the
2181 .Qq Mitigation Rules and the prefer Keyword
2182 page
2183 (available as part of the HTML documentation
2184 provided in
2185 .Pa /usr/share/doc/ntp )
2186 for further information.
2187 .It Cm mode Ar int
2188 Specifies a mode number which is interpreted in a
2189 device-specific fashion.
2190 For instance, it selects a dialing
2191 protocol in the ACTS driver and a device subtype in the
2192 parse
2193 drivers.
2194 .It Cm minpoll Ar int
2195 .It Cm maxpoll Ar int
2196 These options specify the minimum and maximum polling interval
2197 for reference clock messages, as a power of 2 in seconds
2198 For
2199 most directly connected reference clocks, both
2200 .Cm minpoll
2201 and
2202 .Cm maxpoll
2203 default to 6 (64 s).
2204 For modem reference clocks,
2205 .Cm minpoll
2206 defaults to 10 (17.1 m) and
2207 .Cm maxpoll
2208 defaults to 14 (4.5 h).
2209 The allowable range is 4 (16 s) to 17 (36.4 h) inclusive.
2210 .El
2211 .It Xo Ic fudge
2212 .Sm off
2213 .Li 127.127. Ar t . Ar u
2214 .Sm on
2215 .Op Cm time1 Ar sec
2216 .Op Cm time2 Ar sec
2217 .Op Cm stratum Ar int
2218 .Op Cm refid Ar string
2219 .Op Cm mode Ar int
2220 .Op Cm flag1 Cm 0 \&| Cm 1
2221 .Op Cm flag2 Cm 0 \&| Cm 1
2222 .Op Cm flag3 Cm 0 \&| Cm 1
2223 .Op Cm flag4 Cm 0 \&| Cm 1
2224 .Xc
2225 This command can be used to configure reference clocks in
2226 special ways.
2227 It must immediately follow the
2228 .Ic server
2229 command which configures the driver.
2230 Note that the same capability
2231 is possible at run time using the
2232 .Xr ntpdc 1ntpdcmdoc
2233 program.
2234 The options are interpreted as
2235 follows:
2236 .Bl -tag -width indent
2237 .It Cm time1 Ar sec
2238 Specifies a constant to be added to the time offset produced by
2239 the driver, a fixed-point decimal number in seconds.
2240 This is used
2241 as a calibration constant to adjust the nominal time offset of a
2242 particular clock to agree with an external standard, such as a
2243 precision PPS signal.
2244 It also provides a way to correct a
2245 systematic error or bias due to serial port or operating system
2246 latencies, different cable lengths or receiver internal delay.
2247 The
2248 specified offset is in addition to the propagation delay provided
2249 by other means, such as internal DIPswitches.
2250 Where a calibration
2251 for an individual system and driver is available, an approximate
2252 correction is noted in the driver documentation pages.
2253 Note: in order to facilitate calibration when more than one
2254 radio clock or PPS signal is supported, a special calibration
2255 feature is available.
2256 It takes the form of an argument to the
2257 .Ic enable
2258 command described in
2259 .Sx Miscellaneous Options
2260 page and operates as described in the
2261 .Qq Reference Clock Drivers
2262 page
2263 (available as part of the HTML documentation
2264 provided in
2265 .Pa /usr/share/doc/ntp ) .
2266 .It Cm time2 Ar secs
2267 Specifies a fixed-point decimal number in seconds, which is
2268 interpreted in a driver-dependent way.
2269 See the descriptions of
2270 specific drivers in the
2271 .Qq Reference Clock Drivers
2272 page
2273 (available as part of the HTML documentation
2274 provided in
2275 .Pa /usr/share/doc/ntp ) .
2276 .It Cm stratum Ar int
2277 Specifies the stratum number assigned to the driver, an integer
2278 between 0 and 15.
2279 This number overrides the default stratum number
2280 ordinarily assigned by the driver itself, usually zero.
2281 .It Cm refid Ar string
2282 Specifies an ASCII string of from one to four characters which
2283 defines the reference identifier used by the driver.
2284 This string
2285 overrides the default identifier ordinarily assigned by the driver
2286 itself.
2287 .It Cm mode Ar int
2288 Specifies a mode number which is interpreted in a
2289 device-specific fashion.
2290 For instance, it selects a dialing
2291 protocol in the ACTS driver and a device subtype in the
2292 parse
2293 drivers.
2294 .It Cm flag1 Cm 0 \&| Cm 1
2295 .It Cm flag2 Cm 0 \&| Cm 1
2296 .It Cm flag3 Cm 0 \&| Cm 1
2297 .It Cm flag4 Cm 0 \&| Cm 1
2298 These four flags are used for customizing the clock driver.
2299 The
2300 interpretation of these values, and whether they are used at all,
2301 is a function of the particular clock driver.
2302 However, by
2303 convention
2304 .Cm flag4
2305 is used to enable recording monitoring
2306 data to the
2307 .Cm clockstats
2308 file configured with the
2309 .Ic filegen
2310 command.
2311 Further information on the
2312 .Ic filegen
2313 command can be found in
2314 .Sx Monitoring Options .
2315 .El
2316 .El
2317 .Sh Miscellaneous Options
2318 .Bl -tag -width indent
2319 .It Ic broadcastdelay Ar seconds
2320 The broadcast and multicast modes require a special calibration
2321 to determine the network delay between the local and remote
2322 servers.
2323 Ordinarily, this is done automatically by the initial
2324 protocol exchanges between the client and server.
2325 In some cases,
2326 the calibration procedure may fail due to network or server access
2327 controls, for example.
2328 This command specifies the default delay to
2329 be used under these circumstances.
2330 Typically (for Ethernet), a
2331 number between 0.003 and 0.007 seconds is appropriate.
2332 The default
2333 when this command is not used is 0.004 seconds.
2334 .It Ic calldelay Ar delay
2335 This option controls the delay in seconds between the first and second
2336 packets sent in burst or iburst mode to allow additional time for a modem
2337 or ISDN call to complete.
2338 .It Ic driftfile Ar driftfile
2339 This command specifies the complete path and name of the file used to
2340 record the frequency of the local clock oscillator.
2341 This is the same
2342 operation as the
2343 .Fl f
2344 command line option.
2345 If the file exists, it is read at
2346 startup in order to set the initial frequency and then updated once per
2347 hour with the current frequency computed by the daemon.
2348 If the file name is
2349 specified, but the file itself does not exist, the starts with an initial
2350 frequency of zero and creates the file when writing it for the first time.
2351 If this command is not given, the daemon will always start with an initial
2352 frequency of zero.
2353 .Pp
2354 The file format consists of a single line containing a single
2355 floating point number, which records the frequency offset measured
2356 in parts-per-million (PPM).
2357 The file is updated by first writing
2358 the current drift value into a temporary file and then renaming
2359 this file to replace the old version.
2360 This implies that
2361 .Xr ntpd 1ntpdmdoc
2362 must have write permission for the directory the
2363 drift file is located in, and that file system links, symbolic or
2364 otherwise, should be avoided.
2365 .It Xo Ic enable
2366 .Oo
2367 .Cm auth | Cm bclient |
2368 .Cm calibrate | Cm kernel |
2369 .Cm monitor | Cm ntp |
2370 .Cm pps | Cm stats
2371 .Oc
2372 .Xc
2373 .It Xo Ic disable
2374 .Oo
2375 .Cm auth | Cm bclient |
2376 .Cm calibrate | Cm kernel |
2377 .Cm monitor | Cm ntp |
2378 .Cm pps | Cm stats
2379 .Oc
2380 .Xc
2381 Provides a way to enable or disable various server options.
2382 Flags not mentioned are unaffected.
2383 Note that all of these flags
2384 can be controlled remotely using the
2385 .Xr ntpdc 1ntpdcmdoc
2386 utility program.
2387 .Bl -tag -width indent
2388 .It Cm auth
2389 Enables the server to synchronize with unconfigured peers only if the
2390 peer has been correctly authenticated using either public key or
2391 private key cryptography.
2392 The default for this flag is
2393 .Ic enable .
2394 .It Cm bclient
2395 Enables the server to listen for a message from a broadcast or
2396 multicast server, as in the
2397 .Ic multicastclient
2398 command with default
2399 address.
2400 The default for this flag is
2401 .Ic disable .
2402 .It Cm calibrate
2403 Enables the calibrate feature for reference clocks.
2404 The default for
2405 this flag is
2406 .Ic disable .
2407 .It Cm kernel
2408 Enables the kernel time discipline, if available.
2409 The default for this
2410 flag is
2411 .Ic enable
2412 if support is available, otherwise
2413 .Ic disable .
2414 .It Cm monitor
2415 Enables the monitoring facility.
2416 See the
2417 .Xr ntpdc 1ntpdcmdoc
2418 program
2419 and the
2420 .Ic monlist
2421 command or further information.
2422 The
2423 default for this flag is
2424 .Ic enable .
2425 .It Cm ntp
2426 Enables time and frequency discipline.
2427 In effect, this switch opens and
2428 closes the feedback loop, which is useful for testing.
2429 The default for
2430 this flag is
2431 .Ic enable .
2432 .It Cm pps
2433 Enables the pulse-per-second (PPS) signal when frequency and time is
2434 disciplined by the precision time kernel modifications.
2435 See the
2436 .Qq A Kernel Model for Precision Timekeeping
2437 (available as part of the HTML documentation
2438 provided in
2439 .Pa /usr/share/doc/ntp )
2440 page for further information.
2441 The default for this flag is
2442 .Ic disable .
2443 .It Cm stats
2444 Enables the statistics facility.
2445 See the
2446 .Sx Monitoring Options
2447 section for further information.
2448 The default for this flag is
2449 .Ic disable .
2450 .El
2451 .It Ic includefile Ar includefile
2452 This command allows additional configuration commands
2453 to be included from a separate file.
2454 Include files may
2455 be nested to a depth of five; upon reaching the end of any
2456 include file, command processing resumes in the previous
2457 configuration file.
2458 This option is useful for sites that run
2459 .Xr ntpd 1ntpdmdoc
2460 on multiple hosts, with (mostly) common options (e.g., a
2461 restriction list).
2462 .It Ic logconfig Ar configkeyword
2463 This command controls the amount and type of output written to
2464 the system
2465 .Xr syslog 3
2466 facility or the alternate
2467 .Ic logfile
2468 log file.
2469 By default, all output is turned on.
2470 All
2471 .Ar configkeyword
2472 keywords can be prefixed with
2473 .Ql = ,
2474 .Ql +
2475 and
2476 .Ql - ,
2477 where
2478 .Ql =
2479 sets the
2480 .Xr syslog 3
2481 priority mask,
2482 .Ql +
2483 adds and
2484 .Ql -
2485 removes
2486 messages.
2487 .Xr syslog 3
2488 messages can be controlled in four
2489 classes
2490 .Po
2491 .Cm clock ,
2492 .Cm peer ,
2493 .Cm sys
2494 and
2495 .Cm sync
2496 .Pc .
2497 Within these classes four types of messages can be
2498 controlled: informational messages
2499 .Po
2500 .Cm info
2501 .Pc ,
2502 event messages
2503 .Po
2504 .Cm events
2505 .Pc ,
2506 statistics messages
2507 .Po
2508 .Cm statistics
2509 .Pc
2510 and
2511 status messages
2512 .Po
2513 .Cm status
2514 .Pc .
2515 .Pp
2516 Configuration keywords are formed by concatenating the message class with
2517 the event class.
2518 The
2519 .Cm all
2520 prefix can be used instead of a message class.
2521 A
2522 message class may also be followed by the
2523 .Cm all
2524 keyword to enable/disable all
2525 messages of the respective message class.Thus, a minimal log configuration
2526 could look like this:
2527 .Bd -literal
2528 logconfig =syncstatus +sysevents
2529 .Ed
2530 .Pp
2531 This would just list the synchronizations state of
2532 .Xr ntpd 1ntpdmdoc
2533 and the major system events.
2534 For a simple reference server, the
2535 following minimum message configuration could be useful:
2536 .Bd -literal
2537 logconfig =syncall +clockall
2538 .Ed
2539 .Pp
2540 This configuration will list all clock information and
2541 synchronization information.
2542 All other events and messages about
2543 peers, system events and so on is suppressed.
2544 .It Ic logfile Ar logfile
2545 This command specifies the location of an alternate log file to
2546 be used instead of the default system
2547 .Xr syslog 3
2548 facility.
2549 This is the same operation as the -l command line option.
2550 .It Ic setvar Ar variable Op Cm default
2551 This command adds an additional system variable.
2552 These
2553 variables can be used to distribute additional information such as
2554 the access policy.
2555 If the variable of the form
2556 .Sm off
2557 .Va name = Ar value
2558 .Sm on
2559 is followed by the
2560 .Cm default
2561 keyword, the
2562 variable will be listed as part of the default system variables
2563 .Po
2564 .Xr ntpq 1ntpqmdoc
2565 .Ic rv
2566 command
2567 .Pc ) .
2568 These additional variables serve
2569 informational purposes only.
2570 They are not related to the protocol
2571 other that they can be listed.
2572 The known protocol variables will
2573 always override any variables defined via the
2574 .Ic setvar
2575 mechanism.
2576 There are three special variables that contain the names
2577 of all variable of the same group.
2578 The
2579 .Va sys_var_list
2580 holds
2581 the names of all system variables.
2582 The
2583 .Va peer_var_list
2584 holds
2585 the names of all peer variables and the
2586 .Va clock_var_list
2587 holds the names of the reference clock variables.
2588 .It Xo Ic tinker
2589 .Oo
2590 .Cm allan Ar allan |
2591 .Cm dispersion Ar dispersion |
2592 .Cm freq Ar freq |
2593 .Cm huffpuff Ar huffpuff |
2594 .Cm panic Ar panic |
2595 .Cm step Ar srep |
2596 .Cm stepout Ar stepout
2597 .Oc
2598 .Xc
2599 This command can be used to alter several system variables in
2600 very exceptional circumstances.
2601 It should occur in the
2602 configuration file before any other configuration options.
2603 The
2604 default values of these variables have been carefully optimized for
2605 a wide range of network speeds and reliability expectations.
2606 In
2607 general, they interact in intricate ways that are hard to predict
2608 and some combinations can result in some very nasty behavior.
2609 Very
2610 rarely is it necessary to change the default values; but, some
2611 folks cannot resist twisting the knobs anyway and this command is
2612 for them.
2613 Emphasis added: twisters are on their own and can expect
2614 no help from the support group.
2615 .Pp
2616 The variables operate as follows:
2617 .Bl -tag -width indent
2618 .It Cm allan Ar allan
2619 The argument becomes the new value for the minimum Allan
2620 intercept, which is a parameter of the PLL/FLL clock discipline
2621 algorithm.
2622 The value in log2 seconds defaults to 7 (1024 s), which is also the lower
2623 limit.
2624 .It Cm dispersion Ar dispersion
2625 The argument becomes the new value for the dispersion increase rate,
2626 normally .000015 s/s.
2627 .It Cm freq Ar freq
2628 The argument becomes the initial value of the frequency offset in
2629 parts-per-million.
2630 This overrides the value in the frequency file, if
2631 present, and avoids the initial training state if it is not.
2632 .It Cm huffpuff Ar huffpuff
2633 The argument becomes the new value for the experimental
2634 huff-n'-puff filter span, which determines the most recent interval
2635 the algorithm will search for a minimum delay.
2636 The lower limit is
2637 900 s (15 m), but a more reasonable value is 7200 (2 hours).
2638 There
2639 is no default, since the filter is not enabled unless this command
2640 is given.
2641 .It Cm panic Ar panic
2642 The argument is the panic threshold, normally 1000 s.
2643 If set to zero,
2644 the panic sanity check is disabled and a clock offset of any value will
2645 be accepted.
2646 .It Cm step Ar step
2647 The argument is the step threshold, which by default is 0.128 s.
2648 It can
2649 be set to any positive number in seconds.
2650 If set to zero, step
2651 adjustments will never occur.
2652 Note: The kernel time discipline is
2653 disabled if the step threshold is set to zero or greater than the
2654 default.
2655 .It Cm stepout Ar stepout
2656 The argument is the stepout timeout, which by default is 900 s.
2657 It can
2658 be set to any positive number in seconds.
2659 If set to zero, the stepout
2660 pulses will not be suppressed.
2661 .El
2662 .It Xo Ic rlimit
2663 .Oo
2664 .Cm memlock Ar Nmegabytes |
2665 .Cm stacksize Ar N4kPages
2666 .Cm filenum Ar Nfiledescriptors
2667 .Oc
2668 .Xc
2669 .Bl -tag -width indent
2670 .It Cm memlock Ar Nmegabytes
2671 Specify the number of megabytes of memory that can be allocated.
2672 Probably only available under Linux, this option is useful
2673 when dropping root (the
2674 .Fl i
2675 option).
2676 The default is 32 megabytes. Setting this to zero will prevent any attemp to lock memory.
2677 .It Cm stacksize Ar N4kPages
2678 Specifies the maximum size of the process stack on systems with the
2679 .It Cm filenum Ar Nfiledescriptors
2680 Specifies the maximum number of file descriptors ntpd may have open at once. Defaults to the system default.
2681 .Fn mlockall
2682 function.
2683 Defaults to 50 4k pages (200 4k pages in OpenBSD).
2684 .El
2685 .It Xo Ic trap Ar host_address
2686 .Op Cm port Ar port_number
2687 .Op Cm interface Ar interface_address
2688 .Xc
2689 This command configures a trap receiver at the given host
2690 address and port number for sending messages with the specified
2691 local interface address.
2692 If the port number is unspecified, a value
2693 of 18447 is used.
2694 If the interface address is not specified, the
2695 message is sent with a source address of the local interface the
2696 message is sent through.
2697 Note that on a multihomed host the
2698 interface used may vary from time to time with routing changes.
2699 .Pp
2700 The trap receiver will generally log event messages and other
2701 information from the server in a log file.
2702 While such monitor
2703 programs may also request their own trap dynamically, configuring a
2704 trap receiver will ensure that no messages are lost when the server
2705 is started.
2706 .It Cm hop Ar ...
2707 This command specifies a list of TTL values in increasing order, up to 8
2708 values can be specified.
2709 In manycast mode these values are used in turn in
2710 an expanding-ring search.
2711 The default is eight multiples of 32 starting at
2712 31.
2713 .El
2714 _END_PROG_MDOC_DESCRIP;
2715 };
2716
2717 doc-section = {
2718 ds-type = 'FILES';
2719 ds-format = 'mdoc';
2720 ds-text = <<- _END_MDOC_FILES
2721 .Bl -tag -width /etc/ntp.drift -compact
2722 .It Pa /etc/ntp.conf
2723 the default name of the configuration file
2724 .It Pa ntp.keys
2725 private MD5 keys
2726 .It Pa ntpkey
2727 RSA private key
2728 .It Pa ntpkey_ Ns Ar host
2729 RSA public key
2730 .It Pa ntp_dh
2731 Diffie-Hellman agreement parameters
2732 .El
2733 _END_MDOC_FILES;
2734 };
2735
2736 doc-section = {
2737 ds-type = 'SEE ALSO';
2738 ds-format = 'mdoc';
2739 ds-text = <<- _END_MDOC_SEE_ALSO
2740 .Xr ntpd 1ntpdmdoc ,
2741 .Xr ntpdc 1ntpdcmdoc ,
2742 .Xr ntpq 1ntpqmdoc
2743 .Pp
2744 In addition to the manual pages provided,
2745 comprehensive documentation is available on the world wide web
2746 at
2747 .Li http://www.ntp.org/ .
2748 A snapshot of this documentation is available in HTML format in
2749 .Pa /usr/share/doc/ntp .
2750 .Rs
2751 .%A David L. Mills
2752 .%T Network Time Protocol (Version 4)
2753 .%O RFC5905
2754 .Re
2755 _END_MDOC_SEE_ALSO;
2756 };
2757
2758 doc-section = {
2759 ds-type = 'BUGS';
2760 ds-format = 'mdoc';
2761 ds-text = <<- _END_MDOC_BUGS
2762 The syntax checking is not picky; some combinations of
2763 ridiculous and even hilarious options and modes may not be
2764 detected.
2765 .Pp
2766 The
2767 .Pa ntpkey_ Ns Ar host
2768 files are really digital
2769 certificates.
2770 These should be obtained via secure directory
2771 services when they become universally available.
2772 _END_MDOC_BUGS;
2773 };
2774
2775 doc-section = {
2776 ds-type = 'NOTES';
2777 ds-format = 'mdoc';
2778 ds-text = <<- _END_MDOC_NOTES
2779 This document corresponds to version #VERSION# of NTP.
2780 This document was derived from FreeBSD.
2781 _END_MDOC_NOTES;
2782 };
2783