diff options
| author | 2025-08-15 12:08:39 +0100 | |
|---|---|---|
| committer | 2025-08-15 12:38:23 +0100 | |
| commit | 6d4555be1377babffbdcca7afd7e7ec675340747 (patch) | |
| tree | a800e8ed4d105b6f45ee782372cdae5b32dcc48f /modules/spanningtree/server.cpp | |
| parent | Release v5.0.0 development snapshot 1. (diff) | |
| parent | Update the Windows dependencies. (diff) | |
| download | inspircd++-6d4555be1377babffbdcca7afd7e7ec675340747.tar.gz inspircd++-6d4555be1377babffbdcca7afd7e7ec675340747.tar.bz2 inspircd++-6d4555be1377babffbdcca7afd7e7ec675340747.zip | |
Merge branch 'insp4'
Diffstat (limited to 'modules/spanningtree/server.cpp')
| -rw-r--r-- | modules/spanningtree/server.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/modules/spanningtree/server.cpp b/modules/spanningtree/server.cpp index eb73f97b9..88a2f4267 100644 --- a/modules/spanningtree/server.cpp +++ b/modules/spanningtree/server.cpp @@ -37,15 +37,15 @@ namespace { - bool RunningInContainer() + bool IsLocalRange(const irc::sockets::sockaddrs& sa) { - std::error_code ec; - if (std::filesystem::is_regular_file("/.dockerenv", ec)) + if (sa.is_local()) + return true; // Always allowed. + + for (const auto& cidr : Utils->LocalRanges) { - // We are running inside of Docker so all IP addresses are - // non-local and as far as I can see there isn't a way to - // reliably detect the Docker network. - return true; + if (cidr.match(sa)) + return true; // Explicitly allowed range. } return false; } @@ -156,7 +156,7 @@ std::shared_ptr<Link> TreeSocket::AuthRemote(const CommandBase::Params& params) ssliohook->GetCiphersuite(ciphersuite); ServerInstance->SNO.WriteToSnoMask('l', "Negotiated ciphersuite {} on link {}", ciphersuite, x->Name); } - else if (!capab->remotesa.is_local() && !RunningInContainer()) + else if (!IsLocalRange(capab->remotesa)) { this->SendError("Non-local server connections MUST be linked with SSL!"); return nullptr; |
