X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=index.php;h=9f50d15323d2ea40207e14d08d030cfcdbb20025;hb=3116d8671d388690bac1070e39d2c74d28b14f0e;hp=f9f248953eb1d09281b548a7c01e465f553bc31e;hpb=4fd053d6b29a1b6724eda17a3daddb29b1bf1ca3;p=github%2Fshaarli%2FShaarli.git diff --git a/index.php b/index.php index f9f24895..9f50d153 100644 --- a/index.php +++ b/index.php @@ -332,8 +332,17 @@ include $conf->get('resource.ban_file', 'data/ipbans.php'); function ban_loginFailed($conf) { $ip = $_SERVER['REMOTE_ADDR']; + $trusted = $conf->get('security.trusted_proxies', array()); + if (in_array($ip, $trusted)) { + $ip = getIpAddressFromProxy($_SERVER, $trusted); + if (!$ip) { + return; + } + } $gb = $GLOBALS['IPBANS']; - if (!isset($gb['FAILURES'][$ip])) $gb['FAILURES'][$ip]=0; + if (! isset($gb['FAILURES'][$ip])) { + $gb['FAILURES'][$ip]=0; + } $gb['FAILURES'][$ip]++; if ($gb['FAILURES'][$ip] > ($conf->get('security.ban_after') - 1)) {