diff --git a/.github/workflows/nexjast-ci.yml b/.github/workflows/nexjast-ci.yml index 46ff03a3..a4d9876f 100644 --- a/.github/workflows/nexjast-ci.yml +++ b/.github/workflows/nexjast-ci.yml @@ -846,6 +846,15 @@ jobs: python3 tools/ci/verify_gen1_approved_viewer_access.py dotnet run --project tools/ci/OglApprovedViewerRegression/OglApprovedViewerRegression.csproj --configuration Release + - name: Verify NexBus shutdown race and Wolfvoice integration + shell: bash + run: | + set -euo pipefail + python3 tools/ci/verify_gen1_nexbus_shutdown.py + python3 tools/ci/verify_gen1_wolfvoice_compat.py + bash -n tools/voice/install-wolfvoice-region-addon.sh + bash -n tools/voice/configure-wolfvoice-region.sh + - name: Runtime smoke test LLLogin protocol shell: bash run: bash tools/ci/smoke_lllogin_protocol.sh diff --git a/.github/workflows/ogl-wolfvoice-compatibility.yml b/.github/workflows/ogl-wolfvoice-compatibility.yml new file mode 100644 index 00000000..07b878d5 --- /dev/null +++ b/.github/workflows/ogl-wolfvoice-compatibility.yml @@ -0,0 +1,59 @@ +name: Wolfvoice Region Addon Compatibility + +on: + workflow_dispatch: + pull_request: + paths: + - 'tools/voice/**' + - 'doc/NexVerse/GEN1_WOLFVOICE_COMPATIBILITY.md' + - '.github/workflows/ogl-wolfvoice-compatibility.yml' + +permissions: + contents: read + +jobs: + build-addon: + name: Build hardened WebRTC region addon + runs-on: ubuntu-latest + timeout-minutes: 25 + steps: + - name: Checkout OpenGenesisLINK + uses: actions/checkout@v4 + + - name: Setup .NET 8 + uses: actions/setup-dotnet@v4 + with: + dotnet-version: '8.0.x' + + - name: Install native dependencies + run: | + sudo apt-get update + sudo apt-get install -y libgdiplus libc6-dev + + - name: Validate integration safety contracts + run: | + python3 tools/ci/verify_gen1_wolfvoice_compat.py + bash -n tools/voice/install-wolfvoice-region-addon.sh + bash -n tools/voice/configure-wolfvoice-region.sh + + - name: Fetch and compile pinned hardened WebRTC addon + run: | + chmod +x runprebuild.sh + bash tools/voice/install-wolfvoice-region-addon.sh build + + - name: Validate opt-in config with disposable test credentials + shell: bash + run: | + set -euo pipefail + tmp="$(mktemp -d)" + trap 'rm -rf "$tmp"' EXIT + umask 077 + openssl rand -hex 32 > "$tmp/rpc_key" + openssl rand -hex 32 > "$tmp/cred_key" + export WOLFVOICE_RPC_KEY_FILE="$tmp/rpc_key" + export WOLFVOICE_CRED_KEY_FILE="$tmp/cred_key" + bash tools/voice/configure-wolfvoice-region.sh \ + https://voice-ci.stadt-nexverse.test:9443 "$tmp/wolfvoice.ini" + grep -Fq 'Enabled = false' "$tmp/wolfvoice.ini" + grep -Fq 'WebRtcVoice.dll:WebRtcVoiceServiceConnector' "$tmp/wolfvoice.ini" + grep -Fq 'PositionFeed = true' "$tmp/wolfvoice.ini" diff --git a/.gitignore b/.gitignore index 50a895d6..8e614d54 100644 --- a/.gitignore +++ b/.gitignore @@ -28,3 +28,7 @@ bin/maptiles/ # Grid-specific terrain source data and accidental filesystem cache copy bin/nexverse-deutschland/ bin/opt/ + +# Optional, pinned external wolfvoice region addon, fetched by operator. +# Do not accidentally vendor its full upstream source or build outputs. +/addon-modules/os-webrtc-janus/ diff --git a/NexVerse/RegionModules/NodeAgent/NexVerseNodeAgentModule.cs b/NexVerse/RegionModules/NodeAgent/NexVerseNodeAgentModule.cs index 7f226a82..22df66de 100644 --- a/NexVerse/RegionModules/NodeAgent/NexVerseNodeAgentModule.cs +++ b/NexVerse/RegionModules/NodeAgent/NexVerseNodeAgentModule.cs @@ -52,6 +52,9 @@ namespace NexVerse.RegionModules.NodeAgent new ConcurrentDictionary(); private bool m_Enabled; + // Inbound HTTP may finish after Close starts and the bus is disposed. + // Reject new events during shutdown instead of logging a spurious 500. + private int m_Stopping; private string m_NodeId = string.Empty; private string m_SharedKey = string.Empty; private string m_InboundPath = "/internal/nexbus/v1/events"; @@ -210,6 +213,7 @@ namespace NexVerse.RegionModules.NodeAgent queueCapacity, timeoutMs); m_Bus = new DistributedNexEventBus(m_Transport, deduplicationWindow); + Interlocked.Exchange(ref m_Stopping, 0); m_StartedAt = DateTimeOffset.UtcNow; m_Enabled = true; @@ -347,7 +351,7 @@ namespace NexVerse.RegionModules.NodeAgent public void Close() { - if (!m_Enabled) + if (!m_Enabled || Interlocked.Exchange(ref m_Stopping, 1) != 0) return; try @@ -2366,6 +2370,13 @@ namespace NexVerse.RegionModules.NodeAgent response.KeepAlive = false; response.ContentType = "application/json; charset=utf-8"; + if (Volatile.Read(ref m_Stopping) != 0 || !m_Enabled) + { + WriteInbound(response, HttpStatusCode.ServiceUnavailable, + new { error = "node_shutting_down" }); + return; + } + if (request == null || !string.Equals( request.HttpMethod, @@ -2426,7 +2437,17 @@ namespace NexVerse.RegionModules.NodeAgent try { - bool accepted = m_Bus.Receive(nexEvent); + // Close() may race with a validated, in-flight HTTP request. + // Snapshot and guard the bus; still handle disposal after the check. + DistributedNexEventBus bus = m_Bus; + if (Volatile.Read(ref m_Stopping) != 0 || bus == null) + { + WriteInbound(response, HttpStatusCode.ServiceUnavailable, + new { error = "node_shutting_down" }); + return; + } + + bool accepted = bus.Receive(nexEvent); WriteInbound( response, HttpStatusCode.Accepted, @@ -2436,6 +2457,12 @@ namespace NexVerse.RegionModules.NodeAgent event_id = nexEvent.EventId }); } + catch (ObjectDisposedException) + { + // Expected for requests already authenticated when teardown begins. + WriteInbound(response, HttpStatusCode.ServiceUnavailable, + new { error = "node_shutting_down" }); + } catch (Exception e) { m_Log.Error( diff --git a/OpenSim/Framework/OglApprovedViewerPolicy.cs b/OpenSim/Framework/OglApprovedViewerPolicy.cs index f1c62a72..f051b5da 100644 --- a/OpenSim/Framework/OglApprovedViewerPolicy.cs +++ b/OpenSim/Framework/OglApprovedViewerPolicy.cs @@ -12,7 +12,7 @@ namespace OpenSim.Framework { private static readonly string[] s_AllowedNames = { - "Firestorm", "OpenGenesisLINK", "OGL Viewer" + "Firestorm", "OpenGenesisLINK", "OGL Viewer", "Radegast-ng", "Radegast" }; private static readonly string[] s_KnownCopybotNames = diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 13ab4d93..78a4c0e8 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -4054,7 +4054,7 @@ namespace OpenSim.Region.Framework.Scenes if (m_OglApprovedViewersOnly && !OglApprovedViewerPolicy.IsAllowed(acd.Viewer, acd.Channel)) { - reason = "Only Firestorm or OpenGenesisLINK Viewer is permitted"; + reason = "Only Firestorm, OpenGenesisLINK or Radegast-ng Viewer is permitted"; m_log.InfoFormat("[OGL VIEWER ACCESS]: Region {0} rejected viewer {1}, channel {2}", RegionInfo.RegionName, acd.Viewer, acd.Channel); return false; diff --git a/OpenSim/Services/HypergridService/GatekeeperService.cs b/OpenSim/Services/HypergridService/GatekeeperService.cs index 1187c978..b9635e43 100644 --- a/OpenSim/Services/HypergridService/GatekeeperService.cs +++ b/OpenSim/Services/HypergridService/GatekeeperService.cs @@ -338,7 +338,7 @@ namespace OpenSim.Services.HypergridService if (m_OglApprovedViewersOnly && !OglApprovedViewerPolicy.IsAllowed(aCircuit.Viewer, aCircuit.Channel)) { - reason = "Only Firestorm or OpenGenesisLINK Viewer is permitted"; + reason = "Only Firestorm, OpenGenesisLINK or Radegast-ng Viewer is permitted"; m_log.InfoFormat("[OGL VIEWER ACCESS]: Rejected Hypergrid arrival using viewer {0}, channel {1}", aCircuit.Viewer, aCircuit.Channel); return false; diff --git a/doc/NexVerse/GEN1_APPROVED_VIEWERS.md b/doc/NexVerse/GEN1_APPROVED_VIEWERS.md index 9a651fce..6424947b 100644 --- a/doc/NexVerse/GEN1_APPROVED_VIEWERS.md +++ b/doc/NexVerse/GEN1_APPROVED_VIEWERS.md @@ -6,6 +6,7 @@ - **Firestorm Viewer** – `Firestorm` und Firestorm-Channel wie `Firestorm-Releasex64` - **OpenGenesisLINK Viewer** – `OpenGenesisLINK` und der projektinterne Name `OGL Viewer` +- **Radegast-ng** – `Radegast-ng` und kompatibler Alias `Radegast` Andere selbst gemeldete Viewernamen – einschließlich **Darkstorm**, **Hydrastorm**, Alchemy, Singularity, Cool VL und unbekannter Clients – sind nicht zugelassen. @@ -27,7 +28,7 @@ OGLApprovedViewersOnly = true Das gilt sowohl für ROBUST (LoginService **und** GatekeeperService) als auch für jeden Simulator (`OpenSim.ini`). Nach einem Update müssen tatsächlich geladene Konfigurationen auf allen Nodes geprüft und die betroffenen Dienste neu gestartet werden. Für Tests kann die Option in einer isolierten Umgebung auf `false` gesetzt werden. -Bisherige `AllowedClients`/`DeniedClients`-Regeln werden weiterhin angewandt; diese dürfen die zwei offiziellen Viewer nicht zusätzlich ungewollt ausschließen. Die bestehende OGL Viewer Advisor-Empfehlung ist unabhängig davon und bleibt deaktiviert. +Bisherige `AllowedClients`/`DeniedClients`-Regeln werden weiterhin angewandt; diese dürfen die drei zugelassenen Viewer nicht zusätzlich ungewollt ausschließen. Die bestehende OGL Viewer Advisor-Empfehlung ist unabhängig davon und bleibt deaktiviert. ## Hypergrid und Marketplace bleiben offen @@ -39,7 +40,7 @@ OutboundPermission = true DisallowAllExport = false ``` -Berechtigte ausländische Gäste mit Firestorm/OpenGenesisLINK können Gegenstände kaufen, in ihr eigenes Inventar übertragen, heimreisen und sie im Rahmen der üblichen Objektberechtigungen aufstellen. Die HG-Asset-Endpunkte bleiben für autorisierte Transaktionen offen. Die Begrenzung großer Asset-Existenzabfragen aus PR #330 bleibt erhalten. +Berechtigte ausländische Gäste mit einem zugelassenen Viewer können Gegenstände kaufen, in ihr eigenes Inventar übertragen, heimreisen und sie im Rahmen der üblichen Objektberechtigungen aufstellen. Die HG-Asset-Endpunkte bleiben für autorisierte Transaktionen offen. Die Begrenzung großer Asset-Existenzabfragen aus PR #330 bleibt erhalten. ## Sicherheitsgrenze (verpflichtend klar kommunizieren) diff --git a/doc/NexVerse/GEN1_WOLFVOICE_COMPATIBILITY.md b/doc/NexVerse/GEN1_WOLFVOICE_COMPATIBILITY.md new file mode 100644 index 00000000..c2759518 --- /dev/null +++ b/doc/NexVerse/GEN1_WOLFVOICE_COMPATIBILITY.md @@ -0,0 +1,65 @@ +# OpenGenesisLINK Generation 1: wolfvoice 0.2.0 (optionaler Backend-Modus) + +## Status und Abgrenzung + +wolfvoice ist ein **separater Rust-Medienserver**, nicht einfach eine austauschbare OGLVoice-URL. Seine Firestorm-CAPS kommen zwingend aus dem **gehärteten os-webrtc-janus-Regionsaddon**. wolfvoice spricht dessen JSON-RPC, SDP, DTLS/SRTP und LL-WebRTC-Datachannel; der vorhandene OGLVoice/LiveKit-Media-Exchange in NexVerse benutzt dagegen einen anderen Authentisierungs- und Signalisierungsvertrag. **Nicht einfach MediaGatewayUrl auf wolfvoice zeigen.** + +Diese Integration liefert ein **reproduzierbares opt-in Modul-Build**, ein **sicherheitsgeprüftes Aktivierungs-Skript für einen Simulator** und Konfliktvermeidung für die Viewer-CAPS. Nichts wird automatisch auf produktiven Servern installiert, gestartet oder umgeschaltet. Die Quelltexte von wolfvoice und os-webrtc-janus werden **nicht** ungeprüft in den NexVerse-Quellbaum kopiert oder als Docker-Container gestartet. + +Quellen / feste Revisionsstände: +- [wolfvoice](https://github.com/intelligentwolf/wolfvoice), main-Commit `f13ce3c462fd9524e2b3a89f897f7a034357c03d`, Cargo version 0.2.0, Apache-2.0. +- [gehärtetes Regionsaddon](https://github.com/intelligentwolf/os-webrtc-janus/tree/chatsession-p2p-session-id-and-fast-fail), Commit `7f08ce453fc5938beea12c452348d46b3ed1088e`, zwingend für authentifizierten Wolfvoice-Betrieb. Externe Lizenz beachten. + +## Installation auf einer isolierten Generation-1-Entwicklungsregion + +1. Auf einem **separaten Voice-Host** wolfvoice 0.2.0 aus geprüftem Quellstand bereitstellen, TLS-Zertifikat für öffentliche DNS-Adresse, extern UDP **40000–40999**, JSON-RPC TCP **9443 nur für Regionshosts**; **nie** RPC-Schlüssel an Viewer ausgeben. Vor Ausführung das externe `setup.sh` des Projekts prüfen. +2. **Zwei unabhängige Schlüssel** serverseitig erzeugen: `rpc_key` (Relay-Authentisierung) und `cred_key` (Tickets). Auf Voice-Host `/etc/wolfvoice/`, auf jedem Regionenhost z. B. `/etc/opensim/voice_rpc_key` und `/etc/opensim/voice_cred_key` für die OpenSim-Serviceidentität nur lesbar bereitstellen (Dateimodus 0400). Nicht in GitHub, INI, Log, Issue oder Chat veröffentlichen. +3. Im NexVerse-Quellbaum (mit vollständiger Quelle, `dotnet`, `git` und `bin/prebuild.dll`): + ```bash + bash tools/voice/install-wolfvoice-region-addon.sh fetch + bash tools/voice/install-wolfvoice-region-addon.sh build + ``` + Das Skript benutzt `addon-modules/os-webrtc-janus` und den **festen** gehärteten Revision-Stand. Ein bereits abweichender oder lokal modifizierter Checkout wird **nicht** überschrieben. Das standardmäßige `prebuild.xml` in NexVerse schließt `addon-modules/*/prebuild*.xml` automatisch ein. Erforderliche Ausgabedateien: `bin/WebRtcVoice.dll`, `bin/WebRtcVoiceServiceModule.dll`, `bin/WebRtcVoiceRegionModule.dll`. +4. Nach Bereitstellung von Voice-Host und Schlüsseln für den gewählten **Staging-Simulatorprozess**: + ```bash + bash tools/voice/configure-wolfvoice-region.sh https://voice.example.org:9443 + ``` + `voice.example.org` **durch den eigenen TLS-Host ersetzen**. Das Skript verweigert den Platzhalter und fehlende DLLs/Schlüssel; es schreibt ausschließlich die neue `bin/config/wolfvoice.ini` und überschreibt keine vorhandene Datei. Dabei wird `[OGLVoiceViewer] Enabled=false` gesetzt, um konkurrierende Firestorm-CAPS zu verhindern. `[WebRtcVoice] Enabled=true` schaltet die gehärtete Regionserweiterung ein. Legacy Vivox wird abgeschaltet. Nach Prüfungen **diesen** Simulator geordnet neu starten. +5. Estate und Parzelle **Allow Voice Chat** aktivieren. Mit Firestorm **7.1.10 oder neuer** (vorzugsweise aktueller Build) auf Staging testen: lokale Voice-Sitzung, Teilnehmerliste, positionsabhängiges Hören, Sprach-Mute, Regionwechsel, P2P-Text-IM und Gruppenruf. Die WebRTC-IM-CAPS des gehärteten Moduls sind wichtig, weil sonst P2P-Textnachrichten in kompatiblen Viewern blockieren können. + +Ein Simulatorprozess kann mehrere Regionen hosten; in dem Fall wirkt `[WebRtcVoice]` auf alle Regionen im Prozess. Das Ziel ist ein bewusstes **entweder Wolfvoice oder OGLVoice** je Simulatorprozess, kein paralleler Betrieb zweier CAPS-Anbieter für denselben Viewer. + +## Konfiguration nach dem Setup-Skript + +```ini +[OGLVoiceViewer] + Enabled = false + +[WebRtcVoice] + Enabled = true + SpatialVoiceService = WebRtcVoice.dll:WebRtcVoiceServiceConnector + NonSpatialVoiceService = WebRtcVoice.dll:WebRtcVoiceServiceConnector + WebRtcVoiceServerURI = https://MEIN-VOICE-HOST:9443 + RpcKeyFile = /etc/opensim/voice_rpc_key + CredKeyFile = /etc/opensim/voice_cred_key + PositionFeed = true + MessageDetails = false + AcceptLegacyCallCredentials = false + +[VivoxVoice] + enabled = false +``` + +Diese Dateien müssen nach einem Update auf dem **laufenden** Simulator landen. Die beiden Schlüssel dürfen ausschließlich vom Regionsprozess lesbar sein. Die bestehende ROBUST-Verwaltung wird **nicht** auf wolfvoice umkonfiguriert. + +## Betrieb, Status und Sicherheitsgrenzen + +- Der Voice-Host antwortet ohne Relay-Schlüssel auf `https://MEIN-VOICE-HOST:9443/` lediglich mit `ok`. Die Regionshosts senden Authentisierungsheader zum eigentlichen Voice-Service; die Schlüssel gehören niemals in öffentliche Frontends. +- Bei Störung von wolfvoice bleibt der Simulator erreichbar, aber WebRTC-Sprachverbindungen scheitern. Bei IPv4/IPv6, NAT und Firewalls müssen die UDP-Medienports erreichbar sein. +- **Radegast-ng** ist durch die neue Viewer-Zulassung für **Login/Chat** erlaubt. Ob genau diese Radegast-ng-Version selbst den LL-WebRTC-Webclient beherrscht, ist getrennt zu testen; allein eine Viewer-Zulassung aktiviert kein Mikrofon. +- Das separate OGLVoice/LiveKit-Backend bleibt unangetastet; Wolfvoice ist **kein LiveKit-Ersatz über eine OGLVoice-URL**. +- End-to-end-Voice mit echten Firestorm-Clients, externem Rust-Medienserver und Netztransport ist **nicht durch den .NET-Gesamtbuild bewiesen** und benötigt eine Staging-Abnahme auf einem echten Regionshost. + +## Rücknahme + +`bin/config/wolfvoice.ini` im betroffenen Staging-Simulator entfernen bzw. `[WebRtcVoice] Enabled=false` setzen. Danach für die vorherige OGLVoice-Konfiguration `[OGLVoiceViewer] Enabled=true` oder bisherigen Default wiederherstellen und den Simulator neu starten. Die externen, lokal nicht versionierten Addon-Dateien und Schlüssel **nicht blind löschen**, wenn andere Regionen sie verwenden. diff --git a/tools/ci/OglApprovedViewerRegression/Program.cs b/tools/ci/OglApprovedViewerRegression/Program.cs index 5ed01d02..6a801a60 100644 --- a/tools/ci/OglApprovedViewerRegression/Program.cs +++ b/tools/ci/OglApprovedViewerRegression/Program.cs @@ -28,6 +28,14 @@ internal static class Program Check("1.0.0", "OGL Viewer-Release", true); Check("OpenGenesisLINK-Release", null, true); + // Radegast-ng reports its channel in different forms across builds. + Check("Radegast-ng 2.3", "Radegast-ng", true); + Check("Radegast-ng", "", true); + Check("2.3.0", "Radegast-ng", true); + Check("Radegast 2.3", "Radegast", true); + Check("2.3.0", "Radegast", true); + Check("Radegast-ng-malice", "Hydrastorm", false); + // Denials: explicit known Copybot labels and every other viewer family. Check("Darkstorm 2.0", "Darkstorm", false); Check("Hydrastorm 1.0", "Hydrastorm", false); diff --git a/tools/ci/verify_gen1_approved_viewer_access.py b/tools/ci/verify_gen1_approved_viewer_access.py index 1b2b12dc..72ff1d10 100644 --- a/tools/ci/verify_gen1_approved_viewer_access.py +++ b/tools/ci/verify_gen1_approved_viewer_access.py @@ -16,7 +16,7 @@ def section(data, name): policy = read("OpenSim/Framework/OglApprovedViewerPolicy.cs") for marker in ( - '"Firestorm", "OpenGenesisLINK", "OGL Viewer"', + '"Firestorm", "OpenGenesisLINK", "OGL Viewer", "Radegast-ng", "Radegast"', '"Darkstorm", "Hydrastorm", "Copybot"', "StartsWithApprovedName", "ContainsKnownCopybotName", diff --git a/tools/ci/verify_gen1_nexbus_shutdown.py b/tools/ci/verify_gen1_nexbus_shutdown.py new file mode 100644 index 00000000..718338ff --- /dev/null +++ b/tools/ci/verify_gen1_nexbus_shutdown.py @@ -0,0 +1,28 @@ +#!/usr/bin/env python3 +"""Regression guard for NexVerse NodeAgent close/inbound HTTP race.""" +from pathlib import Path + +root = Path(__file__).resolve().parents[2] +src = (root / "NexVerse/RegionModules/NodeAgent/NexVerseNodeAgentModule.cs").read_text(encoding="utf-8-sig") +start = src.index(" private void HandleInbound(") +end = src.index(" private static void WriteInbound(", start) +handler = src[start:end] +close = src.split(" public void Close()",1)[1].split(" public IDisposable Subscribe(",1)[0] + +assert "private int m_Stopping;" in src +assert "Interlocked.Exchange(ref m_Stopping, 1)" in close +assert close.index("Interlocked.Exchange(ref m_Stopping, 1)") < close.index("m_Bus?.Dispose()") +assert 'Volatile.Read(ref m_Stopping) != 0 || !m_Enabled' in handler +assert 'DistributedNexEventBus bus = m_Bus;' in handler +assert 'Volatile.Read(ref m_Stopping) != 0 || bus == null' in handler +assert "bool accepted = bus.Receive(nexEvent);" in handler +assert "catch (ObjectDisposedException)" in handler +assert "HttpStatusCode.ServiceUnavailable" in handler +assert 'new { error = "node_shutting_down" }' in handler +receive_tail = handler.split("bool accepted = bus.Receive(nexEvent);", 1)[1] +assert receive_tail.index("catch (ObjectDisposedException)") < receive_tail.index("catch (Exception e)") +assert "NexBusProtocol.Verify(" in handler +assert handler.index("NexBusProtocol.Verify(") < handler.index("bus.Receive(nexEvent)") +assert 'HttpStatusCode.Unauthorized' in handler + +print("NodeAgent shutdown: early 503, safe in-flight Receive, HMAC preserved") diff --git a/tools/ci/verify_gen1_wolfvoice_compat.py b/tools/ci/verify_gen1_wolfvoice_compat.py new file mode 100644 index 00000000..2e311500 --- /dev/null +++ b/tools/ci/verify_gen1_wolfvoice_compat.py @@ -0,0 +1,49 @@ +#!/usr/bin/env python3 +"""Static checks for opt-in wolfvoice integration and Radegast-ng policy.""" +from pathlib import Path + +root = Path(__file__).resolve().parents[2] +def read(p): + return (root / p).read_text(encoding="utf-8-sig") + +policy = read("OpenSim/Framework/OglApprovedViewerPolicy.cs") +tests = read("tools/ci/OglApprovedViewerRegression/Program.cs") +verify = read("tools/ci/verify_gen1_approved_viewer_access.py") +for item in ('"Firestorm"', '"OpenGenesisLINK"', '"OGL Viewer"', + '"Radegast-ng"', '"Radegast"'): + assert item in policy +assert "Check(\"Radegast-ng\", \"\", true);" in tests +assert "Check(\"2.3.0\", \"Radegast\", true);" in tests +assert "Radegast-ng" in verify + +install = read("tools/voice/install-wolfvoice-region-addon.sh") +configure = read("tools/voice/configure-wolfvoice-region.sh") +doc = read("doc/NexVerse/GEN1_WOLFVOICE_COMPATIBILITY.md") + +assert '7f08ce453fc5938beea12c452348d46b3ed1088e' in install +assert "intelligentwolf/os-webrtc-janus.git" in install +assert "git clone --no-checkout" in install +assert 'git -C "$ADDON_DIR" checkout --detach "$SOURCE_COMMIT"' in install +assert 'git -C "$ADDON_DIR" status --porcelain' in install +assert './runprebuild.sh' in install +assert "dotnet build --configuration Release OpenSim.sln" in install +for dll in ("WebRtcVoice.dll", "WebRtcVoiceRegionModule.dll", "WebRtcVoiceServiceModule.dll"): + assert dll in install and dll in configure, dll + +for marker in ( + "[OGLVoiceViewer]", "Enabled = false", + "[WebRtcVoice]", "Enabled = true", + "WebRtcVoice.dll:WebRtcVoiceServiceConnector", + "RpcKeyFile = $RPC_KEY", "CredKeyFile = $CRED_KEY", + "MessageDetails = false", "PositionFeed = true", + "AcceptLegacyCallCredentials = false", + "[VivoxVoice]", "enabled = false", + "if [[ -e \"$TARGET\" ]]; then", +): + assert marker in configure, marker + +assert "wolfvoice" in doc and "os-webrtc-janus" in doc +assert "OGLVoiceViewer" in doc +assert "/addon-modules/os-webrtc-janus/" in read(".gitignore") +assert "OglVoiceFirestormCapsModule" in read("NexVerse/RegionModules/Voice/OglVoiceFirestormCapsModule.cs") +print("Wolfvoice optional integration + Radegast-ng aliases: source pin, CAPS separation, key checks OK") diff --git a/tools/voice/configure-wolfvoice-region.sh b/tools/voice/configure-wolfvoice-region.sh new file mode 100644 index 00000000..fc5d62c9 --- /dev/null +++ b/tools/voice/configure-wolfvoice-region.sh @@ -0,0 +1,71 @@ +#!/usr/bin/env bash +# SPDX-License-Identifier: MPL-2.0 +# Opt-in configuration for one OpenGenesisLINK simulator process. +# No network downloads, no service restarts, no access to secret contents. +set -euo pipefail + +ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)" +URL="${1:-}" +TARGET="${2:-$ROOT/bin/config/wolfvoice.ini}" +RPC_KEY="${WOLFVOICE_RPC_KEY_FILE:-/etc/opensim/voice_rpc_key}" +CRED_KEY="${WOLFVOICE_CRED_KEY_FILE:-/etc/opensim/voice_cred_key}" + +if [[ ! "$URL" =~ ^https://[A-Za-z0-9][A-Za-z0-9.-]*(:[0-9]{1,5})?/?$ ]]; then + echo "Usage: $0 https://voice.example.org:9443 [target/wolfvoice.ini]" >&2 + echo "Requires HTTPS with a matching, publicly verifiable certificate." >&2 + exit 2 +fi +if [[ "$URL" == *example.* ]]; then + echo "Replace the example host with the real wolfvoice TLS hostname." >&2 + exit 2 +fi + +for dll in WebRtcVoice.dll WebRtcVoiceRegionModule.dll WebRtcVoiceServiceModule.dll; do + [[ -s "$ROOT/bin/$dll" ]] || { + echo "Missing addon assembly $dll; run install-wolfvoice-region-addon.sh first." >&2 + exit 1 + } +done + +for key in "$RPC_KEY" "$CRED_KEY"; do + [[ -r "$key" && -s "$key" ]] || { + echo "Voice key not readable/empty: $key (not printing its contents)." >&2 + exit 1 + } +done + +# No silent overwrite of an existing configured voice backend. +if [[ -e "$TARGET" ]]; then + echo "Refusing to overwrite existing voice config: $TARGET" >&2 + exit 1 +fi +mkdir -p "$(dirname "$TARGET")" +umask 027 +cat > "$TARGET" <&2 + exit 2 +fi + +cd "$ROOT" +for bin in git dotnet; do + command -v "$bin" >/dev/null || { echo "Missing prerequisite: $bin" >&2; exit 1; } +done + +# This repository includes add-ons via addon-modules/*/prebuild*.xml. +# A second in-tree copy would produce conflicting projects/cap handlers. +if [[ -d OpenSim/Addons/os-webrtc-janus || -d Addons/os-webrtc-janus ]]; then + echo "Conflicting in-tree os-webrtc-janus found; refusing duplicate addon." >&2 + exit 1 +fi + +if [[ -e "$ADDON_DIR" ]]; then + if [[ ! -d "$ADDON_DIR/.git" ]]; then + echo "Existing addon directory is not a Git checkout: $ADDON_DIR" >&2 + exit 1 + fi + current="$(git -C "$ADDON_DIR" rev-parse HEAD)" + if [[ "$current" != "$SOURCE_COMMIT" ]]; then + echo "Existing addon has unexpected revision $current; do not overwrite it." >&2 + exit 1 + fi + if [[ -n "$(git -C "$ADDON_DIR" status --porcelain)" ]]; then + echo "Addon checkout has local changes; refusing to continue." >&2 + exit 1 + fi +elif [[ "$BUILD_MODE" == "check" ]]; then + echo "Addon not fetched: $ADDON_DIR" >&2 + exit 1 +else + echo "Fetching pinned hardened addon $SOURCE_COMMIT ..." + git clone --no-checkout "$SOURCE_REPO" "$ADDON_DIR" + git -C "$ADDON_DIR" checkout --detach "$SOURCE_COMMIT" +fi + +for file in prebuild-webrtc.xml prebuild-regionmodule.xml prebuild-servicemodule.xml; do + test -f "$ADDON_DIR/$file" || { echo "Missing $file" >&2; exit 1; } +done + +if [[ "$BUILD_MODE" == "fetch" ]]; then + echo "Pinned wolfvoice region addon fetched, not built." + exit 0 +fi + +if [[ "$BUILD_MODE" == "build" ]]; then + # Regen solution locally; this can touch generated .csproj/.sln files. + # Operator must review 'git status' before committing anything. + ./runprebuild.sh + dotnet build --configuration Release OpenSim.sln +fi + +for dll in WebRtcVoice.dll WebRtcVoiceRegionModule.dll WebRtcVoiceServiceModule.dll; do + test -s "$ROOT/bin/$dll" || { + echo "Missing $ROOT/bin/$dll; addon was not built successfully." >&2 + exit 1 + } +done + +echo "wolfvoice region addon ready at pinned revision $SOURCE_COMMIT." +echo "Only activate after checking TLS, voice keys, and OGLVoiceViewer conflicts." +echo "Next: bash tools/voice/configure-wolfvoice-region.sh https://VOICE-HOST:9443"