From: Ruben Kerkhof Date: Sun, 14 Dec 2014 14:19:55 +0000 (+0100) Subject: Limit who can send us AXFR notify queries X-Git-Tag: auth-3.4.3^2 X-Git-Url: http://git.ipfire.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F2289%2Fhead;p=thirdparty%2Fpdns.git Limit who can send us AXFR notify queries Fixes #1937 and #1120 (cherry picked from commit d207ad630ba2c98c922c8ca31b35d973b2e6b756) --- diff --git a/pdns/common_startup.cc b/pdns/common_startup.cc index 1df40bec70..30976a6b7e 100644 --- a/pdns/common_startup.cc +++ b/pdns/common_startup.cc @@ -98,6 +98,7 @@ void declareArguments() ::arg().set("allow-axfr-ips","Allow zonetransfers only to these subnets")="127.0.0.0/8,::1"; ::arg().set("only-notify", "Only send AXFR NOTIFY to these IP addresses or netmasks")="0.0.0.0/0,::/0"; ::arg().set("also-notify", "When notifying a domain, also notify these nameservers")=""; + ::arg().set("allow-notify-from","Allow AXFR NOTIFY from these IP ranges. If empty, drop all incoming notifies.")="0.0.0.0/0,::/0"; ::arg().set("slave-cycle-interval","Schedule slave freshness checks once every .. seconds")="60"; ::arg().set("tcp-control-address","If set, PowerDNS can be controlled over TCP on this address")=""; diff --git a/pdns/communicator.cc b/pdns/communicator.cc index 41e7e56ca7..e5160e1215 100644 --- a/pdns/communicator.cc +++ b/pdns/communicator.cc @@ -56,6 +56,14 @@ void CommunicatorClass::retrievalLoopThread(void) void CommunicatorClass::go() { + try { + PacketHandler::s_allowNotifyFrom.toMasks(::arg()["allow-notify-from"] ); + } + catch(PDNSException &e) { + L< Behaviour post 2.9.10: If set, only these IP addresses or netmasks will be able to perform AXFR. - + + + + allow-notify-from=... + + + By specifying allow-notify-from, receiving AXFR NOTIFY can be restricted to netmasks specified. The default is to allow + AXFR NOTIFY from anywhere. Example: allow-notify-from=192.168.0.0/24, 10.0.0.0/8, 192.0.2.4. + The default is 0.0.0.0,::/0. Setting this to an empty string will drop all incoming notifies. Available since 3.4.3. + + + allow-recursion=... diff --git a/pdns/packethandler.cc b/pdns/packethandler.cc index 01e409b567..1ab5118a02 100644 --- a/pdns/packethandler.cc +++ b/pdns/packethandler.cc @@ -50,6 +50,7 @@ #endif AtomicCounter PacketHandler::s_count; +NetmaskGroup PacketHandler::s_allowNotifyFrom; extern string s_programname; enum root_referral { @@ -756,6 +757,12 @@ int PacketHandler::processNotify(DNSPacket *p) L<qdomain<<" from "<getRemote()<<" but slave support is disabled in the configuration"<d_remote )) { + L<qdomain<<" from "<getRemote()<<" but remote is not in allow-notify-from"<