From: bert hubert Date: Wed, 23 Mar 2016 12:00:35 +0000 (+0100) Subject: Closes #3390 by fixing validation of provably insecure delegation for NSEC records... X-Git-Tag: dnsdist-1.0.0-beta1~69^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3e9c6c0add512c63cc9aed4b18611944cdfc56e0;p=thirdparty%2Fpdns.git Closes #3390 by fixing validation of provably insecure delegation for NSEC records, plus improving our DNSSEC validation logging with --trace output on --- diff --git a/pdns/pdns_recursor.cc b/pdns/pdns_recursor.cc index e0d54a5519..c28194d6c7 100644 --- a/pdns/pdns_recursor.cc +++ b/pdns/pdns_recursor.cc @@ -2358,6 +2358,7 @@ int serviceMain(int argc, char*argv[]) SyncRes::setDefaultLogMode(SyncRes::Log); ::arg().set("quiet")="no"; g_quiet=false; + g_dnssecLOG=true; } SyncRes::s_minimumTTL = ::arg().asNum("minimum-ttl-override"); diff --git a/pdns/validate-recursor.cc b/pdns/validate-recursor.cc index d337fc445e..4057b30f84 100644 --- a/pdns/validate-recursor.cc +++ b/pdns/validate-recursor.cc @@ -1,9 +1,12 @@ #include "validate.hh" #include "validate-recursor.hh" #include "syncres.hh" +#include "logger.hh" DNSSECMode g_dnssecmode{DNSSECMode::Process}; +#define LOG(x) if(g_dnssecLOG) { L <& recs) return Insecure; // can't secure nothing cspmap_t cspmap=harvestCSPFromRecs(recs); - // cerr<<"Got "<& recs) for(const auto& csp : cspmap) { for(const auto& sig : csp.second.signatures) { state = getKeysFor(sro, sig->d_signer, keys); // XXX check validity here - // cerr<<"! state = "<& recs) validateWithKeySet(cspmap, validrrsets, keys); } else { - // cerr<<"no sigs, hoping for Insecure"<d_name<d_name, keys); // um WHAT DOES THIS MEAN - try first qname?? - // cerr<<"! state = "<& recs) #endif // cerr<<"Input to validate: "<d_siginception < now && signature->d_sigexpire > now) isValid = DNSCryptoKeyEngine::makeFromPublicKeyString(l.d_algorithm, l.d_key)->verify(msg, signature->d_signature); else { - DLOG(cerr<<"signature is expired/not yet valid"<first] = i->second; @@ -116,7 +118,7 @@ void validateWithKeySet(const cspmap_t& rrsets, cspmap_t& validated, const keyse // cerr<<"! validated "<first.first<<"/"<d_type)<d_type != QType::DNSKEY) { dotEdge(signature->d_signer, @@ -287,7 +289,7 @@ vState getKeysFor(DNSRecordOracle& dro, const DNSName& zone, keyset_t &keyset) break; } else { - DLOG(cerr<<"Validation did not succeed!"<getZoneRepresentation()<(r); + if(v.first.first == qname && !nsec->d_set.count(QType::DS)) + return Insecure; + else { + LOG("Did not deny existence of DS, "<d_set.count(QType::DS)<second.records.cbegin(); j!=cspiter->second.records.cend(); j++) { diff --git a/pdns/validate.hh b/pdns/validate.hh index 73011cfbdc..f72a98cfc7 100644 --- a/pdns/validate.hh +++ b/pdns/validate.hh @@ -6,6 +6,8 @@ #include "namespaces.hh" #include "dnsrecords.hh" +extern bool g_dnssecLOG; + // 4033 5 enum vState { Indeterminate, Bogus, Insecure, Secure }; extern const char *vStates[];