Skip to content

Commit 677b25b

Browse files
Merge pull request #30731 from nextcloud/bugfix/noid/help-debugging-bruteforce-attempts
Log bruteforce throttle and blocking
2 parents 58798b8 + c6d000f commit 677b25b

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

lib/private/Security/Bruteforce/Throttler.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -354,9 +354,20 @@ public function sleepDelay(string $ip, string $action = ''): int {
354354
public function sleepDelayOrThrowOnMax(string $ip, string $action = ''): int {
355355
$delay = $this->getDelay($ip, $action);
356356
if (($delay === self::MAX_DELAY_MS) && $this->getAttempts($ip, $action, 0.5) > self::MAX_ATTEMPTS) {
357+
$this->logger->info('IP address blocked because it reached the maximum failed attempts in the last 30 minutes [action: {action}, ip: {ip}]', [
358+
'action' => $action,
359+
'ip' => $ip,
360+
]);
357361
// If the ip made too many attempts within the last 30 mins we don't execute anymore
358362
throw new MaxDelayReached('Reached maximum delay');
359363
}
364+
if ($delay > 100) {
365+
$this->logger->info('IP address throttled because it reached the attempts limit in the last 30 minutes [action: {action}, delay: {delay}, ip: {ip}]', [
366+
'action' => $action,
367+
'ip' => $ip,
368+
'delay' => $delay,
369+
]);
370+
}
360371
usleep($delay * 1000);
361372
return $delay;
362373
}

0 commit comments

Comments
 (0)