diff options
author | Benjamin Gaussorgues <benjamin.gaussorgues@nextcloud.com> | 2024-12-02 11:37:11 +0100 |
---|---|---|
committer | Benjamin Gaussorgues <benjamin.gaussorgues@nextcloud.com> | 2024-12-03 10:48:10 +0100 |
commit | 1fd19685f1e39a19b8cb6129a96ab43ec717e01b (patch) | |
tree | 002a9a2aac808aa370357a4cd19c8b5dbd2a0242 /lib | |
parent | e87ed9b5fba5e60117216933239165d4d2ab56b6 (diff) | |
download | nextcloud-server-1fd19685f1e39a19b8cb6129a96ab43ec717e01b.tar.gz nextcloud-server-1fd19685f1e39a19b8cb6129a96ab43ec717e01b.zip |
chore(bruteforce): allows to configure max attempts before request abort
Signed-off-by: Benjamin Gaussorgues <benjamin.gaussorgues@nextcloud.com>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/private/Security/Bruteforce/Throttler.php | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/private/Security/Bruteforce/Throttler.php b/lib/private/Security/Bruteforce/Throttler.php index 596fcf408fa..924ae3685f3 100644 --- a/lib/private/Security/Bruteforce/Throttler.php +++ b/lib/private/Security/Bruteforce/Throttler.php @@ -195,7 +195,7 @@ class Throttler implements IThrottler { } $firstDelay = 0.1; - if ($attempts > self::MAX_ATTEMPTS) { + if ($attempts > $this->config->getSystemValueInt('auth.bruteforce.max-attempts', self::MAX_ATTEMPTS)) { // Don't ever overflow. Just assume the maxDelay time:s return self::MAX_DELAY_MS; } @@ -263,7 +263,7 @@ class Throttler implements IThrottler { */ 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) { + if (($delay === self::MAX_DELAY_MS) && $this->getAttempts($ip, $action, 0.5) > $this->config->getSystemValueInt('auth.bruteforce.max-attempts', 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, |