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