<?xml version="1.0" encoding="US-ASCII"?>
<!-- This template is for creating an Internet Draft using xml2rfc,
     which is available here: http://xml.resource.org. -->
<!DOCTYPE rfc SYSTEM "rfc2629.dtd" [
<!-- One method to get references from the online citation libraries.
     There has to be one entity for each item to be referenced. 
     An alternate method (rfc include) is described in the references. -->
<!ENTITY RFC5905 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.5905.xml">
<!ENTITY RFC5906 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.5906.xml">
<!ENTITY RFC1305 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.1305.xml">
<!ENTITY RFC2827 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.2827.xml">
<!ENTITY RFC2119 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.2119.xml">
<!ENTITY RFC2434 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.2434.xml">
<!ENTITY RFC3552 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.3552.xml">
<!ENTITY RFC4786 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.4786.xml">
<!ENTITY RFC7094 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.7094.xml">
<!ENTITY RFC4085 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.4085.xml">
<!ENTITY RFC7384 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.7384.xml">
<!ENTITY RFC6151 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.6151.xml">

<!ENTITY RFC8174 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.8174.xml">
<!ENTITY I-D.narten-iana-considerations-rfc2434bis SYSTEM "http://xml.resource.org/public/rfc/bibxml3/reference.I-D.narten-iana-considerations-rfc2434bis.xml">

<!ENTITY NTSFORNTP SYSTEM "https://xml2rfc.tools.ietf.org/public/rfc/bibxml3/reference.I-D.ietf-ntp-using-nts-for-ntp.xml">

<!ENTITY DATAMIN SYSTEM "https://xml2rfc.tools.ietf.org/public/rfc/bibxml3/reference.I-D.ietf-ntp-data-minimization.xml">

<!ENTITY NTPMAC SYSTEM "https://xml2rfc.tools.ietf.org/public/rfc/bibxml3/reference.I-D.ietf-ntp-mac.xml">

<!ENTITY CTRLMSG SYSTEM "https://xml2rfc.tools.ietf.org/public/rfc/bibxml3/reference.I-D.ietf-ntp-mode-6-cmds.xml">

]>


<?xml-stylesheet type='text/xsl' href='rfc2629.xslt' ?>
<!-- used by XSLT processors -->
<!-- For a complete list and description of processing instructions (PIs), 
     please see http://xml.resource.org/authoring/README.html. -->
<!-- Below are generally applicable Processing Instructions (PIs) that most I-Ds might want to use.
     (Here they are set differently than their defaults in xml2rfc v1.32) -->
<?rfc strict="yes" ?>
<!-- give errors regarding ID-nits and DTD validation -->
<!-- control the table of contents (ToC) -->
<?rfc toc="yes"?>
<!-- generate a ToC -->
<?rfc tocdepth="4"?>
<!-- the number of levels of subsections in ToC. default: 3 -->
<!-- control references -->
<?rfc symrefs="yes"?>
<!-- use symbolic references tags, i.e, [RFC2119] instead of [1] -->
<?rfc sortrefs="yes" ?>
<!-- sort the reference entries alphabetically -->
<!-- control vertical white space 
     (using these PIs as follows is recommended by the RFC Editor) -->
<?rfc compact="yes" ?>
<!-- do not start each main section on a new page -->
<?rfc subcompact="no" ?>
<!-- keep one blank line between list items -->
<!-- end of list of popular I-D processing instructions -->
<rfc category="bcp" docName="draft-ietf-ntp-bcp-13" ipr="trust200902">
  <!-- category values: std, bcp, info, exp, and historic
     ipr values: full3667, noModification3667, noDerivatives3667
     you can add the attributes updates="NNNN" and obsoletes="NNNN" 
     they will automatically be output with "(if approved)" -->

  <!-- ***** FRONT MATTER ***** -->

  <front>
    <!-- The abbreviated title is used in the page header - it is only necessary if the 
         full title is longer than 39 characters -->

    <title abbrev="Network Time Protocol BCP">Network Time Protocol Best
    Current Practices</title>

    <!-- add 'role="editor"' below for the editors if appropriate -->

    <!-- Another author who claims to be an editor -->

    <author fullname="Denis Reilly" initials="D." surname="Reilly" role="editor">
      <organization>Orolia USA</organization>

      <address>
        <postal>
          <street>1565 Jefferson Road, Suite 460</street>

          <!-- Reorder these if your country does things differently -->

          <city>Rochester, NY</city>

          <region/>

          <code>14623</code>

          <country>US</country>
        </postal>

        <phone/>

        <email>denis.reilly@orolia.com</email>

        <!-- uri and facsimile elements may also be added -->
      </address>
    </author>

    <author fullname="Harlan Stenn" initials="H." surname="Stenn">
      <organization>Network Time Foundation</organization>

      <address>
        <postal>
          <street>P.O. Box 918</street>

          <city>Talent, OR</city>

          <region/>

          <code>97540</code>

          <country>US</country>
        </postal>

        <phone/>

        <email>stenn@nwtime.org</email>
      </address>
    </author>

    <author fullname="Dieter Sibold" initials="D." surname="Sibold">
      <organization abbrev="PTB">Physikalisch-Technische
      Bundesanstalt</organization>

      <address>
        <postal>
          <street>Bundesallee 100</street>

          <city>Braunschweig</city>

          <code>D-38116</code>

          <region/>

          <country>Germany</country>
        </postal>

        <phone>+49-(0)531-592-8420</phone>

        <facsimile>+49-531-592-698420</facsimile>

        <email>dieter.sibold@ptb.de</email>
      </address>
    </author>

    <date year="2019"/>

    <!-- If the month and year are both specified and are the current ones, xml2rfc will fill 
         in the current day for you. If only the current year is specified, xml2rfc will fill 
         in the current day and month for you. If the year is not the current one, it is 
         necessary to specify at least a month (xml2rfc assumes day="1" if not specified for the 
         purpose of calculating the expiry date).  With drafts it is normally sufficient to 
         specify just the year. -->

    <!-- Meta-data Declarations -->

    <area>General</area>

    <workgroup>Internet Engineering Task Force</workgroup>

    <!-- WG name at the upperleft corner of the doc,
         IETF is fine for individual submissions.  
         If this element is not present, the default is "Network Working Group",
         which is used by the RFC Editor as a nod to the history of the IETF. -->

    <keyword>NTP</keyword>

    <!-- Keywords will be incorporated into HTML output
         files in a meta tag but they have no effect on text or nroff
         output. If you submit your draft to the RFC Editor, the
         keywords will be used for the search engine. -->

    <abstract>
      <t>The Network Time Protocol (NTP) is one of the oldest protocols on 
      the Internet and has been widely used since its initial publication. 
      This document is a collection of Best Practices for general operation 
      of NTP servers and clients on the Internet. It includes recommendations 
      for stable, accurate and secure operation of NTP infrastructure. This
      document is targeted at NTP version 4 as described in RFC 5905.</t>
    </abstract>
  </front>

  <middle>
    <section title="Introduction">
      <t>NTP version 4 (NTPv4) has been widely used since its publication as
      <xref target="RFC5905"/>. This document is a
      collection of best practices for the operation of NTP clients and
      servers.</t>
      <t>The recommendations in this document are intended to help
      operators distribute time on their networks more accurately and more
      securely. It is intended to apply generally to a broad range of networks.
      Some specific networks may have higher accuracy requirements
	  that require additional techniques beyond what is documented here.</t>
	  <t>Among the best practices covered are recommendations for general 
	  network security, time protocol specific security, and NTP server and client 
      configuration. NTP operation in embedded devices is also covered.</t>
      <t>This document also contains 
      information for protocol implementors who want to develop their own
      implementations that are compliant to RFC 5905. </t> 
       	  

      <section title="Requirements Language">     
        <t>The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL
        NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED",
        "MAY", and "OPTIONAL" in this document are to be interpreted as
        described in BCP&nbsp;14 
        <xref target='RFC2119' /> <xref target='RFC8174' />
        when, and only when, they appear in all capitals, as shown here.</t>
      </section>
    </section>

    <section anchor="Sec_Gen" title="General Network Security Best Practices">

      <section anchor="bcp38" title="BCP 38">
        <t>Many network attacks rely on modifying the IP source address of a
        packet to point to a different IP address than the computer which
        originated it. UDP-based protocols such as NTP are generally more
        susceptible to spoofing attacks than connection-oriented
        protocols. NTP control messages can generate a lot of data in
        response to a small query, which makes it attractive as a 
        vector for distributed denial-of-service attacks. (NTP Control 
        messages are discussed further in <xref target="mode67"/>). 
        One documented instance of such an attack can be found <eref 
        target="https://blog.cloudflare.com/technical-details-behind-a-400gbps-ntp-amplification-ddos-attack/"> 
        here</eref>, and further discussion in <xref target="IMC14"/> and <xref target="NDSS14"/>. 
        </t>
        
        <t><xref target="RFC2827">BCP 38</xref> was
        published in 2000 to to provide some level of
		remediation against address-spoofing attacks. BCP
        38 calls for filtering outgoing and incoming traffic to make
        sure that the source and destination IP addresses are consistent
        with the expected flow of traffic on each network interface. 
		It is
        RECOMMENDED that ISP's and large corporate networks
		implement ingress and egress filtering. More information is
		available at the
	<eref target="http://www.bcp38.info">BCP38 Info Web page</eref> .</t>
      </section>
    </section>

    <section title="NTP Configuration Best Practices">
    <t>This section provides Best Practices for NTP configuration and 
    operation.  Application of these best practices that are specific 
    to the Network Time Foundation implementation, including example 
    configuration directives valid at the time of this writing, are 
    compiled in Appendix A.</t>
    
    <section title="Keeping NTP up to date">
      <t>There are multiple versions of the NTP protocol in use, and
      multiple implementations, on many different platforms. The 
      practices in this document are meant to apply generally to any implementation
      of <xref target="RFC5905"/>. NTP users should select an implementation that is 
      actively maintained. Users should keep up to date on any known 
      attacks on their selected implementation, and deploy updates containing 
      security fixes as soon as practical.</t>
      
    </section>

      <section anchor="TimeSources" title="Use enough time sources">
        <t>An NTP implementation that is compliant with 
        <xref target="RFC5905"/>
        takes the available sources of time and submits this timing data to
        sophisticated intersection, clustering, and combining algorithms to
        get the best estimate of the correct time. The description of these
        algorithms is beyond the scope of this document. Interested readers
        should read <xref target="RFC5905"/> or the detailed
        description of NTP in <xref target="MILLS2006"/>.
        </t>

	<t><list style="symbols">
          <t>If there is only 1 source of time, the answer is obvious.  It
	      may not be a good source of time, but it's the only source of
	      time that can be considered. Any issue with the time at the source 
          will be passed on to the client.</t>
			 
          <t>If there are 2 sources of time and they agree well enough,
          then the best time can be calculated easily. But if one source 
          fails, then the solution degrades to the single-source solution 
          outlined above. And if the two sources don't agree, it will be 
          difficult to know which one is correct without making use of 
          information from outside of the protocol.</t>
			 
          <t>If there are 3 sources of time, there is more data available to 
          converge on the best calculated time, and this time is more likely to be 
          accurate. And the loss of one of the sources (by becoming unreachable
          or unusable) can be tolerated. But at that point, the solution 
          degrades to the 2 source solution.</t>
            
          <t>4 or more sources of time is better, as long as the sources are 
          <xref target="Diversity"> diverse</xref>. If one of these sources
          develops a problem there are still at least 3 other time sources.</t>
        </list></t>
        
    <t>This analysis assumes that a majority of the servers used in the 
    solution are honest, even if some may be inaccurate.  Operators should 
    be aware of the possibility that if an attacker is in control of the 
    network, the time coming from all servers could be compromised.</t>
		
    <t>Operators who are concerned with maintaining accurate time SHOULD use
    at least 4 independent, diverse sources of time. Four sources will 
    provide sufficient backup in case one source goes down. If four sources
    are not available, operators MAY use fewer sources, subject to the risks
    outlined above.</t>
    
	<t>But even with 4 or more sources of time, systemic problems can
	happen. One example involves the leap smearing concept detailed in 
	<xref target="leap_smear"/>. For several hours before and after the 
	June 2015 leap second, several operators configured their NTP servers 
	with leap smearing while others did not. Many NTP end
	nodes could not determine an accurate time source because 2 of their
	4 sources of time gave them consistent UTC/POSIX time, while the
	other 2 gave them consistent leap-smeared time. This is just one of 
	many potential causes of disagreement among time sources.</t>

        <t>Operators are advised to monitor all time sources that are 
        in use.  If time sources do not generally agree, operators are 
        encouraged to investigate the cause of this and either 
        correct the problems or stop using defective servers.  
        See <xref target="Monitoring"/> for
        more information.</t>
      </section>

      <section anchor="Diversity" title="Use a diversity of Reference Clocks">
        <t>When using servers with attached hardware reference clocks, it is
        suggested that different types of reference clocks be
        used.  Having a diversity of sources with independent implementations 
        means that any one issue is less likely to cause a service interruption.</t>

        <t>Are all clocks on a network from the same vendor?  They may have
        the same bugs.  Even devices from different vendors may not be truly 
        independent if they share common elements. Are they using the same 
        base chipset? 
        Are they all running the same version of firmware? Chipset and
        firmware bugs can happen, but they can be more difficult to diagnose
        than application software bugs. When having the correct time is of 
        critical importance, it's ultimately up to operators to ensure that 
        their sources are sufficiently independent, even if they are not under
        the operator's control.</t>

        <t>A systemic problem with time from any satellite navigation
        service is possible and has happened.  Sunspot activity can render
        satellite or radio-based time source unusable.  Depending on the 
        application requirements, operators may need to consider backup 
        scenarios in the rare circumstance when the satellite system 
        is faulty or unavailable.</t>
      </section>

      <section anchor="mode67" title="Control Messages">
        <t>Some implementations of NTPv4 provide the NTP Control Messages
        (also known as Mode 6 messages) that were originally specified in Appendix B of 
        <xref target="RFC1305"/> which defined NTPv3.  These messages were  
        never included the NTPv4 specification, but they are still used. 
        At the time of this writing, work is being done to formally document the structure of these 
        control messages in <xref target="I-D.ietf-ntp-mode-6-cmds"/>.
        </t>
        <t>The NTP Control Messages
        are designed to permit monitoring and optionally authenticated 
        control of NTP and its configuration.  Used properly, these facilities
		provide vital debugging and performance information and control. 
		But these facilities can be a vector for amplification attacks when
		abused.  For this reason, it is 
        RECOMMENDED that publicly-facing NTP servers should block NTP Control Message queries from outside their organization.</t>

        <t>The ability to use NTP Control Messages beyond their basic monitoring
        capabilities SHOULD be limited to authenticated sessions that provide a
        'controlkey'. It can also be limited through mechanisms outside of the
        NTP specification, such as Access Control Lists, that only allow access 
        from approved IP addresses.</t>

        <t>The NTP Control Messages responses are much larger than
        the corresponding queries. Thus, they can be
        abused in high-bandwidth DDoS attacks. <xref target="bcp38"/> gives
		more information on how to provide protection for this abuse by
		implementing BCP 38.</t>
        
      </section>

      <section anchor="Monitoring" title="Monitoring">

        <t>Operators SHOULD use their NTP implementation's remote monitoring capabilities to 
        quickly identify servers which are out of sync, and ensure correctness
        of the service. Operators SHOULD also monitor system logs for messages so problems and abuse 
        attempts can be quickly identified.</t>
		
		<t>If a system starts to receive NTP Reply packets from a remote time server
		that do not correspond to any requests sent by the system, that can be
		an indication that an attacker is forging that system's IP address in
		requests to the remote time server. The goal of this attack is to 
        adversely impact the availability of time to the targeted system whose 
        address is being forged. Based on these forged packets, the 
        remote time server might decide to throttle or rate limit packets, or 
        even stop sending packets to the targeted system.</t>
		

        <t>If a system is a broadcast client and its system log shows that it
        is receiving early time messages from its server, that is an
        indication that somebody may be forging packets from a broadcast
        server. (Broadcast client and server modes are defined in 
		Section 3 of <xref target="RFC5905"/>)</t>

        <t>If a server's system log shows messages that indicates it is
        receiving NTP timestamps that are much earlier than the current 
		system time,
        then either the system clock is unusually fast or somebody is trying
        to launch a replay attack against that server.</t>

      </section>

      <section anchor="Pool" title="Using Pool Servers">
        <t>It only takes a small amount of bandwidth and system resources to
        synchronize one NTP client, but NTP servers that can service tens of
        thousands of clients take more resources to run.  Network operators
        and advanced users who want to
        synchronize their computers MUST only synchronize to 
        servers that they have permission to use. </t>

        <t>The NTP Pool Project is a group of volunteers who have donated
        their computing and bandwidth resources to freely distribute time
        from primary time sources to others on the Internet.  The time is
        generally of good quality but comes with no guarantee whatsoever.
        If you are interested in using this pool, please review their
        instructions at <eref target="http://www.pool.ntp.org/en/use.html">
        http://www.pool.ntp.org/en/use.html</eref>.</t>
		
        <t>Vendors can obtain
        their own subdomain that is part of the NTP Pool Project.  This offers
        vendors the ability to safely make use of the time distributed by
        the pool for their devices. Details are available at
        <eref target="http://www.pool.ntp.org/en/vendors.html">
        http://www.pool.ntp.org/en/vendors.html</eref> .</t>

        <t>If there is a need to synchronize many computers,
        an operator may want to run local NTP servers that are synchronized
        to the NTP Pool Project. NTP users on that operator's networks can
        then be synchronized to local NTP servers.</t>

      </section>

      <section title="Leap Second Handling">
        <t>UTC is kept in agreement with the astronomical time 
	<eref target="https://en.wikipedia.org/wiki/Solar_time#Mean_solar_time">UT1</eref>
        to within +/- 0.9 seconds by the insertion (or possibly a deletion)
        of a leap second.  UTC is an atomic time scale whereas UT1 is based
        on the rotational rate of the earth.  Leap seconds are not
        introduced at a fixed rate.  They are announced
        by the International Earth Rotation
        and Reference Systems Service (IERS) in its
	<eref target="https://www.iers.org/IERS/EN/Publications/Bulletins/bulletins.html">Bulletin
        C </eref> when necessary to keep UTC and UT1 aligned.</t>
        
        <t>NTP time is based on the UTC timescale, and the protocol has the
        capability to broadcast leap second information.  Some Global Navigation 
        Satellite Systems (like GPS) or radio transmitters (like DCF77) broadcast leap second
        information. If an NTP client is synced to an NTP server that provides leap second 
        notification, the client will get advance notification of impending leap seconds
        automatically.</t>
        
	<t>Since the length of the UT1 day
        is <eref target="https://en.wikipedia.org/wiki/Solar_time#Mean_solar_time">
        generally slowly increasing</eref>, all leap seconds that have been
        introduced since the practice started in 1972 have been positive
        leap seconds, where a second is added to UTC.  NTP also supports a
        negative leap second, where a second is removed from UTC, if
        that ever becomes necessary.</t>

        <t>While earlier versions of NTP contained some ambiguity regarding
        when a leap second that is broadcast by a server should be applied
        by a client, RFC 5905 is clear that leap seconds are only applied on
        the last day of a month.  However, because some older clients may
        apply it at the end of the current day, it is RECOMMENDED that NTP
        servers wait until the last day of the month before broadcasting
        leap seconds. Doing this will prevent older clients from applying a
        leap second at the wrong time.  When implementing this recommendation, 
		operators should ensure that clients are not configured to use 
		polling intervals
		greater than 24 hours, so the leap second notification is not missed.
		</t>

<!--        <t>The IETF maintains a 
        <eref target="https://www.ietf.org/timezones/data/leap-seconds.list">leap
	    second list</eref> as part of the Time Zone Database for NTP users who are not receiving leap second
	    information through an automatic source. Information on the maintenance of the Time Zone Database is available in <xref target="RFC6557">BCP 135</xref>.</t>
-->
        <t>In circumstances where an NTP server is not receiving leap second 
        information from an automated source, certain organizations maintain 
        files which are updated every time a new leap second is announced:</t>
        <t>NIST: ftp://time.nist.gov/pub/leap-seconds.list</t>
        <t>US Navy (maintains GPS Time): ftp://tycho.usno.navy.mil/pub/ntp/leap-seconds.list</t>
        <t>IERS (announces leap seconds): https://hpiers.obspm.fr/iers/bul/bulc/ntp/leap-seconds.list</t>
        

        <section anchor="leap_smear" title="Leap Smearing">
          <t>Some NTP installations make use of a technique
          called Leap Smearing.  With this method, instead of introducing
          an extra second (or eliminating a second) on a leap second event, 
          NTP time will be slewed
          in small increments over a comparably large window of time (called
          the smear interval) around the leap second event.  The smear
          interval should be large enough to make the rate that the time is
          slewed small, so that clients will follow the smeared time without
          objecting.  Periods ranging from 2 to 24 hours have been used
          successfully.  During the adjustment window, all the NTP clients'
          times may be offset from UTC by as much as a full second,
          depending on the implementation.  But at least all clients will
          generally agree on what time they think it is.</t>         
		  
	  <t>The purpose of Leap Smearing is to enable systems that don't
          deal with the leap second event properly to function consistently,
          at the expense of fidelity to UTC during the smear window.  During
          a standard leap second event, that minute will have 61 (or
          possibly 59) seconds in it, and some applications (and even some
          OS's) are known to have problems with that.</t>
          
          <t>Operators who have legal obligations or other strong requirements
          to be synchronized with UTC or civil time SHOULD NOT use leap smearing,
          because the distributed time cannot be guaranteed to be traceable to 
          UTC during the smear interval.</t> 

	  <t>Clients that are connected to leap smearing servers MUST NOT
	  apply the standard NTP leap second handling.  These clients must 
      never have a leap second file loaded, and the smearing servers must 
      never advertise to clients that a leap second is pending.</t>
		  
          <t>Any use of leap smearing servers should be limited to within a 
          single, well-controlled environment. Leap Smearing MUST NOT be used
          for public-facing NTP servers,
          as they will disagree with non-smearing servers (as well as UTC)
          during the leap smear interval, and there is no standardized way for
          a client to detect that a server is using leap smearing.  However, 
          be aware that some public-facing servers may be configured this way 
          anyway in spite of this guidance.</t>

	  <!-- Cite the "Leap-Smear REFID" in the ntp-refid update? -->
		         
          <t>System Administrators are advised to be aware of impending leap
          seconds and how the servers (inside and outside their
          organization) they are using deal with them.  Individual clients
          MUST NOT be configured to use a mixture of smeared and
          non-smeared servers.  If a client uses smeared servers, the
          servers it uses must all have the same leap smear
          configuration.</t>

        </section>
      </section>
    </section>

      <section anchor="Sec_Mech" title="NTP Security Mechanisms">
        <t>In the standard configuration NTP packets are exchanged
        unprotected between client and server.  An adversary that is able to
        become a Man-In-The-Middle is therefore able to drop, replay or
        modify the content of the NTP packet, which leads to degradation of
        the time synchronization or the transmission of false time
        information.  A threat analysis for time synchronization
        protocols is given in <xref target="RFC7384"/>.  NTP
        provides two internal security mechanisms to protect authenticity
        and integrity of the NTP packets.  Both measures protect the NTP
        packet by means of a Message Authentication Code (MAC).  Neither of
        them encrypts the NTP's payload, because this payload information is
        not considered to be confidential.</t>

        <section title="Pre-Shared Key Approach">
          <t>This approach applies a symmetric key for the calculation of
          the MAC, which protects authenticity and integrity of the
          exchanged packets for an association.  NTP does not provide a
          mechanism for the exchange of the keys between the associated
          nodes.  Therefore, for each association, keys MUST be exchanged
          securely by external means, and they MUST be protected from
          disclosure.  It is RECOMMENDED that each
          association be protected by its own unique key. It is RECOMMENDED
          that participants agree to refresh keys periodically. 
          However, NTP does not provide a mechanism to assist in doing so.
		  Each communication partner will need to keep track of its keys in
		  its own local key storage.</t>
		  
          <t><xref target="RFC5905"/> specifies using the MD5 hash algorithm
          for calculation of the MAC, but other algorithms 
          may be supported as well. The MD5 hash is now considered to be too 
          weak and unsuitable for cryptographic usage. <xref target="RFC6151"/> has more information on the algorithm's weaknesses. Implementations will soon be available based on 
          <xref target="I-D.ietf-ntp-mac">AES-128-CMAC </xref>, and users SHOULD use that when it is available. </t>

          <t>Some implementations store the key in clear text.  Therefore it
          MUST only be readable by the NTP process.</t>
		  
		  <t>An NTP client has to be able to link a key to a particular server
		  in order to establish a protected association. This linkage is
		  implementation specific. Once applied, a key will be trusted until
		  the link is removed.</t>
        </section>

        <section title="Autokey">
          <t><xref target="RFC5906"/> specifies the Autokey protocol. 
          It was published in 2010 to provide automated key management 
		  and authentication of NTP servers.  However, security researchers
	      have identified <eref
	      target="https://lists.ntp.org/pipermail/ntpwg/2011-August/001714.html">
          vulnerabilities</eref> in the Autokey protocol. 
	  </t>

          <t>Autokey SHOULD NOT be used.</t>

      </section>
		
    <section title="Network Time Security">
          <t> Work is in progress on an enhanced replacement for Autokey. Refer to
          <xref target="I-D.ietf-ntp-using-nts-for-ntp"/> for more information. </t>
        </section>
        
    <section title="External Security Protocols">
    	<t>If applicable, external security protocols such as IPsec and MACsec can be 
    	applied to enhance integrity and authenticity protection of NTP time 
    	synchronization packets. Usage of such external security protocols can decrease
    	time synchronization performance <xref target="RFC7384"/>. Therefore, operators
    	are advised to carefully evaluate if the decreased time synchronization 
    	performance meets their specific timing requirements.</t>
    	
    <t>
    Note that none of the security measures described in <xref target="Sec_Mech"/> can
    prevent packet delay manipulation attacks on NTP. Such delay attacks can target time synchronization packets sent as clear-text or even within an encrypted tunnel. 
    These attacks are described further in Section 3.2.6 of <xref target="RFC7384"/>. 
    </t>
    </section>
  </section>

  <section anchor="Sec_Bcp" title="NTP Security Best Practices">
      <t>This section lists some general NTP security practices,
      but these issues may (or may not) have been mitigated in particular
      versions of particular implementations. Contact the maintainers of 
      the relevant implementation for more information.</t>
	<section title="Minimizing Information Leakage">
          <t>The base NTP packet leaks important information (including
           reference ID and reference time) that may be used in attacks
           <xref target="NDSS16"></xref>, <xref target="CVE-2015-8138"></xref>, 
           <xref target="CVE-2016-1548"></xref>.  A remote attacker can
           learn this information by sending mode 3 queries to a target
           system and inspecting the fields in the mode 4 response packet.
           NTP control queries also leak important information (including
           reference ID, expected origin timestamp, etc.) that may be used
           in attacks <xref target="CVE-2015-8139"></xref>.  A remote
           attacker can learn this information by sending control queries to
           a target system and inspecting the leaked information in the
		   response.</t>

           <t>As such, mechanisms outside of the NTP protocol, such as 
           Access Control Lists, SHOULD be used to limit the exposure
           of this information to allowed IP addresses, and keep it from
		   remote attackers not on the list.  Hosts SHOULD only respond to 
           NTP control queries from authorized parties. </t>

           <t>An NTP client that does not provide time on the network 
           can additionally log
           and drop incoming mode 3 timing queries from unexpected sources.
           Note well that the easiest way to monitor the status of an NTP 
		   instance is to send it a mode 3 query, so it may not be desirable
		   to drop all mode 3 queries. As an alternative, operators SHOULD
           either filter mode 3 queries from outside their networks, 
		   or make sure mode 3 queries
           are allowed only from trusted systems or networks.</t>

           <t>A "leaf-node host" is a host that is using NTP solely for the
           purpose of adjusting its own system time.  Such a host is not
           expected to provide time to other hosts, and relies exclusively
           on NTP's basic mode to take time from a set of servers. (That is,
           the host sends mode 3 queries to its servers and receives mode 4
           responses from these servers containing timing information.)  To
           minimize information leakage, leaf-node hosts SHOULD drop all
           incoming NTP packets except mode 4 response packets that come
           from known sources. An exception to this can be made if a 
		   leaf-node host is being actively monitored, in which case
		   incoming packets from the monitoring server can be allowed.</t>
           
           <t>Please refer to <xref target="I-D.ietf-ntp-data-minimization"/>
           for more information.</t>
      </section>

      <section title="Avoiding Daemon Restart Attacks">
        <t><xref target="RFC5905"/> says NTP clients should
          not accept time shifts greater than the panic threshold.
          Specifically, RFC 5905 says "PANIC means the offset is greater
          than the panic threshold PANICT (1000 s) and SHOULD cause the
          program to exit with a diagnostic message to the system log."</t>

          <t>However, this behavior can be exploited by attackers 
          as described in <xref target="NDSS16"/>, when the following two conditions
          hold:</t>

          <t><list style="numbers">
            <t>The operating system automatically restarts the NTP client
            when it quits.  (Modern *NIX operating systems are replacing
            traditional init systems with process supervisors, such as
            systemd, which can be configured to automatically restart any
            daemons that quit.  This behavior is the default in CoreOS and
            Arch Linux.  As of the time of this writing, it appears
            likely to become the default behavior in
            other systems as they migrate legacy init scripts to process
            supervisors such as systemd.)</t>
          
            <t>The NTP client is configured to ignore the panic 
            threshold on all restarts.</t>
          </list></t>

          <t>In such cases, if the attacker can send the target an offset
          that exceeds the panic threshold, the client will quit.  Then,
          when it restarts, it ignores the panic threshold and
          accepts the attacker's large offset.</t>

          <t>Operators need to be aware that when operating with the above 
          two conditions, the panic threshold offers no protection from attacks.  
          The natural solution is not to run hosts with these
          conditions.  Specifically, operators SHOULD NOT ignore the panic 
          threshold in all cold-start situations unless sufficient 
          oversight and checking is in place to make sure that this type of
          attack cannot happen.</t>

          <t>As an alternative, the following steps MAY be taken by operators 
          to mitigate the risk of attack:</t>
          <t><list style="symbols">
             <t>Monitor the NTP system log to detect when the NTP daemon has
             quit due to a panic event, as this could be a sign of an
             attack.</t>

             <t>Request manual intervention when a timestep larger than the
             panic threshold is detected.</t>
             
             <t>Configure the ntp client to only ignore the panic threshold in
             a cold start situation.</t>
            
             <t>Increase the minimum number of servers required before the NTP 
             client adjusts the system clock. This will make the NTP client wait 
             until enough trusted sources of time agree before declaring the 
             time to be correct.</t>
          
          </list></t>
		  
		  <t>In addition, the following steps SHOULD be taken by those who 
		  implement the NTP protocol:</t>
		  <t><list style="symbols">
			<t>Prevent the NTP daemon from taking time steps that set the 
			clock to a time earlier than the compile date of the NTP daemon.</t>
			<t>Prevent the NTP daemon from putting 'INIT' in the reference ID of
			its NTP packets upon initializing. This will make it more difficult
			for attackers to know when the daemon reboots.</t>
		  </list></t>
		  
      </section>
      
      <section title="Detection of Attacks Through Monitoring">
        <t>Operators SHOULD monitor their NTP instances to detect attacks.  Many
        known attacks on NTP have particular signatures.  Common attack
        signatures include:</t>
        
        <t><list style="numbers">
          <t>Bogus packets - A packet whose origin timestamp does not
          match the value that expected by the client.</t>

          <t>Zero origin packet - A packet with an origin timestamp set to
          zero <xref target="CVE-2015-8138"/>.</t>

          <t>A packet with an invalid cryptographic MAC <xref target="CCR16"/>.</t>
        </list></t>

        <t>The observation of many such packets could indicate that the client 
        is under attack.</t>

      </section>

      <section anchor="KoD" title="Kiss-o'-Death Packets">
        <t>The "Kiss-o'-Death" (KoD) packet includes a rate management mechanism
        where a server can tell a misbehaving client to reduce its query
        rate.  KoD packets in general (and the RATE packet in particular)
		are defined in Section 7.4 of <xref target="RFC5905"/>.
		It is RECOMMENDED that all NTP devices respect these packets
        and back off when asked to do so by a server.  It is even more
        important for an embedded device, which may not have an exposed 
        control interface for NTP.</t>

        <t>That said, a client MUST only accept a KoD packet if it has a valid
        origin timestamp. Once a RATE packet is accepted, the client should 
        increase its poll interval value (thus decreasing its polling rate) up 
        to a reasonable maximum. This maximum can vary by implementation but 
        should not exceed a poll interval value of 13 (2 hours). The mechanism 
        to determine how much to increase the poll interval value is undefined 
        in <xref target="RFC5905"/>. If the client uses the poll
        interval value sent by the server in the RATE packet, it MUST NOT simply
        accept any value. Using large interval values may open a vector for a 
        denial-of-service attack that causes the client to stop querying its 
        server <xref target="NDSS16"/>.</t>

        <t>The KoD rate management mechanism relies on clients behaving 
        properly in order to be effective.  Some clients ignore the RATE packet 
        entirely, and other poorly-implemented clients might unintentionally 
        increase their poll rate and simulate a denial of service attack.  
        Server administrators are advised to be prepared for this and take 
        measures outside of the NTP protocol to drop packets from misbehaving 
        clients when these clients are detected.</t>
        
        <t>Kiss-o'-Death (KoD) packets can be used in denial of service
        attacks.  Thus, the observation of even just one RATE packet with a
        high poll value could be sign that the client is under attack. 
        And KoD packets are commonly accepted even when not cryptographically 
        authenticated, which increases the risk of denial of service attacks.</t>
      </section>

      <section title="Broadcast Mode Should Only Be Used On Trusted Networks">
        <t>Per <xref target="RFC5905"/>, NTP's broadcast mode is
        authenticated using symmetric key cryptography.  The broadcast
        server and all its broadcast clients share a symmetric
        cryptographic key, and the broadcast server uses this key to append
        a message authentication code (MAC) to the broadcast packets it
        sends.</t>

        <t>Importantly, all broadcast clients that listen to this server
        have to know the cryptographic key. This mean that any client can use
        this key to send valid broadcast messages that look like they come
        from the broadcast server. Thus, a rogue broadcast client can use
        its knowledge of this key to attack the other broadcast clients.</t>

        <t>For this reason, an NTP broadcast server and all its clients have 
        to trust each other.  Broadcast mode SHOULD only be run from within a 
        trusted network.</t>

      </section>

      <section title="Symmetric Mode Should Only Be Used With Trusted Peers">
        <t>In symmetric mode, two peers Alice and Bob can both push and pull
        synchronization to and from each other using either ephemeral
        symmetric passive (mode 2) or persistent symmetric active (NTP mode
        1) packets.  The persistent association is preconfigured and
        initiated at the active peer but not preconfigured at the passive
        peer (Bob).  Upon receipt of a mode 1 NTP packet from Alice, Bob
        mobilizes a new ephemeral association if he does not have one
        already.  This is a security risk for Bob because an arbitrary
        attacker can attempt to change Bob's time by asking Bob to become
        its symmetric passive peer.</t>

        <t>For this reason, a host SHOULD only allow symmetric passive
        associations to be established with trusted peers.  Specifically,
        a host SHOULD require each of its symmetric passive association to be
        cryptographically authenticated.  Each symmetric passive association
        SHOULD be authenticated under a different cryptographic key.</t>

      </section>
    </section>

    <section title="NTP in Embedded Devices">
      <t>As computing becomes more
      ubiquitous, there will be many small embedded devices that
      require accurate time.  These devices may not have a persistent
	  battery-backed clock, so using NTP to set the correct time on 
	  power-up may be critical for proper operation. These devices may not
	  have a traditional user interface, but if they connect to the
	  Internet they will be subject to the same security threats as 
	  traditional deployments.</t>

      <section title="Updating Embedded Devices">
        <t>Vendors of embedded devices are advised to pay attention to the 
        current state 
		of protocol security issues and bugs in their chosen implementation,
        because their customers don't have the ability to update their NTP
        implementation on their own.  Those devices may have a single
        firmware upgrade, provided by the manufacturer, that updates all
        capabilities at once.  This means that the vendor assumes the
        responsibility of making sure their devices have an up-to-date and
		secure NTP implementation.</t>

        <t>Vendors of embedded devices SHOULD include the ability to update 
        the list of NTP servers used by the device.</t>

        <t>There is a catalog of NTP server abuse incidents, some of which
	involve embedded devices, on the Wikipedia page
	for <eref target="https://en.wikipedia.org/wiki/NTP_server_misuse_and_abuse">
	NTP Server Misuse and Abuse</eref>. </t>
      </section>

      <section title="Server configuration">
        <t>Vendors of embedded devices with preconfigured NTP servers need 
        to carefully consider which servers to use. There are
        several public-facing NTP servers available, but they may not be
        prepared to service requests from thousands of new devices on the
        Internet. Vendors MUST only preconfigure NTP servers that they have
        permission to use.</t>

        <t>Vendors are encouraged to invest resources into providing their own
        time servers for their devices to connect to. This may be done through
		the NTP Pool Project, as documented in 
		<xref target="Pool"/>.</t>
        
        <t>Vendors should read <xref target="RFC4085"/>, 
        which advises against embedding globally-routable IP addresses in 
        products, and offers several better alternatives.</t>

      </section>
    </section>

    <section title="NTP over Anycast">
      <t>Anycast is described in <xref target="RFC4786">BCP 126</xref>.
      (Also see <xref target="RFC7094"/>).  With anycast, a
      single IP address is assigned to multiple servers, and routers
      direct packets to the closest active server.</t>

      <t>Anycast is often used for Internet services at known IP addresses,
      such as DNS.  Anycast can also be used in large organizations to
      simplify configuration of many NTP clients.  Each client
      can be configured with the same NTP server IP address, and a pool of
      anycast servers can be deployed to service those requests.  New
      servers can be added to or taken from the pool, and other than a
      temporary loss of service while a server is taken down, these
      additions can be transparent to the clients.</t>

      <t>Note well that using a single anycast address for NTP presents its 
      own potential issues. It means each client will likely use a single time server
      source.  A key element of a robust NTP deployment is each client using
      multiple sources of time.  With multiple time sources, a client will
      analyze the various time sources, selecting good ones, and
      disregarding poor ones.  If a single Anycast address is used, this 
      analysis will not happen. This can be mitigated by creating multiple,
	  separate anycast pools so clients can have multiple sources of time
	  while still gaining the configuration benefits of the anycast pools.</t>

      <t>If clients are connected to an NTP server via anycast, the client
      does not know which particular server they are connected to.  As 
      anycast servers enter and leave the network, or the network topology 
      changes, the server a particular client is connected to may change. 
      This may cause a small shift in time from the perspective of the 
      client when the server it is connected to changes.  In extreme cases 
      where the network topology is changing rapidly, this could cause 
      the server seen by a client to rapidly change as well, which can lead 
      to larger time inaccuracies. It is RECOMMENDED that network operators 
      only deploy anycast NTP in environments where operators know these 
      small shifts can be tolerated by the applications running on the clients 
      being synchronized in this manner.</t>

      <t>Configuration of an anycast interface is independent of NTP.
      Clients will always connect to the closest server, even if that server
      is having NTP issues.  It is RECOMMENDED that anycast NTP
      implementations have an independent method of monitoring the
      performance of NTP on a server.  If the server is not performing to
      specification, it should remove itself from the Anycast network.  It
      is also RECOMMENDED that each Anycast NTP server have an alternative method
      of access, such as an alternate Unicast IP address, so its performance 
      can be checked independently of the anycast routing scheme.</t>
	  

      <t>One useful application in large networks is to use a hybrid
      unicast/anycast approach.  Stratum 1 NTP servers can be deployed with
      unicast interfaces at several sites.  Each site may have several
      Stratum 2 servers with two ethernet interfaces, or a single interface 
      which can support multiple addresses.  One interface has a
      unique unicast IP address.  The second has an anycast IP interface
      (with a shared IP address per location).  The unicast interfaces can
      be used to obtain time from the Stratum 1 servers globally (and
      perhaps peer with the other Stratum 2 servers at their site).  Clients
      at each site can be configured to use the shared anycast address for
      their site, simplifying their configuration.  Keeping the anycast
      routing restricted on a per-site basis will minimize the disruption at
      the client if its closest anycast server changes.  Each Stratum 2
      server can be uniquely identified on their unicast interface, to make
      monitoring easier.</t>
    </section>

    <section anchor="Acknowledgements" title="Acknowledgments">
      <t>The authors wish to acknowledge the contributions of Sue Graves,
      Samuel Weiler, Lisa Perdue, Karen O'Donoghue, David Malone, Sharon
      Goldberg, Martin Burnicki, Miroslav Lichvar, Daniel Fox Franke,
      Robert Nagy, and Brian Haberman.</t> </section>

    <!-- Possibly a 'Contributors' section ... -->

    <section anchor="IANA" title="IANA Considerations">
      <t>This memo includes no request to IANA.</t>
    </section>

    <section anchor="Security" title="Security Considerations">
      <t>Time is a fundamental component of security on the internet. 
         The absence of a reliable source of current time subverts many 
         common web authentication schemes, e.g.,  by allowing the use of 
         expired credentials or by allowing for replay of messages only 
         intended to be processed once.</t>
      
      <t>Much of this document directly addresses how to secure NTP servers.
      In particular, see <xref target="Sec_Gen"/>, <xref target="Sec_Mech"/>, 
      and <xref target="Sec_Bcp"/>. </t>
      
      <t>There are several general threats to time synchronization protocols 
      which are discussed in <xref target="RFC7384"/>.</t>

      <t>
      <xref target="I-D.ietf-ntp-using-nts-for-ntp"/> specifies the
	  Network Time Security (NTS) mechanism and applies it to 
	  NTP.  Readers are encouraged to check the status of the draft, and 
	  make use of the methods it describes.</t>
    </section>
  </middle>

  <!--  *****BACK MATTER ***** -->

  <back>
    <!-- References split into informative and normative -->

    <!-- There are 2 ways to insert reference entries from the citation libraries:
     1. define an ENTITY at the top, and use "ampersand character"RFC2629; here (as shown)
     2. simply use a PI "less than character"?rfc include="reference.RFC.2119.xml"?> here
        (for I-Ds: include="reference.I-D.narten-iana-considerations-rfc2434bis.xml")

     Both are cited textually in the same manner: by using xref elements.
     If you use the PI option, xml2rfc will, by default, try to find included files in the same
     directory as the including file. You can also define the XML_LIBRARY environment variable
     with a value containing a set of directories to search.  These can be either in the local
     filing system or remote ones accessed by http (http://domain/dir/... ).-->

    <references title="Normative References">

      &RFC5905;


      &RFC2827;


      &RFC4786;

	  
	  &RFC4085;
      
      &RFC2119;
       
      &RFC8174;
	  

     

    </references>

    <!-- Here we use entities that we defined at the beginning. -->

    <references title="Informative References">
    
    &RFC7094;
          
    &RFC7384;
    
    &RFC1305;
    
    &RFC5906;
    
    &RFC6151;
	
<!--	<reference anchor="BCP38INFO" target="http://www.bcp38.info">
  <front>
    <title>BCP38 Info Page</title>
    <author/>
    <date/>
  </front>
</reference> -->
<!-- [MILLS2006] Mills, D. (2006). Computer network time synchronization: the Network Time Protocol: CRC Press. -->
      <reference anchor="MILLS2006">
        <front>
          <title>Computer network time synchronization: the Network Time Protocol</title>
          <author fullname="David Mills" surname="Mills" initials="D.">
		  	<organization>University of Delaware</organization>
          </author>
		  <date year="2006" />
        </front>
		<seriesInfo name="CRC Press" value=""/>
      </reference>


<!-- [NDSS16] Attacking the Network Time Protocol. Aanchal Malhotra, Isaac E. Cohen, Erik Brakke and Sharon Goldberg NDSS'16, San Diego, CA. Feb 2016.    https://eprint.iacr.org/2015/1020.pdf -->

      <reference anchor="NDSS16"
                 target="https://eprint.iacr.org/2015/1020.pdf">
        <front>
          <title>Attacking the Network Time Protocol</title>
          <author fullname="Aanchal Malhotra" surname="Malhotra" initials="A.">
		  	<organization>Boston University</organization>
          </author>
          <author fullname="Isaac E. Cohen" surname="Cohen" initials="I.">
		  	<organization>Boston University</organization>
          </author>
          <author fullname="Erik Brakke" surname="Brakke" initials="E.">
			<organization>Boston University</organization>
          </author>
          <author fullname="Sharon Goldberg" surname="Goldberg" initials="S.">
			<organization>Boston University</organization>
          </author>
		  <date year="2016" />
        </front>
		<seriesInfo name="NDSS'16, San Diego, CA." value=""/>
      </reference>

<!--
[CCR16] 
Attacking NTP's Authenticated Broadcast Mode. Aanchal Malhotra and Sharon Goldberg. SIGCOMM Computer Communications Review (CCR), April 2016.
-->

      <reference anchor="CCR16">
        <front>
          <title>Attacking NTP's Authenticated Broadcast Mode</title>
          <author fullname="Aanchal Malhotra" surname="Malhotra" initials="A.">
		  	<organization>Boston University</organization>
          </author>
          <author fullname="Sharon Goldberg" surname="Goldberg" initials="S.">
			<organization>Boston University</organization>
          </author>
          <date year="2016" />
        </front>
		<seriesInfo name="SIGCOMM Computer Communications Review (CCR)" value=""/>
      </reference>
      
<!--
[IMC14] 
Czyz, J., Kallitsis, M., Gharaibeh, M., Papadopoulos, C., Bailey, M., 
& Karir, M. (2014). Taming the 800 Pound Gorilla: The Rise and Decline of NTP 
DDoS Attacks. Paper presented at the Proceedings of the 2014 Conference on 
Internet Measurement Conference, Vancouver, BC, Canada. 
http://dl.acm.org/citation.cfm?doid=2663716.2663717
-->

      <reference anchor="IMC14">
        <front>
          <title>Taming the 800 Pound Gorilla: The Rise and Decline of NTP DDoS Attacks</title>
          <author fullname="Jakub Czyz" surname="Czyz" initials="J.">
		  	<organization>University of Michigan</organization>
          </author>
          <author fullname="Michael Kallitsis" surname="Kallitsis" initials="M.">
			<organization>Merit Network, Inc.</organization>
          </author>
          
          <author fullname="Manaf Gharaibeh" surname="Gharaibeh" initials="M.">
			<organization>Colorado State University</organization>
          </author>
          <author fullname="Christos Papadopoulos" surname="Papadopoulos" initials="C.">
			<organization>Colorado State University</organization>
          </author>
          <author fullname="Michael Bailey" surname="Bailey" initials="M.">
			<organization>University of Michigan, University of Illinois</organization>
          </author>
          <author fullname="Manish Karir" surname="Karir" initials="M.">
			<organization>Merit Network, Inc.</organization>
          </author>
          <date year="2014" />
        </front>
		<seriesInfo name="Internet Measurement Conference" value=""/>
      </reference>
      
<!--
[NDSS14] 
o	Rossow, C. (2014). Amplification Hell: Revisiting Network Protocols for DDoS Abuse. Paper presented at the NDSS Symposium 2014, San Diego, California. 
-->

      <reference anchor="NDSS14">
        <front>
          <title>Amplification Hell: Revisiting Network Protocols for DDoS Abuse</title>
          <author fullname="Christian Rossow" surname="Rossow" initials="C.">
		  	<organization>VU University </organization>
          </author>
          <date year="2014" />
        </front>
		<seriesInfo name="NDSS'14, San Diego, CA." value=""/>
      </reference>

<!--
[CVE-2015-8138] 
NETWORK TIME PROTOCOL ORIGIN TIMESTAMP CHECK IMPERSONATION VULNERABILITY.  Matthew Van Gundy, Jonathan Gardner. JANUARY 19, 2016 http://www.talosintel.com/reports/TALOS-2016-0077/
-->

      <reference anchor="CVE-2015-8138" target="http://www.talosintel.com/reports/TALOS-2016-0077">
        <front>
          <title>NETWORK TIME PROTOCOL ORIGIN TIMESTAMP CHECK IMPERSONATION VULNERABILITY</title>
          <author fullname="Matthew Van Gundy" surname="Van Gundy" initials="M.">
          </author>
          <author fullname="Jonathan Gardner" surname="Gardner" initials="J.">
          </author>
          <date year="2016" />
        </front>
      </reference>

<!--
[CVE-2016-1548] Xleave Pivot: NTP Basic Mode to Interleaved. Jonathan Gardner, Miroslav Lichvar. April 27, 2016. http://blog.talosintel.com/2016/04/vulnerability-spotlight-further-ntpd_27.html
-->

      <reference anchor="CVE-2016-1548" target="http://blog.talosintel.com/2016/04/vulnerability-spotlight-further-ntpd_27.html">
        <front>
          <title>Xleave Pivot: NTP Basic Mode to Interleaved</title>
          <author fullname="Jonathan Gardner" surname="Gardner" initials="J.">
          </author>
          <author fullname="Miroslav Lichvar" surname="Lichvar" initials="M.">
          </author>
          <date year="2016" />
        </front>
      </reference>

<!--
[CVE-2015-8139] 
NETWORK TIME PROTOCOL NTPQ AND NTPDC ORIGIN TIMESTAMP DISCLOSURE VULNERABILITY
Matthew Van Gundy. JANUARY 19, 2016
http://www.talosintel.com/reports/TALOS-2016-0078/
-->

      <reference anchor="CVE-2015-8139" target="http://www.talosintel.com/reports/TALOS-2016-0078">
        <front>
          <title>NETWORK TIME PROTOCOL NTPQ AND NTPDC ORIGIN TIMESTAMP DISCLOSURE VULNERABILITY</title>
          <author fullname="Matthew Van Gundy" surname="Van Gundy" initials="M.">
          </author>
          <date year="2016" />
        </front>
      </reference>
	  

<!-- NTS for NTP I-D -->

        &NTSFORNTP;
<!-- NTP MAC -->

        &NTPMAC;
<!-- Control Message Draft --> 
        &CTRLMSG;

<!-- Data minimization  -->     
        &DATAMIN;
          

    </references> 
  
  
    <!-- Appendix with implementation specific stuff -->
       
       <section anchor="AppendixNTPD" title="Best Practices specific to the Network 
       Time Foundation implementation">
       
       <t>The Network Time Foundation (NTF) provides a widely used
       implementation of NTP, known as 
       <eref target="http://www.ntp.org/downloads.html">ntpd</eref>. 
       It is an evolution of the first NTP implementations developed by 
       David Mills at the University of Delaware.  This appendix contains
       additional recommendations specific to this implementation that are 
       valid at the time of this writing.
       </t>
      
       <section anchor="AppendixNTPDTimeSources"
       title="Use enough time sources">
      
        <t>In addition to the recommendation given in <xref 
        target="TimeSources"/> the ntpd implementation provides the 'pool'
        directive. 
        Starting with ntp-4.2.6, using this directive in the ntp.conf 
		file will spin up
        enough associations to provide robust time service, and will
        disconnect poor servers and add in new servers as-needed.  
        The 'minclock' and 'maxclock' options
        of the 'tos' command may be used to override the default values of how many
        servers are discovered through the 'pool' directive.</t>
       </section>
      	 <section anchor="NTPFacilityMessages" 
      	 title="NTP Control and Facility Messages">
        <t>In addition to NTP Control Messages the ntpd implementation 
      	also offers the Mode 7 commands for monitoring and configuration.</t>
      	 
      	<t> If Mode 7 has been explicitly enabled to be used
        for more than basic monitoring it should be limited to authenticated
        sessions that provide a 'requestkey'.</t>
        
        <t>As mentioned above, there are two general ways to use Mode 6 and
        Mode 7 requests. One way is to query ntpd for information, and this
        mode can be disabled with:</t>

        <t>restrict ... noquery</t>

        <t>The second way to use Mode 6 and Mode 7 requests is to modify
        ntpd's behavior.  Modification of ntpd's configuration requires an
        authenticated session by default.  If no authentication keys have
        been specified no modifications can be made.  For additional
        protection, the ability to perform these modifications can be
        controlled with:</t>

        <t>restrict ... nomodify</t>

        <t>Users can prevent their NTP servers from considering
        query/configuration traffic by default by adding the following to
        their ntp.conf file:</t>

        <t>restrict default -4 nomodify notrap nopeer noquery</t>

        <t>restrict default -6 nomodify notrap nopeer noquery</t>

        <t>restrict source nomodify notrap noquery</t>
      	 </section>

       
        <section anchor="AppendixNTPDMonitoring" title="Monitoring">
        <t>The ntpd implementation allows remote monitoring.
        Access to this service is generally controlled by the "noquery"
        directive in NTP's configuration file (ntp.conf) via a "restrict"
        statement.  The syntax reads:</t>

        <figure>
          <artwork><![CDATA[restrict address mask address_mask noquery]]></artwork>
        </figure>

        <t>If a system is using broadcast mode and is running ntp-4.2.8p6 or
        later, use the 4th field of the ntp.keys file to specify the IPs of
        machines that are allowed to serve time to the group.</t>
        
      </section>
      
      <section anchor="AppendixNTPDLeapFile" title="Leap Second File">      
        <t>The use of leap second
	     files requires ntpd 4.2.6 or later.  After fetching the leap seconds
	     file onto the server, add this line to ntpd.conf to apply and use
	    the file, substituting the proper path:</t>

        <t>leapfile "/path/to/leap-file"</t>

        <t>There may need to restart ntpd to apply this change.</t>

        <t>ntpd servers with a manually configured leap second file will
        ignore leap second information broadcast from upstream NTP servers
        until the leap second file expires.  If no valid leap second file is
        available then a leap second notification from an attached reference
        clock is always accepted by ntpd.</t>
		
	    <t>If no valid leap second file is available, a leap second
	    notification may be accepted from upstream NTP servers.  As of
	    ntp-4.2.6, a majority of servers must provide the notification
	    before it is accepted.  Before 4.2.6, a leap second notification
	    would be accepted if a single upstream server of a group of
	    configured servers provided a leap second notification. This would
	    lead to misbehavior if single NTP servers sent an invalid leap
	    second warning, e.g. due to a faulty GPS receiver in one server, but
	    this behavior was once chosen because in the "early days" there was
	    a greater chance that leap second information would be available
	    from a very limited number of sources.</t>
        
      </section>
      <section anchor="AppendixNTPDLeapSmear" title="Leap Smearing"> 
        <t>Leap Smearing was introduced in ntpd versions 4.2.8.p3 and
        4.3.47, in response to client requests.  Support for leap smearing
        is not configured by default and must be added at compile time.
        In addition, no leap smearing will occur unless a leap smear
        interval is specified in ntpd.conf .  For more information, refer
        to <eref target="http://bk1.ntp.org/ntp-stable/README.leapsmear?PAGE=anno">
        http://bk.ntp.org/ntp-stable/README.leapsmear?PAGE=anno</eref>.</t>
      </section>
        
        <section title="Configuring ntpd">
	      <t>See <eref target="https://support.ntp.org/bin/view/Support/ConfiguringNTP">
	      https://support.ntp.org/bin/view/Support/ConfiguringNTP</eref>
	      for additional information on configuring ntpd.</t>
        </section>
        
      <section anchor="AppendixNTPDPreSharedKeys" title="Pre-Shared Keys"> 
        <t>Each communication partner must add the key
        information to their key file in the form:</t>

          <figure>
            <artwork><![CDATA[keyid type key]]></artwork>
          </figure>
		  <t>where "keyid" is a number between 1 and 65534, inclusive, 
		  "type" is an ASCII character which defines the key format, 
		  and "key" is the key itself.</t>
          
          <t>An ntpd client establishes a protected association by appending
          the option "key keyid" to the server statement in ntp.conf:</t>

          <figure>
            <artwork><![CDATA[server address key keyid]]></artwork>
          </figure>
		  <t>substituting the server address in the "address" field and the 
		  numerical keyid to use with that server in the "keyid" field.</t>
          
          <t>A key is deemed trusted when its keyid is added to the list of trusted
	      keys by the "trustedkey" statement in ntp.conf.</t>

          <figure>
            <artwork><![CDATA[trustedkey keyid_1 keyid_2 ... keyid_n]]></artwork>
          </figure>
		  
          
        <t>Starting with ntp-4.2.8p7 the ntp.keys file accepts an optional 4th 
        column, a comma-separated list of IPs that are allowed to serve time. 
        Use this feature.  Note, however, that an adversarial client that knows
        the symmetric broadcast key could still easily spoof its source IP to an
        IP that is allowed to serve time. (This is easy to do because the origin
        timestamp on broadcast mode packets is not validated by the client. By
        contrast, client/server and symmetric modes do require origin timestamp 
        validation, making it more difficult to spoof packets <xref target="CCR16">
        </xref>).</t> 
      </section>
      
      <!-- end of ntpd appendix -->
      
      </section> 

    <!-- Change Log

	draft-reilly-ntp-bcp
v00 2015-09-18  DPR Initial Submission   
v01 2016-03-09  DPR 1st Rev after submissions from Harlan, Dieter
v02 2016-06-08  DPR 2nd Rev, incudes input from David Malone, Sharon Goldberg
	draft-ietf-ntp-bcp
v00 2016-07-26  DPR moved to ietf doc, lots of suggestions from Martin Burnicki, others
v01 2016-10-04  DPR more leap second fixes from Martin, editrorial fixes
    2016-10-29	HMS Updates and cleanup.
    2017-05-11 HMS: tweaks to DPR's 04
    2017-05-18 DPR tweaks back 
               (sources of time, autokey, anycast, extended info)
    lots missing
    2018-07-05  DPR: put NTPd-specific things in an appendix with Dieter's help  
                resolved other feedback from reviewers.
v08 2018-11-12  DPR: resolved several comments from outside reviewers
v09             DPR: strengthened and clarified requirements language
v10 2018-12-13  DPR: fixed minor nits regarding URL's, and citation of informative and obsolete RFC's
v11             DPR: changes made due to IESG feedback
v12 2019-01-25  DPR: IESG Feedback
       -->
  </back>
</rfc>
