<?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-00" ipr="trust200902"
     obsoletes="5906">
  <front>
    <title abbrev="">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="30" month="July" year="2012"/>

    <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 (RFC 5906) 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. Its
      basic design is a combination of PKI and a pseudo-random sequence of
      symmetric keys, the so-called autokeys of which each are valid for one
      packet only. This design maintains the stateless nature of NTP 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 utilized hash algorithms are negotiable.</t>

            <t>The IP addresses of the synchronization partners in the
            calculation of the cookie have been replaced by the public key of
            the NTP client.</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>

            <t>Compatibility with the current autokey specification is not
            given.</t>

            <t>The term proventication is not used, i.e., authorization and
            time synchronization are disentangled. <list style="hanging">
                <t>Discussion<list style="hanging">
                    <t>The client verifies the authenticity of the server via
                    PKI infrastructure. To this end, it has to verify the
                    certification chain up to a trusted authority which, in
                    the context of the PKI, is a certification authority (CA).
                    Proventication may be established if the trusted authority
                    is also the NTP stratum 1 server. See also the discussion
                    in <xref target="cert"/>.</t>
                  </list></t>
              </list></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) or a hash-based
          message authentication code (HMAC).</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: Interoperation with autokey version 1 and the
          symmetric key scheme described in <xref target="RFC1305"/> is not
          given. Insecure NTP associations are not affected.</t>

          <t>Leap seconds are not in the scope of autokey.</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>
        </list></t>
    </section>

    <section title="Autokey Overview">
      <t>In autokey, authenticity and integrity of NTP packets are ensured by
      an attached key ID and a message authentication code (MAC). The MAC is
      calculated with a so-called "autokey" which is a symmetric key that is
      valid for one packet only. The MAC is given by</t>

      <t><list style="hanging">
          <t>MAC = H(autokey || NTP packet),</t>
        </list>where || indicates concatenation and in which H is a hash
      algorithm on which client and server agree during the association
      message (ASSOC) exchange. The key ID uniquely identifies the autokey.
      The autokeys are calculated for each NTP packet according to:<list
          style="hanging">
          <t>autokey = H(key ID || cookie),</t>
        </list>in which H is a hash function on which client and server have
      to agree (during ASSOC) and which is not necessarily identical to the
      one used for the MAC calculation. The cookie is a 128 bit secret between
      client and server. It is exchanged during the cookie message protocol
      sequence (COOK). The cookie is calculated by the server via</t>

      <t><list style="hanging">
          <t>cookie = MSB_128 (H(server seed || public key of client)).</t>
        </list>The same hash algorithm H is utilized as in the calculation of
      the autokey. 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. To comply with 4.5.3 in <xref
      target="I-D.ietf-tictoc-security-requirements"/> the server seed has to
      be changed 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 its
      public key to each request (see <xref target="timerequest"/>).</t>

      <t>Discussion<list style="hanging">
          <t>Alternative cookie calculation: Instead of using the client's
          public key for the cookie calculation, the hash value of the public
          key can be used. This has the advantage that during the time request
          message the client only needs to send the hash of its public key and
          not the whole public key itself.</t>
        </list></t>
    </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. Client and server MUST agree
        upon the employed MAC and hash algorithms.</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 prove that each issuer is authorized to issue new
        certificates. To this end, it has to prove that the X.509v3 extension
        contains the 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</t>

        <t><list style="hanging">
            <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 <xref
            target="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.</t>
          </list></t>
      </section>

      <section title="Cookie Message">
        <t>The client requests a cookie from the server, which is used to
        calculate the autokeys. The request includes the public key of the
        client. The public key is used by the server to calculate the cookie.
        The response of the server contains the cookie encrypted with the
        public key.</t>
      </section>

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

    <section title="Hash and MAC algorithms">
      <t>Hash algorithms are used for the calculation of cookie, autokey and
      MAC.</t>

      <section title="Hash Function for Cookie and Autokey">
        <t>The hash algorithm utilized for the calculation of the cookie and
        the autokey is negotiated during the association message exchange
        (<xref target="assoc"/>). The client MUST request SHA-1 or a stronger
        hash function. The server also MUST provide SHA-256.</t>
      </section>

      <section title="Hash Function for the Message Authentication Code">
        <t>The hash function for the MAC is negotiated during the association
        message exchange in <xref target="assoc"/>. Client and server SHOULD
        negotiate a Keyed-Hash Message Authentication Code <xref
        target="RFC2104"/>.</t>
      </section>
    </section>

    <section title="Server Seed Considerations">
      <t>The server has to calculate a random seed which has to be kepted
      secret and which has to be changed periodically.</t>

      <section title="Server Seed Function">
        <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 TA and the dependent certificates are trusted by default.
          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.5905'?>

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

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

      <?target include='reference.RFC.1305'?>

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

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

      <?rfc include='reference.RFC.2104'?>
    </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>
    </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="center" style="all" suppress-title="false" title="???">
        <ttcol align="left">Section</ttcol>

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

        <ttcol>Type</ttcol>

        <ttcol>Autokey V2</ttcol>

        <c>4.1</c>

        <c>Authentication of sender.</c>

        <c>MUST</c>

        <c>OK</c>

        <c/>

        <c>Authentication of master.</c>

        <c>MUST</c>

        <c>OK</c>

        <c/>

        <c>Proventication</c>

        <c>MUST</c>

        <c>Open 1)</c>

        <c/>

        <c>Authentication of slaves.</c>

        <c>SHOULD</c>

        <c>OK</c>

        <c/>

        <c>PTP: Authentication of TCs.</c>

        <c>SHOULD</c>

        <c>N/A</c>

        <c/>

        <c>PTP: Authentication of Announce messages.</c>

        <c>SHOULD</c>

        <c>N/A</c>

        <c>4.2</c>

        <c>Integrity protection.</c>

        <c>MUST</c>

        <c>OK</c>

        <c/>

        <c>PTP: hop-by-hop integrity protection.</c>

        <c>MUST</c>

        <c>N/A</c>

        <c/>

        <c>PTP: end-to-end integrity protection.</c>

        <c>SHOULD</c>

        <c>N/A</c>

        <c>4.3</c>

        <c>Protection against DoS attacks.</c>

        <c>MUST</c>

        <c>NTP 2)</c>

        <c>4.4</c>

        <c>Replay protection.</c>

        <c>MUST</c>

        <c>NTP 2)</c>

        <c>4.5</c>

        <c>Security association.</c>

        <c>MUST</c>

        <c>OK</c>

        <c/>

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

        <c>MUST</c>

        <c>OK</c>

        <c/>

        <c>Key freshness.</c>

        <c>MUST</c>

        <c>OK</c>

        <c>4.6</c>

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

        <c>MUST</c>

        <c>OK</c>

        <c/>

        <c>Performance: lightweight.</c>

        <c>SHOULD</c>

        <c>YES</c>

        <c/>

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

        <c>MUST</c>

        <c>OK</c>

        <c>4.7</c>

        <c>Confidentiality protection.</c>

        <c>MAY</c>

        <c>NO</c>

        <c/>

        <c>Protection against delay attacks.</c>

        <c>MAY</c>

        <c>NO</c>

        <c>4.9</c>

        <c>Secure mode.</c>

        <c>MUST</c>

        <c>NTP? 3)</c>

        <c/>

        <c>Hybrid mode.</c>

        <c>MAY</c>

        <c>YES</c>

        <postamble>1) Refer to discussion in <xref target="cert"/>. 2) These
        requirements are fulfilled by the NTP on-wire protocol. 3) Has still
        to be checked.</postamble>
      </texttable>
    </section>
  </back>
</rfc>
