]> granicus.if.org Git - pdns/commitdiff
process NSEC3 insecure delegation, closes #3675
authorbert hubert <bert.hubert@netherlabs.nl>
Wed, 27 Apr 2016 13:10:49 +0000 (15:10 +0200)
committerbert hubert <bert.hubert@netherlabs.nl>
Wed, 27 Apr 2016 13:10:49 +0000 (15:10 +0200)
pdns/validate.cc

index fda7ec32e65c58b376d8b861663a9a747ad71188..1d6de7d0337aa8732eea2abaa07fa97210055165 100644 (file)
@@ -347,6 +347,22 @@ vState getKeysFor(DNSRecordOracle& dro, const DNSName& zone, keyset_t &keyset)
             }
 
           }
+          else if(v.first.second==QType::NSEC3) {
+            for(const auto& r : v.second.records) {
+              LOG("\t"<<r->getZoneRepresentation()<<endl);
+
+              auto nsec3 = std::dynamic_pointer_cast<NSEC3RecordContent>(r);
+              string h = hashQNameWithSalt(nsec3->d_salt, nsec3->d_iterations, qname);
+              LOG("\tquery hash: "<<toBase32Hex(h)<<endl);
+              if(fromBase32Hex(v.first.first.getRawLabels()[0]) < h && h < nsec3->d_nexthash) {
+                LOG("Denies existence of DS!"<<endl);
+                return Insecure;
+              }
+              else {
+                LOG("Did not cover us, start="<<v.first.first<<", us="<<toBase32Hex(h)<<", end="<<toBase32Hex(nsec3->d_nexthash)<<endl);
+              }
+            }
+          }
         }
         return Bogus;
       }