fix(login/portal): Firestorm ToS-Akzeptanz und HTTPS-Proxy-Diagnose (#262)
* fix(login): accept Firestorm ToS confirmation as bool or XML-RPC numeric 1 * fix(portal): diagnose rejected HTTPS proxy requests and support normalized forwarded proto * diag(tos): log verified consent arrival after successful authentication * test(tos/portal): cover numeric viewer consent and trusted HTTPS proxy diagnostics * test(tos/portal): cover numeric viewer consent and trusted HTTPS proxy diagnostics * docs: troubleshoot persistent Firestorm ToS and portal HTTPS name-check 403 * docs: troubleshoot persistent Firestorm ToS and portal HTTPS name-check 403 * fix(portal): trust configured KeyHelp proxy 109.91.20.9 for HTTPS forwarding * test(portal): enforce dedicated production HTTPS proxy trust configuration * docs(portal): record verified operator-provided KeyHelp proxy IP for HG rollout * test(portal): retain blank proxy defaults in examples while trusting production KeyHelp IP
This commit is contained in:
1 parent
3728273e56
commit
c9a0322062
8 files changed
+127
-9
No files matched your search
@@ -79,6 +79,21 @@ namespace NexVerse.Server.Api
|
||||
return allowed.Contains(value);
|
||||
}
|
||||
|
||||
// Trust the HTTPS scheme only if every hop reports HTTPS and the
|
||||
// direct TCP peer is the configured TLS termination proxy.
|
||||
// An absent/mixed HTTP header is not proof of an encrypted client.
|
||||
private static bool IsForwardedHttps(string header)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(header))
|
||||
return false;
|
||||
foreach (string value in header.Split(','))
|
||||
{
|
||||
if (!string.Equals(value.Trim(), "https", StringComparison.OrdinalIgnoreCase))
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// Both signup and live name lookup must share identical
|
||||
// transport, enablement and machine-key security requirements.
|
||||
private bool AuthorizePortal(IOSHttpRequest request, IOSHttpResponse response)
|
||||
@@ -96,15 +111,26 @@ namespace NexVerse.Server.Api
|
||||
IPAddress peer = request.RemoteIPEndPoint?.Address;
|
||||
bool isLoopback = peer != null && IPAddress.IsLoopback(peer);
|
||||
bool trustedProxy = isLoopback || TrustedPeer(request, m_TrustedProxyIps);
|
||||
bool forwardedHttps = trustedProxy &&
|
||||
string.Equals(request.Headers?["X-Forwarded-Proto"], "https",
|
||||
StringComparison.OrdinalIgnoreCase);
|
||||
string forwardedProto = request.Headers?["X-Forwarded-Proto"];
|
||||
bool forwardedHttps = trustedProxy && IsForwardedHttps(forwardedProto);
|
||||
// Backend HTTP is a separate, explicit per-IP opt-in. Use
|
||||
// loopback or a private/VPN link to protect passwords/API keys.
|
||||
bool trustedBackendHttp = TrustedPeer(request, m_TrustedHttpPeers);
|
||||
bool secured = request.IsSecured || forwardedHttps || trustedBackendHttp;
|
||||
if (!secured)
|
||||
{
|
||||
// Diagnostic metadata only: never log the API key, credentials,
|
||||
// registration payload, or arbitrary untrusted header contents.
|
||||
string peerAddress = peer == null ? "(unbekannt)" :
|
||||
(peer.IsIPv4MappedToIPv6 ? peer.MapToIPv4().ToString() : peer.ToString());
|
||||
m_Log.WarnFormat(
|
||||
"[OGL-REGISTRIERUNG] HTTPS-Proxy-Pruefung verweigert: peer={0} " +
|
||||
"tls={1} trustedProxy={2} xfpPresent={3} xfpHttps={4} trustedHttpPeer={5}. " +
|
||||
"Proxy-Quell-IP in PortalRegistrationTrustedProxyIPs konfigurieren und " +
|
||||
"am TLS-Proxy X-Forwarded-Proto=https setzen.",
|
||||
peerAddress, request.IsSecured, trustedProxy,
|
||||
!string.IsNullOrWhiteSpace(forwardedProto), IsForwardedHttps(forwardedProto),
|
||||
trustedBackendHttp);
|
||||
Reply(response, HttpStatusCode.Forbidden,
|
||||
"https_required", "Eine verschluesselte Verbindung ist erforderlich.");
|
||||
return false;
|
||||
|
||||
@@ -61,6 +61,16 @@ namespace OpenSim.Server.Handlers.Login
|
||||
m_Proxy = hasProxy;
|
||||
}
|
||||
|
||||
// Firestorm/XML-RPC may encode LLSD true as boolean, 1, or "1".
|
||||
// Never treat an arbitrary non-empty string as acceptance.
|
||||
private static bool TosAccepted(object value)
|
||||
{
|
||||
if (value is bool accepted)
|
||||
return accepted;
|
||||
string text = Convert.ToString(value)?.Trim();
|
||||
return string.Equals(text, "true", StringComparison.OrdinalIgnoreCase) || text == "1";
|
||||
}
|
||||
|
||||
public XmlRpcResponse HandleXMLRPCLogin(XmlRpcRequest request, IPEndPoint remoteClient)
|
||||
{
|
||||
Hashtable requestData = (Hashtable)request.Params[0];
|
||||
@@ -133,7 +143,9 @@ namespace OpenSim.Server.Handlers.Login
|
||||
//m_log.InfoFormat("[LOGIN]: XMLRPC Login Requested for {0} {1}, starting in {2}, using {3}", first, last, startLocation, clientVersion);
|
||||
|
||||
bool agreeToTos = requestData.ContainsKey("agree_to_tos") &&
|
||||
bool.TryParse(Convert.ToString(requestData["agree_to_tos"]), out bool accepted) && accepted;
|
||||
TosAccepted(requestData["agree_to_tos"]);
|
||||
if (agreeToTos)
|
||||
m_log.Info("[NEX-TOS]: XML-RPC Zustimmungsflag empfangen.");
|
||||
|
||||
LoginResponse reply = null;
|
||||
reply = m_LocalService.Login(first, last, passwd, startLocation, scopeID, clientVersion, channel, mac, id0, remoteClient, agreeToTos);
|
||||
@@ -222,7 +234,9 @@ namespace OpenSim.Server.Handlers.Login
|
||||
m_log.Info("[LOGIN]: LLSD Login Requested for: '" + first + "' '" + last + "' / " + startLocation);
|
||||
|
||||
bool agreeToTos = map.TryGetValue("agree_to_tos", out OSD tosValue) &&
|
||||
tosValue.AsBoolean();
|
||||
TosAccepted(tosValue.AsString());
|
||||
if (agreeToTos)
|
||||
m_log.Info("[NEX-TOS]: LLSD Zustimmungsflag empfangen.");
|
||||
|
||||
LoginResponse reply = null;
|
||||
reply = m_LocalService.Login(first, last, passwd, startLocation, scopeID,
|
||||
|
||||
@@ -541,6 +541,10 @@ namespace OpenSim.Services.LLLoginService
|
||||
!string.Equals(account.NexVerseTosAcceptedVersion,
|
||||
m_NexVerseTosVersion, StringComparison.Ordinal))
|
||||
{
|
||||
if (agreeToTos)
|
||||
m_log.InfoFormat(
|
||||
"[NEX-TOS]: Zustimmung am LoginService angekommen fuer Avatar {0}, Version={1}.",
|
||||
account.PrincipalID, m_NexVerseTosVersion);
|
||||
if (!agreeToTos)
|
||||
{
|
||||
m_log.InfoFormat(
|
||||
|
||||
+1
-1
@@ -709,7 +709,7 @@
|
||||
; KeyHelp HTTPS -> internal ROBUST HTTP: exact source IP of the proxy,
|
||||
; not the original browser's X-Forwarded-For address. Reverse proxy MUST
|
||||
; overwrite X-Forwarded-Proto: https and restrict origin port access.
|
||||
PortalRegistrationTrustedProxyIPs = ""
|
||||
PortalRegistrationTrustedProxyIPs = "109.91.20.9"
|
||||
; Optional direct HTTP only from exact backend IP(s) over a VPN/private
|
||||
; network; NEVER expose plaintext passwords/API keys on the internet.
|
||||
PortalRegistrationTrustedHttpPeers = ""
|
||||
|
||||
@@ -140,3 +140,21 @@ beziehungsweise Merge neue Konfigurationsoptionen gezielt manuell übernehmen.
|
||||
`git stash pop` kann bei geänderter Repo-INI Merge-Konflikte verursachen;
|
||||
sicherheitshalber ggf. die Datei aus der externen Sicherung wiederherstellen
|
||||
und die drei TOS-Schlüssel manuell ergänzen, statt produktive Werte zu ersetzen.
|
||||
|
||||
|
||||
## Firestorm 7.2.4: ToS-Fenster erscheint nach Bestätigung erneut
|
||||
|
||||
Im XML-RPC-Login kann Firestorm die LLSD-Zustimmung als Boolean `true`
|
||||
oder als numerischen Wert `1` serialisieren. Beide bedeuten Zustimmung.
|
||||
Der Login-Handler normalisiert deshalb `true` und `1`; andere Werte
|
||||
einschließlich `false`, `0`, leer oder nicht übermittelte Felder werden
|
||||
nicht als Zustimmung anerkannt. Passwortprüfung, Versionsprüfung und
|
||||
persistentes Speichern bleiben unverändert erforderlich.
|
||||
|
||||
Diagnose nach Deployment: Die ROBUST-Konsole muss bei Bestätigung zuerst
|
||||
`[NEX-TOS]: XML-RPC Zustimmungsflag empfangen.` (alternativ LLSD)
|
||||
und anschließend `[NEX-TOS]: Zustimmung am LoginService angekommen ...`
|
||||
melden. Danach muss `Buergerordnung 1.0 akzeptiert ...` erscheinen.
|
||||
Ohne die erste Meldung kommt das Flag nicht durch den Protokoll-Handler.
|
||||
Ohne die letzte Meldung DB-Migration/Account-Service-Protokoll prüfen.
|
||||
Keine Passwörter, Login-Tokens oder API-Schlüssel protokollieren.
|
||||
@@ -377,3 +377,46 @@ erneuter Login; anschließend Fehler- und Missbrauchsprüfungen.
|
||||
|
||||
**Die ausführliche Betreiberanleitung mit vollständigen Browser-/Go-
|
||||
Beispielen ist zusätzlich als Markdown-Download in der Chat-Ausgabe verfügbar.**
|
||||
|
||||
|
||||
## 403 `https_required` bei Namensprüfung und Avatarregistrierung
|
||||
|
||||
**Betrifft beide Endpunkte**, da `HandleNameAvailability` (GET) und
|
||||
`Handle` (POST) dieselbe Transportprüfung verwenden. Ein 403 hier
|
||||
liegt noch vor der eigentlichen Namensabfrage und sagt nichts über die
|
||||
Verfügbarkeit eines Avatarnamens aus.
|
||||
|
||||
ROBUST meldet nach dem Transport-Diagnose-Fix unter
|
||||
`[OGL-REGISTRIERUNG] HTTPS-Proxy-Pruefung verweigert`:
|
||||
|
||||
- `peer=`: echte TCP-Quelladresse aus Sicht des ROBUST-Dienstes, **nicht**
|
||||
die Browseradresse aus `X-Forwarded-For`.
|
||||
- `tls=`: direkte TLS-Verbindung zu ROBUST.
|
||||
- `trustedProxy=`: Quell-IP ist Loopback oder steht in
|
||||
`PortalRegistrationTrustedProxyIPs`.
|
||||
- `xfpPresent=` / `xfpHttps=`: ist `X-Forwarded-Proto` vorhanden und
|
||||
lautet er ausschließlich `https`?
|
||||
- `trustedHttpPeer=`: direkter HTTP-Transport aus dem
|
||||
besonders freigegebenen, privaten Backend-Segment.
|
||||
|
||||
Bei einer KeyHelp-HTTPS-Terminierung mit internem HTTP-Hop die echte
|
||||
TCP-Quelladresse des Proxys in der **lokalen** `bin/Robust.HG.ini`
|
||||
unter `[NexVerseWorldApi]` eintragen:
|
||||
|
||||
```ini
|
||||
PortalRegistrationTrustedProxyIPs = "109.91.20.9"
|
||||
PortalRegistrationTrustedHttpPeers = ""
|
||||
```
|
||||
|
||||
Die Quell-IP `109.91.20.9` wurde vom Betreiber für den KeyHelp-Proxy angegeben. Der Wert muss bei `peer=` im ROBUST-Log mit der echten Quelladresse übereinstimmen. Bei anderer `peer`-Adresse ist die reale TCP-Quell-IP zu verwenden, nicht die Client-IP.
|
||||
|
||||
Am HTTPS-VHost des Reverse Proxys muss `X-Forwarded-Proto: https`
|
||||
**vom Proxy gesetzt/überschrieben** werden (nicht vom Browser übernommen).
|
||||
Beispiel für einen geeigneten nginx-HTTPS-`location`-Block:
|
||||
`proxy_set_header X-Forwarded-Proto https;`.
|
||||
|
||||
Robust neu starten und **beide** Endpunkte testen. Erst wenn die
|
||||
Verbindung die Transportprüfung passiert, können `401 unauthorized_portal`
|
||||
(ungültiger `users:register`-Maschinenkey) oder `200`/ `201` auftreten.
|
||||
`PortalRegistrationTrustedHttpPeers` nicht mit öffentlichen WAN-Adressen
|
||||
füllen. Den Schutz nicht abschalten und keine API-Keys an den Browser senden.
|
||||
@@ -36,6 +36,15 @@ assert login_source.index("StoreUserAccount(currentAccount)") < login_source.ind
|
||||
handler = Path("OpenSim/Server/Handlers/Login/LLLoginHandlers.cs").read_text(encoding="utf-8")
|
||||
assert 'requestData.ContainsKey("agree_to_tos")' in handler
|
||||
assert 'map.TryGetValue("agree_to_tos"' in handler
|
||||
# Firestorm's XML-RPC stack can send the LLSD acceptance flag as numeric 1
|
||||
# instead of the C# bool string. Never accept arbitrary nonempty values.
|
||||
assert 'private static bool TosAccepted(object value)' in handler
|
||||
assert 'value is bool accepted' in handler
|
||||
assert 'text == "1"' in handler
|
||||
assert 'string.Equals(text, "true", StringComparison.OrdinalIgnoreCase)' in handler
|
||||
assert 'TosAccepted(requestData["agree_to_tos"])' in handler
|
||||
assert 'TosAccepted(tosValue.AsString())' in handler
|
||||
|
||||
account_handler = Path("OpenSim/Server/Handlers/UserAccounts/UserAccountServerPostHandler.cs").read_text(encoding="utf-8")
|
||||
account_interface = Path("OpenSim/Services/Interfaces/IUserAccountService.cs").read_text(encoding="utf-8")
|
||||
account_service = Path("OpenSim/Services/UserAccountService/UserAccountService.cs").read_text(encoding="utf-8")
|
||||
|
||||
@@ -88,7 +88,9 @@ for marker in (
|
||||
"private static bool TrustedPeer(",
|
||||
"request.RemoteIPEndPoint?.Address",
|
||||
'request.Headers?["X-Forwarded-Proto"]',
|
||||
'string.Equals(request.Headers?["X-Forwarded-Proto"], "https"',
|
||||
"private static bool IsForwardedHttps(string header)",
|
||||
"bool forwardedHttps = trustedProxy && IsForwardedHttps(forwardedProto)",
|
||||
"HTTPS-Proxy-Pruefung verweigert: peer={0}",
|
||||
"bool forwardedHttps = trustedProxy &&",
|
||||
"bool trustedBackendHttp = TrustedPeer(request, m_TrustedHttpPeers)",
|
||||
"bool secured = request.IsSecured || forwardedHttps || trustedBackendHttp",
|
||||
@@ -126,8 +128,9 @@ assert account_portal.index("SetLastPosition(") < account_portal.index("return a
|
||||
for path in ("bin/Robust.HG.ini", "bin/Robust.HG.ini.example",
|
||||
"bin/Robust.HG.OGLAsset.ini.example", "bin/Robust.ini.example"):
|
||||
config = Path(path).read_text()
|
||||
for marker in ("PortalRegistrationTrustedProxyIPs = \"\"",
|
||||
"PortalRegistrationTrustedHttpPeers = \"\"",
|
||||
if path != "bin/Robust.HG.ini":
|
||||
assert 'PortalRegistrationTrustedProxyIPs = ""' in config, path
|
||||
for marker in ("PortalRegistrationTrustedHttpPeers = \"\"",
|
||||
'PortalRegistrationDefaultRegionName = "Magdeburg"',
|
||||
"PortalRegistrationDefaultX = 134",
|
||||
"PortalRegistrationDefaultY = 111",
|
||||
@@ -171,6 +174,7 @@ assert "NexScopes.UsersRegister," in key_store
|
||||
# Production HG configuration now enables registration only for the
|
||||
# users:register machine key and explicitly trusted KeyHelp/HTTP backend.
|
||||
assert "PortalAvatarRegistrationEnabled = true" in Path("bin/Robust.HG.ini").read_text()
|
||||
assert 'PortalRegistrationTrustedProxyIPs = "109.91.20.9"' in Path("bin/Robust.HG.ini").read_text(), "Production HG proxy IP must be configured"
|
||||
for path in ("bin/Robust.HG.ini.example", "bin/Robust.ini.example",
|
||||
"bin/Robust.HG.OGLAsset.ini.example"):
|
||||
assert "PortalAvatarRegistrationEnabled = false" in Path(path).read_text(), path
|
||||
|
||||
Reference in new issue
Block a user