mirror of
https://github.com/nextcloud/server.git
synced 2026-04-20 22:00:39 -04:00
Improve local IP detection
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
This commit is contained in:
parent
b2017cd557
commit
bd9aff47b6
1 changed files with 6 additions and 0 deletions
|
|
@ -41,6 +41,12 @@ class LocalAddressChecker {
|
|||
throw new LocalServerException('Host violates local access rules');
|
||||
}
|
||||
|
||||
$localIps = ['100.100.100.200'];
|
||||
if ((bool)filter_var($ip, FILTER_VALIDATE_IP) && in_array($ip, $localIps)) {
|
||||
$this->logger->warning("Host $ip was not connected to because it violates local access rules");
|
||||
throw new LocalServerException('Host violates local access rules');
|
||||
}
|
||||
|
||||
// Also check for IPv6 IPv4 nesting, because that's not covered by filter_var
|
||||
if ((bool)filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6) && substr_count($ip, '.') > 0) {
|
||||
$delimiter = strrpos($ip, ':'); // Get last colon
|
||||
|
|
|
|||
Loading…
Reference in a new issue