<?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-01" 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="30" month="January" 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>
        </list></t>
    </section>

    <section anchor="overview" title="Autokey Overview">
      <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. 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 the hash
      value of its public key to each request (see <xref
      target="timerequest"/>).</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. 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
            requirement 4.1.2 of <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 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>

    <section title="Hash algorithms and MAC generation">
      <section anchor="hash" title="Hash algorithms">
        <t>Hash algorithms are used at three 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 support by the
        server. This list is notified during association message exchange
        (<xref target="assoc"/>). The selected algorithm is used for all
        hashing processes in the protocol. 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-03'?>

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

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

      <?rfc include='reference.RFC.5906'?>
    </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>Recursive authentication</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) To be
        checked.</postamble>
      </texttable>
    </section>
  </back>
</rfc>
