diff options
author | Joas Schilling <213943+nickvergessen@users.noreply.github.com> | 2022-01-19 12:38:23 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-01-19 12:38:23 +0100 |
commit | 677b25b0d3fa258f920c8cca06e3ed069e9f18ed (patch) | |
tree | 8a215a1e3453eb8ee4aa906d2b0ac7270c882afe | |
parent | 58798b835a1d57edf55ba9a2a319b15579fe82ce (diff) | |
parent | c6d000f87fce5bc8e0912e95a7c827b4145b6012 (diff) | |
download | nextcloud-server-677b25b0d3fa258f920c8cca06e3ed069e9f18ed.tar.gz nextcloud-server-677b25b0d3fa258f920c8cca06e3ed069e9f18ed.zip |
Merge pull request #30731 from nextcloud/bugfix/noid/help-debugging-bruteforce-attempts
Log bruteforce throttle and blocking
-rw-r--r-- | lib/private/Security/Bruteforce/Throttler.php | 11 |
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; } |