<?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-07"
     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" ?>
  <?rfc subcompact="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>ICANN</organization>

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

        <email>roy.arends@icann.org</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, CA</city>

          <code>95617</code>

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

        <email>ietf@hardakers.net</email>
      </address>
    </author>

    <author fullname="David C Lawrence" initials="D." surname="Lawrence">
      <organization>Oracle + Dyn</organization>

      <address>
        <postal>
          <street>150 Dow St</street>

          <city>Manchester, NH</city>

          <code>03101</code>

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

        <email>tale@dd.org</email>
      </address>
    </author>

    <date day="09" month="August" year="2019"/>

    <abstract>
      <t>This document defines an extensible method to return
      additional information about the cause of DNS errors. Though
      created primarily to extend SERVFAIL to provide additional
      information about the cause of DNS and DNSSEC failures, the
      Extended DNS Errors option defined in this document allows all
      response types to contain extended error information.</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. was the answer marked REFUSED 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 are errors caused by DNSSEC validation issues. 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.
      These extended error codes are specially useful when received
      by resolvers, to return to stub resolvers or to downstream
      resolvers. Authoritative servers MAY parse and use them, but
      most error codes would make no sense for them.  Authoritative
      servers may need to generate extended error codes though.</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 (<xref target="RFC2671" />) option to include
      Extended DNS Error (EDE) 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: | INFO-CODE                                                     |
   +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
6: / EXTRA-TEXT ...                                                /
   +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
]]></artwork>
      </figure>

      <t/>

      <t>Field definition details:</t>

      <t><list style="symbols">
          <t>OPTION-CODE, 2 octets (defined in <xref target="RFC6891"
          />]), for EDE is TBD.
          [RFC Editor: change TBD to the proper code once assigned by IANA.]</t>

          <t>OPTION-LENGTH, 2 octets ((defined in <xref
          target="RFC6891" />]) contains
          the length of the payload (everything after OPTION-LENGTH)
          in octets and should be 4 plus the length of the EXTRA-TEXT
          section (which may be a zero-length string).</t>

          <t>INFO-CODE, 16-bits, which is the principal contribution of
          this document.</t>

          <t>EXTRA-TEXT, a variable length, UTF-8 encoded, text field
          that may hold additional textual information.  Note:
          EXTRA-TEXT may be zero octets in length, indicating there is
          no EXTRA-TEXT included.</t>
        </list></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 response (SERVFAIL, NXDOMAIN, REFUSED, etc) to a query that
        includes OPT Pseudo-RR <xref target="RFC6891" />.
        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 and
        information codes to be defined in the future.</t>

      <t>The fields of the Extended DNS Error option are defined
      further in the following sub-sections.</t>

      <section title="The INFO-CODE field">
          <t>This 16-bit value, encoded in network (MSB) byte order,
          provides the additional context for the RESPONSE-CODE of the
          DNS message. The INFO-CODE serves as an index to the
          "Extended DNS Errors" registry <xref target="IANA" />.</t>
      </section>

      <section title="The EXTRA-TEXT field">
          <t>The UTF-8-encoded, EXTRA-TEXT field may be zero-length,
          or may hold additional information useful to network
          operators.</t>
      </section>

    </section>

    <section title="Defined Extended DNS Errors">
      <t>This document defines some initial EDE codes. The mechanism
      is intended to be extensible, and additional code-points can be
      registered in the "Extended DNS Errors" registry <xref
      target="IANA" />.  The INFO-CODE from the EDE EDNS option is used
      to serve as an index into the "Extended DNS Error codes" IANA
      registry, the initial values for which are defined in the following
      sub-sections.</t>

      <section anchor="errother" title="Extended DNS Error Code 0 - Other">
	      <t>The error in question falls into a category that does
	      not match known extended error codes.  Implementations
	      SHOULD include a EXTRA-TEXT value to augment this error
	      code with additional information.</t>
      </section>

        <section anchor="errbaddnskeyalg"
                 title="Extended DNS Error Code 1 -
                        Unsupported DNSKEY Algorithm">
          <t>The resolver attempted to perform DNSSEC validation, but a DNSKEY
          RRSET contained only unknown algorithms.</t>
        </section>

        <section anchor="errbaddsalg"
                 title="Extended DNS Error Code 2 - Unsupported                           DS Algorithm">
          <t>The resolver attempted to perform DNSSEC validation, but a DS
          RRSET contained only unknown algorithms.</t>
        </section>

        <section anchor="stalenoerror"
	         title="Extended DNS Error Code 3 - Stale Answer">
          <t>The resolver was unable to resolve answer within its time
          limits and decided to answer with a previously cached data
          instead of answering with an error.  This is typically
          caused by problems on authoritative side, possibly as result
          of a DoS attack.</t>
        </section>

        <section anchor="forgedanswer"
                 title="Extended DNS Error Code 4 - Forged Answer">
          <t>For policy reasons (legal obligation, or malware
          filtering, for instance), an answer was forged.</t>
        </section>

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

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

        <section anchor="errexpired"
                 title="Extended DNS Error Code 7 - Signature Expired">
          <t>The resolver attempted to perform DNSSEC validation, a
          signature in the validation chain was expired.</t>
        </section>

        <section anchor="errprior"
                 title="Extended DNS Error Code 8 - Signature Not Yet Valid">
          <t>The resolver attempted to perform DNSSEC validation, but the
          signatures received were not yet valid.</t>
        </section>

        <section anchor="errnodnskey"
                 title="Extended DNS Error Code 9 - DNSKEY Missing">
          <t>A DS record existed at a parent, but no supported
          matching DNSKEY record could be found for the child.</t>
        </section>

        <section anchor="errnorrsig"
                 title="Extended DNS Error Code 10 - RRSIGs Missing">
          <t>The resolver attempted to perform DNSSEC validation, but no
          RRSIGs could be found for at least one RRset where RRSIGs were
          expected.</t>
        </section>

        <section anchor="errnozonekey"
                 title="Extended DNS Error Code 11 - No Zone Key Bit Set">
          <t>The resolver attempted to perform DNSSEC validation, but no Zone
          Key Bit was set in a DNSKEY.</t>
        </section>

        <section anchor="nonsec"
                 title="Extended DNS Error Code 12 - NSEC Missing">
          <t>The resolver attempted to perform DNSSEC validation, but
          the requested data was missing and a covering NSEC or NSEC3
          was not provided.</t>
        </section>

        <section anchor="cachederror"
                 title="Extended DNS Error Code 13 - Cached Error">
          <t>The resolver has cached SERVFAIL for this query without
          additional information.</t>
        </section>

        <section anchor="notready"
                 title="Extended DNS Error Code 14 - Not Ready">
          <t>The server is unable to answer the query as it is not
          fully up and functional yet.</t>
        </section>


        <section anchor="errblocked"
	         title="Extended DNS Error Code 15 - Blocked">
          <t>The resolver attempted to perfom a DNS query but the
          domain is blacklisted due to a security policy implemented
          on the server being directly talked to.</t>
        </section>

        <section anchor="errcensored"
	         title="Extended DNS Error Code 16 - Censored">
          <t>The resolver attempted to perfom a DNS query but the
          domain was blacklisted by a security policy imposed upon the
          server being talked to. Note that how the imposed policy is
          applied is irrelevant (in-band DNS somehow, court order,
          etc).</t>
        </section>


        <section anchor="errprohibted"
	         title="Extended DNS Error Code 17 - 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, local
          policy, etc.</t>
        </section>


        <section anchor="stalenx"
	         title="Extended DNS Error Code 18 - Stale Answer">
          <t>The resolver was unable to resolve answer within its time
          limits and decided to answer with a previously cached
          NXDOMAIN answer instead of answering with an error.  This is
          typically caused by problems on authoritative side, possibly
          as result of a DoS attack.</t>

        </section>

	<section anchor="errlame"
	         title="Extended DNS Error Code 19 - Lame">
          <t>An authoritative server 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 SERVFAIL response.  A
          resolver that receives a query (with the RD bit clear)
          SHOULD include this EDE code in the REFUSED
          response.</t>
        </section>



	<section anchor="deprecated"
	         title="Extended DNS Error Code 20 - Deprecated">
          <t>The requested operation or query is not supported as its
          use has been deprecated.</t>
        </section>

        <section anchor="noauth"
                 title="Extended DNS Error Code 21 - No Reachable Authority">
          <t>The resolver could not reach any of the authoritative name servers
          (or they refused to reply).</t>
        </section>

      </section>

    <section title="IANA Considerations">
      <section title="A New Extended Error Code EDNS Option" anchor="IANA">

        <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>
      </section>

      <section title="New Double-Index Registry Table for Extended Error Codes">
        <t>This document defines a new double-index IANA registry
        table, where the index value is the INFO-CODE from the
        Extended DNS Error EDNS option defined in this document. The
        IANA is requested to create and maintain this "Extended DNS
        Error codes" registry. The code-point space for each INFO-CODE
        index is to be broken into 3 ranges:</t>

        <t><list style="symbols">
            <t>0 - : Specification required.</t>

            <t>65023 - 65279: First come, first served.</t>

            <t>65280 - 32767: Experimental / Private use</t>
        </list></t>

        <t>A starting set of entries, based on the contents of this
        document, is as follows:</t>

    <t><list style="hanging" hangIndent="10">
    <t hangText="INFO-CODE:">0</t>
    <t hangText="Purpose:">Other Error</t>
    <t hangText="Reference:"><xref target="errother" /></t>
    </list></t>

    <t><list style="hanging" hangIndent="10">
    <t hangText="INFO-CODE:">1</t>
    <t hangText="Purpose:">Unsupported DNSKEY Algorithm</t>
    <t hangText="Reference:"><xref target="errbaddnskeyalg" /></t>
    </list></t>

    <t><list style="hanging" hangIndent="10">
    <t hangText="INFO-CODE:">2</t>
    <t hangText="Purpose:">Unsupported DS Algorithm</t>
    <t hangText="Reference:"><xref target="errbaddsalg" /></t>
    </list></t>

    <t><list style="hanging" hangIndent="10">
    <t hangText="INFO-CODE:">3</t>
    <t hangText="Purpose:">Answering with stale/cached data</t>
    <t hangText="Reference:"><xref target="stalenoerror" /></t>
    </list></t>

    <t><list style="hanging" hangIndent="10">
    <t hangText="INFO-CODE:">4</t>
    <t hangText="Purpose:">Forged Answer</t>
    <t hangText="Reference:"><xref target="forgedanswer" /></t>
    </list></t>

    <t><list style="hanging" hangIndent="10">
    <t hangText="INFO-CODE:">5</t>
    <t hangText="Purpose:">DNSSEC Indeterminate</t>
    <t hangText="Reference:"><xref target="errindeterminate" /></t>
    </list></t>

    <t><list style="hanging" hangIndent="10">
    <t hangText="INFO-CODE:">6</t>
    <t hangText="Purpose:">DNSSEC Bogus</t>
    <t hangText="Reference:"><xref target="errbogus" /></t>
    </list></t>

    <t><list style="hanging" hangIndent="10">
    <t hangText="INFO-CODE:">7</t>
    <t hangText="Purpose:">Signature Expired</t>
    <t hangText="Reference:"><xref target="errexpired" /></t>
    </list></t>

    <t><list style="hanging" hangIndent="10">
    <t hangText="INFO-CODE:">8</t>
    <t hangText="Purpose:">Signature Not Yet Valid</t>
    <t hangText="Reference:"><xref target="errprior" /></t>
    </list></t>

    <t><list style="hanging" hangIndent="10">
    <t hangText="INFO-CODE:">9</t>
    <t hangText="Purpose:">DNSKEY Missing</t>
    <t hangText="Reference:"> <xref target="errnodnskey" /></t>
    </list></t>

    <t><list style="hanging" hangIndent="10">
    <t hangText="INFO-CODE:">10</t>
    <t hangText="Purpose:">RRSIGs Missing</t>
    <t hangText="Reference:"><xref target="errnorrsig" /></t>
    </list></t>

    <t><list style="hanging" hangIndent="10">
    <t hangText="INFO-CODE:">11</t>
    <t hangText="Purpose:">No Zone Key Bit Set</t>
    <t hangText="Reference:"><xref target="errnozonekey" /></t>
    </list></t>

    <t><list style="hanging" hangIndent="10">
    <t hangText="INFO-CODE:">12</t>
    <t hangText="Purpose:">No NSEC records could be obtained</t>
    <t hangText="Reference:"><xref target="nonsec" /></t>
    </list></t>

    <t><list style="hanging" hangIndent="10">
    <t hangText="INFO-CODE:">13</t>
    <t hangText="Purpose:">The SERVFAIL error comes from the cache</t>
    <t hangText="Reference:"><xref target="cachederror" /></t>
    </list></t>

    <t><list style="hanging" hangIndent="10">
    <t hangText="INFO-CODE:">14</t>
    <t hangText="Purpose:">Not Ready.</t>
    <t hangText="Reference:"><xref target="notready" /></t>
    </list></t>
    
    <t><list style="hanging" hangIndent="10">
    <t hangText="INFO-CODE:">15</t>
    <t hangText="Purpose:">Blocked</t>
    <t hangText="Reference:"><xref target="errblocked" /></t>
    </list></t>

    <t><list style="hanging" hangIndent="10">
    <t hangText="INFO-CODE:">16</t>
    <t hangText="Purpose:">Censored</t>
    <t hangText="Reference:"><xref target="errcensored" /></t>
    </list></t>

    <t><list style="hanging" hangIndent="10">
    <t hangText="INFO-CODE:">17</t>
    <t hangText="Purpose:">Prohibited</t>
    <t hangText="Reference:"><xref target="errprohibted" /></t>
    </list></t>

    <t><list style="hanging" hangIndent="10">
    <t hangText="INFO-CODE:">18</t>
    <t hangText="Purpose:">Answering with stale/cached NXDOMAIN data</t>
    <t hangText="Reference:"><xref target="stalenx" /></t>
    </list></t>

    <t><list style="hanging" hangIndent="10">
    <t hangText="INFO-CODE:">19</t>
    <t hangText="Purpose:">Lame</t>
    <t hangText="Reference:"><xref target="errlame" /></t>
    </list></t>

    <t><list style="hanging" hangIndent="10">
    <t hangText="INFO-CODE:">20</t>
    <t hangText="Purpose:">Deprecated</t>
    <t hangText="Reference:"><xref target="deprecated" /></t>
    </list></t>

    <t><list style="hanging" hangIndent="10">
    <t hangText="INFO-CODE:">21</t>
    <t hangText="Purpose:">No Reachable Authority</t>
    <t hangText="Reference:"><xref target="deprecated" /></t>
    </list></t>

      </section>
    </section>

    <section anchor="security" title="Security Considerations">
      <t>Though DNSSEC continues to be deployed, unfortunately a
      significant number of clients (~11% according to <xref
      target="GeoffValidation"/>) that receive a SERVFAIL from a
      validating resolver because of a DNSSEC validaion issue will
      simply ask the next (potentially non-validating) resolver in
      their list, and thus 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, have a
      cookie!".</t>

      <t>This information is unauthenticated information, and an attacker (e.g
      MITM or malicious recursive server) could insert an extended error
      response into already untrusted data &mdash; ideally clients and
      resolvers would not trust any unauthenticated information, but until we
      live in an era where all DNS answers are authenticated via DNSSEC or
      other mechanisms, there are some tradeoffs. As an example, an attacker
      who is able to insert the DNSSEC Bogus Extended Error into a packet
      could instead simply reply with a fictitious address (A or AAAA) record.
      </t>
    </section>

    <section title="Acknowledgements">
      <t>The authors wish to thank Joe Abley, Mark Andrews, Stephane
      Bortzmeyer, Vladimir Cunat, Peter DeVries, Peter van Dijk,
      Donald Eastlake, Bob Harold, Geoff Huston, Shane Kerr, Edward
      Lewis, Carlos M.  Martinez, George Michelson, Michael Sheldon,
      Petr Spacek, Ondrej Sury, Loganaden Velvindron, and Paul Vixie.
      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 we cannot remember why...</t>
    </section>
  </middle>

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

    <references title="Informative References">
      <?rfc include='reference.RFC.2845' ?>

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

      <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>
  </back>
</rfc>
