From d207ad630ba2c98c922c8ca31b35d973b2e6b756 Mon Sep 17 00:00:00 2001 From: Ruben Kerkhof Date: Sun, 14 Dec 2014 15:19:55 +0100 Subject: [PATCH] Limit who can send us AXFR notify queries Fixes #1937 and #1120 --- docs/markdown/authoritative/settings.md | 8 ++++++++ pdns/common_startup.cc | 1 + pdns/communicator.cc | 8 ++++++++ pdns/packethandler.cc | 7 +++++++ pdns/packethandler.hh | 1 + pdns/pdns.conf-dist | 5 +++++ 6 files changed, 30 insertions(+) diff --git a/docs/markdown/authoritative/settings.md b/docs/markdown/authoritative/settings.md index 9ede9c072a..923bf4eddd 100644 --- a/docs/markdown/authoritative/settings.md +++ b/docs/markdown/authoritative/settings.md @@ -22,6 +22,14 @@ If set, only these IP addresses or netmasks will be able to perform AXFR. Allow DNS updates from these IP ranges. +## `allow-notify-from` +* IP ranges, separated by commas +* Default: 0.0.0.0/0,::/0 +* Available since: 3.5.0 + +Allow AXFR NOTIFY from these IP ranges. +Setting this to an empty string will drop all incoming notifies. + ## `allow-recursion` * IP ranges, separated by commas diff --git a/pdns/common_startup.cc b/pdns/common_startup.cc index ac9256d8e6..edd9313caf 100644 --- a/pdns/common_startup.cc +++ b/pdns/common_startup.cc @@ -101,6 +101,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 b2b29b6b9d..ea22b1bacd 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<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"<