<?xml version="1.0" encoding="utf-8"?>
<!-- name="GENERATOR" content="github.com/mmarkdown/mmark Mmark Markdown Processor - mmark.miek.nl" --> encoding="UTF-8"?>
 <!DOCTYPE rfc SYSTEM "rfc2629-xhtml.ent">

 <rfc version="3" ipr="trust200902" docName="draft-ietf-dnsop-nsec-ttl-05" number="9077" submissionType="IETF" category="std" consensus="true" xml:lang="en" xmlns:xi="http://www.w3.org/2001/XInclude" updates="4034, 4035, 5155, 8198" consensus="true"> symRefs="true" sortRefs="true" tocInclude="true">

   <front>

 <title abbrev="nsec-ttl">NSEC abbrev="NSEC TTL">NSEC and NSEC3 NSEC3: TTLs and NSEC Aggressive Use</title><seriesInfo value="draft-ietf-dnsop-nsec-ttl-05" stream="IETF" status="standard" name="Internet-Draft"></seriesInfo> Use</title>

 <seriesInfo name="RFC" value="9077"/>

 <author initials="P." surname="van Dijk" fullname="Peter van Dijk"><organization>PowerDNS</organization><address><postal><street></street> Dijk"><organization>PowerDNS</organization>
 <address>
 <postal>
 <street></street>
 <city>Den Haag</city>
 <country>Netherlands</country>
</postal><email>peter.van.dijk@powerdns.com</email>
</address></author>
<date/>
 </postal>
 <email>peter.van.dijk@powerdns.com</email>
 </address>
 </author>
 <date year="2021" month="July" />
 <area>General</area>
 <workgroup>dnsop</workgroup>
<keyword>Internet-Draft</keyword>
<keyword>DNSSEC</keyword>
<keyword>negative cache</keyword>
<keyword>Denial of Existence</keyword>

 <abstract>
 <t>Due to a combination of unfortunate wording in earlier documents, aggressive use of NSEC and NSEC3 records may deny the existence of names far beyond the intended lifetime of a denial.
 This document changes the definition of the NSEC and NSEC3 TTL (Time To Live) to correct that situation.
 This document updates RFC RFCs 4034, RFC 4035, RFC 5155, and RFC 8198.</t>
 </abstract>

 </front>

 <middle>

 <section anchor="introduction"><name>Introduction</name>
<t>[RFC editor: please remove this block before publication.</t>
<t>Earlier notes on this:</t>

<ul>
<li><eref target="https://indico.dns-oarc.net/event/29/sessions/98/#20181013">https://indico.dns-oarc.net/event/29/sessions/98/#20181013</eref></li>
<li><eref target="https://lists.dns-oarc.net/pipermail/dns-operations/2018-April/thread.html#17420">https://lists.dns-oarc.net/pipermail/dns-operations/2018-April/thread.html#17420</eref></li>
<li><eref target="https://lists.dns-oarc.net/pipermail/dns-operations/2018-March/017416.html">https://lists.dns-oarc.net/pipermail/dns-operations/2018-March/017416.html</eref></li>
</ul>
<t>This document lives <eref target="https://github.com/PowerDNS/draft-dnsop-nsec-ttl">on GitHub</eref>; proposed text and editorial changes are very much welcomed there, but any functional changes should always first be discussed on the IETF DNSOP WG mailing list.</t>
<t>]</t>
 <t><xref target="RFC2308"></xref> defines the TTL of the SOA (Start Of Authority) Start of Authority (SOA) record that must be returned in negative answers (NXDOMAIN or NODATA):</t>

 <blockquote><t>The TTL of this record is set from the minimum of the MINIMUM field of the SOA record and the TTL of the SOA itself, and indicates how long a resolver may cache the negative answer.</t>
</blockquote><t>Thus,
 </blockquote>

 <t>Thus, if the TTL of the SOA in the zone is lower than the SOA MINIMUM value (the last number in the SOA record),
 the authoritative server sends that lower value as the TTL of the returned SOA record.
 The resolver always uses the TTL of the returned SOA record when setting the negative TTL in its cache.</t>

 <t>However, <xref target="RFC4034"></xref> section 4 target="RFC4034" sectionFormat="comma" section="4"></xref> has this unfortunate text:</t>

 <blockquote><t>The NSEC RR SHOULD <bcp14>SHOULD</bcp14> have the same TTL value as the SOA minimum TTL field. This is in the spirit of negative caching ([RFC2308]).</t>
</blockquote><t>This (<xref target="RFC2308"/>).</t>
 </blockquote>

 <t>This text, while referring to RFC2308, <xref target="RFC2308"/>, can cause NSEC records to have much higher TTLs than the appropriate negative TTL for a zone.
 <xref target="RFC5155"></xref> contains equivalent text.</t>

 <t><xref target="RFC8198"></xref> section 5.4 target="RFC8198" sectionFormat="comma" section="5.4"></xref> tries to correct this:</t>
<blockquote><t>Section 5 of [RFC2308]

 <blockquote><t><xref target="RFC2308" sectionFormat="of" section="5"/> also states that a negative cache entry TTL is taken from the minimum of the SOA.MINIMUM field and SOA's TTL.  This can be less than the TTL of an NSEC or NSEC3 record, since their TTL is equal to the SOA.MINIMUM field (see <xref target="RFC4035"></xref>, Section 2.3 target="RFC4035" sectionFormat="comma" section="2.3"></xref> and [RFC5155], Section 3).</t> <xref target="RFC5155" sectionFormat="comma" section="3"/>).</t>

 <t>A resolver that supports aggressive use of NSEC and NSEC3 SHOULD <bcp14>SHOULD</bcp14> reduce the TTL of NSEC and NSEC3 records to match the SOA.MINIMUM field in the authority section of a negative response, if SOA.MINIMUM is smaller.</t>
</blockquote><t>But
 </blockquote>

 <t>But the NSEC and NSEC3 RRs should, according to RFC4034 <xref target="RFC4034"/> and RFC5155,  <xref target="RFC5155"/>, already be at the value of the MINIMUM field in the SOA. Thus, the advice from RFC8198  <xref target="RFC8198"/> would not actually change the TTL used for the NSEC and NSEC3 RRs for authoritative servers that follow the RFCs.</t>

<t>As a theoretical exercise, consider a TLD top-level domain (TLD) named <tt>.example</tt> .example with a an SOA record like this:</t>
<t><tt>example.

<artwork name="" type="" align="left" alt=""><![CDATA[
example.    900 IN  SOA primary.example. hostmaster.example. dnsadmin.example. (
                                         1 1800 900 604800 86400</tt></t> 86400 )
]]></artwork>

 <t>The SOA record has a 900 second TTL, 900-second TTL and a 86400 an 86400-second MINIMUM TTL.
 Negative responses from this zone have a 900 second 900-second TTL, but the NSEC or NSEC3 records in those negative responses have a 86400 an 86400-second TTL.
 If a resolver were to use those NSEC or NSEC3 records aggressively, they would be considered valid for a day, day instead of the intended 15 minutes.</t>
 </section>

 <section anchor="conventions-and-definitions"><name>Conventions and Definitions</name>
<t>The
	 <t>
     The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, "<bcp14>MUST</bcp14>", "<bcp14>MUST NOT</bcp14>", "<bcp14>REQUIRED</bcp14>", "<bcp14>SHALL</bcp14>", "<bcp14>SHALL
     NOT</bcp14>", "<bcp14>SHOULD</bcp14>", "<bcp14>SHOULD NOT</bcp14>", "<bcp14>RECOMMENDED</bcp14>", "<bcp14>NOT RECOMMENDED</bcp14>",
     "<bcp14>MAY</bcp14>", and &quot;OPTIONAL&quot; "<bcp14>OPTIONAL</bcp14>" in this document are to be interpreted as
     described in BCP 14 BCP&nbsp;14 <xref target="RFC2119"></xref> target="RFC2119"/> <xref target="RFC8174"></xref> target="RFC8174"/>
     when, and only when, they appear in all capitals, as shown here.</t> here.
	 </t>
 </section>

 <section anchor="nsec-and-nsec3-ttl-changes"><name>NSEC and NSEC3 TTL changes</name>
<t>The existing texts in <xref Changes</name>

<t><xref target="RFC4034"></xref>, <xref target="RFC4035"></xref>, and <xref target="RFC5155"></xref> use the SHOULD <bcp14>SHOULD</bcp14> requirement level, but they were written prior to the publication of <xref target="RFC8198"></xref> when <xref target="RFC4035"></xref> still said 'However, said: </t>

<blockquote><t>However, it seems prudent for resolvers to avoid blocking new authoritative data or synthesizing new data on their own'. own.</t></blockquote>
<t>

<xref target="RFC8198"></xref> updated that text to contain 'DNSSEC-enabled contain:</t> <blockquote><t>...DNSSEC-enabled validating resolvers SHOULD <bcp14>SHOULD</bcp14> use wildcards and NSEC/NSEC3 resource records to generate positive and negative responses until the effective TTLs or signatures for those records expire'. expire.</t></blockquote><t>

This means that the correctness of NSEC and NSEC3 records, records and their TTLs, TTLs has become much more important.

Because of that, the updates in this document upgrade the requirement level to MUST.</t> <bcp14>MUST</bcp14>.</t>

<section anchor="updates-to-rfc4034"><name>Updates to RFC4034</name>
<t>Where <xref RFC 4034</name>
<t><xref target="RFC4034"></xref> says:</t>

<blockquote><t>The NSEC RR SHOULD <bcp14>SHOULD</bcp14> have the same TTL value as the SOA minimum TTL field.  This is in the spirit of negative caching ([RFC2308]).</t> (<xref target="RFC2308"/>).</t>
</blockquote><t>This is updated to say:</t>
<blockquote><t>The
<blockquote>

  <t>The TTL of the NSEC RR that is returned MUST <bcp14>MUST</bcp14> be the lesser of the MINIMUM field of the SOA record and the TTL of the SOA itself.  This matches the definition of the TTL for negative responses in <xref target="RFC2308"></xref>. Because some signers incrementally update the NSEC chain, a transient inconsistency between the observed and expected TTL MAY <bcp14>MAY</bcp14> exist.</t>
</blockquote></section>

<section anchor="updates-to-rfc4035"><name>Updates to RFC4035</name>
<t>Where <xref RFC 4035</name>
<t><xref target="RFC4035"></xref> says:</t>

<blockquote><t>The TTL value for any NSEC RR SHOULD <bcp14>SHOULD</bcp14> be the same as the minimum TTL value field in the zone SOA RR.</t>
</blockquote><t>This is updated to say:</t>
<blockquote><t>The
<blockquote>

  <t>The TTL of the NSEC RR that is returned MUST <bcp14>MUST</bcp14> be the lesser of the MINIMUM field of the SOA record and the TTL of the SOA itself.  This matches the definition of the TTL for negative responses in <xref target="RFC2308"></xref>. Because some signers incrementally update the NSEC chain, a transient inconsistency between the observed and expected TTL MAY <bcp14>MAY</bcp14> exist.</t>
</blockquote></section>

<section anchor="updates-to-rfc5155"><name>Updates to RFC5155</name>
<t>Where <xref RFC 5155</name>
<t><xref target="RFC5155"></xref> says:</t>
<blockquote><t>The NSEC3 RR SHOULD <bcp14>SHOULD</bcp14> have the same TTL value as the SOA minimum TTL field.  This is in the spirit of negative caching [RFC2308].</t> <xref target="RFC2308"/>.</t>
</blockquote><t>This is updated to say:</t>
<blockquote><t>The TTL of the NSEC3 RR that is returned MUST <bcp14>MUST</bcp14> be the lesser of the MINIMUM field of the SOA record and the TTL of the SOA itself.  This matches the definition of the TTL for negative responses in <xref target="RFC2308"></xref>. Because some signers incrementally update the NSEC3 chain, a transient inconsistency between the observed and expected TTL MAY <bcp14>MAY</bcp14> exist.</t>
</blockquote><t>Where <xref target="RFC5155"></xref> says:</t>
<blockquote><t>o  The
<blockquote>
<ul empty="false">
<li>The TTL value for any NSEC3 RR SHOULD <bcp14>SHOULD</bcp14> be the same as the minimum TTL value field in the zone SOA RR.</t>
</blockquote><t>This RR.</li>
</ul>
</blockquote>
<t>This is updated to say:</t>
<blockquote><t>o  The
<blockquote>
<ul empty="false">
<li>The TTL value for each NSEC3 RR MUST <bcp14>MUST</bcp14> be the lesser of the MINIMUM field of the zone SOA RR and the TTL of the zone SOA RR itself. Because some signers incrementally update the NSEC3 chain, a transient inconsistency between the observed and expected TTL MAY exist.</t> <bcp14>MAY</bcp14> exist.</li>
</ul>
</blockquote></section>

<section anchor="updates-to-rfc8198"><name>Updates to RFC8198</name> RFC 8198</name>
<t><xref target="RFC8198"></xref> section 5.4 (Consideration target="RFC8198" sectionFormat="comma" section="5.4"></xref> ("Consideration on TTL) TTL") is completely replaced by the following text:</t>
<blockquote><t>The TTL value of negative information is especially important,
   because newly added domain names cannot be used while the negative
   information is effective.</t>
<t>Section 5 of [RFC2308]
<t><xref target="RFC2308" sectionFormat="of" section="5"/> suggests a maximum default negative cache TTL
   value of 3 hours (10800).  It is RECOMMENDED <bcp14>RECOMMENDED</bcp14> that validating
   resolvers limit the maximum effective TTL value of negative responses
   (NSEC/NSEC3 RRs) to this same value.</t>
<t>A resolver that supports aggressive use of NSEC and NSEC3 MAY <bcp14>MAY</bcp14>
   limit the TTL of NSEC and NSEC3 records to the lesser of the SOA.MINIMUM
   field and the TTL of the SOA in a response, if present.
   It MAY <bcp14>MAY</bcp14> also use a previously cached SOA for a zone to find these values.</t>
</blockquote><t>(The third paragraph of the original is removed, and the fourth paragraph is updated to allow resolvers to also take the lesser of the SOA TTL and SOA MINIMUM.)</t>
</section>
</section>

<section anchor="zone-operator-considerations"><name>Zone Operator Considerations</name>
<t>If signers and DNS servers for a zone cannot immediately be updated to conform to this document, zone operators are encouraged to consider setting their SOA record TTL and the SOA MINIMUM field to the same value.
That way, the TTL used for aggressive NSEC and NSEC3 use matches the SOA TTL for negative responses.</t>
<t>Note that some signers might use the SOA TTL or MINIMUM as a default for other values, such as the TTL for DNSKEY records.
Operators should consult documentation before changing values.</t>

<section anchor="a-note-on-wildcards"><name>A Note On on Wildcards</name>
<t>Validating resolvers consider an expanded wildcard valid for the wildcard's TTL, capped by the TTLs of the NSEC or NSEC3 proof that shows that the wildcard expansion is legal.
Thus, changing the TTL of NSEC or NSEC3 records (explicitly, or by implementation of this document, document implicitly) might affect (shorten) the lifetime of wildcards.</t>
</section>
</section>

<section anchor="security-considerations"><name>Security Considerations</name>
<t>An attacker can delay future records from appearing in a cache by seeding the cache with queries that cause NSEC or NSEC3 responses to be cached for aggressive use purposes.
This document reduces the impact of that attack in cases where the NSEC or NSEC3 TTL is higher than the zone operator intended.</t>
</section>

<section anchor="iana-considerations"><name>IANA Considerations</name>
<t>IANA is requested to add has added a reference to this document in the &quot;Resource Record (RR) TYPEs&quot; subregistry of the &quot;Domain Name System (DNS) Parameters&quot; registry, registry for the NSEC and NSEC3 types.</t>
</section>

</middle>

<back>
<references><name>Normative References</name>
<xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.8174.xml"/>
<xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.2308.xml"/>
<xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.4034.xml"/>
<xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.5155.xml"/>
<xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.8198.xml"/>
<xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.4035.xml"/>
<xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.2119.xml"/>
</references>

<section anchor="implementation-status"><name>Implementation Status</name>
<t>[RFC Editor: please remove this section before publication]</t>
<t>Implemented in PowerDNS Authoritative Server 4.3.0 <eref target="https://doc.powerdns.com/authoritative/dnssec/operational.html?highlight=ttl#some-notes-on-ttl-usage">https://doc.powerdns.com/authoritative/dnssec/operational.html?highlight=ttl#some-notes-on-ttl-usage</eref> .</t>
<t>Implemented in BIND 9.16 and up, to be released early 2021 <eref target="https://mailarchive.ietf.org/arch/msg/dnsop/ga41J2PPUbmc21--dqf3i7_IY6M">https://mailarchive.ietf.org/arch/msg/dnsop/ga41J2PPUbmc21--dqf3i7_IY6M</eref> <eref target="https://gitlab.isc.org/isc-projects/bind9/-/merge_requests/4506">https://gitlab.isc.org/isc-projects/bind9/-/merge_requests/4506</eref> .</t>
<t>Implemented in Knot DNS 3.1, to be released in 2021 <eref target="https://gitlab.nic.cz/knot/knot-dns/-/merge_requests/1219">https://gitlab.nic.cz/knot/knot-dns/-/merge_requests/1219</eref> .</t>
<t>Implemented in ldns, patch under review <eref target="https://github.com/NLnetLabs/ldns/pull/118">https://github.com/NLnetLabs/ldns/pull/118</eref></t>
<t>Implementation status is tracked at <eref target="https://trac.ietf.org/trac/dnsop/wiki/draft-ietf-dnsop-nsec-ttl">https://trac.ietf.org/trac/dnsop/wiki/draft-ietf-dnsop-nsec-ttl</eref></t>
</section>

<section anchor="document-history"><name>Document history</name>
<t>[RFC editor: please remove this section before publication.]</t>
<t>From draft-vandijk-dnsop-nsec-ttl-00 to draft-ietf-dnsop-nsec-ttl-00:</t>

<ul>
<li>document was adopted</li>
<li>various minor editorial changes</li>
<li>now also updates 4035</li>
<li>use .example instead of .com for the example</li>
<li>more words on 8198</li>
<li>a note on wildcards</li>
</ul>
<t>From draft-ietf-dnsop-nsec-ttl-00 to draft-ietf-dnsop-nsec-ttl-01:</t>

<ul>
<li>various wording improvements</li>
<li>added Implementation note from Knot, expanded the BIND one with the GitLab MR URL</li>
<li>reduced requirement level from MUST to SHOULD, like the original texts</li>
</ul>
<t>From draft-ietf-dnsop-nsec-ttl-01 to draft-ietf-dnsop-nsec-ttl-02:</t>

<ul>
<li>updated the second bit of wrong text in 5155</li>
</ul>
<t>From draft-ietf-dnsop-nsec-ttl-02 to draft-ietf-dnsop-nsec-ttl-03:</t>

<ul>
<li>document now updates resolver behaviour in 8198</li>
<li>lots of extra text to clarify what behaviour goes where (thanks Paul Hoffman)</li>
<li>replace 'any' with 'each' (thanks Duane)</li>
<li>upgraded requirement level to MUST, plus a note on incremental signers</li>
</ul>
<t>From draft-ietf-dnsop-nsec-ttl-03 to draft-ietf-dnsop-nsec-ttl-04:</t>

<ul>
<li>the 'incremental signer exception' is now part of all relevant document updates</li>
<li>added an explanation for the upgraded requirement level</li>
</ul>
<t>From draft-ietf-dnsop-nsec-ttl-04 to draft-ietf-dnsop-nsec-ttl-05:</t>

<ul>
<li>various minor rewordings (from IESG review, and things I spotted while handling IESG review comments)</li>
<li>added a note on the secondary impact of changing the SOA TTL and/or MINIMUM (IESG review)</li>
</ul>
</section>

<section anchor="acknowledgements" numbered="false"><name>Acknowledgements</name>
<t>This document was made possible with the help of the following people:</t>

<ul>
<li>Ralph Dolmans</li>
<li>Warren Kumari</li>
<li>Matthijs Mekking</li>
<li>Vladimir Cunat</li>
<li>Matt Nordhoff</li>
<li>Josh Soref</li>
<li>Tim Wicinski</li>

<ul spacing="normal">
<li><t><contact fullname="Ralph Dolmans"/></t></li>
<li><t><contact fullname="Warren Kumari"/></t></li>
<li><t><contact fullname="Matthijs Mekking"/></t></li>
<li><t><contact fullname="Vladimir Cunat"/></t></li>
<li><t><contact fullname="Matt Nordhoff"/></t></li>
<li><t><contact fullname="Josh Soref"/></t></li>
<li><t><contact fullname="Tim Wicinski"/></t></li>
</ul>
<t>The author would like to explicitly thank Paul Hoffman <contact fullname="Paul Hoffman"/> for the extensive reviews, text contributions, and help in navigating WG comments.</t>
</section>

</back>

</rfc>