diff --git a/scripts/pi-hole/php/FTL.php b/scripts/pi-hole/php/FTL.php index 958ac7bed..4ceba32c3 100644 --- a/scripts/pi-hole/php/FTL.php +++ b/scripts/pi-hole/php/FTL.php @@ -8,12 +8,12 @@ $piholeFTLConfFile = "/etc/pihole/pihole-FTL.conf"; -function piholeFTLConfig() +function piholeFTLConfig($force=false) { static $piholeFTLConfig; global $piholeFTLConfFile; - if(isset($piholeFTLConfig)) + if(isset($piholeFTLConfig) && !$force) { return $piholeFTLConfig; } diff --git a/scripts/pi-hole/php/savesettings.php b/scripts/pi-hole/php/savesettings.php index edfd72b8c..6178902eb 100644 --- a/scripts/pi-hole/php/savesettings.php +++ b/scripts/pi-hole/php/savesettings.php @@ -352,6 +352,13 @@ function addStaticDHCPLease($mac, $ip, $hostname) { } pihole_execute("-a -i ".$DNSinterface." -web"); + // Add rate-limiting settings + if(isset($_POST["rate_limit_count"]) && isset($_POST["rate_limit_interval"])) + { + // Restart of FTL is delayed + pihole_execute("-a ratelimit " . intval($_POST["rate_limit_count"]) . " " . intval($_POST["rate_limit_interval"]) . " false"); + } + // If there has been no error we can save the new DNS server IPs if(!strlen($error)) { diff --git a/settings.php b/settings.php index e59b13523..c7e6e21bc 100644 --- a/settings.php +++ b/settings.php @@ -10,7 +10,7 @@ require_once "scripts/pi-hole/php/FTL.php"; // Reread ini file as things might have been changed $setupVars = parse_ini_file("/etc/pihole/setupVars.conf"); -$piholeFTLConf = piholeFTLConfig(); +$piholeFTLConf = piholeFTLConfig(true); // Handling of PHP internal errors $last_error = error_get_last(); @@ -718,6 +718,19 @@ function convertseconds($argument) +
in active">
@@ -934,6 +947,21 @@ function convertseconds($argument) here.


+

Rate-limiting

+

Block clients making more than queries within + seconds.

+

When a client makes too many queries in too short time, it + gets rate-limited. Rate-limited queries are answered with a + REFUSED reply and not further processed by FTL + and prevent Pi-holes getting overwhelmed by rogue clients. + It is important to note that rate-limiting is happening on a + per-client basis. Other clients can continue to use FTL while + rate-limited clients are short-circuited at the same time.

+

Rate-limiting may be disabled altogether by setting both + values to zero. See + our documentation + for further details.

+

Conditional forwarding

If not configured as your DHCP server, Pi-hole typically won't be able to determine the names of devices on your local network. As a