<?xml version="1.0" encoding="utf-8"?>
<!-- name="GENERATOR" content="github.com/mmarkdown/mmark Mmark Markdown Processor - mmark.miek.nl" -->
<rfc version="3" ipr="trust200902" docName="draft-vandijk-dnsop-nsec-ttl-00" submissionType="IETF" category="std" xml:lang="en" xmlns:xi="http://www.w3.org/2001/XInclude" updates="4034, 5155" consensus="true">

<front>
<title abbrev="nsec-ttl">NSEC(3) TTLs and NSEC Aggressive Use</title><seriesInfo value="draft-vandijk-dnsop-nsec-ttl-00" stream="IETF" status="standard" name="Internet-Draft"></seriesInfo>
<author initials="P." surname="van Dijk" fullname="Peter van 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/>
<area>General</area>
<workgroup>dnsop</workgroup>
<keyword>Internet-Draft</keyword>

<abstract>
<t>Due to a combination of unfortunate wording in earlier documents, aggressive use of NSEC(3) records may deny names far beyond the intended lifetime of a denial.
This document changes the definition of the NSEC(3) TTL to correct that situation.</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>]</t>
<t><xref target="RFC2308"></xref> defines that the SOA TTL to be used in negative answers (NXDOMAIN, NoData NOERROR) is</t>
<blockquote><t>the minimum of the MINIMUM field of the SOA record and the TTL of the SOA itself</t>
</blockquote><t>Thus, if the TTL of the SOA in the zone is lower than the SOA MINIMUM value (the last number in a SOA record), the negative TTL for that zone is lower than the SOA MINIMUM value.</t>
<t>However, <xref target="RFC4034"></xref> section 4 has this unfortunate text:</t>
<blockquote><t>The NSEC RR SHOULD have the same TTL value as the SOA minimum TTL field. This is in the spirit of negative caching ([RFC2308]).</t>
</blockquote><t>This text, while referring to 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 tries to correct this:</t>
<blockquote><t>Section 5 of [RFC2308] 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 [RFC4035], Section 2.3 and [RFC5155], Section 3).</t>
<t>A resolver that supports aggressive use of NSEC and NSEC3 SHOULD 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 he NSEC(3) RRs should, per RFC4034, already be at the MINIMUM TTL, which means this advice would never actually change the TTL used for the NSEC(3) RRs.</t>
<t>As a concrete example, the <tt>.com</tt> SOA currently looks like this:</t>
<t><tt>com.			900	IN	SOA	a.gtld-servers.net. nstld.verisign-grs.com. 1606158464 1800 900 604800 86400</tt></t>
<t>The SOA record has a 900 second TTL, and a 86400 MINIMUM TTL.
Negative responses from this zone have a 900 second TTL, but the NSEC3 records in those negative responses have a 86400 TTL.
If a resolver were to use those NSEC3s aggressively, they would be considered valid for a day, instead of the intended 15 minutes.
(Note that, because .com uses opt-out NSEC3, such aggressive use would not in fact apply to this zone - it is merely used as a very visible example here.)</t>
</section>

<section anchor="document-work"><name>Document work</name>
<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>
</section>

<section anchor="conventions-and-definitions"><name>Conventions and Definitions</name>
<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;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in BCP 14 <xref target="RFC2119"></xref> <xref target="RFC8174"></xref> when, and only when, they appear in all capitals, as shown here.</t>
</section>

<section anchor="nsec-3-ttl-changes"><name>NSEC(3) TTL changes</name>

<section anchor="in-rfc4034"><name>In RFC4034</name>
<t>Where <xref target="RFC4034"></xref> says:</t>
<blockquote><t>The NSEC RR SHOULD have the same TTL value as the SOA minimum TTL field.  This is in the spirit of negative caching ([RFC2308]).</t>
</blockquote><t>This is updated to say:</t>
<blockquote><t>The NSEC RR MUST have the same TTL value as the minimum 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>.</t>
</blockquote></section>

<section anchor="in-rfc5155"><name>In RFC5155</name>
<t>Where <xref target="RFC5155"></xref> says:</t>
<blockquote><t>The NSEC3 RR SHOULD have the same TTL value as the SOA minimum TTL field.  This is in the spirit of negative caching [RFC2308].</t>
</blockquote><t>This is updated to say:</t>
<blockquote><t>The NSEC3 RR MUST have the same TTL value as the minimum 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>.</t>
</blockquote></section>

<section anchor="zone-operator-guidance"><name>Zone operator guidance</name>
<t>If signers &amp; 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 use matches the SOA TTL for negative responses.</t>
</section>
</section>

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

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

<section anchor="iana-considerations"><name>IANA Considerations</name>
<t>IANA is requested to add a reference to this document in the DNS Resource Record Types registry, for the NSEC and NSEC3 types.</t>
</section>

<section anchor="acknowledgements"><name>Acknowledgements</name>
<t>Ralph Dolmans helpfully pointed out that fixing this in RFC8198 is only possible for negative (NXDOMAIN/NoData NOERROR) responses, and not for wildcard responses.</t>
<t>Warren Kumari gracefully acknowledged that the current behaviour of RFC8198, in context of the NSEC TTL defined in RFC4034, is not the intended behaviour.</t>
</section>

</middle>

<back>
<references><name>Normative References</name>
<xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.2119.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"/>
</references>
<references><name>Informative References</name>
<xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.8174.xml"/>
</references>

<section anchor="document-history"><name>Document history</name>
</section>

</back>

</rfc>
