diff options
author | Côme Chilliet <come.chilliet@nextcloud.com> | 2023-11-20 15:52:28 +0100 |
---|---|---|
committer | Côme Chilliet <come.chilliet@nextcloud.com> | 2023-11-20 15:52:28 +0100 |
commit | f023216cf47ad2d6e69a16d69718d22e4d06ec2f (patch) | |
tree | ed35343be3e6b5a44e4f540397e97424e656cad0 /apps/settings | |
parent | f47a2bbcae72f9fa1e52fe3c28d98b7edfe9535e (diff) | |
download | nextcloud-server-f023216cf47ad2d6e69a16d69718d22e4d06ec2f.tar.gz nextcloud-server-f023216cf47ad2d6e69a16d69718d22e4d06ec2f.zip |
Make it an error if address is not known and we are not in CLI
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
Diffstat (limited to 'apps/settings')
-rw-r--r-- | apps/settings/lib/SetupChecks/BruteForceThrottler.php | 10 | ||||
-rw-r--r-- | apps/settings/lib/SetupChecks/ForwardedForHeaders.php | 9 |
2 files changed, 14 insertions, 5 deletions
diff --git a/apps/settings/lib/SetupChecks/BruteForceThrottler.php b/apps/settings/lib/SetupChecks/BruteForceThrottler.php index 6c1efd56bc1..88de5c2c82a 100644 --- a/apps/settings/lib/SetupChecks/BruteForceThrottler.php +++ b/apps/settings/lib/SetupChecks/BruteForceThrottler.php @@ -53,9 +53,13 @@ class BruteForceThrottler implements ISetupCheck { public function run(): SetupResult { $address = $this->request->getRemoteAddress(); if ($address === '') { - return SetupResult::info( - $this->l10n->t('Your remote address could not be determined.') - ); + if (\OC::$CLI) { + /* We were called from CLI */ + return SetupResult::info('Your remote address could not be determined.'); + } else { + /* Should never happen */ + return SetupResult::error('Your remote address could not be determined.'); + } } elseif ($this->throttler->showBruteforceWarning($address)) { return SetupResult::error( $this->l10n->t('Your remote address was identified as "%s" and is bruteforce throttled at the moment slowing down the performance of various requests. If the remote address is not your address this can be an indication that a proxy is not configured correctly.', $address), diff --git a/apps/settings/lib/SetupChecks/ForwardedForHeaders.php b/apps/settings/lib/SetupChecks/ForwardedForHeaders.php index 5ba966f380b..47ff51ee05e 100644 --- a/apps/settings/lib/SetupChecks/ForwardedForHeaders.php +++ b/apps/settings/lib/SetupChecks/ForwardedForHeaders.php @@ -59,8 +59,13 @@ class ForwardedForHeaders implements ISetupCheck { } if (($remoteAddress === '') && ($this->request->getRemoteAddress() === '')) { - /* Most likely we were called from CLI */ - return SetupResult::info('Your remote address could not be determined.'); + if (\OC::$CLI) { + /* We were called from CLI */ + return SetupResult::info('Your remote address could not be determined.'); + } else { + /* Should never happen */ + return SetupResult::error('Your remote address could not be determined.'); + } } if (empty($trustedProxies) && $this->request->getHeader('X-Forwarded-Host') !== '') { |