]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
auth: add configurable timeout for inbound AXFR 8547/head
authorMatti Hiljanen <matti@hiljanen.com>
Tue, 3 Sep 2019 13:10:04 +0000 (16:10 +0300)
committerPeter van Dijk <peter.van.dijk@powerdns.com>
Mon, 18 Nov 2019 14:40:26 +0000 (15:40 +0100)
(cherry picked from commit e3619f5766c37598579fd6d8d58d7160d31db34f)

docs/settings.rst
pdns/common_startup.cc
pdns/slavecommunicator.cc

index bd306ea6ff8d5b7a60a256e69c53d4b23299a0d6..e9df097cccec3ec58bffcf0d9e60435cd5e57241 100644 (file)
@@ -160,6 +160,18 @@ Static pre-shared authentication key for access to the REST API.
 
 Disallow data modification through the REST API when set.
 
+.. _setting-axfr-fetch-timeout:
+
+``axfr-fetch-timeout``
+----------------------
+
+- Integer
+- Default: 10
+
+.. versionadded:: 4.3.0
+
+Maximum time in seconds for inbound AXFR to start or be idle after starting.
+
 .. _setting-axfr-lower-serial:
 
 ``axfr-lower-serial``
index 0bbf28915f866c369ae6fb187e83e31067742306..e6439cf6380ebc536c5308a6fc29ff506ead7856 100644 (file)
@@ -221,6 +221,7 @@ void declareArguments()
 
   ::arg().set("lua-axfr-script", "Script to be used to edit incoming AXFRs")="";
   ::arg().set("xfr-max-received-mbytes", "Maximum number of megabytes received from an incoming XFR")="100";
+  ::arg().set("axfr-fetch-timeout", "Maximum time in seconds for inbound AXFR to start or be idle after starting")="10";
 
   ::arg().set("tcp-fast-open", "Enable TCP Fast Open support on the listening sockets, using the supplied numerical value as the queue size")="0";
 
index a5d19c0a5964be6ceff40edcc8e09e734243bb3b..d755857b902b22a28bb8f31e9b7939ce5f252827 100644 (file)
@@ -241,13 +241,14 @@ static bool processRecordForZS(const DNSName& domain, bool& firstNSEC3, DNSResou
 
 static vector<DNSResourceRecord> doAxfr(const ComboAddress& raddr, const DNSName& domain, const TSIGTriplet& tt, const ComboAddress& laddr,  scoped_ptr<AuthLua4>& pdl, ZoneStatus& zs)
 {
+  uint16_t axfr_timeout=::arg().asNum("axfr-fetch-timeout");
   vector<DNSResourceRecord> rrs;
-  AXFRRetriever retriever(raddr, domain, tt, (laddr.sin4.sin_family == 0) ? NULL : &laddr, ((size_t) ::arg().asNum("xfr-max-received-mbytes")) * 1024 * 1024);
+  AXFRRetriever retriever(raddr, domain, tt, (laddr.sin4.sin_family == 0) ? NULL : &laddr, ((size_t) ::arg().asNum("xfr-max-received-mbytes")) * 1024 * 1024, axfr_timeout);
   Resolver::res_t recs;
   bool first=true;
   bool firstNSEC3{true};
   bool soa_received {false};
-  while(retriever.getChunk(recs)) {
+  while(retriever.getChunk(recs, nullptr, axfr_timeout)) {
     if(first) {
       g_log<<Logger::Error<<"AXFR started for '"<<domain<<"'"<<endl;
       first=false;