From 5b07dc823354c22f1083d450b4c4d7b732be5881 Mon Sep 17 00:00:00 2001 From: Kees Monshouwer Date: Thu, 30 Nov 2017 13:40:04 +0100 Subject: [PATCH] auth: remove an other query for unsigned notifies and notifies signed with a wrong TSIG key --- pdns/packethandler.cc | 51 ++++++++++++++++++++++--------------------- 1 file changed, 26 insertions(+), 25 deletions(-) diff --git a/pdns/packethandler.cc b/pdns/packethandler.cc index fdf5b8bcc..dba5379e5 100644 --- a/pdns/packethandler.cc +++ b/pdns/packethandler.cc @@ -801,64 +801,65 @@ int PacketHandler::processNotify(DNSPacket *p) We determine the SOA at our (known) master if master is higher -> do stuff */ - vector meta; if(!::arg().mustDo("slave") && s_forwardNotify.empty()) { - g_log<qdomain<<" from "<getRemote()<<" but slave support is disabled in the configuration"<qdomain<<" from "<getRemote()<<" but slave support is disabled in the configuration"<d_remote ) || p->d_havetsig) { if (p->d_havetsig && p->getTSIGKeyname().empty() == false) { - g_log<qdomain<<" from "<getRemote()<<", allowed by TSIG key '"<getTSIGKeyname()<<"'"<qdomain<<" from "<getRemote()<<", with TSIG key '"<getTSIGKeyname()<<"'"<qdomain<<" from "<getRemote()<<" but remote is not permitted by TSIG or allow-notify-from"<qdomain<<" from "<getRemote()<<" but the remote is not providing a TSIG key or in allow-notify-from (Refused)"<qdomain, di, false) || !(db=di.backend)) { - g_log<qdomain<<" from "<getRemote()<<" for which we are not authoritative"<getTSIGKeyname()); - } - - meta.clear(); - if (B.getDomainMetadata(p->qdomain,"AXFR-MASTER-TSIG",meta) && meta.size() > 0) { + if ((!::arg().mustDo("allow-unsigned-notify") && !p->d_havetsig) || p->d_havetsig) { if (!p->d_havetsig) { - if (::arg().mustDo("allow-unsigned-notify")) { - g_log<qdomain<<" from "<getRemote()<<": permitted because allow-unsigned-notify"; - } else { - g_log<qdomain<<" from "<getRemote()<<": refused"<qdomain<<" from "<getRemote()<<" while a TSIG key was required (Refused)"< meta; + if (B.getDomainMetadata(p->qdomain,"AXFR-MASTER-TSIG",meta) && meta.size() > 0) { + if (!pdns_iequals(meta[0], p->getTSIGKeyname().toStringNoDot())) { + g_log<qdomain<<" from "<getRemote()<<": expected TSIG key '"<getTSIGKeyname()<<"' (Refused)"<getTSIGKeyname().toStringNoDot()) { - g_log<qdomain<<" from "<getRemote()<<": expected TSIG key '"<getTSIGKeyname()<<"'"<qdomain, di, false) || !di.backend) { + g_log<qdomain<<" from "<getRemote()<<" for which we are not authoritative, trying supermaster"<getTSIGKeyname()); // FIXME a global 'off' switch for supermaster support will save some resources in setups without supermasters + } + if(::arg().contains("trusted-notification-proxy", p->getRemote().toString())) { g_log<qdomain<<" from trusted-notification-proxy "<< p->getRemote()<qdomain<<" does not have any masters defined"<qdomain<<" does not have any masters defined (Refused)"<qdomain<<" from "<getRemote()<<" but we are master, rejecting"<qdomain<<" from "<getRemote()<<" but we are master (Refused)"<getRemote())) { - g_log<qdomain<<" from "<getRemote()<<" which is not a master"<qdomain<<" from "<getRemote()<<" which is not a master (Refused)"< forwardNotify(s_forwardNotify); for(set::const_iterator j=forwardNotify.begin();j!=forwardNotify.end();++j) { - g_log<qdomain<<" from "<getRemote()<<" to "<<*j<qdomain<<" from "<getRemote()<<" to "<<*j<qdomain,*j); } } -- 2.40.0