idnits 2.17.00 (12 Aug 2021) /tmp/idnits33202/draft-ietf-ntp-mode-6-cmds-11.txt: Checking boilerplate required by RFC 5378 and the IETF Trust (see https://trustee.ietf.org/license-info): ---------------------------------------------------------------------------- No issues found here. Checking nits according to https://www.ietf.org/id-info/1id-guidelines.txt: ---------------------------------------------------------------------------- No issues found here. Checking nits according to https://www.ietf.org/id-info/checklist : ---------------------------------------------------------------------------- ** The document seems to lack a both a reference to RFC 2119 and the recommended RFC 2119 boilerplate, even if it appears to use RFC 2119 keywords. RFC 2119 keyword, line 792: '...interface is NOT RECOMMENDED.Regardles...' RFC 2119 keyword, line 795: '...face for mode 6 commands SHOULD NOT be...' Miscellaneous warnings: ---------------------------------------------------------------------------- == The document seems to contain a disclaimer for pre-RFC5378 work, but was first submitted on or after 10 November 2008. The disclaimer is usually necessary only for documents that revise or obsolete older RFCs, and that take significant amounts of text from those RFCs. If you can contact all authors of the source material and they are willing to grant the BCP78 rights to the IETF Trust, you can and should remove the disclaimer. Otherwise, the disclaimer is needed and you can ignore this comment. (See the Legal Provisions document at https://trustee.ietf.org/license-info for more information.) -- The document date (February 2022) is 88 days in the past. Is this intentional? Checking references for intended status: Historic ---------------------------------------------------------------------------- ** Obsolete normative reference: RFC 1305 (Obsoleted by RFC 5905) -- Obsolete informational reference (is this intentional?): RFC 2460 (Obsoleted by RFC 8200) Summary: 2 errors (**), 0 flaws (~~), 1 warning (==), 2 comments (--). Run idnits with the --verbose option for more detailed information about the items above. -------------------------------------------------------------------------------- 2 Network Working Group B. Haberman, Ed. 3 Internet-Draft JHU 4 Intended status: Historic February 2022 5 Expires: 19 August 2022 7 Control Messages Protocol for Use with Network Time Protocol Version 4 8 draft-ietf-ntp-mode-6-cmds-11 10 Abstract 12 This document describes the structure of the control messages that 13 were historically used with the Network Time Protocol before the 14 advent of more modern control and management approaches. These 15 control messages have been used to monitor and control the Network 16 Time Protocol application running on any IP network attached 17 computer. The information in this document was originally described 18 in Appendix B of RFC 1305. The goal of this document is to provide 19 an updated description of the control messages described in RFC 1305 20 in order to conform with the updated Network Time Protocol 21 specification documented in RFC 5905. 23 The publication of this document is not meant to encourage the 24 development and deployment of these control messages. This document 25 is only providing a current reference for these control messages 26 given the current status of RFC 1305. 28 Status of This Memo 30 This Internet-Draft is submitted in full conformance with the 31 provisions of BCP 78 and BCP 79. 33 Internet-Drafts are working documents of the Internet Engineering 34 Task Force (IETF). Note that other groups may also distribute 35 working documents as Internet-Drafts. The list of current Internet- 36 Drafts is at https://datatracker.ietf.org/drafts/current/. 38 Internet-Drafts are draft documents valid for a maximum of six months 39 and may be updated, replaced, or obsoleted by other documents at any 40 time. It is inappropriate to use Internet-Drafts as reference 41 material or to cite them other than as "work in progress." 43 This Internet-Draft will expire on 5 August 2022. 45 Copyright Notice 47 Copyright (c) 2022 IETF Trust and the persons identified as the 48 document authors. All rights reserved. 50 This document is subject to BCP 78 and the IETF Trust's Legal 51 Provisions Relating to IETF Documents (https://trustee.ietf.org/ 52 license-info) in effect on the date of publication of this document. 53 Please review these documents carefully, as they describe your rights 54 and restrictions with respect to this document. Code Components 55 extracted from this document must include Revised BSD License text as 56 described in Section 4.e of the Trust Legal Provisions and are 57 provided without warranty as described in the Revised BSD License. 59 This document may contain material from IETF Documents or IETF 60 Contributions published or made publicly available before November 61 10, 2008. The person(s) controlling the copyright in some of this 62 material may not have granted the IETF Trust the right to allow 63 modifications of such material outside the IETF Standards Process. 64 Without obtaining an adequate license from the person(s) controlling 65 the copyright in such materials, this document may not be modified 66 outside the IETF Standards Process, and derivative works of it may 67 not be created outside the IETF Standards Process, except to format 68 it for publication as an RFC or to translate it into languages other 69 than English. 71 Table of Contents 73 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 3 74 1.1. Control Message Overview . . . . . . . . . . . . . . . . 3 75 1.2. Remote Facility Message Overview . . . . . . . . . . . . 5 76 2. NTP Control Message Format . . . . . . . . . . . . . . . . . 5 77 3. Status Words . . . . . . . . . . . . . . . . . . . . . . . . 7 78 3.1. System Status Word . . . . . . . . . . . . . . . . . . . 8 79 3.2. Peer Status Word . . . . . . . . . . . . . . . . . . . . 10 80 3.3. Clock Status Word . . . . . . . . . . . . . . . . . . . . 12 81 3.4. Error Status Word . . . . . . . . . . . . . . . . . . . . 12 82 4. Commands . . . . . . . . . . . . . . . . . . . . . . . . . . 13 83 5. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 16 84 6. Security Considerations . . . . . . . . . . . . . . . . . . . 16 85 7. Contributors . . . . . . . . . . . . . . . . . . . . . . . . 18 86 8. Acknowledgements . . . . . . . . . . . . . . . . . . . . . . 18 87 9. References . . . . . . . . . . . . . . . . . . . . . . . . . 18 88 9.1. Normative References . . . . . . . . . . . . . . . . . . 18 89 9.2. Informative References . . . . . . . . . . . . . . . . . 19 90 Appendix A. NTP Remote Facility Message Format . . . . . . . . . 20 91 Author's Address . . . . . . . . . . . . . . . . . . . . . . . . 22 93 1. Introduction 95 RFC 1305 [RFC1305] described a set of control messages for use within 96 the Network Time Protocol (NTP) when a comprehensive network 97 management solution was not available. The definitions of these 98 control messages were not promulgated to RFC 5905 [RFC5905] when NTP 99 version 4 was documented. These messages were intended for use only 100 in systems where no other management facilities were available or 101 appropriate, such as in dedicated-function bus peripherals. Support 102 for these messages is not required in order to conform to RFC 5905 103 [RFC5905]. The control messages are described here as a current 104 reference for use with an RFC 5905 implementation of NTP. 106 The publication of this document is not meant to encourage the 107 development and deployment of these control messages. This document 108 is only providing a current reference for these control messages 109 given the current status of RFC 1305. 111 1.1. Control Message Overview 113 The NTP Mode 6 control messages are used by NTP management programs 114 (e.g., ntpq) when a more robust network management facility (e.g., 115 SNMP) is not available. These control messages provide rudimentary 116 control and monitoring functions to manage a running instance of an 117 NTP server. These commands are not designed to be used for 118 communication between instances of running NTP servers. 120 The NTP Control Message has the value 6 specified in the mode field 121 of the first octet of the NTP header and is formatted as shown in 122 Figure 1. The format of the data field is specific to each command 123 or response; however, in most cases the format is designed to be 124 constructed and viewed by humans and so is coded in free-form ASCII. 125 This facilitates the specification and implementation of simple 126 management tools in the absence of fully evolved network-management 127 facilities. As in ordinary NTP messages, the authenticator field 128 follows the data field. If the authenticator is used the data field 129 is zero-padded to a 32-bit boundary, but the padding bits are not 130 considered part of the data field and are not included in the field 131 count. 133 IP hosts are not required to reassemble datagrams over a certain size 134 (576 octets for IPv4 [RFC0791] and 1280 octets for IPv6 [RFC2460]); 135 however, some commands or responses may involve more data than will 136 fit into a single datagram. Accordingly, a simple reassembly feature 137 is included in which each octet of the message data is numbered 138 starting with zero. As each fragment is transmitted the number of 139 its first octet is inserted in the offset field and the number of 140 octets is inserted in the count field. The more-data (M) bit is set 141 in all fragments except the last. 143 Most control functions involve sending a command and receiving a 144 response, perhaps involving several fragments. The sender chooses a 145 distinct, nonzero sequence number and sets the status field and "R" 146 and "E" bits to zero. The responder interprets the opcode and 147 additional information in the data field, updates the status field, 148 sets the "R" bit to one and returns the three 32-bit words of the 149 header along with additional information in the data field. In case 150 of invalid message format or contents the responder inserts a code in 151 the status field, sets the "R" and "E" bits to one and, optionally, 152 inserts a diagnostic message in the data field. 154 Some commands read or write system variables (e.g., s.offset) and 155 peer variables (e.g., p.stratum) for an association identified in the 156 command. Others read or write variables associated with a radio 157 clock or other device directly connected to a source of primary 158 synchronization information. To identify which type of variable and 159 association the Association ID is used. System variables are 160 indicated by the identifier zero. As each association is mobilized a 161 unique, nonzero identifier is created for it. These identifiers are 162 used in a cyclic fashion, so that the chance of using an old 163 identifier which matches a newly created association is remote. A 164 management entity can request a list of current identifiers and 165 subsequently use them to read and write variables for each 166 association. An attempt to use an expired identifier results in an 167 exception response, following which the list can be requested again. 169 Some exception events, such as when a peer becomes reachable or 170 unreachable, occur spontaneously and are not necessarily associated 171 with a command. An implementation may elect to save the event 172 information for later retrieval or to send an asynchronous response 173 (called a trap) or both. In case of a trap the IP address and port 174 number is determined by a previous command and the sequence field is 175 set as described below. Current status and summary information for 176 the latest exception event is returned in all normal responses. Bits 177 in the status field indicate whether an exception has occurred since 178 the last response and whether more than one exception has occurred. 180 Commands need not necessarily be sent by an NTP peer, so ordinary 181 access-control procedures may not apply; however, the optional mask/ 182 match mechanism suggested in Section Section 6 elsewhere in this 183 document provides the capability to control access by mode number, so 184 this could be used to limit access for control messages (mode 6) to 185 selected address ranges. 187 1.2. Remote Facility Message Overview 189 The original development of the NTP daemon included a remote facility 190 for monitoring and configuration. This facility used mode 7 commands 191 to communicate with the NTP daemon. This document illustrates the 192 mode 7 packet format only. The commands embedded in the mode 7 193 messages are implementation specific and not standardized in any way. 194 The mode 7 message format is described in Appendix A. 196 2. NTP Control Message Format 198 The format of the NTP Control Message header, which immediately 199 follows the UDP header, is shown in Figure 1. Following is a 200 description of its fields. 202 0 1 2 3 203 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 204 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 205 |LI | VN |Mode |R|E|M| OpCode | Sequence Number | 206 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 207 | Status | Association ID | 208 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 209 | Offset | Count | 210 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 211 | | 212 / Data (up to 468 bytes) / 213 | | 214 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 215 | Padding (optional) | 216 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 217 | | 218 / Authenticator (optional, 20 or 24 bits) / 219 | | 220 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 222 Figure 1: NTP Control Message Header 224 Leap Indicator (LI): This is a two-bit integer that is set to b00 for 225 control message requests and responses. The Leap Indicator value 226 used at this position in most NTP modes is in the System Status Word 227 provided in some control message responses. 229 Version Number (VN): This is a three-bit integer indicating a minimum 230 NTP version number. NTP servers do not respond to control messages 231 with an unrecognized version number. Requests may intentionally use 232 a lower version number to enable interoperability with earlier 233 versions of NTP. Responses carry the same version as the 234 corresponding request. 236 Mode: This is a three-bit integer indicating the mode. The value 6 237 indicates an NTP control message. 239 Response Bit (R): Set to zero for commands, one for responses. 241 Error Bit (E): Set to zero for normal response, one for error 242 response. 244 More Bit (M): Set to zero for last fragment, one for all others. 246 Operation Code (OpCode): This is a five-bit integer specifying the 247 command function. Values currently defined include the following: 249 +-------+--------------------------------------------------+ 250 | Code | Meaning | 251 +-------+--------------------------------------------------+ 252 | 0 | reserved | 253 | 1 | read status command/response | 254 | 2 | read variables command/response | 255 | 3 | write variables command/response | 256 | 4 | read clock variables command/response | 257 | 5 | write clock variables command/response | 258 | 6 | set trap address/port command/response | 259 | 7 | trap response | 260 | 8 | runtime configuration command/response | 261 | 9 | export configuration to file command/response | 262 | 10 | retrieve remote address stats command/response | 263 | 11 | retrieve ordered list command/response | 264 | 12 | request client-specific nonce command/response | 265 | 13-30 | reserved | 266 | 31 | unset trap address/port command/response | 267 +-------+--------------------------------------------------+ 269 Sequence Number: This is a 16-bit integer indicating the sequence 270 number of the command or response. Each request uses a different 271 sequence number. Each response carries the same sequence number as 272 its corresponding request. For asynchronous trap responses, the 273 responder increments the sequence number by one for each response, 274 allowing trap receivers to detect missing trap responses. The 275 sequence number of each fragment of a multiple-datagram response 276 carries the same sequence number, copied from the request. 278 Status: This is a 16-bit code indicating the current status of the 279 system, peer or clock, with values coded as described in following 280 sections. 282 Association ID: This is a 16-bit unsigned integer identifying a valid 283 association, or zero for the system clock. 285 Offset: This is a 16-bit unsigned integer indicating the offset, in 286 octets, of the first octet in the data area. The offset is set to 287 zero in requests. Responses spanning multiple datagrams use a 288 positive offset in all but the first datagram. 290 Count: This is a 16-bit unsigned integer indicating the length of the 291 data field, in octets. 293 Data: This contains the message data for the command or response. 294 The maximum number of data octets is 468. 296 Padding (optional): Contains zero to three octets with value zero, as 297 needed to ensure the overall control message size is a multiple of 4 298 octets. 300 Authenticator (optional): When the NTP authentication mechanism is 301 implemented, this contains the authenticator information defined in 302 Appendix C of [RFC1305]. 304 3. Status Words 306 Status words indicate the present status of the system, associations 307 and clock. They are designed to be interpreted by network-monitoring 308 programs and are in one of four 16-bit formats shown in Figure 2 and 309 described in this section. System and peer status words are 310 associated with responses for all commands except the read clock 311 variables, write clock variables and set trap address/port commands. 312 The association identifier zero specifies the system status word, 313 while a nonzero identifier specifies a particular peer association. 314 The status word returned in response to read clock variables and 315 write clock variables commands indicates the state of the clock 316 hardware and decoding software. A special error status word is used 317 to report malformed command fields or invalid values. 319 0 1 320 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 321 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 322 | LI| Clock Src | Count | Code | 323 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 324 System Status Word 326 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 327 | Status | SEL | Count | Code | 328 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 329 Peer Status Word 331 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 332 | Clock Status | Code | 333 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 334 Radio Status Word 336 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 337 | Error Code | Reserved | 338 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 339 Error Status Word 341 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 342 | Reserved | Count | Code | 343 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 344 Clock Status Word 346 Figure 2: Status Word Formats 348 3.1. System Status Word 350 The system status word appears in the status field of the response to 351 a read status or read variables command with a zero association 352 identifier. The format of the system status word is as follows: 354 Leap Indicator (LI): This is a two-bit code warning of an impending 355 leap second to be inserted/deleted in the last minute of the current 356 day, with bit 0 and bit 1, respectively, coded as follows: 358 +------+------------------------------------------------------------+ 359 | LI | Meaning | 360 +------+------------------------------------------------------------+ 361 | 00 | no warning | 362 | 01 | insert second after 23:59:59 of the current day | 363 | 10 | delete second 23:59:59 of the current day | 364 | 11 | unsynchronized | 365 +------+------------------------------------------------------------+ 366 Clock Source (Clock Src): This is a six-bit integer indicating the 367 current synchronization source, with values coded as follows: 369 +-------+-----------------------------------------------------------+ 370 | Code | Meaning | 371 +-------+-----------------------------------------------------------+ 372 | 0 | unspecified or unknown | 373 | 1 | Calibrated atomic clock (e.g., PPS, HP 5061) | 374 | 2 | VLF (band 4) or LF (band 5) radio (e.g., OMEGA,, WWVB) | 375 | 3 | HF (band 7) radio (e.g., CHU, MSF, WWV/H) | 376 | 4 | UHF (band 9) satellite (e.g., GOES, GPS) | 377 | 5 | local net (e.g., DCN, TSP, DTS) | 378 | 6 | UDP/NTP | 379 | 7 | UDP/TIME | 380 | 8 | eyeball-and-wristwatch | 381 | 9 | telephone modem (e.g., NIST) | 382 | 10-63 | reserved | 383 +-------+-----------------------------------------------------------+ 385 System Event Counter (Count): This is a four-bit integer indicating 386 the number of system events occurring since the last time the System 387 Event Code changed. Upon reaching 15, subsequent events with the 388 same code are not counted. 390 System Event Code (Code): This is a four-bit integer identifying the 391 latest system exception event, with new values overwriting previous 392 values, and coded as follows: 394 +------+---------------------------------------------------------+ 395 | Code | Meaning | 396 +------+---------------------------------------------------------+ 397 | 0 | unspecified | 398 | 1 | frequency correction (drift) file not available | 399 | 2 | frequency correction started (frequency stepped) | 400 | 3 | spike detected and ignored, starting stepout timer | 401 | 4 | frequency training started | 402 | 5 | clock synchronized | 403 | 6 | system restart | 404 | 7 | panic stop (required step greater than panic threshold) | 405 | 8 | no system peer | 406 | 9 | leap second insertion/deletion armed for the | 407 | | of the current month | 408 | 10 | leap second disarmed | 409 | 11 | leap second inserted or deleted | 410 | 12 | clock stepped (stepout timer expired) | 411 | 13 | kernel loop discipline status changed | 412 | 14 | leapseconds table loaded from file | 413 | 15 | leapseconds table outdated, updated file needed | 414 +------+---------------------------------------------------------+ 416 3.2. Peer Status Word 418 A peer status word is returned in the status field of a response to a 419 read status, read variables or write variables command and appears 420 also in the list of association identifiers and status words returned 421 by a read status command with a zero association identifier. The 422 format of a peer status word is as follows: 424 Peer Status (Status): This is a five-bit code indicating the status 425 of the peer determined by the packet procedure, with bits assigned as 426 follows: 428 +-------------+---------------------------------------------------+ 429 | Peer Status | Meaning | 430 | bit | | 431 +-------------+---------------------------------------------------+ 432 | 0 | configured (peer.config) | 433 | 1 | authentication enabled (peer.authenable) | 434 | 2 | authentication okay (peer.authentic) | 435 | 3 | reachability okay (peer.reach != 0) | 436 | 4 | broadcast association | 437 +-------------+---------------------------------------------------+ 439 Peer Selection (SEL): This is a three-bit integer indicating the 440 status of the peer determined by the clock-selection procedure, with 441 values coded as follows: 443 +-----+-------------------------------------------------------------+ 444 | Sel | Meaning | 445 +-----+-------------------------------------------------------------+ 446 | 0 | rejected | 447 | 1 | discarded by intersection algorithm | 448 | 2 | discarded by table overflow (not currently used) | 449 | 3 | discarded by the cluster algorithm | 450 | 4 | included by the combine algorithm | 451 | 5 | backup source (with more than sys.maxclock survivors) | 452 | 6 | system peer (synchronization source) | 453 | 7 | PPS (pulse per second) peer | 454 +-----+-------------------------------------------------------------+ 456 Peer Event Counter (Count): This is a four-bit integer indicating the 457 number of peer exception events that occurred since the last time the 458 peer event code changed. Upon reaching 15, subsequent events with 459 the same code are not counted. 461 Peer Event Code (Code): This is a four-bit integer identifying the 462 latest peer exception event, with new values overwriting previous 463 values, and coded as follows: 465 +-------+--------------------------------------------------------+ 466 | Peer | | 467 | Event | Meaning | 468 | Code | | 469 +-------+--------------------------------------------------------+ 470 | 0 | unspecified | 471 | 1 | association mobilized | 472 | 2 | association demobilized | 473 | 3 | peer unreachable (peer.reach was nonzero now zero) | 474 | 4 | peer reachable (peer.reach was zero now nonzero) | 475 | 5 | association restarted or timed out | 476 | 6 | no reply (only used with one-shot clock set command) | 477 | 7 | peer rate limit exceeded (kiss code RATE received) | 478 | 8 | access denied (kiss code DENY received) | 479 | 9 | leap second insertion/deletion at month's end armed | 480 | | by peer vote | 481 | 10 | became system peer (sys.peer) | 482 | 11 | reference clock event (see clock status word) | 483 | 12 | authentication failed | 484 | 13 | popcorn spike suppressed by peer clock filter register | 485 | 14 | entering interleaved mode | 486 | 15 | recovered from interleave error | 487 +-------+--------------------------------------------------------+ 489 3.3. Clock Status Word 491 There are two ways a reference clock can be attached to a NTP service 492 host, as a dedicated device managed by the operating system and as a 493 synthetic peer managed by NTP. As in the read status command, the 494 association identifier is used to identify which one, zero for the 495 system clock and nonzero for a peer clock. Only one system clock is 496 supported by the protocol, although many peer clocks can be 497 supported. A system or peer clock status word appears in the status 498 field of the response to a read clock variables or write clock 499 variables command. This word can be considered an extension of the 500 system status word or the peer status word as appropriate. The 501 format of the clock status word is as follows: 503 Reserved: An eight-bit integer that is ignored by requesters and 504 zeroed by responders. 506 Count: This is a four-bit integer indicating the number of clock 507 events that occurred since the last time the clock event code 508 changed. Upon reaching 15, subsequent events with the same code are 509 not counted. 511 Clock Code (Code): This is a four-bit integer indicating the current 512 clock status, with values coded as follows: 514 +--------------+--------------------------------------------------+ 515 | Clock Status | Meaning | 516 +--------------+--------------------------------------------------+ 517 | 0 | clock operating within nominals | 518 | 1 | reply timeout | 519 | 2 | bad reply format | 520 | 3 | hardware or software fault | 521 | 4 | propagation failure | 522 | 5 | bad date format or value | 523 | 6 | bad time format or value | 524 | 7-15 | reserved | 525 +--------------+--------------------------------------------------+ 527 3.4. Error Status Word 529 An error status word is returned in the status field of an error 530 response as the result of invalid message format or contents. Its 531 presence is indicated when the E (error) bit is set along with the 532 response (R) bit in the response. It consists of an eight-bit 533 integer coded as follows: 535 +--------------+--------------------------------------------------+ 536 | Error Status | Meaning | 537 +--------------+--------------------------------------------------+ 538 | 0 | unspecified | 539 | 1 | authentication failure | 540 | 2 | invalid message length or format | 541 | 3 | invalid opcode | 542 | 4 | unknown association identifier | 543 | 5 | unknown variable name | 544 | 6 | invalid variable value | 545 | 7 | administratively prohibited | 546 | 8-255 | reserved | 547 +--------------+--------------------------------------------------+ 549 4. Commands 551 Commands consist of the header and optional data field shown in 552 Figure 1. When present, the data field contains a list of 553 identifiers or assignments in the form 554 <>[=<>],<>[=<>],... where 555 <> is the ASCII name of a system or peer variable such as 556 the ones specified in RFC 5905 and <> is expressed as a 557 decimal, hexadecimal or string constant in the syntax of the C 558 programming language. Where no ambiguity exists, the "sys." or 559 "peer." prefixes can be suppressed. Whitespace (ASCII nonprinting 560 format effectors) can be added to improve readability for simple 561 monitoring programs that do not reformat the data field. Internet 562 addresses are represented as follows: IPv4 addresses are written in 563 the form [n.n.n.n], where n is in decimal notation and the brackets 564 are optional; IPv6 addresses are formulated based on the guidelines 565 defined in [RFC5952]. Timestamps, including reference, originate, 566 receive and transmit values, as well as the logical clock, are 567 represented in units of seconds and fractions, preferably in 568 hexadecimal notation. Delay, offset, dispersion and distance values 569 are represented in units of milliseconds and fractions, preferably in 570 decimal notation. All other values are represented as-is, preferably 571 in decimal notation. 573 Implementations may define variables other than those described in 574 RFC 5905. Called extramural variables, these are distinguished by 575 the inclusion of some character type other than alphanumeric or "." 576 in the name. For those commands that return a list of assignments in 577 the response data field, if the command data field is empty, it is 578 expected that all available variables defined in RFC 5905 will be 579 included in the response. For the read commands, if the command data 580 field is nonempty, an implementation may choose to process this field 581 to individually select which variables are to be returned. 583 Commands are interpreted as follows: 585 Read Status (1): The command data field is empty or contains a list 586 of identifiers separated by commas. The command operates in two ways 587 depending on the value of the association identifier. If this 588 identifier is nonzero, the response includes the peer identifier and 589 status word. Optionally, the response data field may contain other 590 information, such as described in the Read Variables command. If the 591 association identifier is zero, the response includes the system 592 identifier (0) and status word, while the data field contains a list 593 of binary-coded pairs <> <>, one 594 for each currently defined association. 596 Read Variables (2): The command data field is empty or contains a 597 list of identifiers separated by commas. If the association 598 identifier is nonzero, the response includes the requested peer 599 identifier and status word, while the data field contains a list of 600 peer variables and values as described above. If the association 601 identifier is zero, the data field contains a list of system 602 variables. If a peer has been selected as the synchronization 603 source, the response includes the peer identifier and status word; 604 otherwise, the response includes the system identifier (0) and status 605 word. 607 Write Variables (3): The command data field contains a list of 608 assignments as described above. The variables are updated as 609 indicated. The response is as described for the Read Variables 610 command. 612 Read Clock Variables (4): The command data field is empty or contains 613 a list of identifiers separated by commas. The association 614 identifier selects the system clock variables or peer clock variables 615 in the same way as in the Read Variables command. The response 616 includes the requested clock identifier and status word and the data 617 field contains a list of clock variables and values, including the 618 last timecode message received from the clock. 620 Write Clock Variables (5): The command data field contains a list of 621 assignments as described above. The clock variables are updated as 622 indicated. The response is as described for the Read Clock Variables 623 command. 625 Set Trap Address/Port (6): The command association identifier, status 626 and data fields are ignored. The address and port number for 627 subsequent trap messages are taken from the source address and port 628 of the control message itself. The initial trap counter for trap 629 response messages is taken from the sequence field of the command. 630 The response association identifier, status and data fields are not 631 significant. Implementations should include sanity timeouts which 632 prevent trap transmissions if the monitoring program does not renew 633 this information after a lengthy interval. 635 Trap Response (7): This message is sent when a system, peer or clock 636 exception event occurs. The opcode field is 7 and the R bit is set. 637 The trap counter is incremented by one for each trap sent and the 638 sequence field set to that value. The trap message is sent using the 639 IP address and port fields established by the set trap address/port 640 command. If a system trap the association identifier field is set to 641 zero and the status field contains the system status word. If a peer 642 trap the association identifier field is set to that peer and the 643 status field contains the peer status word. Optional ASCII-coded 644 information can be included in the data field. 646 Configure (8): The command data is parsed and applied as if supplied 647 in the daemon configuration file. 649 Save Configuration (9): Write a snapshot of the current configuration 650 to the file name supplied as the command data. Further, the command 651 is refused unless a directory in which to store the resulting files 652 has been explicitly configured by the operator. 654 Read Most Recently Used (MRU) list (10): Retrieves records of 655 recently seen remote addresses and associated statistics. This 656 command supports all of the state variables defined in Section 9 of 657 [RFC5905]. Command data consists of name=value pairs controlling the 658 selection of records, as well as a requestor-specific nonce 659 previously retrieved using this command or opcode 12, Request Nonce. 660 The response consists of name=value pairs where some names can appear 661 multiple times using a dot followed by a zero-based index to 662 distinguish them, and to associate elements of the same record with 663 the same index. A new nonce is provided with each successful 664 response. 666 Read ordered list (11): Retrieves a list ordered by IP address (IPv4 667 information precedes IPv6 information). If the command data is empty 668 or the seven characters "ifstats", the associated statistics, status 669 and counters for each local address are returned. If the command 670 data is the characters "addr_restrictions" then the set of IPv4 671 remote address restrictions followed by the set of IPv6 remote 672 address restrictions (access control lists) are returned. Other 673 command data returns error code 5 (unknown variable name). Similar 674 to Read MRU, response information uses zero-based indexes as part of 675 the variable name preceding the equals sign and value, where each 676 index relates information for a single address or network. This 677 opcode requires authentication. 679 Request Nonce (12): Retrieves a 96-bit nonce specific to the 680 requesting remote address, which is valid for a limited period. 681 Command data is not used in the request. The nonce consists of a 682 64-bit NTP timestamp and 32 bits of hash derived from that timestamp, 683 the remote address, and salt known only to the server which varies 684 between daemon runs. Inclusion of the nonce by a management agent 685 demonstrates to the server that the agent can receive datagrams sent 686 to the source address of the request, making source address 687 "spoofing" more difficult in a similar way as TCP's three-way 688 handshake. 690 Unset Trap (31): Removes the requesting remote address and port from 691 the list of trap receivers. Command data is not used in the request. 692 If the address and port are not in the list of trap receivers, the 693 error code is 4, bad association. 695 5. IANA Considerations 697 This document makes no request of IANA. 699 Note to RFC Editor: this section may be removed on publication as an 700 RFC. 702 6. Security Considerations 704 A number of security vulnerabilities have been identified with these 705 control messages. 707 NTP's control query interface allows reading and writing of system, 708 peer, and clock variables remotely from arbitrary IP addresses using 709 commands mentioned in Section 4. Traditionally, overwriting these 710 variables, but not reading them, requires authentication by default. 711 However, this document argues that an NTP host must authenticate all 712 control queries and not just ones that overwrite these variables. 713 Alternatively, the host can use an access control list to explicitly 714 list IP addresses that are allowed to control query the clients. 715 These access controls are required for the following reasons: 717 * NTP as a Distributed Denial-of-Service (DDoS) vector. NTP timing 718 query and response packets (modes 1-2, 3-4, 5) are usually short 719 in size. However, some NTP control queries generate a very long 720 packet in response to a short query. As such, there is a history 721 of use of NTP's control queries, which exhibit such behavior, to 722 perform DDoS attacks. These off-path attacks exploit the large 723 size of NTP control queries to cause UDP-based amplification 724 attacks (e.g., mode 7 monlist command generates a very long packet 725 in response to a small query [CVE-DOS]). These attacks only use 726 NTP as a vector for DoS attacks on other protocols, but do not 727 affect the time service on the NTP host itself. To limit the 728 sources of these malicious commands, NTP server operators are 729 recommended to deploy ingress filtering [RFC3704]. 731 * Time-shifting attacks through information leakage/overwriting. 732 NTP hosts save important system and peer state variables. An off- 733 path attacker who can read these variables remotely can leverage 734 the information leaked by these control queries to perform time- 735 shifting and DoS attacks on NTP clients. These attacks do affect 736 time synchronization on the NTP hosts. For instance, 738 - In the client/server mode, the client stores its local time 739 when it sends the query to the server in its xmt peer variable. 740 This variable is used to perform TEST2 to non-cryptographically 741 authenticate the server, i.e., if the origin timestamp field in 742 the corresponding server response packet matches the xmt peer 743 variable, then the client accepts the packet. An off-path 744 attacker, with the ability to read this variable can easily 745 spoof server response packets for the client, which will pass 746 TEST2, and can deny service or shift time on the NTP client. 747 The specific attack is described in [CVE-SPOOF]. 749 - The client also stores its local time when the server response 750 is received in its rec peer variable. This variable is used 751 for authentication in interleaved-pivot mode. An off-path 752 attacker with the ability to read this state variable can 753 easily shift time on the client by passing this test. This 754 attack is described in [CVE-SHIFT]. 756 * Fast-Scanning. NTP mode 6 control messages are usually small UDP 757 packets. Fast-scanning tools like ZMap can be used to spray the 758 entire (potentially reachable) Internet with these messages within 759 hours to identify vulnerable hosts. To make things worse, these 760 attacks can be extremely low-rate, only requiring a control query 761 for reconnaissance and a spoofed response to shift time on 762 vulnerable clients. 764 * The mode 6 and 7 messages are vulnerable to replay attacks 765 [CVE-Replay]. If an attacker observes mode 6/7 packets that 766 modify the configuration of the server in any way, the attacker 767 can apply the same change at any time later simply by sending the 768 packets to the server again. The use of the nonce (Request Nonce 769 command) provides limited protection against replay attacks. 771 NTP best practices recommend configuring NTP with the no-query 772 parameter. The no-query parameter blocks access to all remote 773 control queries. However, sometimes the hosts do not want to block 774 all queries and want to give access for certain control queries 775 remotely. This could be for the purpose of remote management and 776 configuration of the hosts in certain scenarios. Such hosts tend to 777 use firewalls or other middleboxes to blacklist certain queries 778 within the network. 780 Significantly fewer hosts respond to mode 7 monlist queries as 781 compared to other control queries because it is a well-known and 782 exploited control query. These queries are likely blocked using 783 blacklists on firewalls and middleboxes rather than the no-query 784 option on NTP hosts. The remaining control queries that can be 785 exploited likely remain out of the blacklist because they are 786 undocumented in the current NTP specification [RFC5905]. 788 This document describes all of the mode 6 control queries allowed by 789 NTP and can help administrators make informed decisions on security 790 measures to protect NTP devices from harmful queries and likely make 791 those systems less vulnerable. The use of the legacy mode 6 792 interface is NOT RECOMMENDED.Regardless of which mode 6 commands an 793 administrator may elect to allow, remote access to this facility 794 needs to be protected from unauthorized access (e.g., strict ACLs). 795 Additionally, the legacy interface for mode 6 commands SHOULD NOT be 796 utilized in new deployments or implementation of NTP. 798 7. Contributors 800 Dr. David Mills specified the vast majority of the mode 6 commands 801 during the development of RFC 1305 [RFC1305] and deserves the credit 802 for their existence and use. 804 8. Acknowledgements 806 Tim Plunkett created the original version of this document. Aanchal 807 Malhotra provided the initial version of the Security Considerations 808 section. 810 Karen O'Donoghue, David Hart, Harlan Stenn, and Philip Chimento 811 deserve credit for portions of this document due to their earlier 812 efforts to document these commands. 814 Miroshav Lichvar, Ulrich Windl, Dieter Sibold, J Ignacio Alvarez- 815 Hamelin, and Alex Campbell provided valuable comments on various 816 versions of this document. 818 9. References 820 9.1. Normative References 822 [RFC1305] Mills, D., "Network Time Protocol (Version 3) 823 Specification, Implementation and Analysis", RFC 1305, 824 DOI 10.17487/RFC1305, March 1992, 825 . 827 [RFC3704] Baker, F. and P. Savola, "Ingress Filtering for Multihomed 828 Networks", BCP 84, RFC 3704, DOI 10.17487/RFC3704, March 829 2004, . 831 [RFC5905] Mills, D., Martin, J., Ed., Burbank, J., and W. Kasch, 832 "Network Time Protocol Version 4: Protocol and Algorithms 833 Specification", RFC 5905, DOI 10.17487/RFC5905, June 2010, 834 . 836 [RFC5952] Kawamura, S. and M. Kawashima, "A Recommendation for IPv6 837 Address Text Representation", RFC 5952, 838 DOI 10.17487/RFC5952, August 2010, 839 . 841 9.2. Informative References 843 [CVE-DOS] NIST National Vulnerability Database, "CVE-2013-5211, 844 https://nvd.nist.gov/vuln/detail/CVE-2013-5211", 2 January 845 2014. 847 [CVE-Replay] 848 NIST National Vulnerability Database, "CVE-2015-8140, 849 https://nvd.nist.gov/vuln/detail/CVE-2015-8140", 30 850 January 2015. 852 [CVE-SHIFT] 853 NIST National Vulnerability Database, "CVE-2016-1548, 854 https://nvd.nist.gov/vuln/detail/CVE-2016-1548", 6 January 855 2017. 857 [CVE-SPOOF] 858 NIST National Vulnerability Database, "CVE-2015-8139, 859 https://nvd.nist.gov/vuln/detail/CVE-2015-8139", 30 860 January 2017. 862 [RFC0791] Postel, J., "Internet Protocol", STD 5, RFC 791, 863 DOI 10.17487/RFC0791, September 1981, 864 . 866 [RFC2460] Deering, S. and R. Hinden, "Internet Protocol, Version 6 867 (IPv6) Specification", RFC 2460, DOI 10.17487/RFC2460, 868 December 1998, . 870 Appendix A. NTP Remote Facility Message Format 872 The format of the NTP Remote Facility Message header, which 873 immediately follows the UDP header, is shown in Figure 3. Following 874 is a description of its fields. Bit positions marked as zero are 875 reserved and should always be transmitted as zero. 877 0 1 2 3 878 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 879 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 880 |R|M| VN |Mode |A| Sequence | Implementation| Req Code | 881 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 882 | Err | Count | MBZ | Size | 883 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 884 | | 885 / Data (up to 500 bytes) / 886 | | 887 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 888 | Encryption KeyID (when A bit set) | 889 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 890 | | 891 / Message Authentication Code (when A bit set) / 892 | | 893 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 895 Figure 3: NTP Remote Facility Message Header 897 Response Bit (R) : Set to 0 if the packet is a request. Set to 1 if 898 the packet is a response. 900 More Bit (M) : Set to 0 if this is the last packet in a response, 901 otherwise set to 1 in responses requiring more than one packet. 903 Version Number (VN) : Set to the version number of the NTP daemon. 905 Mode : Set to 7 for Remote Facility messages. 907 Authenticated Bit (A) : If set to 1, this packet contains 908 authentication information. 910 Sequence : For a multi-packet response, this field contains the 911 sequence number of this packet. Packets in a multi-packet response 912 are numbered starting with 0. The More Bit is set to 1 for all 913 packets but the last. 915 Implementation : The version number of the implementation that 916 defined the request code used in this message. An implementation 917 number of 0 is used for a Request Code supported by all versions of 918 the NTP daemon. The value 255 is reserved for future extensions. 920 Request Code (Req Code) : An implementation-specific code which 921 specifies the operation being requested. A Request Code definition 922 includes the format and semantics of the data included in the packet. 924 Error (Err) : Set to 0 for a request. For a response, this field 925 contains an error code relating to the request. If the Error is non- 926 zero, the operation requested wasn't performed. 928 0 - no error 930 1 - incompatible implementation number 932 2 - unimplemented request code 934 3 - format error 936 4 - no data available 938 7 - authentication failure 940 Count : The number of data items in the packet. Range is 0 to 500. 942 Must Be Zero (MBZ) : A reserved field set to 0 in requests and 943 responses. 945 Size : The size of each data item in the packet. Range is 0 to 500. 947 Data : A variable-sized field containing request/response data. For 948 requests and responses, the size in octets must be greater than or 949 equal to the product of the number of data items (Count) and the size 950 of a data item (Size). For requests, the data area is exactly 40 951 octets in length. For responses, the data area will range from 0 to 952 500 octets, inclusive. 954 Encryption KeyID : A 32-bit unsigned integer used to designate the 955 key used for the Message Authentication Code. This field is included 956 only when the A bit is set to 1. 958 Message Authentication Code : An optional Message Authentication Code 959 defined by the version of the NTP daemon indicated in the 960 Implementation field. This field is included only when the A bit is 961 set to 1. 963 Author's Address 965 Brian Haberman (editor) 966 JHU 968 Email: brian@innovationslab.net