From 95256c05abb3277426d2b6421316d51038286d4d Mon Sep 17 00:00:00 2001 From: Remi Gacogne Date: Tue, 16 Jun 2020 14:42:02 +0200 Subject: [PATCH] rec: Don't validate a NXD with a NSEC proving that the name is an ENT 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 | 5 +++++ pdns/validate.cc | 20 ++++++++++++++------ 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/pdns/recursordist/test-syncres_cc8.cc b/pdns/recursordist/test-syncres_cc8.cc index 056fb1ef88..95a9721635 100644 --- a/pdns/recursordist/test-syncres_cc8.cc +++ b/pdns/recursordist/test-syncres_cc8.cc @@ -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) diff --git a/pdns/validate.cc b/pdns/validate.cc index 58aa671327..c025647f23 100644 --- a/pdns/validate.cc +++ b/pdns/validate.cc @@ -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 "<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 "<