From 994cae6be075d3a5be6454fab5a8d88b6bc14099 Mon Sep 17 00:00:00 2001 From: Kees Monshouwer Date: Mon, 9 Nov 2020 13:36:14 +0100 Subject: [PATCH] auth: make primary logging less verbose --- pdns/tcpreceiver.cc | 64 ++++++++++++++++++++------------------------- 1 file changed, 28 insertions(+), 36 deletions(-) diff --git a/pdns/tcpreceiver.cc b/pdns/tcpreceiver.cc index 98cd249586..3c49c61ba7 100644 --- a/pdns/tcpreceiver.cc +++ b/pdns/tcpreceiver.cc @@ -346,7 +346,7 @@ void TCPNameserver::doConnection(int fd) { std::lock_guard l(s_plock); if(!s_P) { - g_log<(); } @@ -405,18 +405,18 @@ bool TCPNameserver::canDoAXFR(std::unique_ptr& q) DNSSECKeeper dk(s_P->getBackend()); if(!dk.TSIGGrantsAccess(q->qdomain, keyname)) { - g_log<qdomain<<"' denied: key with name '"<d_tsig_algo)<<"' does not grant access to zone"<qdomain<<"' denied: key with name '"<d_tsig_algo)<<"' does not grant access to zone"<qdomain<<"' allowed: TSIG signed request with authorized key '"<d_tsig_algo)<<"'"<qdomain<<"' allowed: TSIG signed request with authorized key '"<d_tsig_algo)<<"'"<d_remote )) { - g_log<qdomain<<"' allowed: client IP "<getRemote()<<" is in allow-axfr-ips"<qdomain<<"' allowed: client IP "<getRemote()<<" is in allow-axfr-ips"<& q) if(*k == q->getRemote().toString()) { // cerr<<"got AUTO-NS hit"<qdomain<<"' allowed: client IP "<getRemote()<<" is in NSset"<qdomain<<"' allowed: client IP "<getRemote()<<" is in NSset"<& q) Netmask nm = Netmask(*i); if(nm.match( (ComboAddress *) &q->d_remote )) { - g_log<qdomain<<"' allowed: client IP "<getRemote()<<" is in per-domain ACL"<qdomain<<"' allowed: client IP "<getRemote()<<" is in per-domain ACL"<& q) extern CommunicatorClass Communicator; if(Communicator.justNotified(q->qdomain, q->getRemote().toString())) { // we just notified this ip - g_log<qdomain<<"' from recently notified slave "<getRemote()<qdomain<<"' from recently notified slave "<getRemote()<qdomain<<"' denied: client IP "<getRemote()<<" has no permission"<qdomain<<"' denied: client IP "<getRemote()<<" has no permission"<& q, if(q->d_dnssecOk) outpacket->d_dnssecOk=true; // RFC 5936, 2.2.5 'SHOULD' - g_log<getRemote()<getRemote()<& q, std::lock_guard l(s_plock); DLOG(g_log<<"Looking for SOA"<(); } // canDoAXFR does all the ACL checks, and has the if(disable-axfr) shortcut, call it first. if (!canDoAXFR(q)) { - g_log<getRemote()<<" may not request AXFR"<getRemote()<<" may not request AXFR"<setRcode(RCode::NotAuth); sendPacket(outpacket,outsock); return 0; } if(!s_P->getBackend()->getSOAUncached(target, sd)) { - g_log<setRcode(RCode::NotAuth); sendPacket(outpacket,outsock); return 0; @@ -533,7 +533,7 @@ int TCPNameserver::doAXFR(const DNSName &target, std::unique_ptr& q, UeberBackend db; if(!db.getSOAUncached(target, sd)) { - g_log<setRcode(RCode::NotAuth); sendPacket(outpacket,outsock); return 0; @@ -544,26 +544,19 @@ int TCPNameserver::doAXFR(const DNSName &target, std::unique_ptr& q, bool securedZone = dk.isSecuredZone(target); bool presignedZone = dk.isPresigned(target); - bool noAXFRBecauseOfNSEC3Narrow=false; NSEC3PARAMRecordContent ns3pr; bool narrow; bool NSEC3Zone=false; if(securedZone && dk.getNSEC3PARAM(target, &ns3pr, &narrow)) { NSEC3Zone=true; if(narrow) { - g_log<getRemote()<getRemote()<setRcode(RCode::Refused); + sendPacket(outpacket,outsock); + return 0; } } - if(noAXFRBecauseOfNSEC3Narrow) { - g_log<getRemote()<setRcode(RCode::Refused); - // FIXME: should actually figure out if we are auth over a zone, and send out 9 if we aren't - sendPacket(outpacket,outsock); - return 0; - } - TSIGRecordContent trc; DNSName tsigkeyname; string tsigsecret; @@ -577,7 +570,7 @@ int TCPNameserver::doAXFR(const DNSName &target, std::unique_ptr& q, algorithm = DNSName("hmac-md5"); if(!db.getTSIGKey(tsigkeyname, &algorithm, &tsig64)) { - g_log<& q, int ret1 = stubDoResolve(getRR(zrr.dr)->d_content, QType::A, ips); int ret2 = stubDoResolve(getRR(zrr.dr)->d_content, QType::AAAA, ips); if(ret1 != RCode::NoError || ret2 != RCode::NoError) { - g_log<getZoneRepresentation()<<", aborting AXFR"<getZoneRepresentation()<<", aborting AXFR"<setRcode(RCode::ServFail); sendPacket(outpacket,outsock); return 0; @@ -997,7 +990,7 @@ int TCPNameserver::doAXFR(const DNSName &target, std::unique_ptr& q, udiff=dt.udiffNoReset(); if(securedZone) - g_log<& q, sendPacket(outpacket, outsock); DLOG(g_log<<"last packet - close"<getRemote()<<" finished"<getRemote()<<" finished"<& q, int outsock) serial=pdns_stou(parts[2]); } catch(const std::out_of_range& oor) { - g_log<setRcode(RCode::FormErr); sendPacket(outpacket,outsock); return 0; } } else { - g_log<setRcode(RCode::FormErr); sendPacket(outpacket,outsock); return 0; } } else if (rr->d_type != QType::TSIG && rr->d_type != QType::OPT) { - g_log<d_type).getName()<d_type).getName()<setRcode(RCode::FormErr); sendPacket(outpacket,outsock); return 0; } } - g_log<qdomain<<"' initiated by "<getRemote()<<" with serial "<qdomain<<"' initiated by "<getRemote()<<" with serial "<& q, int outsock) std::lock_guard l(s_plock); DLOG(g_log<<"Looking for SOA"<(); } // canDoAXFR does all the ACL checks, and has the if(disable-axfr) shortcut, call it first. if(!canDoAXFR(q) || !s_P->getBackend()->getSOAUncached(q->qdomain, sd)) { - g_log<qdomain<<"' failed: not authoritative"<qdomain<<"' failed: not authoritative"<setRcode(RCode::NotAuth); sendPacket(outpacket,outsock); return 0; @@ -1079,8 +1072,7 @@ int TCPNameserver::doIXFR(std::unique_ptr& q, int outsock) securedZone = dk.isSecuredZone(q->qdomain); if(dk.getNSEC3PARAM(q->qdomain, nullptr, &narrow)) { if(narrow) { - g_log<qdomain<<"' denied to "<getRemote()<qdomain<<"' for "<getRemote()<setRcode(RCode::Refused); sendPacket(outpacket,outsock); return 0; -- 2.47.2