fix(feature): route node policies correctly and stop heartbeat log flood (#218)
* fix(feature): share exact node identity resolution and prefilter foreign policies * fix(feature): use NodeAgent-compatible machine fallback for empty NodeId * fix(feature): ignore foreign-node broadcast policies and rate-limit own-node warnings * test(feature): verify fallback NodeId and foreign-node broadcast selection * ci(feature): reject foreign-node warning regressions and identity mismatch * docs(ci): clarify feature policy routing regression intent * ci(feature): enforce node-scoped policy logs and verification * docs(feature): explain repeated policy warnings and separate HG purchase regression
This commit is contained in:
1 parent
5416edf301
commit
8eb11eee17
7 files changed
+187
-6
No files matched your search
@@ -95,6 +95,10 @@ jobs:
|
||||
shell: bash
|
||||
run: python3 tools/ci/verify_hg_friends_reconnect_09312.py
|
||||
|
||||
- name: Verify Feature Control node-specific policy routing
|
||||
shell: bash
|
||||
run: python3 tools/ci/verify_ogl_feature_policy_routing.py
|
||||
|
||||
- name: Verify HG inventory external authorization boundary
|
||||
shell: bash
|
||||
run: python3 tools/ci/verify_hg_inventory_security_09312.py
|
||||
|
||||
@@ -80,6 +80,8 @@ namespace NexVerse.RegionModules.NodeAgent
|
||||
private IDisposable m_EstateScriptMessageSubscription;
|
||||
private IDisposable m_CrossRegionChatSubscription;
|
||||
private IDisposable m_FeaturePolicySubscription;
|
||||
// A malformed own-node policy must remain visible without flooding the log.
|
||||
private long m_LastOwnFeaturePolicyWarningSeconds;
|
||||
private volatile bool m_MaintenanceMode;
|
||||
private volatile bool m_Draining;
|
||||
private DateTimeOffset m_StartedAt;
|
||||
@@ -114,9 +116,9 @@ namespace NexVerse.RegionModules.NodeAgent
|
||||
return;
|
||||
}
|
||||
|
||||
m_NodeId = config.GetString("NodeId", Environment.MachineName).Trim();
|
||||
if (string.IsNullOrWhiteSpace(m_NodeId))
|
||||
m_NodeId = Environment.MachineName;
|
||||
m_NodeId = OglArchiveFeatureGate.ResolveNodeId(
|
||||
config.GetString("NodeId", Environment.MachineName),
|
||||
Environment.MachineName);
|
||||
|
||||
m_SharedKey = sharedKey;
|
||||
m_InboundPath = config.GetString(
|
||||
@@ -1020,11 +1022,34 @@ namespace NexVerse.RegionModules.NodeAgent
|
||||
!ev.Data.TryGetValue("signature", out string signature))
|
||||
return;
|
||||
|
||||
// NexBus broadcasts every node's renewal. Ignore policies addressed
|
||||
// to another node WITHOUT attempting signature verification or
|
||||
// treating them as security incidents on this simulator.
|
||||
if (!OglArchiveFeatureGate.IsForConfiguredNode(node))
|
||||
return;
|
||||
|
||||
if (OglArchiveFeatureGate.Apply(node, revision, expires, flags, signature))
|
||||
m_Log.InfoFormat("[OGL FEATURE CONTROL]: Richtlinie von Robust aktualisiert: Node {0}, Flags {1}.",
|
||||
{
|
||||
Interlocked.Exchange(ref m_LastOwnFeaturePolicyWarningSeconds, 0);
|
||||
m_Log.DebugFormat(
|
||||
"[OGL FEATURE CONTROL]: Eigene Richtlinie aktualisiert: Node {0}, Flags {1}.",
|
||||
node, flags);
|
||||
}
|
||||
else
|
||||
m_Log.Warn("[OGL FEATURE CONTROL]: Ungültige, fremde oder abgelaufene Richtlinie verworfen.");
|
||||
{
|
||||
// Bad own-node signatures/expiry remain fail-closed. Warn at
|
||||
// most once per 120 seconds, without disclosing signatures.
|
||||
long now = DateTimeOffset.UtcNow.ToUnixTimeSeconds();
|
||||
long previous = Interlocked.Read(ref m_LastOwnFeaturePolicyWarningSeconds);
|
||||
if (now - previous >= 120 &&
|
||||
Interlocked.CompareExchange(
|
||||
ref m_LastOwnFeaturePolicyWarningSeconds, now, previous) == previous)
|
||||
m_Log.WarnFormat(
|
||||
"[OGL FEATURE CONTROL]: Richtlinie für eigene Node {0} abgewiesen " +
|
||||
"(Revision {1}, Ablauf UTC {2}). NodeId, ES256-Public-Key, " +
|
||||
"ROBUST-Signing-Key und Systemzeit prüfen. Archivfreigaben bleiben gesperrt.",
|
||||
node, revision, expires);
|
||||
}
|
||||
}
|
||||
|
||||
private void PublishHeartbeatSafe()
|
||||
|
||||
@@ -30,6 +30,25 @@ namespace OpenSim.Framework
|
||||
|
||||
public static bool Enabled { get { lock (s_Sync) return s_Enabled; } }
|
||||
|
||||
// The NodeAgent and the archive gate must resolve empty NodeId settings
|
||||
// identically. Otherwise valid policies for the machine name are refused.
|
||||
public static string ResolveNodeId(string configuredNodeId, string fallbackNodeId)
|
||||
{
|
||||
string configured = configuredNodeId?.Trim();
|
||||
return string.IsNullOrWhiteSpace(configured)
|
||||
? (fallbackNodeId?.Trim() ?? string.Empty)
|
||||
: configured;
|
||||
}
|
||||
|
||||
// NexBus broadcasts feature policies for ALL simulators. Foreign-node
|
||||
// policies are not authorization failures for this simulator.
|
||||
public static bool IsForConfiguredNode(string nodeId)
|
||||
{
|
||||
lock (s_Sync)
|
||||
return s_Enabled && s_NodeId.Length != 0 &&
|
||||
string.Equals(nodeId, s_NodeId, StringComparison.Ordinal);
|
||||
}
|
||||
|
||||
public static void Configure(bool enabled, string nodeId, string publicKeyPem)
|
||||
{
|
||||
lock (s_Sync)
|
||||
|
||||
@@ -180,7 +180,9 @@ namespace OpenSim
|
||||
}
|
||||
global::OpenSim.Framework.OglArchiveFeatureGate.Configure(
|
||||
featureConfig?.GetBoolean("Enabled", false) == true,
|
||||
nodeConfig?.GetString("NodeId", Environment.MachineName)?.Trim(),
|
||||
global::OpenSim.Framework.OglArchiveFeatureGate.ResolveNodeId(
|
||||
nodeConfig?.GetString("NodeId", Environment.MachineName),
|
||||
Environment.MachineName),
|
||||
publicPem);
|
||||
if (global::OpenSim.Framework.OglArchiveFeatureGate.Enabled)
|
||||
m_log.Warn("[OGL FEATURE CONTROL]: Aktive Archivfreigabe: ohne gültige Robust-Richtlinie sind alle Archive gesperrt.");
|
||||
|
||||
@@ -0,0 +1,88 @@
|
||||
# OGL 0.9.3.12 – Feature-Control-Heartbeat-Warnungen und HG-Käufe
|
||||
|
||||
## Warum meldet die Konsole fortlaufend „Ungültige, fremde oder abgelaufene Richtlinie“?
|
||||
|
||||
Der World-API-/ROBUST-Dienst veröffentlicht pro Heartbeat eine ES256-signierte
|
||||
Feature-Richtlinie an NexBus. NexBus kann diese Ereignisse an mehrere
|
||||
Simulator-Nodes verteilen. Bisher versuchte jede Node, **auch fremde
|
||||
NodeID-Richtlinien** zu prüfen. Der Sicherheitsfilter verweigerte sie
|
||||
korrekt, erzeugte aber bei jedem Heartbeat Warnungen.
|
||||
|
||||
Zusätzlich löste eine bewusst leere `[NexVerseNodeAgent] NodeId = ""`
|
||||
unterschiedliche Fallbacks aus: NodeAgent verwendete den Rechnernamen,
|
||||
OGLFeatureControl beim Start hingegen die leere Zeichenfolge.
|
||||
Damit konnte die *eigene* signierte Richtlinie nicht angenommen werden.
|
||||
|
||||
Der Fix:
|
||||
- Beide Teile verwenden den **identischen** NodeID-Fallback (Rechnername).
|
||||
- Richtlinien für andere Nodes werden ohne Warnung ignoriert.
|
||||
- Nur die eigene NodeID wird der ES256-Signaturprüfung zugeführt.
|
||||
- Eigene gültige Heartbeat-Erneuerungen protokollieren nur DEBUG.
|
||||
- Eigene ungültige Richtlinien bleiben **abgewiesen**; die Warnung gibt
|
||||
NodeID, Revision und Ablaufzeit an, aber niemals Schlüssel oder Signatur,
|
||||
und ist auf höchstens eine Meldung in 120 Sekunden begrenzt.
|
||||
- Alle bisherigen Ablauf-, Revisions-, Flag- und ES256-Grenzen bleiben aktiv.
|
||||
|
||||
Trotz Fallback für leere Werte ist eine **explizite, eindeutige**
|
||||
`[NexVerseNodeAgent] NodeId` je Simulator empfohlen, beispielsweise:
|
||||
|
||||
```ini
|
||||
[NexVerseNodeAgent]
|
||||
Enabled = true
|
||||
NodeId = "mainland-01"
|
||||
|
||||
[OGLFeatureControl]
|
||||
Enabled = true
|
||||
PublicKeyPath = "config-include/ogl-feature-public.pem"
|
||||
```
|
||||
|
||||
ROBUST muss den *zu diesem Public-Key gehörigen* privaten PEM verwenden.
|
||||
Prüfen mit `openssl pkey -pubout` auf dem Private-Key und dem
|
||||
öffentlichen PEM, ggf. SHA-256 der normalisierten öffentlichen Schlüssel
|
||||
vergleichen. Ein ungültiger oder fehlender Schlüssel darf **niemals**
|
||||
durch Abschalten der Signaturprüfung kompensiert werden.
|
||||
|
||||
Die NodeID muss innerhalb eines Grids eindeutig, stabil und für die
|
||||
Feature-Control-API gültig sein (Buchstaben/Ziffern/`-`/`_`/`.`,
|
||||
maximal 128 Zeichen, keine Leerzeichen). Es muss eine gültige
|
||||
Node-Registrierung und eine passende explizite Policy im OGL Control Center
|
||||
vorliegen. Fehlt die Policy, bleiben OAR/IAR-Rechte gesperrt.
|
||||
|
||||
Nach Aktualisierung **und Neustart jedes betroffenen Simulators**
|
||||
prüfen, ob das Log eigene gültige Richtlinien meldet (ggf. DEBUG)
|
||||
und ob im Control Center eine Policy für die richtige NodeID hinterlegt
|
||||
ist. Systemuhren (NTP) von ROBUST und Simulator prüfen.
|
||||
|
||||
## Hypergrid-Shopping bleibt ein separater Vorfall
|
||||
|
||||
Die in der vorigen Sicherheitskorrektur deaktivierte **öffentliche**
|
||||
`HGInventoryService`-Schnittstelle war Teil der traditionellen
|
||||
Hypergrid-Suitcase-Kommunikation und konnte nachweislich ohne
|
||||
Avatar-Authentifizierung bearbeitet werden. Die Notfallsperre bewirkt,
|
||||
dass Standard-HG-Übertragungen bei Fremd-Grid-Aufenthalten scheitern
|
||||
können – auch die Zustellung bezahlter Gegenstände.
|
||||
|
||||
**Der vorliegende Feature-Control-Fix stellt diese Inventarschnittstelle
|
||||
nicht wieder her.** OAR/IAR-Lizenzen sind nicht der normale
|
||||
Viewer-Kauf-/Inventar-Transfermechanismus.
|
||||
|
||||
Nicht:
|
||||
- `HGInventoryServiceConnector` am PublicPort reaktivieren;
|
||||
- `/xinventory` aus dem PrivatePort ungefiltert nach außen leiten;
|
||||
- eine bloße UUID- oder Grid-SharedKey-Prüfung als Avatar-Autorisierung
|
||||
behandeln.
|
||||
|
||||
Für vollwertiges sicheres Hypergrid-Shopping ist eine getrennte,
|
||||
kurzlebige, signierte avatar- und ziel-grid-gebundene
|
||||
Transferberechtigung mit serverseitiger Freigabe, Replay-Schutz,
|
||||
Suitcase-Eigentumsprüfung, Audit und Interoperabilitätstests nötig.
|
||||
Fremde Legacy-Grids müssen das neue Verfahren ebenfalls unterstützen.
|
||||
|
||||
Bis dahin Käufe bei fremden Grids vermeiden, Transaktionsbelege sichern
|
||||
und bei bereits bezahlten, nicht gelieferten Objekten Betreiber und
|
||||
Verkäufer wegen Lieferung/Erstattung kontaktieren. Zahlungsabschluss,
|
||||
Inventareintrag und Asset-Zustellung sind getrennt zu prüfen.
|
||||
|
||||
Die Änderungen aus diesem Fix sind erst nach neuem Release-Build und
|
||||
Installation auf der Live-Node wirksam. Die bereits veröffentlichte
|
||||
unveränderliche Version `v0.9.3.12` enthält diesen späteren Fix nicht.
|
||||
@@ -30,7 +30,18 @@ internal static class Program
|
||||
Assert(OglArchiveFeatureGate.Allowed(OglArchiveFeatureGate.All),
|
||||
"Legacy mode must preserve original archive commands");
|
||||
|
||||
Assert(OglArchiveFeatureGate.ResolveNodeId(null, "host-01") == "host-01",
|
||||
"missing NodeId must use machine fallback");
|
||||
Assert(OglArchiveFeatureGate.ResolveNodeId(" ", "host-01") == "host-01",
|
||||
"empty NodeId must use machine fallback");
|
||||
Assert(OglArchiveFeatureGate.ResolveNodeId(" mainland-02 ", "host-01") == "mainland-02",
|
||||
"explicit NodeId must be trimmed and retained");
|
||||
|
||||
OglArchiveFeatureGate.Configure(true, node, publicKey);
|
||||
Assert(OglArchiveFeatureGate.IsForConfiguredNode(node),
|
||||
"own-node feature policies must be selected");
|
||||
Assert(!OglArchiveFeatureGate.IsForConfiguredNode("foreign-node"),
|
||||
"foreign-node broadcasts must be ignored before Apply");
|
||||
Assert(!OglArchiveFeatureGate.Allowed(1), "enabled mode requires an explicit policy");
|
||||
string signed = OglArchiveFeatureGate.Sign(valid, node, 10, expiry, 1 | 8);
|
||||
Assert(!OglArchiveFeatureGate.Apply(node, 10, expiry, 1 | 8,
|
||||
@@ -38,6 +49,9 @@ internal static class Program
|
||||
"invalid signing secret should never grant access");
|
||||
Assert(!OglArchiveFeatureGate.Apply("foreign-node", 10, expiry, 1 | 8, signed),
|
||||
"a policy for another simulator must not work");
|
||||
Assert(!OglArchiveFeatureGate.IsForConfiguredNode("foreign-node") &&
|
||||
!OglArchiveFeatureGate.Allowed(1),
|
||||
"foreign policy does not grant any rights");
|
||||
Assert(!OglArchiveFeatureGate.Apply(node, 10, expiry, 17,
|
||||
OglArchiveFeatureGate.Sign(valid, node, 10, expiry, 17)),
|
||||
"unsupported permission flag rejected");
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Check feature-policy routing ignores foreign-node updates and preserves own-node validation."""
|
||||
from pathlib import Path
|
||||
|
||||
root = Path(__file__).resolve().parents[2]
|
||||
read = lambda p: (root / p).read_text(encoding="utf-8")
|
||||
gate = read("OpenSim/Framework/OglArchiveFeatureGate.cs")
|
||||
simulator = read("OpenSim/Region/Application/OpenSim.cs")
|
||||
agent = read("NexVerse/RegionModules/NodeAgent/NexVerseNodeAgentModule.cs")
|
||||
checks = [
|
||||
('public static string ResolveNodeId(', gate),
|
||||
('public static bool IsForConfiguredNode(', gate),
|
||||
('string.Equals(nodeId, s_NodeId, StringComparison.Ordinal)', gate),
|
||||
('OglArchiveFeatureGate.ResolveNodeId(', agent),
|
||||
('OglArchiveFeatureGate.ResolveNodeId(', simulator),
|
||||
('OglArchiveFeatureGate.IsForConfiguredNode(node)', agent),
|
||||
('Interlocked.CompareExchange(', agent),
|
||||
('OglArchiveFeatureGate.Apply(node, revision, expires, flags, signature)', agent),
|
||||
]
|
||||
for value, body in checks:
|
||||
assert value in body, value
|
||||
policy = agent.split("private void HandleFeaturePolicy(", 1)[1].split(
|
||||
"private void PublishHeartbeatSafe()", 1)[0]
|
||||
assert policy.index("IsForConfiguredNode(node)") < policy.index("OglArchiveFeatureGate.Apply(")
|
||||
assert "Ungültige, fremde oder abgelaufene Richtlinie verworfen." not in policy
|
||||
assert "m_Log.WarnFormat(" in policy
|
||||
assert "m_Log.DebugFormat(" in policy
|
||||
assert "m_LastOwnFeaturePolicyWarningSeconds" in policy
|
||||
print("Feature policy node routing and warning throttling: OK")
|
||||
Reference in new issue
Block a user