aboutsummaryrefslogtreecommitdiffstats
path: root/lib/private/Security
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2022-01-18 10:10:19 +0100
committerJoas Schilling <coding@schilljs.com>2022-01-18 10:10:19 +0100
commitc6d000f87fce5bc8e0912e95a7c827b4145b6012 (patch)
treee4545275079f09bba307f9bc907f76d4c1d49a5b /lib/private/Security
parenta7eefa293e4735ab9f249f9d12ced3e70823da35 (diff)
downloadnextcloud-server-c6d000f87fce5bc8e0912e95a7c827b4145b6012.tar.gz
nextcloud-server-c6d000f87fce5bc8e0912e95a7c827b4145b6012.zip
Log bruteforce throttle and blocking
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'lib/private/Security')
-rw-r--r--lib/private/Security/Bruteforce/Throttler.php11
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/private/Security/Bruteforce/Throttler.php b/lib/private/Security/Bruteforce/Throttler.php
index fa4c58e4559..abbe77c6637 100644
--- a/lib/private/Security/Bruteforce/Throttler.php
+++ b/lib/private/Security/Bruteforce/Throttler.php
@@ -354,9 +354,20 @@ class Throttler {
public function sleepDelayOrThrowOnMax(string $ip, string $action = ''): int {
$delay = $this->getDelay($ip, $action);
if (($delay === self::MAX_DELAY_MS) && $this->getAttempts($ip, $action, 0.5) > self::MAX_ATTEMPTS) {
+ $this->logger->info('IP address blocked because it reached the maximum failed attempts in the last 30 minutes [action: {action}, ip: {ip}]', [
+ 'action' => $action,
+ 'ip' => $ip,
+ ]);
// If the ip made too many attempts within the last 30 mins we don't execute anymore
throw new MaxDelayReached('Reached maximum delay');
}
+ if ($delay > 100) {
+ $this->logger->info('IP address throttled because it reached the attempts limit in the last 30 minutes [action: {action}, delay: {delay}, ip: {ip}]', [
+ 'action' => $action,
+ 'ip' => $ip,
+ 'delay' => $delay,
+ ]);
+ }
usleep($delay * 1000);
return $delay;
}