Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Make it an error if address is not known and we are not in CLI
Signed-off-by: Côme Chilliet <[email protected]>
  • Loading branch information
come-nc committed Nov 20, 2023
commit f023216cf47ad2d6e69a16d69718d22e4d06ec2f
10 changes: 7 additions & 3 deletions apps/settings/lib/SetupChecks/BruteForceThrottler.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,13 @@ public function getName(): string {
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),
Expand Down
9 changes: 7 additions & 2 deletions apps/settings/lib/SetupChecks/ForwardedForHeaders.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,13 @@ public function run(): SetupResult {
}

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') !== '') {
Expand Down