<?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="exp" docName="draft-ietf-dprive-dnsodtls-13" ipr="trust200902">
  <front>
    <title abbrev="DNS over DTLS ">Specification for DNS over Datagram
    Transport Layer Security (DTLS)</title>

    <author fullname="Tirumaleswar Reddy" initials="T." surname="Reddy">
      <organization abbrev="Cisco">Cisco Systems, Inc.</organization>

      <address>
        <postal>
          <street>Cessna Business Park, Varthur Hobli</street>

          <street>Sarjapur Marathalli Outer Ring Road</street>

          <city>Bangalore</city>

          <region>Karnataka</region>

          <code>560103</code>

          <country>India</country>
        </postal>

        <email>tireddy@cisco.com</email>
      </address>
    </author>

    <author fullname="Dan Wing" initials="D." surname="Wing">
      <organization abbrev="Cisco">Cisco Systems, Inc.</organization>

      <address>
        <postal>
          <street>170 West Tasman Drive</street>

          <city>San Jose</city>

          <region>California</region>

          <code>95134</code>

          <country>USA</country>
        </postal>

        <email>dwing@cisco.com</email>
      </address>
    </author>

    <author fullname="Prashanth Patil" initials="P." surname="Patil">
      <organization abbrev="Cisco">Cisco Systems, Inc.</organization>

      <address>
        <postal>
          <street></street>

          <street></street>

          <city>Bangalore</city>

          <country>India</country>
        </postal>

        <email>praspati@cisco.com</email>
      </address>
    </author>

    <date />

    <workgroup>DPRIVE</workgroup>

    <abstract>
      <t>DNS queries and responses are visible to network elements on the path
      between the DNS client and its server. These queries and responses can
      contain privacy-sensitive information which is valuable to protect.</t>

      <t>This document proposes the use of Datagram Transport Layer Security
      (DTLS) for DNS, to protect against passive listeners and certain active
      attacks. As latency is critical for DNS, this proposal also discusses
      mechanisms to reduce DTLS round trips and reduce DTLS handshake size.
      The proposed mechanism runs over port 853.</t>
    </abstract>
  </front>

  <middle>
    <section anchor="introduction" title="Introduction">
      <t>The Domain Name System is specified in <xref target="RFC1034"></xref>
      and <xref target="RFC1035"></xref>. DNS queries and responses are
      normally exchanged unencrypted and are thus vulnerable to eavesdropping.
      Such eavesdropping can result in an undesired entity learning domains
      that a host wishes to access, thus resulting in privacy leakage. The DNS
      privacy problem is further discussed in <xref
      target="RFC7626"></xref>.</t>

      <t>This document defines DNS over DTLS (DNS-over-DTLS) which provides
      confidential DNS communication between stub resolvers and recursive
      resolvers, stub resolvers and forwarders, forwarders and recursive
      resolvers. DNS-over-DTLS puts an additional computational load on
      servers. The largest gain for privacy is to protect the communication
      between the DNS client (the end user's machine) and its caching
      resolver. DNS-over-DTLS might work equally between recursive clients and
      authoritative servers, but this application of the protocol is out of
      scope for the DNS PRIVate Exchange (DPRIVE) Working Group per its
      current charter. This document does not change the format of DNS
      messages.</t>

      <t>The motivations for proposing DNS-over-DTLS are that</t>

      <t><list style="symbols">
          <t>TCP suffers from network head-of-line blocking, where the loss of
          a packet causes all other TCP segments to not be delivered to the
          application until the lost packet is re-transmitted. DNS-over-DTLS,
          because it uses UDP, does not suffer from network head-of-line
          blocking.</t>

          <t>DTLS session resumption consumes 1 round trip whereas TLS session
          resumption can start only after TCP handshake is complete. However,
          with TCP Fast Open <xref target="RFC7413"></xref>, the
          implementation can achieve the same RTT efficiency as DTLS.</t>
        </list></t>

      <t>Note: DNS-over-DTLS is an experimental update to DNS, and the
      experiment will be concluded when the specification is evaluated through
      implementations and interoperability testing.</t>

      <section title="Relationship to TCP Queries and to DNSSEC">
        <t>DNS queries can be sent over UDP or TCP. The scope of this
        document, however, is only UDP. DNS over TCP can be protected with
        TLS, as described in <xref target="RFC7858"></xref>. DNS-over-DTLS
        alone cannot provide privacy for DNS messages in all circumstances,
        specifically when the DTLS record size is larger than the path MTU. In
        such situations the DNS server will respond with a truncated response
        (see <xref target="PMTU"></xref>). Therefore DNS clients and servers
        that implement DNS-over-DTLS MUST also implement DNS-over-TLS in order
        to provide privacy for clients that desire Strict Privacy as described
        in <xref target="I-D.ietf-dprive-dtls-and-tls-profiles"></xref>.</t>

        <t>DNS Security Extensions (<xref target="RFC4033">DNSSEC</xref>)
        provides object integrity of DNS resource records, allowing end-users
        (or their resolver) to verify legitimacy of responses. However, DNSSEC
        does not provide privacy for DNS requests or responses. DNS-over-DTLS
        works in conjunction with DNSSEC, but DNS-over-DTLS does not replace
        the need or value of DNSSEC.</t>
      </section>
    </section>

    <section anchor="term" title="Terminology">
      <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 <xref
      target="RFC2119"></xref> .</t>
    </section>

    <section title="Establishing and Managing DNS-over-DTLS Sessions">
      <section title="Session Initiation">
        <t>By default, DNS-over-DTLS MUST run over standard UDP port 853 as
        defined in <xref target="IANA"></xref>, unless the DNS server has
        mutual agreement with its clients to use a port other than 853 for
        DNS-over-DTLS. In order to use a port other than 853, both clients and
        servers would need a configuration option in their software.</t>

        <t>The DNS client should determine if the DNS server supports
        DNS-over-DTLS by sending a DTLS ClientHello message to port 853 on the
        server, unless it has mutual agreement with its server to use a port
        other than port 853 for DNS-over-DTLS. Such another port MUST NOT be
        port 53 but MAY be from the "first-come, first-served" port range
        (User Ports <xref target="RFC6335"></xref>, range 1024- 49151) . This
        recommendation against use of port 53 for DNS-over-DTLS is to avoid
        complication in selecting use or non-use of DTLS and to reduce risk of
        downgrade attacks.</t>

        <t>A DNS server that does not support DNS-over-DTLS will not respond
        to ClientHello messages sent by the client. If no response is received
        from that server, and the client has no better round-trip estimate,
        the client SHOULD retransmit the DTLS ClientHello according to Section
        4.2.4.1 of <xref target="RFC6347"></xref>. After 15 seconds, it SHOULD
        cease attempts to re-transmit its ClientHello. The client MAY repeat
        that procedure to discover if DNS-over-DTLS service becomes available
        from the DNS server, but such probing SHOULD NOT be done more
        frequently than every 24 hours and MUST NOT be done more frequently
        than every 15 minutes. This mechanism requires no additional signaling
        between the client and server.</t>

        <t>DNS clients and servers MUST NOT use port 853 to transport
        cleartext DNS messages. DNS clients MUST NOT send and DNS servers MUST
        NOT respond to cleartext DNS messages on any port used for
        DNS-over-DTLS (including, for example, after a failed DTLS handshake).
        There are significant security issues in mixing protected and
        unprotected data, therefore UDP connections on a port designated by a
        given server for DNS-over-DTLS are reserved purely for encrypted
        communications.</t>
      </section>

      <section title="DTLS Handshake and Authentication">
        <t>DNS client initiates DTLS handshake as described in <xref
        target="RFC6347"></xref>, following the best practices specified in
        <xref target="RFC7525"></xref>. After DTLS negotiation completes, if
        the DTLS handshake succeeds according to <xref
        target="RFC6347"></xref> the connection will be encrypted and is now
        protected from eavesdropping.</t>

        <t>DNS privacy requires encrypting the query (and response) from
        passive attacks. Such encryption typically provides integrity
        protection as a side-effect, which means on-path attackers cannot
        simply inject bogus DNS responses. However, to provide stronger
        protection from active attackers pretending to be the server, the
        server itself needs to be authenticated. To authenticate the server
        providing DNS privacy, DNS client MUST use the authenication
        mechanisms discussed in <xref
        target="I-D.ietf-dprive-dtls-and-tls-profiles"></xref>. This document
        does not propose new ideas for authentication.</t>
      </section>

      <section title="Established Sessions">
        <t>In DTLS, all data is protected using the same record encoding and
        mechanisms. When the mechanism described in this document is in
        effect, DNS messages are encrypted using the standard DTLS record
        encoding. When a user of DTLS wishes to send a DNS message, the data
        is delivered to the DTLS implementation as an ordinary application
        data write (e.g., SSL_write()). A single DTLS session can be used to
        send multiple DNS requests and receive multiple DNS responses.</t>

        <t>To mitigate the risk of unintentional server overload,
        DNS-over-DTLS clients MUST take care to minimize the number of
        concurrent DTLS sessions made to any individual server. It is
        RECOMMENDED that for any given client/server interaction there SHOULD
        be no more than one DTLS session. Similarly, servers MAY impose limits
        on the number of concurrent DTLS sessions being handled for any
        particular client IP address or subnet. These limits SHOULD be much
        looser than the client guidelines above, because the server does not
        know, for example, if a client IP address belongs to a single client,
        is multiple resolvers on a single machine, or is multiple clients
        behind a device performing Network Address Translation (NAT).</t>

        <t>In between normal DNS traffic while the communication to the DNS
        server is quiescent, the DNS client MAY want to probe the server using
        DTLS heartbeat <xref target="RFC6520"></xref> to ensure it has
        maintained cryptographic state. Such probes can also keep alive
        firewall or NAT bindings. This probing reduces the frequency of
        needing a new handshake when a DNS query needs to be resolved,
        improving the user experience at the cost of bandwidth and processing
        time.</t>

        <t>A DTLS session is terminated by the receipt of an authenticated
        message that closes the connection (e.g., a DTLS fatal alert). If the
        server has lost state, a DTLS handshake needs to be initiated with the
        server. For the client, state should be destroyed when disconnecting
        from the network (e.g., associated IP interface is brought down). For
        the server, to mitigate the risk of unintentional server overload, it
        is RECOMMENDED that the default DNS-over-DTLS server application-level
        idle time out be on the order of several seconds, but no particular
        value is specified. When no DNS queries have been received from the
        client after idle time out, the server MUST send a DTLS fatal alert
        and then destroy its DTLS state. The DTLS fatal alert packet indicates
        the server has destroyed its state, signaling to the client if it
        wants to send a new DTLS message it will need to re-establish
        cryptographic context with the server (via full DTLS handshake or DTLS
        session resumption). In practice, the idle period can vary
        dynamically, and servers MAY allow idle connections to remain open for
        longer periods as resources permit.</t>

        <t><xref target="Fig1"></xref> shows DTLS handshake and issuing new
        session ticket for session resumption.</t>

        <t><figure anchor="Fig1"
            title="Message Flow for Full Handshake Issuing New Session Ticket">
            <artwork align="center"><![CDATA[

   Client                                          Server
   ------                                          ------

   ClientHello             -------->     
   (empty SessionTicket extension)
                                              ServerHello  
                                  (empty SessionTicket extension)  
                                             Certificate*    
                                       ServerKeyExchange*      
                                      CertificateRequest*     
                           <--------      ServerHelloDone    

   Certificate*                                             
   ClientKeyExchange                                          
   CertificateVerify*                                          
   (ChangeCipherSpec)                                         
   Finished                -------->                         
                                         NewSessionTicket
                                       (ChangeCipherSpec)    
                           <--------             Finished    

  
   DNS Request             --------->

                           <---------  DNS Response
]]></artwork>
          </figure></t>
      </section>
    </section>

    <section anchor="performance" title="Performance Considerations">
      <t>DTLS protocol profile for DNS-over-DTLS is discussed in Section 11 of
      <xref target="I-D.ietf-dprive-dtls-and-tls-profiles"></xref>. To reduce
      the number of octets of the DTLS handshake, especially the size of the
      certificate in the ServerHello (which can be several kilobytes), DNS
      clients and servers can use raw public keys <xref
      target="RFC7250"></xref> or <xref target="RFC7924">Cached Information
      Extension</xref>. Cached Information Extension avoids transmitting the
      server's certificate and certificate chain if the client has cached that
      information from a previous TLS handshake. TLS False Start <xref
      target="RFC7918"></xref> can reduce round-trips by allowing the TLS
      second flight of messages (ChangeCipherSpec) to also contain the
      (encrypted) DNS query.</t>

      <t>It is highly advantageous to avoid server-side DTLS state and reduce
      the number of new DTLS sessions on the server which can be done with TLS
      Session Resumption without server state <xref target="RFC5077"></xref>.
      This also eliminates a round-trip for subsequent DNS-over-DTLS queries,
      because with <xref target="RFC5077"></xref> the DTLS session does not
      need to be re-established.</t>

      <t>Since responses within a DTLS session can arrive out of order,
      clients MUST match responses to outstanding queries on the same DTLS
      connection using the DNS Message ID. If the response contains a question
      section, the client MUST match the QNAME, QCLASS, and QTYPE fields.
      Failure by clients to properly match responses to outstanding queries
      can have serious consequences for interoperability ( <xref
      target="RFC7766"></xref>, Section 7).</t>
    </section>

    <section anchor="PMTU" title="PMTU issues">
      <t>Compared to normal DNS, DTLS adds at least 13 octets of header, plus
      cipher and authentication overhead to every query and every response.
      This reduces the size of the DNS payload that can be carried. DNS client
      and server MUST support the EDNS0 option defined in <xref
      target="RFC6891"></xref> so that the DNS client can indicate to the DNS
      server the maximum DNS response size it can reassemble and deliver in
      the DNS client&rsquo;s network stack. If the DNS client does set the
      EDNS0 option defined in <xref target="RFC6891"></xref> then the maximum
      DNS response size of 512 bytes plus DTLS overhead will be well within
      the Path MTU. If the Path MTU is not known, an IP MTU of 1280 bytes
      SHOULD be assumed. The client sets its EDNS0 value as if DTLS is not
      being used. The DNS server MUST ensure that the DNS response size does
      not exceed the Path MTU i.e. each DTLS record MUST fit within a single
      datagram, as required by <xref target="RFC6347"></xref>. The DNS server
      must consider the amount of record expansion expected by the DTLS
      processing when calculating the size of DNS response that fits within
      the path MTU. Path MTU MUST be greater than or equal to [DNS response
      size + DTLS overhead of 13 octets + padding size (<xref
      target="RFC7830"></xref>) + authentication overhead of the negotiated
      DTLS cipher suite + block padding (Section 4.1.1.1 of <xref
      target="RFC6347"></xref>]. If the DNS server's response were to exceed
      that calculated value, the server MUST send a response that does fit
      within that value and sets the TC (truncated) bit. Upon receiving a
      response with the TC bit set and wanting to receive the entire response,
      the client behaviour is governed by the current Usage profile <xref
      target="I-D.ietf-dprive-dtls-and-tls-profiles"></xref>. For Strict
      Privacy the client MUST only send a new DNS request for the same
      resource record over an encrypted transport (e.g. DNS-over-TLS <xref
      target="RFC7858"></xref>). Clients using Opportunistic Privacy SHOULD
      try for the best case (an encrypted and authenticated transport) but MAY
      fallback to intermediate cases and eventually the worst case scenario
      (clear text) in order to obtain a response.</t>
    </section>

    <section title="Anycast">
      <t>DNS servers are often configured with anycast addresses. While the
      network is stable, packets transmitted from a particular source to an
      anycast address will reach the same server that has the cryptographic
      context from the DNS-over-DTLS handshake. But when the network
      configuration or routing changes, a DNS-over-DTLS packet can be received
      by a server that does not have the necessary cryptographic context.
      Clients using DNS-over-DTLS need to always be prepared to re-initiate
      DTLS handshake and in the worst case this could even happen immediately
      after re-initiating a new handshake. To encourage the client to initiate
      a new DTLS handshake, DNS servers SHOULD generate a DTLS fatal alert
      message in response to receiving a DTLS packet for which the server does
      not have any cryptographic context. Upon receipt of an un-authenicated
      DTLS fatal alert, the DTLS client validates the fatal alert is within
      the replay window (Section 4.1.2.6 of <xref target="RFC6347"></xref>).
      It is difficult for the DTLS client to validate that the DTLS fatal
      alert was generated by the DTLS server in response to a request or was
      generated by an on- or off-path attacker. Thus, upon receipt of an
      in-window DTLS fatal alert, the client SHOULD continue re-transmitting
      the DTLS packet (in the event the fatal alert was spoofed), and at the
      same time it SHOULD initiate DTLS session resumption. When the DTLS
      client receives an authenticated DNS response from one of those DTLS
      sessions, the other DTLS session should be terminated.</t>
    </section>

    <section anchor="usage" title="Usage">
      <t>Two Usage Profiles, Strict and Opportunistic are explained in <xref
      target="I-D.ietf-dprive-dtls-and-tls-profiles"></xref>. Using encrypted
      DNS messages with an authenticated server is most preferred, encrypted
      DNS messages with an unauthenticated server is next preferred, and plain
      text DNS messages is least preferred.</t>
    </section>

    <section anchor="IANA" title="IANA Considerations">
      <t>This specification uses port 853 already allocated in the IANA port
      number registry as defined in Section 6 of <xref
      target="RFC7858"></xref>.</t>
    </section>

    <section anchor="security" title="Security Considerations">
      <t>The interaction between a DNS client and DNS server requires Datagram
      Transport Layer Security (DTLS) with a ciphersuite offering
      confidentiality protection. The guidance given in <xref
      target="RFC7525"></xref> MUST be followed to avoid attacks on DTLS. DNS
      clients keeping track of servers known to support DTLS enables clients
      to detect downgrade attacks. To interfere with DNS-over-DTLS, an on- or
      off-path attacker might send an ICMP message towards the DTLS client or
      DTLS server. As these ICMP messages cannot be authenticated, all ICMP
      errors should be treated as <xref target="RFC1122">soft errors</xref>.
      If the DNS query was sent over DTLS then the corresponding DNS response
      MUST only be accepted if it is received over the same DTLS connection.
      This behavior mitigates all possible attacks described in <xref
      target="RFC5452"> Measures for Making DNS More Resilient against Forged
      Answers </xref>. Security considerations in <xref
      target="RFC6347"></xref> and <xref
      target="I-D.ietf-dprive-dtls-and-tls-profiles"></xref> are to be taken
      into account.</t>

      <t>A malicious client might attempt to perform a high number of DTLS
      handshakes with a server. As the clients are not uniquely identified by
      the protocol and can be obfuscated with IPv4 address sharing and with
      IPv6 temporary addresses, a server needs to mitigate the impact of such
      an attack. Such mitigation might involve rate limiting handshakes from a
      certain subnet or more advanced DoS/DDoS techniques beyond the scope of
      this paper.</t>
    </section>

    <section anchor="ack" title="Acknowledgements">
      <t>Thanks to Phil Hedrick for his review comments on TCP and to Josh
      Littlefield for pointing out DNS-over-DTLS load on busy servers (most
      notably root servers). The authors would like to thank Simon Josefsson,
      Daniel Kahn Gillmor, Bob Harold, Ilari Liusvaara, Sara Dickinson,
      Christian Huitema, Stephane Bortzmeyer, Alexander Mayrhofer, Allison
      Mankin, Jouni Korhonen and Geoff Huston for discussions and comments on
      the design of DNS-over-DTLS. The authors would like to give special
      thanks to Sara Dickinson for her help.</t>
    </section>
  </middle>

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

      <?rfc include="reference.RFC.1034"?>

      <?rfc include="reference.RFC.1035"?>

      <?rfc include="reference.RFC.4033"?>

      <?rfc include="reference.RFC.5077"
?>

      <?rfc include="reference.RFC.6347"
?>

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

      <?rfc ?>

      <!--
 -->

      <?rfc include="reference.RFC.5452"
?>

      <?rfc include="reference.RFC.6891"
?>

      <?rfc include="reference.RFC.7525"?>

      <?rfc include="reference.RFC.6520"?>
    </references>

    <references title="Informative References">
      <?rfc include='reference.I-D.ietf-dprive-dtls-and-tls-profiles'
?>

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

      <?rfc include="reference.RFC.7626"?>

      <?rfc include="reference.RFC.7918"?>

      <?rfc include="reference.RFC.7924"?>

      <?rfc include="reference.RFC.7250"?>

      <!-- 
      <?rfc include="reference.RFC.4892"?>
 -->

      <?rfc include="reference.RFC.1122"?>

      <?rfc include="reference.RFC.7766"?>

      <?rfc include="reference.RFC.7413"?>

      <?rfc include="reference.RFC.6335"?>

      <!--

      <reference anchor="IANA-domain" target="http://www.iana.org/assignments/special-use-domain-names/special-use-domain-names.xhtml">
	<front>
          <title>Special-Use Domain Names</title>

          <author>
	    <organization>IANA</organization>
          </author>

          <date month="February" year="2013"/>
	  </front>
      </reference>
-->
    </references>
  </back>
</rfc>
