]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
rec: Don't validate a NXD with a NSEC proving that the name is an ENT 9237/head
authorRemi Gacogne <remi.gacogne@powerdns.com>
Tue, 16 Jun 2020 12:42:02 +0000 (14:42 +0200)
committerRemi Gacogne <remi.gacogne@powerdns.com>
Tue, 16 Jun 2020 12:42:02 +0000 (14:42 +0200)
A NSEC from a.powerdns.com. to a.b.powerdns.com. proves that
b.powerdns.com. exists and is an empty non terminal, so it cannot be
used to prove that b.powerdns.com. does not exist.

pdns/recursordist/test-syncres_cc8.cc
pdns/validate.cc

index 056fb1ef88a12694441111b2ae057c654c10d0ec..95a97216359861fe7145a0e40b40dfe41fa086aa 100644 (file)
@@ -477,6 +477,11 @@ BOOST_AUTO_TEST_CASE(test_nsec_ent_denial)
 
   denialState = getDenial(denialMap, DNSName("b.powerdns.com."), QType::A, true, false);
   BOOST_CHECK_EQUAL(denialState, NXDOMAIN);
+
+  /* this NSEC is NOT valid to prove a NXDOMAIN at c.powerdns.com because it proves that
+     it exists and is an ENT */
+  denialState = getDenial(denialMap, DNSName("c.powerdns.com."), QType::AAAA, true, false);
+  BOOST_CHECK_EQUAL(denialState, NODATA);
 }
 
 BOOST_AUTO_TEST_CASE(test_nsec3_ancestor_nxqtype_denial)
index 58aa6713279e25b4251d31159e0079d6c494ac56..c025647f23bf3a156b267ef964ba3f4606d67685 100644 (file)
@@ -419,13 +419,21 @@ dState getDenial(const cspmap_t &validrrsets, const DNSName& qname, const uint16
         }
 
         /* check if the whole NAME is denied existing */
-        if(isCoveredByNSEC(qname, owner, nsec->d_next)) {
+        if (isCoveredByNSEC(qname, owner, nsec->d_next)) {
           LOG(qname<<" is covered ");
-          /* if the name is an ENT and we received a NODATA answer,
-             we are fine with a NSEC proving that the name does not exist. */
-          if (wantsNoDataProof && nsecProvesENT(qname, owner, nsec->d_next)) {
-            LOG("Denies existence of type "<<qname<<"/"<<QType(qtype).getName()<<" by proving that "<<qname<<" is an ENT"<<endl);
-            return NXQTYPE;
+
+          if (nsecProvesENT(qname, owner, nsec->d_next)) {
+            if (wantsNoDataProof) {
+              /* if the name is an ENT and we received a NODATA answer,
+                 we are fine with a NSEC proving that the name does not exist. */
+              LOG("Denies existence of type "<<qname<<"/"<<QType(qtype).getName()<<" by proving that "<<qname<<" is an ENT"<<endl);
+              return NXQTYPE;
+            }
+            else {
+              /* but for a NXDOMAIN proof, this doesn't make sense! */
+              LOG("but it tries to deny the existence of "<<qname<<" by proving that "<<qname<<" is an ENT, this does not make sense!"<<endl);
+              return NODATA;
+            }
           }
 
           if (!needWildcardProof) {