Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(bruteforce): Allow forcing the database throttler #48884

Merged
merged 1 commit into from
Oct 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion config/config.sample.php
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@

/**
* The timeout in seconds for synchronizing address books, e.g. federated system address books (as run by `occ federation:sync-addressbooks`).
*
*
* Defaults to ``30`` seconds
*/
'carddav_sync_request_timeout' => 30,
Expand Down Expand Up @@ -405,6 +405,17 @@
*/
'auth.bruteforce.protection.enabled' => true,

/**
* Whether the brute force protection should write into the database even when a memory cache is available
*
* Using the database is most likely worse for performance, but makes investigating
* issues a lot easier as it's possible to look directly at the table to see all
* logged remote addresses and actions.
*
* Defaults to ``false``
*/
'auth.bruteforce.protection.force.database' => false,

/**
* Whether the brute force protection shipped with Nextcloud should be set to testing mode.
*
Expand Down
3 changes: 2 additions & 1 deletion lib/private/Server.php
Original file line number Diff line number Diff line change
Expand Up @@ -846,7 +846,8 @@ public function __construct($webRoot, \OC\Config $config) {

$this->registerService(\OC\Security\Bruteforce\Backend\IBackend::class, function ($c) {
$config = $c->get(\OCP\IConfig::class);
if (ltrim($config->getSystemValueString('memcache.distributed', ''), '\\') === \OC\Memcache\Redis::class) {
if (!$config->getSystemValueBool('auth.bruteforce.protection.force.database', false)
&& ltrim($config->getSystemValueString('memcache.distributed', ''), '\\') === \OC\Memcache\Redis::class) {
$backend = $c->get(\OC\Security\Bruteforce\Backend\MemoryCacheBackend::class);
} else {
$backend = $c->get(\OC\Security\Bruteforce\Backend\DatabaseBackend::class);
Expand Down
Loading