idnits 2.17.1 draft-ietf-ntp-mode-6-cmds-09.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 : ---------------------------------------------------------------------------- No issues found here. Miscellaneous warnings: ---------------------------------------------------------------------------- == The copyright year in the IETF Trust and authors Copyright Line does not match the current year == 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 (June 22, 2020) is 1405 days in the past. Is this intentional? Checking references for intended status: Informational ---------------------------------------------------------------------------- ** Obsolete normative reference: RFC 1305 (Obsoleted by RFC 5905) Summary: 1 error (**), 0 flaws (~~), 2 warnings (==), 1 comment (--). 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: Informational June 22, 2020 5 Expires: December 24, 2020 7 Control Messages Protocol for Use with Network Time Protocol Version 4 8 draft-ietf-ntp-mode-6-cmds-09 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 a 19 current, but historic, description of the control messages as 20 described in RFC 1305 and any additional commands implemented in NTP. 22 The publication of this document is not meant to encourage the 23 developement and deployment of these control messages. This document 24 is only providing a current reference for these control messages 25 given the current status of RFC 1305. 27 Status of This Memo 29 This Internet-Draft is submitted in full conformance with the 30 provisions of BCP 78 and BCP 79. 32 Internet-Drafts are working documents of the Internet Engineering 33 Task Force (IETF). Note that other groups may also distribute 34 working documents as Internet-Drafts. The list of current Internet- 35 Drafts is at https://datatracker.ietf.org/drafts/current/. 37 Internet-Drafts are draft documents valid for a maximum of six months 38 and may be updated, replaced, or obsoleted by other documents at any 39 time. It is inappropriate to use Internet-Drafts as reference 40 material or to cite them other than as "work in progress." 42 This Internet-Draft will expire on December 24, 2020. 44 Copyright Notice 46 Copyright (c) 2020 IETF Trust and the persons identified as the 47 document authors. All rights reserved. 49 This document is subject to BCP 78 and the IETF Trust's Legal 50 Provisions Relating to IETF Documents 51 (https://trustee.ietf.org/license-info) in effect on the date of 52 publication of this document. Please review these documents 53 carefully, as they describe your rights and restrictions with respect 54 to this document. Code Components extracted from this document must 55 include Simplified BSD License text as described in Section 4.e of 56 the Trust Legal Provisions and are provided without warranty as 57 described in the Simplified 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 . . . . . . . . . 19 91 Author's Address . . . . . . . . . . . . . . . . . . . . . . . . 21 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 historical 104 record given their use within NTPv4. 106 The publication of this document is not meant to encourage the 107 developement 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 larger than 576 134 octets [RFC0791]; however, some commands or responses may involve 135 more data than will fit into a single datagram. Accordingly, a 136 simple reassembly feature is included in which each octet of the 137 message data is numbered starting with zero. As each fragment is 138 transmitted the number of its first octet is inserted in the offset 139 field and the number of octets is inserted in the count field. The 140 more-data (M) bit is set in all fragments except the last. 142 Most control functions involve sending a command and receiving a 143 response, perhaps involving several fragments. The sender chooses a 144 distinct, nonzero sequence number and sets the status field and "R" 145 and "E" bits to zero. The responder interprets the opcode and 146 additional information in the data field, updates the status field, 147 sets the "R" bit to one and returns the three 32-bit words of the 148 header along with additional information in the data field. In case 149 of invalid message format or contents the responder inserts a code in 150 the status field, sets the "R" and "E" bits to one and, optionally, 151 inserts a diagnostic message in the data field. 153 Some commands read or write system variables (e.g., s.offset) and 154 peer variables (e.g., p.stratum) for an association identified in the 155 command. Others read or write variables associated with a radio 156 clock or other device directly connected to a source of primary 157 synchronization information. To identify which type of variable and 158 association the Association ID is used. System variables are 159 indicated by the identifier zero. As each association is mobilized a 160 unique, nonzero identifier is created for it. These identifiers are 161 used in a cyclic fashion, so that the chance of using an old 162 identifier which matches a newly created association is remote. A 163 management entity can request a list of current identifiers and 164 subsequently use them to read and write variables for each 165 association. An attempt to use an expired identifier results in an 166 exception response, following which the list can be requested again. 168 Some exception events, such as when a peer becomes reachable or 169 unreachable, occur spontaneously and are not necessarily associated 170 with a command. An implementation may elect to save the event 171 information for later retrieval or to send an asynchronous response 172 (called a trap) or both. In case of a trap the IP address and port 173 number is determined by a previous command and the sequence field is 174 set as described below. Current status and summary information for 175 the latest exception event is returned in all normal responses. Bits 176 in the status field indicate whether an exception has occurred since 177 the last response and whether more than one exception has occurred. 179 Commands need not necessarily be sent by an NTP peer, so ordinary 180 access-control procedures may not apply; however, the optional mask/ 181 match mechanism suggested elsewhere in this document provides the 182 capability to control access by mode number, so this could be used to 183 limit access for control messages (mode 6) to selected address 184 ranges. 186 1.2. Remote Facility Message Overview 188 The original development of the NTP daemon included a remote facility 189 (ntpdc) for monitoring and configuration. This facility used mode 7 190 commands to communicate with the NTP daemon. This document 191 illustrates the mode 7 packet format only. The commands embedded in 192 the mode 7 messages are implementation specific and not standardized 193 in any way. The mode 7 message format is described in Appendix A. 195 2. NTP Control Message Format 197 The format of the NTP Control Message header, which immediately 198 follows the UDP header, is shown in Figure 1. Following is a 199 description of its fields. Bit positions marked as zero are reserved 200 and should always be transmitted as zero. 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, 96 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): Conains 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 RFC 1305. 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 +-------------+---------------------------------------------------+ 431 | 0 | configured (peer.config) | 432 | 1 | authentication enabled (peer.authenable) | 433 | 2 | authentication okay (peer.authentic) | 434 | 3 | reachability okay (peer.reach != 0) | 435 | 4 | broadcast association | 436 +-------------+---------------------------------------------------+ 438 Peer Selection (SEL): This is a three-bit integer indicating the 439 status of the peer determined by the clock-selection procedure, with 440 values coded as follows: 442 +-----+-------------------------------------------------------------+ 443 | Sel | Meaning | 444 +-----+-------------------------------------------------------------+ 445 | 0 | rejected | 446 | 1 | discarded by intersection algorithm | 447 | 2 | discarded by table overflow (not currently used) | 448 | 3 | discarded by the cluster algorithm | 449 | 4 | included by the combine algorithm | 450 | 5 | backup source (with more than sys.maxclock survivors) | 451 | 6 | system peer (synchronization source) | 452 | 7 | PPS (pulse per second) peer | 453 +-----+-------------------------------------------------------------+ 455 Peer Event Counter (Count): This is a four-bit integer indicating the 456 number of peer exception events that occurred since the last time the 457 peer event code changed. Upon reaching 15, subsequent events with 458 the same code are not counted. 460 Peer Event Code (Code): This is a four-bit integer identifying the 461 latest peer exception event, with new values overwriting previous 462 values, and coded as follows: 464 +-------+--------------------------------------------------------+ 465 | Peer | | 466 | Event | Meaning | 467 | Code | | 468 +-------+--------------------------------------------------------+ 469 | 0 | unspecified | 470 | 1 | association mobilized | 471 | 2 | association demobilized | 472 | 3 | peer unreachable (peer.reach was nonzero now zero) | 473 | 4 | peer reachable (peer.reach was zero now nonzero) | 474 | 5 | association restarted or timed out | 475 | 6 | no reply (only used with one-shot ntpd -q) | 476 | 7 | peer rate limit exceeded (kiss code RATE received) | 477 | 8 | access denied (kiss code DENY received) | 478 | 9 | leap second insertion/deletion at month's end armed | 479 | | by peer vote | 480 | 10 | became system peer (sys.peer) | 481 | 11 | reference clock event (see clock status word) | 482 | 12 | authentication failed | 483 | 13 | popcorn spike suppressed by peer clock filter register | 484 | 14 | entering interleaved mode | 485 | 15 | recovered from interleave error | 486 +-------+--------------------------------------------------------+ 488 3.3. Clock Status Word 490 There are two ways a reference clock can be attached to a NTP service 491 host, as a dedicated device managed by the operating system and as a 492 synthetic peer managed by NTP. As in the read status command, the 493 association identifier is used to identify which one, zero for the 494 system clock and nonzero for a peer clock. Only one system clock is 495 supported by the protocol, although many peer clocks can be 496 supported. A system or peer clock status word appears in the status 497 field of the response to a read clock variables or write clock 498 variables command. This word can be considered an extension of the 499 system status word or the peer status word as appropriate. The 500 format of the clock status word is as follows: 502 Reserved: An eight-bit integer that is ignored by requesters and 503 zeroed by responders. 505 Count: This is a four-bit integer indicating the number of clock 506 events that occurred since the last time the clock event code 507 changed. Upon reaching 15, subsequent events with the same code are 508 not counted. 510 Clock Code (Code): This is a four-bit integer indicating the current 511 clock status, with values coded as follows: 513 +--------------+--------------------------------------------------+ 514 | Clock Status | Meaning | 515 +--------------+--------------------------------------------------+ 516 | 0 | clock operating within nominals | 517 | 1 | reply timeout | 518 | 2 | bad reply format | 519 | 3 | hardware or software fault | 520 | 4 | propagation failure | 521 | 5 | bad date format or value | 522 | 6 | bad time format or value | 523 | 7-15 | reserved | 524 +--------------+--------------------------------------------------+ 526 3.4. Error Status Word 528 An error status word is returned in the status field of an error 529 response as the result of invalid message format or contents. Its 530 presence is indicated when the E (error) bit is set along with the 531 response (R) bit in the response. It consists of an eight-bit 532 integer coded as follows: 534 +--------------+--------------------------------------------------+ 535 | Error Status | Meaning | 536 +--------------+--------------------------------------------------+ 537 | 0 | unspecified | 538 | 1 | authentication failure | 539 | 2 | invalid message length or format | 540 | 3 | invalid opcode | 541 | 4 | unknown association identifier | 542 | 5 | unknown variable name | 543 | 6 | invalid variable value | 544 | 7 | administratively prohibited | 545 | 8-255 | reserved | 546 +--------------+--------------------------------------------------+ 548 4. Commands 550 Commands consist of the header and optional data field shown in 551 Figure 2. When present, the data field contains a list of 552 identifiers or assignments in the form 553 <>[=<>],<>[=<>],... where 554 <> is the ASCII name of a system or peer variable 555 specified in RFC 5905 and <> is expressed as a decimal, 556 hexadecimal or string constant in the syntax of the C programming 557 language. Where no ambiguity exists, the <169>sys.<170> or 558 <169>peer.<170> prefixes can be suppressed. Whitespace (ASCII 559 nonprinting format effectors) can be added to improve readability for 560 simple monitoring programs that do not reformat the data field. 561 Internet addresses are represented as follows: IPv4 addresses are 562 written in the form [n.n.n.n], where n is in decimal notation and the 563 brackets are optional; IPv6 addresses are formulated based on the 564 guidelines defined in [RFC5952]. Timestamps, including reference, 565 originate, receive and transmit values, as well as the logical clock, 566 are represented in units of seconds and fractions, preferably in 567 hexadecimal notation. Delay, offset, dispersion and distance values 568 are represented in units of milliseconds and fractions, preferably in 569 decimal notation. All other values are represented as-is, preferably 570 in decimal notation. 572 Implementations may define variables other than those described in 573 RFC 5905. Called extramural variables, these are distinguished by 574 the inclusion of some character type other than alphanumeric or 575 <169>.<170> in the name. For those commands that return a list of 576 assignments in the response data field, if the command data field is 577 empty, it is expected that all available variables defined in RFC 578 5905 will be included in the response. For the read commands, if the 579 command data field is nonempty, an implementation may choose to 580 process this field to individually select which variables are to be 581 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 and values. If a peer has been selected as the 603 synchronization source, the response includes the peer identifier and 604 status word; otherwise, the response includes the system identifier 605 (0) and status 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 MRU (10): Retrieves records of recently seen remote addresses 655 and associated statistics. Command data consists of name=value pairs 656 controlling the selection of records, as well as a requestor-specific 657 nonce previously retrieved using this command or opcode 12, Request 658 Nonce. The response consists of name=value pairs where some names 659 can appear multiple times using a dot followed by a zero-based index 660 to distinguish them, and to associate elements of the same record 661 with the same index. A new nonce is provided with each successful 662 response. 664 Read ordered list (11): Retrieves an ordered list. If the command 665 data is empty or the seven characters "ifstats" the associated 666 statistics, status and counters for each local address are returned. 667 If the command data is the characters "addr_restrictions" then the 668 set of IPv4 remote address restrictions followed by the set of IPv6 669 remote address restrictions (access control lists) are returned. 670 Other command data returns error code 5 (unknown variable name). 671 Similar to Read MRU, response information uses zero-based indexes as 672 part of the variable name preceding the equals sign and value, where 673 each index relates information for a single address or network. This 674 opcode requires authentication. 676 Request Nonce (12): Retrieves a 96-bit nonce specific to the 677 requesting remote address, which is valid for a limited period. 678 Command data is not used in the request. The nonce consists of a 679 64-bit NTP timestamp and 32 bits of hash derived from that timestamp, 680 the remote address, and salt known only to the server which varies 681 between daemon runs. Inclusion of the nonce by a managment agent 682 demonstrates to the server that the agent can receive datagrams sent 683 to the source address of the request, making source address 684 "spoofing" more difficult in a similar way as TCP's three-way 685 handshake. 687 Unset Trap (31): Removes the requesting remote address and port from 688 the list of trap receivers. Command data is not used in the request. 689 If the address and port are not in the list of trap receivers, the 690 error code is 4, bad association. 692 5. IANA Considerations 694 This document makes no request of IANA. 696 Note to RFC Editor: this section may be removed on publication as an 697 RFC. 699 6. Security Considerations 701 A number of security vulnerabilities have been identified with these 702 control messages. 704 NTP's control query interface allows reading and writing of system, 705 peer, and clock variables remotely from arbitrary IP addresses using 706 commands mentioned in Section 4. Traditionally, overwriting these 707 variables, but not reading them, requires authentication by default. 708 However, this document argues that an NTP host must authenticate all 709 control queries and not just ones that overwrite these variables. 710 Alternatively, the host can use a whitelist to explicitly list IP 711 addresses that are allowed to control query the clients. These 712 access controls are required for the following reasons: 714 o NTP as a Distributed Denial-of-Service (DDoS) vector. NTP timing 715 query and response packets (modes 1-2, 3-4, 5) are usually short 716 in size. However, some NTP control queries generate a very long 717 packet in response to a short query. As such, there is a history 718 of use of NTP's control queries, which exhibit such behavior, to 719 perform DDoS attacks. These off-path attacks exploit the large 720 size of NTP control queries to cause UDP-based amplification 721 attacks (e.g., mode 7 monlist command generates a very long packet 722 in response to a small query [CVE-DOS]). These attacks only use 723 NTP as a vector for DoS atacks on other protocols, but do not 724 affect the time service on the NTP host itself. To limit the 725 sources of these malicious commands, NTP server operators are 726 recommended to deploy ingress filtering [RFC2827]. 728 o Time-shifting attacks through information leakage/overwriting. 729 NTP hosts save important system and peer state variables. An off- 730 path attacker who can read these variables remotely can leverage 731 the information leaked by these control queries to perform time- 732 shifting and DoS attacks on NTP clients. These attacks do affect 733 time synchronization on the NTP hosts. For instance, 735 * In the client/server mode, the client stores its local time 736 when it sends the query to the server in its xmt peer variable. 737 This variable is used to perform TEST2 to non-cryptographically 738 authenticate the server, i.e., if the origin timestamp field in 739 the corresponding server response packet matches the xmt peer 740 variable, then the client accepts the packet. An off-path 741 attacker, with the ability to read this variable can easily 742 spoof server response packets for the client, which will pass 743 TEST2, and can deny service or shift time on the NTP client. 744 The specific attack is described in [CVE-SPOOF]. 746 * The client also stores its local time when the server response 747 is received in its rec peer variable. This variable is used 748 for authentication in interleaved-pivot mode. An off-path 749 attacker with the ability to read this state variable can 750 easily shift time on the client by passing this test. This 751 attack is described in [CVE-SHIFT]. 753 o Fast-Scanning. NTP mode 6 control messages are usually small UDP 754 packets. Fast-scanning tools like ZMap can be used to spray the 755 entire (potentially reachable) Internet with these messages within 756 hours to identify vulnerable hosts. To make things worse, these 757 attacks can be extremely low-rate, only requiring a control query 758 for reconnaissance and a spoofed response to shift time on 759 vulnerable clients. 761 o The mode 6 and 7 messages are vulnerable to replay attacks 762 [CVE-Replay]. If an attacker observes mode 6/7 packets that 763 modify the configuration of the server in any way, the attacker 764 can apply the same change at any time later simply by sending the 765 packets to the server again. The use of the nonce (Request Nonce 766 command) provides limited protection against replay attacks. 768 NTP best practices recommend configuring ntpd with the no-query 769 parameter. The no-query parameter blocks access to all remote 770 control queries. However, sometimes the hosts do not want to block 771 all queries and want to give access for certain control queries 772 remotely. This could be for the purpose of remote management and 773 configuration of the hosts in certain scenarios. Such hosts tend to 774 use firewalls or other middleboxes to blacklist certain queries 775 within the network. 777 Significantly fewer hosts respond to mode 7 monlist queries as 778 compared to other control queries because it is a well-known and 779 exploited control query. These queries are likely blocked using 780 blacklists on firewalls and middleboxes rather than the no-query 781 option on NTP hosts. The remaining control queries that can be 782 exploited likely remain out of the blacklist because they are 783 undocumented in the current NTP specification [RFC5905]. 785 This document describes all of the mode 6 control queries allowed by 786 NTP and can help administrators make informed decisions on security 787 measures to protect NTP devices from harmful queries and likely make 788 those systems less vulnerable. Regardless of which mode 6 commands 789 an administrator may elect to allow, remote access to this facility 790 needs to be protected from unauthorized access (e.g., strict ACLs). 792 7. Contributors 794 Dr. David Mills specified the vast majority of the mode 6 commands 795 during the development of RFC 1305 [RFC1305] and deserves the credit 796 for their existence and use. 798 8. Acknowledgements 800 Tim Plunkett created the original version of this document. Aanchal 801 Malhotra provided the initial version of the Security Considerations 802 section. 804 Karen O'Donoghue, David Hart, Harlan Stenn, and Philip Chimento 805 deserve credit for portions of this document due to their earlier 806 efforts to document these commands. 808 Miroshav Lichvar, Ulrich Windl, Dieter Sibold, J Ignacio Alvarez- 809 Hamelin, and Alex Campbell provided valuable comments on various 810 versions of this document. 812 9. References 814 9.1. Normative References 816 [RFC1305] Mills, D., "Network Time Protocol (Version 3) 817 Specification, Implementation and Analysis", RFC 1305, 818 DOI 10.17487/RFC1305, March 1992, 819 . 821 [RFC2827] Ferguson, P. and D. Senie, "Network Ingress Filtering: 822 Defeating Denial of Service Attacks which employ IP Source 823 Address Spoofing", BCP 38, RFC 2827, DOI 10.17487/RFC2827, 824 May 2000, . 826 [RFC5905] Mills, D., Martin, J., Ed., Burbank, J., and W. Kasch, 827 "Network Time Protocol Version 4: Protocol and Algorithms 828 Specification", RFC 5905, DOI 10.17487/RFC5905, June 2010, 829 . 831 [RFC5952] Kawamura, S. and M. Kawashima, "A Recommendation for IPv6 832 Address Text Representation", RFC 5952, 833 DOI 10.17487/RFC5952, August 2010, 834 . 836 9.2. Informative References 838 [CVE-DOS] NIST National Vulnerability Database, "CVE-2013-5211, 839 https://nvd.nist.gov/vuln/detail/CVE-2013-5211", January 840 2014. 842 [CVE-Replay] 843 NIST National Vulnerability Database, "CVE-2015-8140, 844 https://nvd.nist.gov/vuln/detail/CVE-2015-8140", January 845 2015. 847 [CVE-SHIFT] 848 NIST National Vulnerability Database, "CVE-2016-1548, 849 https://nvd.nist.gov/vuln/detail/CVE-2016-1548", January 850 2017. 852 [CVE-SPOOF] 853 NIST National Vulnerability Database, "CVE-2015-8139, 854 https://nvd.nist.gov/vuln/detail/CVE-2015-8139", January 855 2017. 857 [RFC0791] Postel, J., "Internet Protocol", STD 5, RFC 791, 858 DOI 10.17487/RFC0791, September 1981, 859 . 861 Appendix A. NTP Remote Facility Message Format 863 The format of the NTP Remote Facility Message header, which 864 immediately follows the UDP header, is shown in Figure 3. Following 865 is a description of its fields. Bit positions marked as zero are 866 reserved and should always be transmitted as zero. 868 0 1 2 3 869 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 870 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 871 |R|M| VN |Mode |A| Sequence | Implementation| Req Code | 872 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 873 | Err | Count | MBZ | Size | 874 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 875 | | 876 / Data (up to 500 bytes) / 877 | | 878 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 879 | Encryption KeyID (when A bit set) | 880 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 881 | | 882 / Message Authentication Code (when A bit set) / 883 | | 884 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 886 Figure 3: NTP Remote Facility Message Header 888 Response Bit (R) : Set to 0 if the packet is a request. Set to 1 if 889 the packet is a reponse. 891 More Bit (M) : Set to 0 if this is the last packet in a response, 892 otherwise set to 1 in responses requiring more then one packet. 894 Version Number (VN) : Set to the version number of the NTP daemon. 896 Mode : Set to 7 for Remote Facility messages. 898 Authenticated Bit (A) : If set to 1, this packet contains 899 authentication information. 901 Sequence : For a multi-packet response, this field contains the 902 sequence number of this packet. Packets in a multi-packet response 903 are numbered starting with 0. The More Bit is set to 1 for all 904 packets but the last. 906 Implementation : The version number of the implementation that 907 defined the request code used in this message. An implementation 908 number of 0 is used for a Request Code supported by all versions of 909 the NTP daemon. The value 255 is reserved for future extensions. 911 Request Code (Req Code) : An implementation-specific code which 912 specifies the operation being requested. A Request Code definition 913 includes the format and semantics of the data included in the packet. 915 Error (Err) : Set to 0 for a request. For a response, this field 916 contains an error code relating to the request. If the Error is non- 917 zero, the operation requested wasn't performed. 919 0 - no error 921 1 - incompatible implementation number 923 2 - unimplemented request code 925 3 - format error 927 4 - no data available 929 7 - authentication failure 931 Count : The number of data items in the packet. Range is 0 to 500. 933 Must Be Zero (MBZ) : A reserved field set to 0 in requests and 934 responses. 936 Size : The size of each data item in the packet. Range is 0 to 500. 938 Data : A variable-sized field containing request/response data. For 939 requests and responses, the size in octets must be greater than or 940 equal to the product of the number of data items (Count) and the size 941 of a data item (Size). For requests, the data area is exactly 40 942 octets in length. For responses, the data area will range from 0 to 943 500 octets, inclusive. 945 Encryption KeyID : A 32-bit unsigned integer used to designate the 946 key used for the Message Authentication Code. This field is included 947 only when the A bit is set to 1. 949 Message Authentication Code : An optional Message Authentication Code 950 defined by the version of the NTP daemon indicated in the 951 Implementation field. This field is included only when the A bit is 952 set to 1. 954 Author's Address 956 Brian Haberman (editor) 957 JHU 959 Email: brian@innovationslab.net