<?xml version="1.0" encoding="US-ASCII"?>
<!DOCTYPE rfc SYSTEM "rfc2629.dtd">
<?rfc toc="yes"?>
<?rfc tocompact="yes"?>
<?rfc tocdepth="3"?>
<?rfc tocindent="yes"?>
<?rfc symrefs="yes"?>
<?rfc sortrefs="yes"?>
<?rfc comments="yes"?>
<?rfc inline="yes"?>
<?rfc compact="yes"?>
<?rfc subcompact="no"?>
<rfc category="std" docName="draft-sibold-autokey-02" ipr="trust200902"
     submissionType="IETF">
  <front>
    <title abbrev="NTP autokey V2">Network Time Protocol: autokey Version 2
    Specification</title>

    <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>

    <author fullname="Stephen R&ouml;ttger" initials="S."
            surname="R&ouml;ttger">
      <organization abbrev="TU-BS">Technische Universit&auml;t
      Braunschweig</organization>

      <address>
        <postal>
          <street/>

          <city/>

          <region/>

          <code/>

          <country/>
        </postal>

        <phone/>

        <facsimile/>

        <email>stephen.roettger@googlemail.com</email>

        <uri/>
      </address>
    </author>

    <date day="23" month="February" year="2013"/>

    <area>Internet Area</area>

    <workgroup>NTP Working Group</workgroup>

    <keyword>Authentication</keyword>

    <keyword>NTP</keyword>

    <keyword>Draft</keyword>

    <abstract>
      <t>This document describes a security protocol that enables
      authenticated time synchronization using Network Time Protocol (NTP).
      Autokey Version 2 obsoletes NTP autokey protocol <xref
      target="RFC5906">RFC 5906</xref> which suffers from various security
      vulnerabilities. Its design considers the special requirements that are
      related to the task of precise timekeeping.</t>
    </abstract>

    <note title="Requirements Language">
      <t>The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
      "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this
      document are to be interpreted as described in <xref
      target="RFC2119">RFC 2119</xref>.</t>
    </note>
  </front>

  <middle>
    <section title="Introduction">
      <t>In NTP <xref target="RFC5905"/> the autokey protocol <xref
      target="RFC5906"/> was introduced to provide authenticity to NTP servers
      and to ensure integrity of time synchronization. It is designed to meet
      the specific communication requirements of precise timekeeping and
      therefore does not compromise timekeeping precision.</t>

      <t>This document focuses on a new definition of the autokey protocol for
      NTP, autokey version 2. The necessity to renew the autokey specification
      arises from various severe security vulnerabilities that have been found
      in a thorough analysis of the protocol <xref target="R&ouml;ttger"/>.
      The new specification is based on the same assumptions as the original
      autokey specification. In particular, the prerequisite is that precise
      timekeeping can only be accomplished with stateless time synchronization
      communication, which excludes standard security protocols like IPSec or
      TLS. This prerequisite corresponds with the requirement that a security
      mechanism for timekeeping must be designed in such a way that it does
      not degrade the quality of the time transfer <xref
      target="I-D.ietf-tictoc-security-requirements"/>.</t>

      <section title="Differences from the original autokey">
        <t>Autokey version 2 is a major redraft of the original autokey
        specification. It is intended to mitigate security vulnerabilities of
        the original specification and it is based on the suggestions in the
        analysis of R&ouml;ttger <xref target="R&ouml;ttger"/>. The major
        changes are:</t>

        <t><list style="symbols">
            <t>The bit length of server seed and cookie has been
            increased.</t>

            <t>The IP addresses of the synchronization partners in the
            calculation of the cookie have been replaced by the hash value of
            the client's public key.</t>

            <t>The identity schemes for the verification of the NTP server
            authenticity have been replaced by a hierarchical public key
            infrastructure (PKI) based on X.509 certificates.</t>
          </list></t>
      </section>
    </section>

    <section title="Security Threats">
      <t>A profound analysis of security threats and requirements for NTP and
      Precision Time Protocol (PTP) can be found in the I-D <xref
      target="I-D.ietf-tictoc-security-requirements"/>.</t>
    </section>

    <section title="Objectives">
      <t>The objectives of the autokey specifications are as follows:<list
          style="symbols">
          <t>Authenticity: Autokey enables the client to authenticate its NTP
          server or peer.</t>

          <t>Integrity: Autokey protects the integrity of time synchronization
          packets via a message authentication code (MAC).</t>

          <t>Confidentiality: Autokey does not provide confidentiality
          protection of the NTP packets.</t>

          <t>Modes of operation: All operational modes of NTP are supported
          (client server, symmetric, broadcast).</t>

          <t>Hybrid mode: Both secure and insecure communication modes are
          possible for NTP servers and clients, respectively.</t>

          <t>Compatibility:<list style="symbols">
              <t>Interoperation with autokey version 1 is not given.</t>

              <t>NTP associations without authentication shall not be
              affected.</t>

              <t>An NTP server that does not support autokey version 2 shall
              not be affected by autokey version 2 authentication
              requests.</t>
            </list></t>
        </list></t>
    </section>

    <section title="Terms and abbreviations">
      <t><list style="symbols">
          <t>Throughout this document the term "autokey" refers to autokey
          version 2.</t>

          <t>TESLA: Time efficient stream loss-tolerant authentication</t>
        </list></t>
    </section>

    <section title="Autokey Overview">
      <section anchor="overview" title="Symmetric and Client/Server Mode">
        <t>Authenticity and integrity of the NTP packets are ensured by a
        Message Authentication Code (MAC), which is attached to the NTP
        packet. The calculation of the MAC includes the whole NTP packet and
        the cookie which is shared between client and server. It is calculated
        according to:<list style="hanging">
            <t>cookie = MSB_128 (H(server seed || H(public key of
            client))),</t>
          </list>where || indicates concatenation and in which H is a hash
        algorithm. The function MSB_128 cuts off the 128 most significant bits
        of the result of the hash function. The server seed is a 128 bit
        random value of the server, which has to be kept secret. The cookie
        thus never changes. The server seed has to be refreshed periodically.
        The server does not keep a state of the client. Therefore it has to
        recalculate the cookie each time it receives a request from the
        client. To this end, the client has to attach the hash value of its
        public key to each request (see <xref target="timerequest"/>).</t>
      </section>

      <section title="Broadcast Mode">
        <t>Just as in the case of the client server mode and symmetric mode,
        authenticity and integrity of the NTP packets are ensured by a MAC,
        which is attached to the NTP packet by the sender. The verification of
        the authenticity is based on the TESLA protocol <xref
        target="RFC4082"/>. TESLA is based on a one-way chain of keys, where
        each key is the output of a one-way function applied on the previous
        key in the chain. The last element of the chain is shared securely
        with all clients. The server splits time into intervals of uniform
        duration and assigns each key to an interval in reverse order,
        starting with the penultimate. At each time interval, the server sends
        an NTP broadcast packet appended by a MAC, calculated using the
        corresponding key, and the key of the previous interval. The client
        verifies the MAC by buffering the packet until the disclosure of the
        key in the next interval. In order to be able to verify the validity
        of the key, the client has to be loosely time synchronized to the
        server. This has to be accomplished during the initial client server
        exchange between broadcast client and server.</t>
      </section>
    </section>

    <section title="Protocol Sequence">
      <section anchor="assoc" title="Association Message">
        <t>The protocol sequence starts with the association message, in which
        the client sends an NTP packet with an extension field of type
        association. It contains the hostname of the client and a status word
        which contains the algorithms used for the signatures and the status
        of the connection. The response contains the hostname of the server
        and the algorithms for the signatures. The server notifies the
        cryptographic hash algorithms which it supports.</t>
      </section>

      <section anchor="cert" title="Certificate Message">
        <t>In this step, the client receives the certification chain up to the
        trusted authority (TA). To this end, the client requests the
        certificate for the subject name (hostname) of the NTP server. The
        response contains the certificate with the issuer name. If the issuer
        name is different from the subject name, the client requests the
        certificate for the issuer. This continues until it receives a
        certificate which is issued by a TA. The client recognizes the TA
        because it has a list of certificates which are accepted as TAs. The
        client has to check that each issuer is authorized to issue new
        certificates. To this end, the certificates have to include the
        X.509v3 extension field "CA:TRUE". With the established certification
        chain the client is able to verify the server signatures and, hence,
        the authenticity of the server messages with extension fields is
        ensured.</t>

        <t>Discussion:<list style="hanging">
            <t>Note that in this step the client validate the authenticity of
            its NTP-server only. It does not recursively validate the
            authenticity of each NTP server on the time synchronization chain.
            But each NTP server on the time synchronization chain validates
            the NTP server to which it is synchronized. This conforms to the
            recursive authentication requirement in the TICTOC security
            requirements <xref
            target="I-D.ietf-tictoc-security-requirements"/>.</t>
          </list></t>

        <!--Note that this certification chain is a priori independent of the
      time synchronization chain, because the TA and the NTP root are
      not inevitably identical.  This has consequences if proventication
      is required (Requirement 4.1.2 in [I-D.ietf-tictoc-security-
      requirements]). In this case, proventication can be ensured only
      if the NTP root server is also a recognized TA, hence a CA.-->
      </section>

      <section title="Cookie Message">
        <t>The client requests a cookie from the server. It selects a hash
        algorithm from the list of algorithms supported by the server. The
        request includes its public key and the selected hash algorithm. The
        hash of the public key is used by the server to calculate the cookie
        (see <xref target="overview"/>). The response of the server contains
        the cookie encrypted with the public key.</t>
      </section>

      <section title="Broadcast Parameter Message">
        <t>In the broadcast mode the client requests the following information
        from the server: <list style="symbols">
            <t>the last key of the one-way key chain,</t>

            <t>the disclosure schedule of the following keys. This
            contains:<list style="symbols">
                <t>time interval duration, time at which the next time
                interval will start and its associated index,</t>

                <t>key disclosure delay (number of time intervals for which a
                key is valid).</t>
              </list></t>
          </list></t>

        <t>The server will sign all transmitted properties so that the client
        is able to verify their authenticity. For this packet exchange a new
        extension field "broadcast parameters" is used. The client
        synchronizes its time with the server in the client server mode and
        saves an upper bound of its time offset with respect to the time of
        the server. See <xref format="counter" target="appBroadcast"/> for
        more details.</t>
      </section>

      <section anchor="timerequest" title="Time Request Message">
        <t>The client request includes a new extension field "time request"
        which contains the hash of its public key. The server needs the hash
        of the public key to recalculate the cookie for the client. The
        response is a normal NTP packet without extension field. It contains a
        MAC.</t>
      </section>

      <section title="Broadcast Message">
        <t>The NTP broadcast packet includes a new extension field "broadcast
        message" which contains the disclosed key of the previous disclosure
        interval (current time interval minus disclosure delay). The NTP
        packet is appended by a MAC, calculated with the key for the current
        time interval. When a client receives a broadcast message it has to
        perform the following tests: <list style="symbols">
            <t>Proof that the MAC is based on a key that is not yet disclosed.
            If verified the packet will be buffered for later authentication
            otherwise it has to be discarded.</t>

            <t>The client checks whether it already knows the disclosed key.
            If not, the client verifies its legitimacy. If falsified the
            packet has to be discarded.</t>

            <t>If the disclosed key is legitimate the client verifies the
            authenticity of any packet that it received during the
            corresponding time interval. If authenticity of a packet is
            verified it is released from the buffer. If the verification fails
            authenticity is no longer given. In this case the client MUST
            request authentic time from the server by means of a unicast time
            request message.</t>
          </list>See <xref format="counter" target="appBroadcast"/> or <xref
        target="RFC4082"/> for a detailed description of the packet
        verification process.</t>
      </section>
    </section>

    <section title="Hash algorithms and MAC generation">
      <section anchor="hash" title="Hash algorithms">
        <t>Hash algorithms are used at different points: calculation of the
        cookie and the MAC, and hashing of the public key. The client selects
        the hash algorithm from the list of hash algorithms which are
        supported by the server. This list is notified during the association
        message exchange (<xref target="assoc"/>). The selected algorithm is
        used for all hashing processes in the protocol.</t>

        <t>In the broadcast mode hash algorithm are used as pseudo random
        function to construct the one-way key chain.</t>

        <t>The list of the server supported hash algorithms has to fulfill
        following requirements:</t>

        <t><list style="symbols">
            <t>it MUST NOT contain the MD5 or weaker algorithms,</t>

            <t>it MUST include SHA-256 or stronger algorithms.</t>
          </list></t>
      </section>

      <section title="MAC Calculation">
        <t>For the calculation of the MAC client and server are using a
        Keyed-Hash Message Authentication Code (HMAC) approach <xref
        target="RFC2104"/>. The HMAC is generated with the hash algorithm
        specified by the client (see <xref target="hash"/>).</t>
      </section>
    </section>

    <section title="Server Seed Considerations">
      <t>The server has to calculate a random seed which has to be kept secret
      and which has to be changed periodically. The server has to generate a
      seed for each supported hash algorithm.</t>

      <section title="Server Seed algorithm">
        <t/>
      </section>

      <section title="Server Seed Live Time">
        <t/>
      </section>
    </section>

    <section anchor="IANA" title="IANA Considerations">
      <t>This document makes no request of IANA.</t>

      <t>Note to RFC Editor: this section may be removed on publication as an
      RFC.</t>
    </section>

    <section anchor="Security" title="Security Considerations">
      <t>The client has to verify the validity of the certificates during the
      certification message exchange (<xref target="cert"/>). Since it
      generally has no reliable time during this initial communication phase,
      it is impossible to verify the period of validity of the certificates.
      Therefore, the client MUST use one of the following approaches:</t>

      <t><list style="symbols">
          <t>The validity of the certificates is preconditioned. Usually this
          will be the case in corporation networks.</t>

          <t>The client ensures that the certificates are not revoked. To this
          end, the client uses the Online Certificate Status Protocol (OCSP)
          defined in <xref target="RFC6277"/>.</t>

          <t>The client requests a different service to get an initial time
          stamp in order to be able to verify the certificates' periods of
          validity. To this end, it can, e.g., use a secure shell connection
          to a reliable host. Another alternative is to request a time stamp
          from a Time Stamping Authority (TSA) by means of the Time-Stamp
          Protocol (TSP) defined in <xref target="RFC3161"/>.</t>
        </list></t>
    </section>

    <section anchor="Acknowledgements" title="Acknowledgements">
      <t/>
    </section>
  </middle>

  <back>
    <references title="Normative References">
      <?rfc include="reference.RFC.2119"?>

      <?rfc include='reference.RFC.6277'?>

      <?rfc include='reference.RFC.3161'?>
    </references>

    <references title="Informative References">
      <reference anchor="R&ouml;ttger">
        <front>
          <title>Analysis of the NTP Autokey Procedures</title>

          <author fullname="Stephen R&ouml;ttger" initials="S"
                  surname="R&ouml;ttger">
            <organization/>
          </author>

          <date day="8" month="February" year="2012"/>
        </front>
      </reference>

      <?rfc include='reference.I-D.draft-ietf-tictoc-security-requirements-04'?>

      <?rfc include='reference.RFC.2104'?>

      <?rfc include='reference.RFC.5905'?>

      <?rfc include='reference.RFC.5906'?>

      <?rfc include='reference.RFC.4082'?>
    </references>

    <section title="TICTOC Security Requirements">
      <t>The following table compares the autokey specifications against the
      TICTOC security requirements <xref
      target="I-D.ietf-tictoc-security-requirements"/>.</t>

      <texttable align="left" style="full" suppress-title="false" title="???">
        <ttcol align="left">Section</ttcol>

        <ttcol>Requirement from I-D tictoc security-requirements-04</ttcol>

        <ttcol>Requirement level</ttcol>

        <ttcol>Autokey V2</ttcol>

        <c>5.1</c>

        <c>Clock Identity Authentication and Authorization</c>

        <c>MUST</c>

        <c>OK</c>

        <c>5.1.1</c>

        <c>Authentication and Authorization of Masters</c>

        <c>MUST</c>

        <c>OK</c>

        <c>5.1.2</c>

        <c>Recursive Authentication and Authorization of Masters (Chain of
        Trust)</c>

        <c>MUST</c>

        <c>OK</c>

        <c>5.1.3</c>

        <c>Authentication and Authorization of Slaves</c>

        <c>MAY</c>

        <c>-</c>

        <c>5.2</c>

        <c>Integrity protection.</c>

        <c>MUST</c>

        <c>OK</c>

        <c>5.3</c>

        <c>Protection against DoS attacks</c>

        <c>SHOULD</c>

        <c>-</c>

        <c>5.4</c>

        <c>Replay protection</c>

        <c>MUST</c>

        <c>OK (NTP)</c>

        <c>5.5.1</c>

        <c>Key freshness.</c>

        <c>MUST</c>

        <c>OK</c>

        <c>5.5.2</c>

        <c>Security association.</c>

        <c>SHOULD</c>

        <c>OK</c>

        <c>5.5.3</c>

        <c>Unicast and multicast associations.</c>

        <c>SHOULD</c>

        <c>OK</c>

        <c>5.6</c>

        <c>Performance: no degradation in quality of time transfer.</c>

        <c>MUST</c>

        <c>OK</c>

        <c/>

        <c>Performance: lightweight computation</c>

        <c>SHOULD</c>

        <c>OK</c>

        <c/>

        <c>Performance: storage, bandwidth</c>

        <c>SHOULD</c>

        <c>OK</c>

        <c>5.7</c>

        <c>Confidentiality protection</c>

        <c>MAY</c>

        <c>-</c>

        <c>5.8</c>

        <c>Protection against Packet Delay and Interception Attacks</c>

        <c>SHOULD</c>

        <c>-</c>

        <c>5.9.1</c>

        <c>Secure mode</c>

        <c>MUST</c>

        <c>OK (NTP)</c>

        <c>5.9.2</c>

        <c>Hybrid mode</c>

        <c>MAY</c>

        <c>OK (NTP)</c>

        <postamble>Comparison between TICTOC security requirements and
        autokey.</postamble>
      </texttable>
    </section>

    <section anchor="appBroadcast" title="Broadcast Mode">
      <t/>
    </section>
  </back>
</rfc>
