<?xml version="1.0" encoding="UTF-8"?>


<?xml-stylesheet type='text/xsl' href='rfc2629.xslt' ?>


<!DOCTYPE rfc SYSTEM "rfc2629.dtd" [

  <!ENTITY rfc2119 PUBLIC '' 
  'http://xml.resource.org/public/rfc/bibxml/reference.RFC.2119.xml'> 


]>

  <?xml-stylesheet type='text/xsl' href='rfc2629.xslt' ?>
  <?rfc toc="yes" ?>
  <?rfc symrefs="yes" ?>
  <?rfc sortrefs="yes"?>
  <?rfc iprnotified="no" ?>
  <?rfc strict="yes" ?>
  <?rfc compact="yes" ?>
  <?rfc subcompact="no"?>
  <?rfc comments="yes"?>
  <?rfc inline="yes"?>


<rfc category="bcp" ipr="trust200902" 
     docName="draft-sullivan-dnsop-refer-down-00">

  <front>

    <title abbrev="DNS Referrals are Down Only">
      Please See Below: Use Only Downward Referrals in the DNS 
    </title>

    <author initials="A." surname="Sullivan" fullname="Andrew Sullivan">
      <organization>Oracle</organization>
      <address>
        <email>andrew.s.sullivan@oracle.com</email>
      </address>
    </author>

    <author initials="J." surname="Abley" fullname="Joe Abley">
      <organization>Snake Hill Labs</organization>
      <address>
        <postal>
          <street>300-184 York Street</street>
          <city>London</city>
          <region>ON</region>
          <code>N6A 1B5</code>
          <country>Canada</country>
        </postal>
        <email>jabley@shl.io</email>
      </address>
    </author>

    <date />

    <workgroup>DNSOP</workgroup>

    <abstract>
      <t>
        A server in the Domain Name System can use a mechanism called
        "referral" to indicate that the server is not authoritative
        for a given zone, and to redirect the query to another, more
        appropriate server.  The mechanism was originally specified
        such that a referral might be to any location in the DNS.
        Operational experience indicates dubious value to referrals
        other than those to zones below the zones for which a server
        is authoritative.  This memo therefore recommends such
        referrals and discourages other kinds of referrals.
      </t>
    </abstract>

  </front>

  <middle>
    <section title="Introduction" anchor="sec_intro">
      <t>The Domain Name System (DNS) divides parts of the domain name
      space "into units called 'zones'" (<xref target="RFC1034" />,
      Section 2.4).  The answers for data in these zones are
      (ultimately) provided by authoritative servers.  In the Internet
      context, for any given query, there is a set of authoritative
      servers that can provide an authoritative answer in response to
      that query.</t>
      <t>Sometimes, however, a server receives a query for which it is
      not authoritative.  If such a server does not offer recursion,
      the server might return a response that
      refers to another set of servers on the Internet.  This response is
      called a "referral".</t>
      <t>There are two categories of referral response.  One of
      them indicates a delegation in the DNS, and is a basic part of
      how the DNS functions.  Without such delegation responses, the
      distributed nature of the DNS is impossible.  They may be
      thought of as "downward" referrals because they refer to a zone
      somewhere beneath the zone for which the server is
      authoritative.  Other referrals are for zones where the server
      is neither authoritative for the zone of the QNAME, nor for any
      zone that might be an ancestor of the zone containing the QNAME.
      These referrals might be thought of as "off-tree" referrals,
      because the server is not authoritative for any part of the tree
      containing the QNAME.</t>
      <t>Historically, authoritative servers that received an off-tree
      query would reply with an "upward referral", usually to the root
      zone; these were sometimes called a "root referral".  Such
      referrals have turned out to be undesirable in practice.  This
      memo recommends that servers not provide upward referrals, and
      instead should respond to such queries in some other way.</t>

      <section title="Terminology" anchor="sec_terms">
        <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 14 <xref target="RFC2119" />
        <xref target="RFC8174" />
        when, and only when, they appear in all capitals, as shown
        here.</t>
        <t>Unfamiliar DNS-related terms are likely to be found in RFC
        7719 <xref target="RFC7719" />, and the reader is assumed to
        be familiar with that vocabulary.</t>
      </section>
    </section>
    <section title="Referrals" anchor="sec_referrals">
      <t>Referrals are defined as part of the algorithm for a name
      server (<xref target="RFC1034" />, section 4.3.2, henceforth
      "the algorithm").  Referrals only happen when the RD bit is
      clear in the query or the server does not offer recursion (or
      both).  There are different possible interpretations of the
      algorithm; one's interpretation will affect which kinds of
      referral one thinks acceptable.</t>
      <t>A referral contains an empty answer section.  It contains the
      NS RRset for the referred-to zone in the authority section.  It
      may contain RRs that provide addresses in the additional
      section.  The AA bit is clear.</t>
      <section title="Downward Referrals" anchor="sec_downward_ref">
        <t>The first kind of referral is downward, and is
        uncontroversial.  Step 2 of the matching algorithm evaluates
        whether the name server is authoritative for some zone that is
        an ancestor for the QNAME.  (If the QNAME exactly matches,
        then that zone is the "ancestor".  This is a slightly awkward
        usage of "ancestor", but makes sense due to the distinction
        between a zone and the matching owner name inside the zone.)
        If there is such a zone, then the algorithm moves to step 3;
        otherwise, it moves to step 4.</t>
        <t>In step 3, the server matches label by label in the zone
        until matching terminates.  Step 3(b) of the matching
        algorithm says, "If a match would take us out of the
        authoritative data, we have a referral.  This happens when we
        encounter a node with NS RRs marking cuts along the bottom of
        a zone."  Such a referral is called "downward" because the
        referral is of necessity to a part of the namespace beneath
        the zone for which the server is generating a response.  In
        other words, if the server is authoritative for the zone
        example.com, the referral needs to be to the NS records of
        some subordinate zone in the domain name space.</t>
        <t>Downward referrals are necessary for the DNS to function.
        They are the mechanism by which delegation happens.</t>
      </section>
      <section title="Upward Referrals" anchor="sec_upward_ref">
        <t>The second kind of referral is often called an "upward"
        referral, because it is often a referral to the name servers
        for the root zone (perforce above everything else in the
        domain name space), though in principle the referral could be
        elsewhere in the domain name space.  Step 4 of the algorithm
        says, "If there was no delegation from authoritative data,
        look for the best one from the cache, and put it in the
        authority section."  Returning this kind of referral under
        normal operational conditions is somewhat more controversial
        than a downward referral, because it is not clear that it is
        necessary for the operation of the DNS.</t>
        <t>There are only two cases where upward referrals are
        possible:</t>
        <t><list style="numbers">
          <t>The server offers recursive service, and it cannot
          provide an authoritative answer or a downward referral, but
          the query was received with the RD bit clear.</t>
          <t>The server does not offer recursive service, and it
          cannot provide either an answer or a downward referral in
          response to the query.</t>
        </list></t>
        <t>The first of these is plainly required by step 4 of the
        algorithm, and should therefore be uncontroversial.  In normal
        operation, however, this case appears to be unusual.  A
        resolver that was using such a server for full-service DNS
        resolution would normally query with the RD bit set.  A
        resolver that did not expect recursion would likely only send
        a QNAME for which the server could provide an authoritative
        answer or a downward referral; it is unclear why the query
        would be sent to the server at all otherwise.  Such queries
        are known to occur sometimes, for example when troubleshooting,
        but they do not appear to be normal according to the protocol.</t>
        <t>The second case is controversial because the server, which
        only provides authoritative answers, must somehow have some
        data in a cache in order to return anything in the authority
        section.  The controversy arises because of the question of
        whether the server ought to have such data.  This amounts to a
        question of whether a server that only provides authoritative
        answers should ever have a cache.</t>
        <t>On the one hand, it would seem that such a server should
        not have a cache, because it does not have a resolver side
        that populates such a cache.  Moreover, the SBELT structure
        (see <xref target="RFC1034" />, section 5.3.2) is defined only
        for resolvers and not for servers.  So a server that only
        provides authoritative answers has no reason even to have
        configured in the SBELT structure a list of servers from which
        to start (in resolvers, this is often the "root hints" file).
        On the other hand, there is no requirement that a given name
        server should not provide both authoritative service and recursive
        service.  Moreover, even a server that provides
        no recursive service to others may need to perform resolution
        for its own purposes, and therefore might have need of the
        SBELT structure.  So, depending on one's reading of the
        algorithm, either upward referrals should not be returned from
        such a server and are a sign of misconfiguration, or else they
        will be a normal part of operation.</t>
        <t>Upward referrals, and particularly root referrals, were
        once regarded as a useful mechanism to indicate lame
        delegation <xref target="RFC1912" />.  That use turned out to
        create some difficulties (see <xref
        target="sec_negative_upward" />, below).</t>
      </section>
      <section title="Negative Consequences of Upward Referrals"
               anchor="sec_negative_upward">
        <t>Upward referrals have some negative consequences.  The most
        obvious of them is that they are not in-domain records, and
        therefore they should not be accepted in any case according to
        RFC 5452 <xref target="RFC5452" />, section 6.  This means
        that an upward referral response is just extra traffic,
        because the querying resolver will need to find those records
        from an authoritative source anyway.  Moreover, upward
        referral response messages can be considerably larger than the
        query message that causes them, making them a useful amplifier
        when used in reflector attacks <xref target="RFC5358"
        />.</t>
        <t>Upward referrals can be part of a referral loop, and the
        algorithm does not specify how or when to terminate such a
        loop.  The use of upward referrals to indicate lame
        delegations exhibits this weakness.</t>
      </section>
      <section title="Alternatives to Upward Referrals"
               anchor="sec_alternatives">
        <t>It is possible for a server to send some other response
        than an upward referral, when an upward referral might have
        been generated under the algorithm.  There are several
        alternatives, each of which has advantages and
        disadvantages.</t>
        <section title="NODATA" anchor="sec_nodata">
          <t>A name server that had no information at all in a cache
          (including the SBELT structure) would complete step 4 of the
          algorithm having added nothing to the authority section in
          the response.  It would exit step 6 of the algorithm having
          created an empty response (except for the query that was
          copied from the original query message).  This is a type 3
          NODATA response <xref target="RFC2308" />.  A disadvantage
          of returning such a message is that it is unlikely to cause
          the query source to stop querying the nameserver for that
          name, because type 3 NODATA responses are not cached (see
          <xref target="RFC2308" />, section 5).</t>
        </section>
        <section title="SERVFAIL" anchor="sec_servfail">
          <t>RCODE 2, Server Failure, indicates that a server cannot
          process the query due to a problem with the name server.
          Some operators adopt the position that the name server would
          normally provide an upward referral, except that it has been
          configured not to.  Therefore, the server can return RCODE
          2.  Others argue, however, that there is nothing wrong with
          the server; and that, moreover, the use of RCODE 2 in DNSSEC
          (see <xref target="RFC4035" />) means that this RCODE is
          already overloaded enough.  Some interpretations of RCODE 2
          by resolvers invites subsequent retries to the same server,
          which may not always be desirable.</t>
        </section>
        <section title="NXDOMAIN" anchor="sec_nxdomain">
          <t>RCODE 3, Name Error or NXDOMAIN, indicates that the
          domain name does not exist.  Some operators use RCODE 3
          instead of producing upward referrals.  But since RCODE 3 is
          supposed to be "[m]eaningful only for responses from an
          authoritative name server" (<xref target="RFC1035" />
          section 4.1.1) and since by definition the upward referral
          can only happen in a case where the name server is not
          authoritative, this use appears to be inconsistent with the
          protocol.  </t>
        </section>
        <section title="REFUSED" anchor="sec_refused">
          <t>RCODE 5, Refused, indicates that the server "refuses to
          perform the specified operatio for policy reasons." (<xref
          target="RFC1035" />, section 4.1.1) Some operators adopt a
          policy of refusing to perform upward referrals, and so
          return RCODE 5 to queries that would otherwise cause such
          referrals.  There are some resolvers, however, that
          interpret RCODE 5 to mean that the resolver itself, rather
          than the query sent, is what causes the Refused response.
          Those resolvers will not attempt to query the server again
          (or not for some period of time), running the risk of
          outages in domains for which the server is authoritative and
          would provide a response.</t>
        </section>
      </section>
      <section title="Recommendations" anchor="sec_recommendations">
        <t>A name server that only provides authoritative service
        SHOULD NOT return upward referrals under any circumstances.
        Such a name server SHOULD provide either RCODE 2 or RCODE 5 in
        response.  A name server MUST NOT return RCODE 3 except for
        names for which it can provide authoritative answer that the
        name does not exist.</t>
        <t>A name server that provides recursive service MAY provide
        upward referrals when replying to a query with the RD bit
        clear, or it MAY refuse to provide upward referrals just as
        though it provided only authoritative service.  Operators
        should note that upward referrals might provide a modest
        troubleshooting advantage for recursive servers, but this
        should be weighed against the advantages of removing upward
        referrals as one of the available tools of attackers on
        Internet infrastructure.</t>
      </section>
    </section>
    <section title="Acknowledgements" anchor="sec_ack">
      <t>This memo has benefitted from the comments of Stephane
      Bortzmeyer, Robert Edmonds, Tony Finch, Evan Hunt, John
      Kristoff, Dave Lawrence, Edward Lewis, Matthew Pounsett, and
      Paul Vixie.</t>
      
    </section>
    
    <section title="IANA Considerations" anchor="sec_iana">
      <t>This memo makes no requests of IANA.</t>
      <t><cref>Note in draft: this section can be removed by the RFC
      Editor if the document is ever published as an RFC.</cref></t>
    </section>
  </middle>
  
  <back>
    <references title="Normative References">
      <?rfc include="reference.RFC.2119.xml"?>
      <?rfc include="reference.RFC.8174.xml"?>
    </references>
    <references title="Informative References">
      <?rfc include="reference.RFC.1034.xml"?>
      <?rfc include="reference.RFC.1035.xml"?>
      <?rfc include="reference.RFC.1912.xml"?>            
      <?rfc include="reference.RFC.2308.xml"?>
      <?rfc include="reference.RFC.4035.xml"?>            
      <?rfc include="reference.RFC.5358.xml"?>      
      <?rfc include="reference.RFC.5452.xml"?>      
      <?rfc include="reference.RFC.7719.xml"?>      
    </references>

    <section title="Discussion Venue">
      <t>This Internet-Draft is discussed on the DNS Operations
      Working Group list: dnsop@ietf.org.</t>
    </section>

    <section title="Change History">
      <t>Note to RFC Editor: this section should be removed prior to
      publication as an RFC.</t>
      <t><list style="hanging">
        <t hangText="00:">
          <list style="symbols">
            <t>Initial version</t>
          </list>
        </t>
      </list></t>
    </section>
  </back>
</rfc>
