<?xml version="1.0" encoding="US-ASCII"?>
<!DOCTYPE rfc SYSTEM "rfc2629.dtd" [
<!ENTITY rfc2119 PUBLIC "" ".//reference.RFC.2119.xml">
]>
<!-- WK: Set category, IPR, docName -->
<rfc category="std" docName="draft-ietf-dnsop-extended-error-00"
     ipr="trust200902">
  <?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" ?>

  <front>
    <!-- WK: Set long title. -->

    <title abbrev="draft-ietf-dnsop-extended-error">Extended DNS
    Errors</title>

    <author fullname="Warren Kumari" initials="W." surname="Kumari">
      <organization>Google</organization>

      <address>
        <postal>
          <street>1600 Amphitheatre Parkway</street>

          <city>Mountain View, CA</city>

          <code>94043</code>

          <country>US</country>
        </postal>

        <email>warren@kumari.net</email>
      </address>
    </author>

    <author fullname="Evan Hunt" initials="E." surname="Hunt">
      <organization>ISC</organization>

      <address>
        <postal>
          <street>950 Charter St</street>

          <city>Redwood City, CA</city>

          <code>94063</code>

          <country>US</country>
        </postal>

        <email>each@isc.org</email>
      </address>
    </author>

    <author fullname="Roy Arends" initials="R." surname="Arends">
      <organization>Nominet</organization>

      <address>
        <postal>
          <street/>

          <country>UK</country>
        </postal>

        <email>TBD</email>
      </address>
    </author>

    <author fullname="Wes Hardaker" initials="W." surname="Hardaker">
      <organization>USC/ISI</organization>

      <address>
        <postal>
          <street>P.O. Box 382</street>

          <city>Davis, VA</city>

          <code>95617</code>

          <country>US</country>
        </postal>
      </address>
    </author>

    <author fullname="David C Lawrence" initials="D." surname="Lawrence">
      <organization>Akamai Technologies</organization>

      <address>
        <postal>
          <street>150 Broadway</street>

          <city>Cambridge, MA</city>

          <code>02142-1054</code>

          <country>US</country>
        </postal>

        <email>tale@akamai.com</email>
      </address>
    </author>

    <date day="16" month="October" year="2017"/>

    <abstract>
      <t>This document defines an extensible method to return additional
      information about the cause of DNS errors. The primary use case is to
      extend SERVFAIL to provide additional information about the cause of DNS
      and DNSSEC failures.</t>

      <t>[ Open question: The document currently defines a registry for
      errors. It has also been suggested that the option also carry human
      readable (text) messages, to allow the server admin to provide
      additional debugging information (e.g: "example.com pointed their NS at
      us. No idea why...", "We don't provide recursive DNS to 192.0.2.0.
      Please stop asking...", "Have you tried Acme Anvil and DNS? We do DNS
      right..." (!). Please let us know if you think text is needed, or if a
      16bit FCFS registry is expressive enough. ]</t>

      <t>[ Open question: This document discusses extended *errors*, but it
      has been suggested that this could be used to also annotate *non-error*
      messages. The authors do not think that this is a good idea, but could
      be persuaded otherwise. ]</t>
    </abstract>
  </front>

  <middle>
    <section title="Introduction and background">
      <t>There are many reasons that a DNS query may fail, some of them
      transient, some permanent; some can be resolved by querying another
      server, some are likely best handled by stopping resolution.
      Unfortunately, the error signals that a DNS server can return are very
      limited, and are not very expressive. This means that applications and
      resolvers often have to "guess" at what the issue is - e.g the answer
      was marked REFUSED because of a lame delegation, or because of a
      lame delegation or because the nameserver is still starting up and
      loading zones? Is a SERVFAIL a DNSSEC validation issue, or is the
      nameserver experiencing a bad hair day?</t>

      <t>A good example of issues that would benefit by additional error
      information is an error caused by a DNSSEC validation issue. When a stub
      resolver queries a DNSSEC bogus name (using a validating resolver), the
      stub resolver receives only a SERVFAIL in response. Unfortunately,
      SERVFAIL is used to signal many sorts of DNS errors, and so the stub
      resolver simply asks the next configured DNS resolver. The result of
      trying the next resolver is one of two outcomes: either the next
      resolver also validates, a SERVFAIL is returned again, and the user gets
      an (largely) incomprehensible error message; or the next resolver is not
      a validating resolver, and the user is returned a potentially harmful
      result.</t>

      <t>This document specifies a mechanism to extend (or annotate) DNS
      errors to provide additional information about the cause of the error.
      This information can be used by the resolver to make a decision
      regarding whether or not to retry, or by technical users attempting to
      debug issues.</t>

      <t>Here is a reference to an "external" (non-RFC / draft) thing: (<xref
      target="IANA.AS_Numbers"/>). And this is a link to an ID:<xref
      target="I-D.ietf-sidr-iana-objects"/>.</t>

      <section title="Requirements notation">
        <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"/>.</t>
      </section>
    </section>

    <section title="Extended Error EDNS0 option format">
      <t>This draft uses an EDNS0 ([RFC2671]) option to include extended error
      (ExtError) information in DNS messages. The option is structured as
      follows:</t>

      <figure>
        <artwork align="left"><![CDATA[
                                             1   1   1   1   1   1
     0   1   2   3   4   5   6   7   8   9   0   1   2   3   4   5  
   +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
0: |                            OPTION-CODE                        |
   +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
2: |                           OPTION-LENGTH                       |
   +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
4: | R |                          RESERVED                         |
   +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
6: |                                CODE                           |
   +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+]]></artwork>
      </figure>

      <t/>

      <t><list style="symbols">
          <t>OPTION-CODE, 2 octets (defined in [RFC6891]), for ExtError is
          TBD.</t>

          <t>OPTION-LENGTH, 2 octets ((defined in [RFC6891]) contains the
          length of the payload (everything after OPTION-LENGTH) in octets and
          should be 4.</t>

          <t>RESERVED, 2 octets; the first bit (R) indicates a flag
          defined in this specification.  The remaining bits are
          reserved for future use, potentially as additional flags.</t>

          <t>CODE, 2 octets.</t>
        </list></t>

      <t>Currently the only defined flag is the R flag. <list style="hanging">
          <t hangText="R - Retry">The R (or Retry) flag provides a hint to the
          receiver that it should retry the query, probably by querying
          another server. If the R bit is set (1), the sender believes that
          retrying the query may provide a successful answer next time; if the
          R bit is clear (0), the sender believes that it should not ask
          another server.</t>
        </list></t>

      <t>The remaining bits in the RESERVED field are reserved for
      future use and MUST be set to 0 by the sender
      and SHOULD be ignored by the receiver.</t>

      <t>Code: A code point into the IANA "Extended DNS Errors" registry.</t>
    </section>

    <section title="Use of the Extended DNS Error option">
      <t>The Extended DNS Error (EDE) is an EDNS option. It can be included in
      any error response (SERVFAIL, NXDOMAIN, REFUSED, etc) to a query that
      includes an EDNS option. This document includes a set of initial
      codepoints (and requests to the IANA to add them to the registry), but
      is extensible via the IANA registry to allow additional error codes to
      be defined in the future.</t>

      <t>The R (Retry) flag provides a hint (or suggestion) as to what the
      receiver may want to do with this annotated error. The mechanism is
      specifically designed to be extensible, and so implementations may
      receive EDE codes that it does not understand. The R flag allows
      implementations to make a decision as to what to do if it receives a
      response with an unknown code - retry or drop the query. Note that this
      flag is only a suggestion or hint. Receivers can choose to ignore this
      hint.</t>
    </section>

    <section title="Defined Extended DNS Errors">
      <t>This document defines some initial EDE codes. The mechanism is
      intended to be extensible, and additional codepoints will be registered
      in the "Extended DNS Errors" registry. This document provides
      suggestions for the R flag, but the originating server may ignore these
      recommendations if it knows better.</t>

      <section title="Extended DNS Error Code 100 - DNSSEC Bogus">
        <t>The resolver attempted to perform DNSSEC validation, but validation
        ended in the Bogus state. The R flag should not be set.</t>
      </section>

      <section title="Extended DNS Error Code 2 - DNSSEC Indeterminate">
        <t>The resolver attempted to perform DNSSEC validation, but validation
        ended in the Indeterminate state.</t>

        <t>Usually attached to SERVFAIL messages. The R flag should not be
        set.</t>
      </section>

      <section title="Extended DNS Error Code 3 - Lame">
        <t>An authoritative resolver that receives a query (with the RD bit
        clear) for a domain for which it is not authoritative SHOULD include
        this EDE code in the REFUSED response.</t>

        <t>Implementations should set the R flag in this case (another
        nameserver might not be lame).</t>
      </section>

      <section title="Extended DNS Error Code 4 - Prohibited">
        <t>An authoritative or recursive resolver that receives a query from
        an "unauthorized" client can annotate its REFUSED message with this
        code. Examples of "unauthorized" clients are recursive queries from IP
        addresses outside the network, blacklisted IP addresses, etc.</t>

        <t>Implementations SHOULD allow operators to define what to set the R
        flag to in this case.</t>
      </section>

      <section title="Extended DNS Error Code 5 - TooBusy">
        <t>[ Ed: This might be a bad idea. It is intended to allow servers
        under a DoS (for example a random subdomain attack) to signal to
        recursive clients that they are being abusive and should back off.
        This may be a bad idea -- it may "complete the attack", it may be
        spoofable (by anyone who could also do a MITM style attack), etc.
        ]</t>

        <t>A nameserver which is under excessive load (for example, because it
        is experiencing a DoS) may annotate any answer with this code.</t>

        <t>It is RECOMMENDED that implementations set the R flag in this case,
        but may allow operators to define what to set the R flag to.</t>

        <t>[ agreed: bad idea -wjh ]</t>
      </section>
    </section>

    <section title="IANA Considerations">
      <t>[This section under construction, beware. ]</t>

      <t>This document defines a new EDNS(0) option, entitled "Extended DNS
      Error", assigned a value of TBD1 from the "DNS EDNS0 Option Codes (OPT)"
      registry [to be removed upon publication:
      [http://www.iana.org/assignments/dns-parameters/dns-parameters.xhtml#dns-parameters-11]</t>

      <t><figure>
          <artwork><![CDATA[Value  Name                 Status    Reference
-----  ----------------     ------    ------------------
 TBD   Extended DNS Error    TBD       [ This document ]]]></artwork>
        </figure></t>

      <t>Data Tag Name Length Meaning ---- ---- ------ ------- TBD1 FooBar N
      FooBar server</t>

      <t>The IANA is requested to create and maintain the "Extended DNS Error
      codes" registry. The codepoint space is broken into 3 ranges:<list
          style="symbols">
          <t>1 - 16384: Specification required.</t>

          <t>16385 - 65000: First Come First Served</t>

          <t>65000 - 65534: Experimental / Private use</t>
        </list>The codepoints 0, 65535 are reserved.</t>

      <t/>
    </section>

    <section title="Open questions">
      <t><list style="hanging">
          <t hangText="1">Can this be included in *any* response or only
          responses to requests that included an EDNS option? Resolvers are
          supposed to ignore additional. EDNS capable ones are supposed to
          simply ignore unknown options. I know the spec says you can only
          include EDNS0 in a response if in a request -- it is time to
          reevaluate this?</t>

          <t hangText="2">Can this be applied to *any* response, or only error
          responses?</t>

          <t hangText="3">Should textual information be allowed as well? What
          if the only thing allowed is a domain name, e.g to point at where
          validation began failing?</t>
        </list></t>
    </section>

    <section anchor="security" title="Security Considerations">
      <t>DNSSEC is being deployed - unfortunately a significant number of
      clients (~11% according to <xref target="GeoffValidation"/>), when
      receiving a SERVFAIL from a validating resolver because of a DNSSEC
      validaion issue simply ask the next (non-validating) resolver in their
      list, and don't get any of the protections which DNSSEC should
      provide. This is very similar to a kid asking his mother if he can have
      another cookie. When the mother says "No, it will ruin your dinner!",
      going off and asking his (more permissive) father and getting a "Yes,
      sure, cookie!".</t>
    </section>

    <section title="Acknowledgements">
      <t>The authors wish to thank Geoff Huston and Bob Harold, Carlos
      M. Martinez, Peter DeVries, George Michelson, Mark Andrews,
      Ondrej Sury, Edward Lewis, Paul Vixie, Shane Kerr. They also
      vaguely remember discussing this with a number of people over
      the years, but have forgotten who all they were -- if you were
      one of them, and are not listed, please let us know and we'll
      acknowledge you.</t>

      <t>I also want to thank the band "Infected Mushroom" for providing a
      good background soundtrack (and to see if I can get away with this!)
      Another author would like to thank the band "Mushroom Infectors". This
      was funny at the time we wrote it, but I cannot remember why...</t>

      <t>We would like to especially thank Peter van Dijk, who sent GitHub
      pull requests.</t>

      <t/>
    </section>
  </middle>

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

      <reference anchor="IANA.AS_Numbers"
                 target="http://www.iana.org/assignments/as-numbers">
        <front>
          <title abbrev="Autonomous System (AS) Numbers">Autonomous System
          (AS) Numbers</title>

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

          <date/>
        </front>
      </reference>
    </references>

    <references title="Informative References">
      <?rfc include='reference.I-D.draft-ietf-sidr-iana-objects-03.xml'
?>

      <reference anchor="GeoffValidation"
                 target="http://www.potaroo.net/presentations/2016-06-27-dnssec.pdf">
        <front>
          <title abbrev="Validation today">A quick review of DNSSEC Validation
          in today&rsquo;s Internet</title>

          <author fullname="Geoff Huston, APNIC">
            <organization>IANA</organization>
          </author>

          <date month="June" year="2016"/>
        </front>
      </reference>
    </references>

    <section title="Changes / Author Notes.">
      <t>[RFC Editor: Please remove this section before publication ]</t>

      <t>From -02 to -03:<list style="symbols">
          <t>Added David Lawrence -- I somehow missed that in last
          version.</t>
        </list></t>

      <t>From -00 to -01;</t>

      <t><list style="symbols">
          <t>Fixed up some of the text, minor clarifications.</t>
        </list></t>
    </section>
  </back>
</rfc>
