feat(worldapi): operator dashboard, admin CRUD, daily audit logs and secure NexBus NodeId archives (#313)
* feat(logging): rotate Robust logs daily into bin/logs/Robust_dd_MM_yyyy.log * feat(logging): rotate OpenSim logs daily into bin/logs/OpenSim_dd_MM_yyyy.log * feat(worldapi): secured paginated per-day ROBUST/OpenSim log reader * feat(worldapi): register secured daily logs in HTTP routing and API catalogs * feat(worldapi): register secured daily logs in HTTP routing and API catalogs * feat(worldapi): register secured daily logs in HTTP routing and API catalogs * feat(worldapi): create grouped daily console logs and audit sections * feat(worldapi): redesigned operator console with daily expandable log browser and grouped audit pages * feat(worldapi): inline admin operation execution and real user create/search/deactivate UI * fix(logging): compile-safe defensive secret redaction regex for operator logs * feat(worldapi): full cinematic responsive operator login redesign with original branding * feat(nexbus): archive authenticated external OpenSim logs daily by NodeId * fix(nexbus): match subscribed Action<NexEvent> handler signature * feat(nexbus): automatically forward daily OpenSim logs from every TLS-connected simulator NodeId with signed replay-safe chunks * feat(nexbus): subscribe ROBUST to authenticated NodeId log batches from connected simulators * feat(logging): include remote NodeId daily archives in secure file list and reader * feat(worldapi): show remote NodeId and archive date in expandable log viewer * security(nexbus): acknowledge remote log batches only after persistence and prevent peer broadcast * security(nexbus): acknowledge remote log batches only after persistence and prevent peer broadcast * security(nexbus): make remote log ingestion synchronous and ack only persisted chunks * security(nexbus): route signed log messages directly to committed NodeId archive receiver * docs(nexbus): enable signed TLS-only external NodeId log sync in NodeAgent example config * docs(worldapi): audit supplied 63-table SQL export against API and code, record retained schemas and NodeId log relay handoff * test(worldapi): gate full operator UI and authenticated NexBus NodeId daily log forwarding * ci(worldapi): run operator dashboard, daily log rotation and signed NodeId relay checks * test(worldapi): retain admin auth requirement across new CRUD, audit and log pages * test(worldapi): accept operator documentation with concrete Robust/OpenSim enum in URL
This commit is contained in:
1 parent
8bdbd81bf7
commit
d979182443
17 files changed
+955
-14
No files matched your search
@@ -89,6 +89,9 @@ jobs:
|
||||
- name: Verify World API Sci-Fi admin dashboard navigation and GitHub releases
|
||||
shell: bash
|
||||
run: python3 tools/ci/verify_worldapi_scifi_admin_center.py
|
||||
- name: Verify operator CRUD, Audit and NodeId daily log relay
|
||||
shell: bash
|
||||
run: python3 tools/ci/verify_ogl_operator_logs_admin.py
|
||||
|
||||
|
||||
- name: Verify OpenGenesisLINK 0.9.3.12 dashboard and diagnostic updates
|
||||
|
||||
@@ -12,6 +12,10 @@ namespace NexVerse.Core.Messaging
|
||||
|
||||
private readonly InMemoryNexEventBus m_Local = new InMemoryNexEventBus();
|
||||
private readonly INexEventTransport m_Transport;
|
||||
// ROBUST-only authenticated NexBus log chunks bypass normal fan-out.
|
||||
// Unlike ordinary bus events, they must never be re-relayed to
|
||||
// third-party simulator peers which would expose private log text.
|
||||
public Func<NexEvent, bool> ReceiveLogChunk { get; set; }
|
||||
private readonly ConcurrentDictionary<Guid, byte> m_Seen =
|
||||
new ConcurrentDictionary<Guid, byte>();
|
||||
private readonly ConcurrentQueue<Guid> m_SeenOrder =
|
||||
|
||||
@@ -70,6 +70,15 @@ namespace NexVerse.RegionModules.NodeAgent
|
||||
private SimulatorNexEventTransport m_Transport;
|
||||
private DistributedNexEventBus m_Bus;
|
||||
private Timer m_HeartbeatTimer;
|
||||
// Secure, cursor-based export to the existing HMAC-authenticated
|
||||
// NexBus peer. Never transport plain files via a public HTTP upload.
|
||||
private Timer m_LogForwardTimer;
|
||||
private HttpClient m_LogForwardClient;
|
||||
private Uri m_LogForwardPeer;
|
||||
private bool m_LogForwardEnabled;
|
||||
private int m_LogForwardRunning;
|
||||
private readonly Dictionary<string, long> m_LogForwardOffsets = new();
|
||||
private readonly object m_LogForwardSync = new();
|
||||
private IDisposable m_CreateRegionSubscription;
|
||||
private IDisposable m_MoveRegionSubscription;
|
||||
private IDisposable m_RegionLifecycleSubscription;
|
||||
@@ -126,6 +135,16 @@ namespace NexVerse.RegionModules.NodeAgent
|
||||
m_NodeId = OglArchiveFeatureGate.ResolveNodeId(
|
||||
config.GetString("NodeId", Environment.MachineName),
|
||||
Environment.MachineName);
|
||||
// Log files can contain personally identifiable information or
|
||||
// credentials. Forward only over TLS (or loopback for local tests).
|
||||
m_LogForwardEnabled = config.GetBoolean("LogForwardingEnabled", true) &&
|
||||
System.Text.RegularExpressions.Regex.IsMatch(m_NodeId,
|
||||
@"^[A-Za-z0-9][A-Za-z0-9._-]{0,63}$") &&
|
||||
(peer.Scheme == Uri.UriSchemeHttps || peer.IsLoopback);
|
||||
if (config.GetBoolean("LogForwardingEnabled", true) && !m_LogForwardEnabled)
|
||||
m_Log.Warn("[NEX-NODE]: Automatic OpenSim log forwarding disabled: " +
|
||||
"NexBus peer must use HTTPS and NodeId must contain safe filename characters.");
|
||||
m_LogForwardPeer = peer;
|
||||
|
||||
m_SharedKey = sharedKey;
|
||||
m_UpdateStagingEnabled = config.GetBoolean("UpdateStagingEnabled", false);
|
||||
@@ -295,6 +314,15 @@ namespace NexVerse.RegionModules.NodeAgent
|
||||
null,
|
||||
TimeSpan.FromSeconds(1),
|
||||
TimeSpan.FromSeconds(m_HeartbeatSeconds));
|
||||
if (m_LogForwardEnabled)
|
||||
{
|
||||
m_LogForwardClient = new HttpClient {
|
||||
Timeout = TimeSpan.FromSeconds(8)
|
||||
};
|
||||
m_LogForwardTimer = new Timer(
|
||||
_ => _ = ForwardDailyLogsSafeAsync(),
|
||||
null, TimeSpan.FromSeconds(8), TimeSpan.FromSeconds(15));
|
||||
}
|
||||
|
||||
Publish(new NexEvent(
|
||||
"node.online",
|
||||
@@ -347,6 +375,8 @@ namespace NexVerse.RegionModules.NodeAgent
|
||||
m_ObjectMessageOutboundRates.Clear();
|
||||
m_ObjectMessageInboundRates.Clear();
|
||||
m_HeartbeatTimer?.Dispose();
|
||||
m_LogForwardTimer?.Dispose();
|
||||
m_LogForwardClient?.Dispose();
|
||||
m_Bus?.Dispose();
|
||||
m_Transport = null;
|
||||
m_Bus = null;
|
||||
@@ -1066,6 +1096,98 @@ namespace NexVerse.RegionModules.NodeAgent
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Keep source offsets only after NexBus HTTP 202 acceptance. Each
|
||||
/// message is signed using the existing NodeAgent HMAC transport key.
|
||||
/// A retry starts at the same offset, so Robust de-duplicates content.
|
||||
/// Read at most 4 * 32 KiB per timer cycle to avoid starving the sim.
|
||||
/// The previous 7 daily archives remain eligible for catch-up.
|
||||
/// </summary>
|
||||
private async Task ForwardDailyLogsSafeAsync()
|
||||
{
|
||||
if (!m_Enabled || !m_LogForwardEnabled ||
|
||||
Interlocked.CompareExchange(ref m_LogForwardRunning, 1, 0) != 0)
|
||||
return;
|
||||
try
|
||||
{
|
||||
int remaining = 4;
|
||||
// An oldest-first replay also synchronizes yesterday's tail
|
||||
// after reconnection, restart or temporary network failure.
|
||||
for (int back = 7; back >= 0 && remaining > 0; --back)
|
||||
{
|
||||
DateTime day = DateTime.Today.AddDays(-back);
|
||||
string dayId = day.ToString("yyyy-MM-dd",
|
||||
System.Globalization.CultureInfo.InvariantCulture);
|
||||
string local = Path.Combine(AppContext.BaseDirectory, "logs",
|
||||
"OpenSim_" + day.ToString("dd_MM_yyyy",
|
||||
System.Globalization.CultureInfo.InvariantCulture) + ".log");
|
||||
if (!File.Exists(local)) continue;
|
||||
|
||||
long cursor;
|
||||
lock (m_LogForwardSync)
|
||||
cursor = m_LogForwardOffsets.TryGetValue(dayId, out long pos) ? pos : 0L;
|
||||
|
||||
while (remaining > 0)
|
||||
{
|
||||
byte[] bytes = new byte[32 * 1024];
|
||||
int count;
|
||||
try
|
||||
{
|
||||
using var input = new FileStream(local, FileMode.Open, FileAccess.Read,
|
||||
FileShare.ReadWrite | FileShare.Delete);
|
||||
if (cursor > input.Length) cursor = 0L;
|
||||
input.Position = cursor;
|
||||
count = await input.ReadAsync(bytes.AsMemory(0, bytes.Length))
|
||||
.ConfigureAwait(false);
|
||||
}
|
||||
catch (IOException) { break; }
|
||||
catch (UnauthorizedAccessException) { break; }
|
||||
if (count == 0) break;
|
||||
if (count != bytes.Length) Array.Resize(ref bytes, count);
|
||||
|
||||
var envelope = new NexEvent("node.log.chunk", "nexverse.simulator",
|
||||
new Dictionary<string, string> {
|
||||
["node_id"] = m_NodeId,
|
||||
["date"] = dayId,
|
||||
["offset"] = cursor.ToString(
|
||||
System.Globalization.CultureInfo.InvariantCulture),
|
||||
["bytes_base64"] = Convert.ToBase64String(bytes)
|
||||
});
|
||||
byte[] payload = NexBusProtocol.Serialize(envelope);
|
||||
using var outgoing = new HttpRequestMessage(HttpMethod.Post, m_LogForwardPeer);
|
||||
outgoing.Headers.TryAddWithoutValidation("X-NexBus-Node", m_NodeId);
|
||||
outgoing.Headers.TryAddWithoutValidation("X-NexBus-Schema",
|
||||
NexVerse.Core.NexVersePlatform.NexBusSchemaVersion);
|
||||
outgoing.Headers.TryAddWithoutValidation("X-NexBus-Signature",
|
||||
"sha256=" + NexBusProtocol.Sign(payload, m_SharedKey));
|
||||
outgoing.Content = new ByteArrayContent(payload);
|
||||
outgoing.Content.Headers.ContentType = new MediaTypeHeaderValue("application/json");
|
||||
using HttpResponseMessage result = await m_LogForwardClient.SendAsync(outgoing)
|
||||
.ConfigureAwait(false);
|
||||
if (result.StatusCode != HttpStatusCode.Accepted) return;
|
||||
// 'accepted=false' means the NexBus replay/dedup gate
|
||||
// rejected this particular event; never lose the cursor.
|
||||
byte[] reply = await result.Content.ReadAsByteArrayAsync()
|
||||
.ConfigureAwait(false);
|
||||
using JsonDocument ack = JsonDocument.Parse(reply);
|
||||
if (!ack.RootElement.TryGetProperty("accepted", out JsonElement accepted) ||
|
||||
accepted.ValueKind != JsonValueKind.True)
|
||||
return;
|
||||
cursor += count;
|
||||
lock (m_LogForwardSync) m_LogForwardOffsets[dayId] = cursor;
|
||||
--remaining;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception error)
|
||||
{
|
||||
if (error is not OperationCanceledException)
|
||||
m_Log.Debug("[NEX-NODE]: Signed log sync will retry: " + error.GetType().Name);
|
||||
}
|
||||
finally { Volatile.Write(ref m_LogForwardRunning, 0); }
|
||||
}
|
||||
|
||||
private void PublishHeartbeatSafe()
|
||||
{
|
||||
try
|
||||
|
||||
@@ -242,6 +242,43 @@ main{padding:28px clamp(17px,3vw,52px)}
|
||||
#page-repository .section{min-height:125px}
|
||||
@media(max-width:1180px){.ogl-status-grid{grid-template-columns:repeat(2,minmax(0,1fr))}.ogl-release-grid{grid-template-columns:1fr 1fr}}
|
||||
@media(max-width:850px){.shell{grid-template-columns:1fr}nav{position:relative;top:auto;width:100%;height:auto;max-height:440px}.nav-scroll{max-height:285px}.ogl-status-grid,.ogl-release-grid,.ogl-panel-split,.ogl-operation-grid{grid-template-columns:1fr}.ogl-command-bar{align-items:start;flex-direction:column}.navmeta{display:none}}
|
||||
|
||||
/* Operator Control Center 3.0 – restrained, legible aerospace design */
|
||||
:root{--bg:#060d19;--panel:#111d2c;--panel2:#17283d;--line:#28435a;--text:#edf4fc;--muted:#9cb3c8;--accent:#52c9eb;--accent2:#89aaff;--good:#56d9a9;--shadow:0 8px 28px rgba(0,0,0,.24)}
|
||||
body{background:linear-gradient(148deg,#0a1628 0%,#050a14 56%,#0a1020 100%);font-family:Inter,ui-sans-serif,system-ui,-apple-system,"Segoe UI",sans-serif}
|
||||
.shell{grid-template-columns:276px minmax(0,1fr)}
|
||||
nav{width:276px;background:#091423;border-right:1px solid #243b53}
|
||||
.ogl-brand{border-bottom:1px solid #253c52}
|
||||
.navgroup summary{color:#9db4ca;letter-spacing:.08em}
|
||||
.navbtn{font-size:13px}.navbtn.active{box-shadow:inset 3px 0 #4fcbed;color:#ebfaff;background:#162f43}
|
||||
main{max-width:1900px;width:100%;margin:0 auto}
|
||||
.hero{border-radius:14px;background:linear-gradient(108deg,#152c43,#101d31 64%,#10182b);box-shadow:none;border:1px solid #2b4962;min-height:145px}
|
||||
.hero:before{opacity:.25}
|
||||
.ogl-status-card,.ogl-release-card,.section,.card{background:#111f31;border:1px solid #2c4358;box-shadow:none;border-radius:12px}
|
||||
.ogl-status-card:before{background:#4fcbed;opacity:.55}
|
||||
.ogl-command-bar h2{font-size:26px}.ogl-opcard{background:#0d1929;border:1px solid #2d455c}
|
||||
.ogl-opcard:hover{background:#172d43}
|
||||
.ogl-log-list{display:grid;gap:9px}
|
||||
.ogl-day{background:#0b192a;border:1px solid #2c455c;border-radius:10px;overflow:hidden}
|
||||
.ogl-day summary{cursor:pointer;padding:17px 18px;display:flex;align-items:center;gap:10px;justify-content:space-between;font-weight:700}
|
||||
.ogl-day summary:hover{background:#122b42}
|
||||
.ogl-log-body{padding:14px;border-top:1px solid #29435e}
|
||||
.ogl-logs-pre{font:12px/1.65 ui-monospace,SFMono-Regular,Consolas,monospace;max-height:560px;overflow:auto;white-space:pre-wrap;overflow-wrap:anywhere;background:#06111e;color:#bdd6e6;padding:16px;border-radius:9px;border:1px solid #20384d}
|
||||
.ogl-audit-line{padding:12px;border-bottom:1px solid #294052;display:grid;grid-template-columns:178px 160px 1fr;gap:12px;color:#cad9e9;overflow-wrap:anywhere}
|
||||
.ogl-action-surface{border:1px solid #3c6e86;border-radius:12px;background:#10273a;padding:19px;margin:16px 0}
|
||||
.ogl-action-surface h3{margin:0 0 8px;font-size:17px}
|
||||
.ogl-action-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:11px;margin:14px 0}
|
||||
.ogl-action-field{display:flex;flex-direction:column;gap:6px;min-width:0}
|
||||
.ogl-action-field label{color:#a9c7df;font-size:12px}
|
||||
.ogl-action-surface textarea{min-height:145px;width:100%;font-family:ui-monospace,monospace}
|
||||
.ogl-action-surface pre{font-size:12px;max-height:420px;overflow:auto;white-space:pre-wrap;overflow-wrap:anywhere;background:#061321;border-radius:8px;padding:14px}
|
||||
.ogl-action-buttonrow{display:flex;gap:9px;flex-wrap:wrap;margin-top:11px}
|
||||
.ogl-inline-admin{display:flex;flex-wrap:wrap;gap:10px;margin:16px 0}
|
||||
.ogl-inline-admin input{flex:1;min-width:140px}
|
||||
.ogl-user-results{display:grid;gap:8px;margin:10px 0}
|
||||
.ogl-user-row{display:flex;flex-wrap:wrap;gap:12px;align-items:center;justify-content:space-between;background:#0b1b2d;border:1px solid #31475b;border-radius:9px;padding:11px}
|
||||
.ogl-user-row small{color:#a1bacf}
|
||||
@media(max-width:900px){.ogl-audit-line{grid-template-columns:1fr}.ogl-action-grid{grid-template-columns:1fr}}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
@@ -259,7 +296,8 @@ main{padding:28px clamp(17px,3vw,52px)}
|
||||
<button class="navbtn" data-page="grid">Grid-Planer & Regionen</button>
|
||||
<button class="navbtn" data-page="nodes">Simulator-Nodes</button>
|
||||
<button class="navbtn" data-page="estates">Estates & Land</button>
|
||||
<button class="navbtn" data-page="console">Konsole & Aufträge</button></details>
|
||||
<button class="navbtn" data-page="console">Konsole & Aufträge</button>
|
||||
<button class="navbtn" data-page="logs">ROBUST / OpenSim Logs</button></details>
|
||||
<details class="navgroup"><summary>Einwohner & Communities</summary>
|
||||
<button class="navbtn" data-page="users">Benutzer & Avatare</button>
|
||||
<button class="navbtn" data-page="groups">Gruppen & Rollen</button>
|
||||
@@ -272,7 +310,8 @@ main{padding:28px clamp(17px,3vw,52px)}
|
||||
<button class="navbtn" data-page="experiences">Experiences</button></details>
|
||||
<details class="navgroup"><summary>API & Sicherheit</summary>
|
||||
<button class="navbtn" data-page="secrets">API-Schlüssel & Scopes</button>
|
||||
<button class="navbtn" data-page="security">Sicherheit & Audit</button>
|
||||
<button class="navbtn" data-page="security">Sicherheit</button>
|
||||
<button class="navbtn" data-page="audit">Audit-Protokoll</button>
|
||||
<button class="navbtn" data-page="explorer">API-Explorer</button>
|
||||
<button class="navbtn" data-page="chatgpt">Portale & Integration</button>
|
||||
<button class="navbtn" data-page="adminlogin">Admin-Anmeldung</button></details>
|
||||
@@ -336,7 +375,17 @@ main{padding:28px clamp(17px,3vw,52px)}
|
||||
</div>
|
||||
<div class="section"><div class="ogl-section-flex"><div><h2>Repository-Verbindung</h2><p class="sectionlead" id="githubUpdated">Die Daten werden ausschließlich lesend von der offiziellen GitHub-API geladen.</p></div><button class="action" id="githubRefresh" type="button">Jetzt aktualisieren</button></div><div class="ogl-mini-status" id="githubLastCommit">Kein Commit geladen.</div><div class="ogl-mini-status" id="githubReleaseNotes">Keine Release-Informationen geladen.</div><p class="authnote">Hinweis: Eine GitHub-Freigabe ist nicht identisch mit der momentan auf diesem ROBUST-Host installierten Version. Der lokale Build steht im Dashboard unter „Server“.</p></div>
|
||||
</section>
|
||||
<section class="page" id="page-users">
|
||||
<section class="page" id="page-users"><div class="section"><h2>Benutzerverwaltung</h2><p class="sectionlead">Einwohner direkt erstellen, suchen und deaktivieren. Serverprüfungen und Audit sind aktiv.</p>
|
||||
<form id="oglUserCreate" class="ogl-action-surface"><h3>Neues Benutzerkonto</h3><div class="ogl-action-grid">
|
||||
<label class="ogl-action-field">Vorname<input id="oglFirstName" required maxlength="64"></label>
|
||||
<label class="ogl-action-field">Nachname<input id="oglLastName" required maxlength="64"></label>
|
||||
<label class="ogl-action-field">E-Mail-Adresse<input id="oglUserEmail" type="email"></label>
|
||||
<label class="ogl-action-field">Initialpasswort<input id="oglUserPassword" type="password" autocomplete="new-password" required minlength="8"></label>
|
||||
<label class="ogl-action-field">Startregion<input id="oglHomeRegion" required placeholder="Magdeburg"></label></div>
|
||||
<button type="submit" class="action">Benutzer jetzt anlegen</button><pre id="oglUserCreateResult" class="ogl-logs-pre" hidden></pre></form>
|
||||
<div class="ogl-action-surface"><h3>Benutzer suchen / verwalten</h3><div class="ogl-inline-admin"><input id="oglUserQuery" placeholder="Mindestens zwei Zeichen"><button id="oglUserSearch" class="action" type="button">Suchen</button></div><p id="oglUserSearchStatus" class="authnote"></p><div id="oglUserResults" class="ogl-user-results"></div></div>
|
||||
</div>
|
||||
|
||||
<div class="hero"><div><div class="eyebrow">OGL CONTROL PLANE · USERS</div><h1>Benutzer & Avatare</h1><p>Einwohnerkonten, Registrierung, Profile, Aktivität und Sperr-/Löschabläufe.</p></div><div class="pill"><span class="dot good"></span><span>Autoritative API</span></div></div>
|
||||
<div class="section"><h2>Verfügbare Verwaltungsoperationen</h2><p class="sectionlead">Aus dem aktiven OpenAPI-Vertrag dieses Servers. Ein Klick öffnet die echte Operation mit Parametern, Berechtigungen und Ausführung im API-Explorer; nicht vorhandene Funktionen werden nicht simuliert.</p><div class="ogl-workspace-tools"><input aria-label="Operationen filtern" data-workspace-search="users" placeholder="Operation oder Pfad filtern…"><span id="workspace-count-users">–</span></div><div class="ogl-operation-grid" id="workspace-users"><div class="empty">API-Vertrag wird geladen…</div></div></div>
|
||||
</section>
|
||||
@@ -380,6 +429,10 @@ main{padding:28px clamp(17px,3vw,52px)}
|
||||
<div class="hero"><div><div class="eyebrow">OGL CONTROL PLANE · CONSOLE</div><h1>Konsole & Aufträge</h1><p>Kontrollierte Serverfunktionen und Jobs über bereits geprüfte HTTP-Endpunkte. Keine unbeschränkte Shell.</p></div><div class="pill"><span class="dot good"></span><span>Autoritative API</span></div></div>
|
||||
<div class="section"><h2>Verfügbare Verwaltungsoperationen</h2><p class="sectionlead">Aus dem aktiven OpenAPI-Vertrag dieses Servers. Ein Klick öffnet die echte Operation mit Parametern, Berechtigungen und Ausführung im API-Explorer; nicht vorhandene Funktionen werden nicht simuliert.</p><div class="ogl-workspace-tools"><input aria-label="Operationen filtern" data-workspace-search="console" placeholder="Operation oder Pfad filtern…"><span id="workspace-count-console">–</span></div><div class="ogl-operation-grid" id="workspace-console"><div class="empty">API-Vertrag wird geladen…</div></div></div>
|
||||
</section>
|
||||
<section class="page" id="page-logs"><div class="hero"><div><div class="eyebrow">OBSERVABILITY · DIAGNOSTICS</div><h1>Tagesprotokolle</h1><p>ROBUST und lokale OpenSim-Logs werden nach Kalendertag archiviert. Archive öffnen, blättern und Fehler filtern – ohne Konsolenzugriff oder Download fremder Dateien.</p></div><div class="pill"><span class="dot" id="oglLogsDot"></span><span id="oglLogsStatus">Noch nicht geladen</span></div></div>
|
||||
<div class="section"><div class="ogl-section-flex"><div><h2>Logarchiv</h2><p class="sectionlead">Sortiert nach Datum (neueste zuerst). Die OpenSim-Liste zeigt nur Dateien, die auf demselben Server vorhanden sind; fremde Simulator-Nodes benötigen ihren eigenen geschützten Logdienst.</p></div><button class="action" id="oglLogsRefresh" type="button">Tagesarchive laden</button></div><div class="ogl-workspace-tools"><select id="oglLogsService" aria-label="Logdienst"><option value="all">Alle Dienste</option><option value="Robust">ROBUST</option><option value="OpenSim">OpenSim</option></select><input id="oglLogsSearch" type="search" placeholder="In geladenen Logzeilen filtern…"><span id="oglLogsCount">–</span></div><div id="oglLogArchiveList" class="ogl-log-list"><div class="empty">Zum Öffnen der Logarchive mit einer gültigen Administrator-Sitzung anmelden.</div></div></div></section>
|
||||
<section class="page" id="page-audit"><div class="hero"><div><div class="eyebrow">SECURITY · TRACEABILITY</div><h1>Audit & Ereignisse</h1><p>Die bereits gespeicherten Administrationsaktionen mit Zeit, Akteur, Ressource und Korrelation; gruppiert nach Datum. Keine Änderung oder Löschung von Audit-Ereignissen.</p></div><div class="pill"><span class="dot" id="oglAuditDot"></span><span id="oglAuditStatus">Noch nicht geladen</span></div></div>
|
||||
<div class="section"><div class="ogl-section-flex"><div><h2>Administrations-Audit</h2><p class="sectionlead">Abfrage der bestehenden persistenten World-API-Audit-Historie. Datumseinträge zeigen die aktuell geladene Ergebnismenge; ältere Datensätze können seitenweise nachgeladen werden.</p></div><button class="action" id="oglAuditRefresh" type="button">Audit laden</button></div><div class="ogl-workspace-tools"><input id="oglAuditActor" placeholder="Akteur (optional)"><input id="oglAuditAction" placeholder="Aktion (optional)"><input id="oglAuditResource" placeholder="Ressource (optional)"></div><div id="oglAuditEntries" class="ogl-log-list"></div><button class="action" id="oglAuditMore" type="button" hidden>Weitere Auditeinträge laden</button></div></section>
|
||||
<section class="page" id="page-diagnostics">
|
||||
<div class="hero"><div><div class="eyebrow">OGL CONTROL PLANE / DIAGNOSTICS</div><h1>Systemdiagnose</h1><p>Prüfe die tatsächlich erreichbaren World-API-Dienste dieses OGL-Servers. Kein Demo-Status, keine Datenbankänderungen.</p></div><div class="pill"><span class="dot" id="diagDot"></span><span id="diagSummary">Noch nicht geprüft</span></div></div>
|
||||
<div class="section"><h2>Live-Selbsttest</h2><p class="sectionlead">Diese Prüfung liest ausschließlich den aktuellen Health-/Versions-/OpenAPI-Zustand, die ChatGPT-Anweisung und den optionalen Node-Lizenzdienst. Keine schreibenden Aktionen.</p>
|
||||
@@ -961,11 +1014,105 @@ function oglRenderWorkspaces(){
|
||||
const path=document.createElement('code');path.textContent=entry.path;
|
||||
const summary=document.createElement('small');summary.textContent=entry.op.summary||'API-Operation';
|
||||
const scope=document.createElement('small');scope.textContent='Scope: '+(entry.op['x-nexverse-scope']||'laut OpenAPI-Vertrag');
|
||||
b.append(badge,path,summary,scope);b.addEventListener('click',()=>oglWorkspaceOpen(entry));host.append(b);
|
||||
b.append(badge,path,summary,scope);b.addEventListener('click',()=>oglActionEditor(domain,entry));host.append(b);
|
||||
}
|
||||
}
|
||||
}
|
||||
document.querySelectorAll('[data-workspace-search]').forEach(input=>input.addEventListener('input',oglRenderWorkspaces));
|
||||
|
||||
/* Inline API editor. No permission shortcut: every action uses the signed
|
||||
* administrator bearer token and the existing server-side World API. */
|
||||
function oglActionEditor(domain,entry){
|
||||
const host=$('workspace-'+domain);if(!host)return;
|
||||
let panel=$('oglAction-'+domain);
|
||||
if(!panel){panel=document.createElement('div');panel.id='oglAction-'+domain;panel.className='ogl-action-surface';host.parentNode.insertBefore(panel,host)}
|
||||
panel.replaceChildren();
|
||||
panel.append(oglPlain('h3','',entry.method+' '+entry.path),oglPlain('p','sectionlead',entry.op.summary||'World API'));
|
||||
const form=document.createElement('form'), fields=document.createElement('div');fields.className='ogl-action-grid';
|
||||
const params=[];
|
||||
const pathNames=[...entry.path.matchAll(/\{([^}]+)\}/g)].map(m=>m[1]);
|
||||
const queryNames=(entry.op.parameters||[]).filter(x=>x.in==='query');
|
||||
for(const param of [...pathNames.map(name=>({name,in:'path',required:true})),...queryNames]){
|
||||
const wrapper=document.createElement('label');wrapper.className='ogl-action-field';wrapper.textContent=param.name+(param.in==='path'?' · UUID / ID':' · Query');
|
||||
const input=document.createElement('input');input.required=param.required===true;input.placeholder=param.description||param.name;
|
||||
wrapper.append(input);fields.append(wrapper);params.push({def:param,input});
|
||||
}
|
||||
if(params.length)form.append(fields);
|
||||
let bodyInput=null;const schema=requestSchema(entry.op);
|
||||
if(schema){
|
||||
const label=oglPlain('label','label2','Anfragedaten (JSON)');
|
||||
bodyInput=document.createElement('textarea');bodyInput.setAttribute('aria-label','JSON-Anfrage');bodyInput.spellcheck=false;bodyInput.value=JSON.stringify(exampleFor(schema),null,2);
|
||||
form.append(label,bodyInput);
|
||||
}
|
||||
const bar=document.createElement('div');bar.className='ogl-action-buttonrow';
|
||||
const run=document.createElement('button');run.type='submit';run.className='action';run.textContent=entry.method+' ausführen';
|
||||
const detail=document.createElement('button');detail.type='button';detail.className='action';detail.textContent='API-Details';
|
||||
detail.addEventListener('click',()=>oglWorkspaceOpen(entry));
|
||||
bar.append(run,detail);form.append(bar);
|
||||
const status=oglPlain('p','authnote','Authentifizierte World-API-Operation; Rechteprüfung erfolgt serverseitig.');
|
||||
const output=document.createElement('pre');output.className='ogl-logs-pre';output.hidden=true;
|
||||
panel.append(form,status,output);
|
||||
form.addEventListener('submit',async e=>{
|
||||
e.preventDefault();if(!adminIsActive()){status.textContent='Bitte als Administrator anmelden.';return}
|
||||
let url=entry.path;const query=new URLSearchParams();
|
||||
for(const {def,input} of params){const v=input.value.trim();if(!v&&def.required){status.textContent=def.name+' fehlt';return}
|
||||
if(def.in==='path')url=url.replace('{'+def.name+'}',encodeURIComponent(v));
|
||||
else if(v)query.set(def.name,v);
|
||||
}
|
||||
if(query.toString())url+='?'+query.toString();
|
||||
if(!url.startsWith('/api/v1/')||url.includes('{')){status.textContent='Ungültige World-API-URL';return}
|
||||
const body=bodyInput?.value.trim()||'';if(body){try{JSON.parse(body)}catch{status.textContent='JSON-Anfrage ist ungültig';return}}
|
||||
if(entry.method!=='GET'&&entry.method!=='HEAD'){
|
||||
const destructive=entry.method==='DELETE'||/reset|revoke|ban|purge|delete/i.test(entry.path);
|
||||
if(destructive){if(prompt('Zur Bestätigung AUSFÜHREN eintippen: '+entry.method+' '+url)!=='AUSFÜHREN')return}
|
||||
else if(!confirm(entry.method+' '+url+' wirklich ausführen?'))return;
|
||||
}
|
||||
run.disabled=true;status.textContent='Anfrage läuft…';output.hidden=false;output.textContent='';
|
||||
try{
|
||||
const options={method:entry.method};if(body&&entry.method!=='GET')options.body=body;
|
||||
const result=await oglRequest(url,options);
|
||||
output.textContent=JSON.stringify(result,null,2);status.textContent='Server meldet Erfolg';
|
||||
}catch(error){status.textContent='Fehler: '+error.message}
|
||||
finally{run.disabled=false}
|
||||
});
|
||||
panel.scrollIntoView({behavior:'smooth',block:'nearest'});
|
||||
}
|
||||
async function oglCreateUser(event){
|
||||
event.preventDefault();const out=$('oglUserCreateResult');out.hidden=false;out.textContent='Benutzer wird angelegt…';
|
||||
try{
|
||||
const json=await oglRequest('/api/v1/users',{method:'POST',body:JSON.stringify({
|
||||
first_name:$('oglFirstName').value.trim(),last_name:$('oglLastName').value.trim(),
|
||||
email:$('oglUserEmail').value.trim(),password:$('oglUserPassword').value,
|
||||
home_region:{name:$('oglHomeRegion').value.trim()}
|
||||
})});
|
||||
out.textContent='Benutzer angelegt: '+JSON.stringify(json,null,2);
|
||||
}catch(error){out.textContent=error.message}finally{$('oglUserPassword').value=''}
|
||||
}
|
||||
async function oglSearchUsers(){
|
||||
const q=$('oglUserQuery').value.trim(),host=$('oglUserResults');host.replaceChildren();
|
||||
if(q.length<2){$('oglUserSearchStatus').textContent='Mindestens 2 Zeichen benötigt';return}
|
||||
try{
|
||||
const data=await oglRequest('/api/v1/users?q='+encodeURIComponent(q)+'&limit=50');
|
||||
const users=data.users||data.results||data.items||[];
|
||||
$('oglUserSearchStatus').textContent=users.length+' Ergebnisse';
|
||||
for(const user of users){
|
||||
const id=user.principal_id||user.principalId||user.user_id||user.id;
|
||||
const row=document.createElement('div');row.className='ogl-user-row';
|
||||
row.append(oglPlain('strong','',(user.first_name||user.firstName||'')+' '+(user.last_name||user.lastName||'')),
|
||||
oglPlain('small','',id||'Keine ID'));
|
||||
const buttons=document.createElement('div');buttons.className='ogl-action-buttonrow';
|
||||
const view=document.createElement('button');view.className='action';view.textContent='Details';view.type='button';
|
||||
view.onclick=async()=>{try{const data=await oglRequest('/api/v1/users/'+encodeURIComponent(id));row.append(oglPlain('pre','ogl-logs-pre',JSON.stringify(data,null,2)))}catch(e){$('oglUserSearchStatus').textContent=e.message}};
|
||||
const remove=document.createElement('button');remove.className='action';remove.textContent='Deaktivieren';remove.type='button';
|
||||
remove.onclick=async()=>{if(prompt('Benutzer deaktivieren (Soft-Delete)? Bitte DEAKTIVIEREN eingeben: '+id)!=='DEAKTIVIEREN')return;
|
||||
try{await oglRequest('/api/v1/users/'+encodeURIComponent(id),{method:'DELETE'});$('oglUserSearchStatus').textContent='Konto deaktiviert';await oglSearchUsers()}catch(e){$('oglUserSearchStatus').textContent=e.message}};
|
||||
buttons.append(view,remove);row.append(buttons);host.append(row);
|
||||
}
|
||||
if(!users.length)host.append(oglPlain('p','empty','Keine Benutzer gefunden.'));
|
||||
}catch(error){$('oglUserSearchStatus').textContent=error.message}
|
||||
}
|
||||
$('oglUserCreate').addEventListener('submit',oglCreateUser);
|
||||
$('oglUserSearch').addEventListener('click',oglSearchUsers);
|
||||
function oglGithubText(id,text){const element=$(id);if(element)element.textContent=String(text||'–')}
|
||||
async function oglLoadGithub(force=false){
|
||||
if(oglGitPending)return oglGitPending;
|
||||
@@ -1033,8 +1180,132 @@ function oglFilterKeys(){
|
||||
card.hidden=!(matching&&(filter==='all'||(filter==='active'&&active)||(filter==='disabled'&&!active)));
|
||||
});
|
||||
}
|
||||
|
||||
/* Direct operators: all changes go to existing server-side authorized APIs. */
|
||||
const oglLogState=new Map();
|
||||
let oglAuditOffset=0,oglAuditEvents=[];
|
||||
function oglAdminHeaders(body=false){
|
||||
const token=adminAuthToken();
|
||||
if(!token)throw Error('UserLevel-200-Administrator-Anmeldung erforderlich.');
|
||||
const headers={Accept:'application/json',Authorization:'Bearer '+token};
|
||||
if(body)headers['Content-Type']='application/json';
|
||||
return headers;
|
||||
}
|
||||
async function oglRequest(path,options={}){
|
||||
if(!path.startsWith('/api/v1/')||path.startsWith('//')||path.includes('\\'))throw Error('Nur lokale World-API-Routen sind erlaubt.');
|
||||
const response=await fetch(path,{...options,headers:{...oglAdminHeaders(!!options.body),...(options.headers||{})},credentials:'same-origin',cache:'no-store'});
|
||||
const raw=await response.text();let json;
|
||||
try{json=JSON.parse(raw)}catch{json={message:raw.slice(0,6000)}}
|
||||
if(!response.ok)throw Error('HTTP '+response.status+' · '+(json.error||json.message||'API-Anfrage fehlgeschlagen'));
|
||||
return json;
|
||||
}
|
||||
function oglCleanDate(timestamp){
|
||||
const value=new Date(timestamp);
|
||||
return Number.isNaN(value.getTime())?'Unbekanntes Datum':value.toLocaleDateString('de-DE',{year:'numeric',month:'2-digit',day:'2-digit'});
|
||||
}
|
||||
function oglPlain(tag,cls,value){
|
||||
const e=document.createElement(tag);if(cls)e.className=cls;e.textContent=String(value??'');return e;
|
||||
}
|
||||
async function oglLoadLogIndex(){
|
||||
$('oglLogsStatus').textContent='Lade Archive…';$('oglLogsDot').className='dot';
|
||||
try{
|
||||
const data=await oglRequest('/api/v1/admin/logs');
|
||||
const chosen=$('oglLogsService').value;
|
||||
const files=(data.files||[]).filter(x=>chosen==='all'||x.service===chosen)
|
||||
.sort((a,b)=>String(b.date).localeCompare(String(a.date))||String(a.service).localeCompare(String(b.service)));
|
||||
const host=$('oglLogArchiveList');host.replaceChildren();oglLogState.clear();
|
||||
$('oglLogsCount').textContent=files.length+' Tagesarchive';
|
||||
if(!files.length)host.append(oglPlain('p','empty','Noch keine tagesweise protokollierten Dateien auf diesem Host.'));
|
||||
for(const file of files){
|
||||
const row=document.createElement('details');row.className='ogl-day';
|
||||
const heading=document.createElement('summary');
|
||||
const title=file.service+(file.node_id?' · Node '+file.node_id:' · lokal')+
|
||||
' Log vom '+oglCleanDate(file.date+'T12:00:00');
|
||||
heading.append(oglPlain('span','',title),oglPlain('small','',Math.round((file.bytes||0)/1024)+' KiB'));
|
||||
const body=document.createElement('div');body.className='ogl-log-body';
|
||||
const pre=document.createElement('pre');pre.className='ogl-logs-pre';pre.textContent='Zum Laden aufklappen.';
|
||||
const more=document.createElement('button');more.className='action';more.type='button';more.textContent='Weitere Logzeilen';more.hidden=true;
|
||||
body.append(pre,more);row.append(heading,body);host.append(row);
|
||||
const state={file,lines:[],offset:0,more:false,loading:false,loaded:false};
|
||||
oglLogState.set(row,state);
|
||||
const render=()=>{
|
||||
const q=$('oglLogsSearch').value.trim().toLowerCase();
|
||||
pre.textContent=state.lines.filter(x=>!q||x.toLowerCase().includes(q)).join('\\n')||'Keine passenden Logzeilen.';
|
||||
more.hidden=!state.more;
|
||||
};
|
||||
const load=async()=>{
|
||||
if(state.loading||(!state.more&&state.loaded))return;
|
||||
state.loading=true;more.disabled=true;
|
||||
pre.textContent=state.loaded?'Lade weitere Zeilen…':'Lese Tagesarchiv…';
|
||||
try{
|
||||
const endpoint='/api/v1/admin/logs/'+file.service+'/'+file.date+
|
||||
'/entries?offset='+state.offset+'&limit=500'+
|
||||
(file.node_id?'&node_id='+encodeURIComponent(file.node_id):'');
|
||||
const result=await oglRequest(endpoint);
|
||||
state.lines.push(...(result.lines||[]));state.offset=result.next_offset;
|
||||
state.more=Boolean(result.has_more);state.loaded=true;render();
|
||||
}catch(e){pre.textContent='Log konnte nicht geladen werden: '+e.message}
|
||||
finally{state.loading=false;more.disabled=false}
|
||||
};
|
||||
row.addEventListener('toggle',()=>{if(row.open&&!state.loaded)load()});
|
||||
more.addEventListener('click',load);
|
||||
}
|
||||
$('oglLogsStatus').textContent=files.length+' Tagesarchive';$('oglLogsDot').className='dot good';
|
||||
}catch(error){$('oglLogsStatus').textContent=error.message;$('oglLogsDot').className='dot bad'}
|
||||
}
|
||||
function oglFilterLogLines(){
|
||||
for(const [row,state] of oglLogState.entries()){
|
||||
if(!state.loaded)continue;
|
||||
const pre=row.querySelector('pre'),q=$('oglLogsSearch').value.trim().toLowerCase();
|
||||
pre.textContent=state.lines.filter(x=>!q||x.toLowerCase().includes(q)).join('\\n')||'Keine passenden Logzeilen.';
|
||||
}
|
||||
}
|
||||
async function oglLoadAudit(next=false){
|
||||
if(!next){oglAuditOffset=0;oglAuditEvents=[]}
|
||||
$('oglAuditStatus').textContent='Lade Audit…';$('oglAuditDot').className='dot';
|
||||
const p=new URLSearchParams({limit:'100',offset:String(oglAuditOffset)});
|
||||
for(const [id,param] of [['oglAuditActor','actor'],['oglAuditAction','action'],['oglAuditResource','resource']]){
|
||||
const val=$(id).value.trim();if(val)p.set(param,val);
|
||||
}
|
||||
try{
|
||||
const data=await oglRequest('/api/v1/audit?'+p.toString());
|
||||
oglAuditEvents.push(...(data.events||[]));
|
||||
oglAuditOffset+=data.events?.length||0;
|
||||
const buckets=new Map();
|
||||
for(const event of oglAuditEvents){
|
||||
const day=oglCleanDate(event.timestamp);
|
||||
if(!buckets.has(day))buckets.set(day,[]);
|
||||
buckets.get(day).push(event);
|
||||
}
|
||||
const host=$('oglAuditEntries');host.replaceChildren();
|
||||
for(const [day,events] of buckets){
|
||||
const fold=document.createElement('details');fold.className='ogl-day';fold.open=true;
|
||||
const heading=document.createElement('summary');heading.textContent='Audit vom '+day+' · '+events.length+' Ereignisse';
|
||||
const body=document.createElement('div');body.className='ogl-log-body';
|
||||
for(const event of events){
|
||||
const row=document.createElement('div');row.className='ogl-audit-line';
|
||||
row.append(oglPlain('time','',String(event.timestamp||'').replace('T',' ').slice(0,19)),
|
||||
oglPlain('strong','',event.action||'Unbekannte Aktion'),
|
||||
oglPlain('span','',String(event.actor||'–')+' · '+String(event.resource||'–')));
|
||||
const detail=document.createElement('details');detail.className='ogl-audit-detail';
|
||||
detail.append(oglPlain('summary','','Details / Korrelation anzeigen'),oglPlain('pre','ogl-logs-pre',JSON.stringify({event_id:event.event_id,correlation_id:event.correlation_id,details:event.details},null,2)));
|
||||
body.append(row,detail);
|
||||
}
|
||||
fold.append(heading,body);host.append(fold);
|
||||
}
|
||||
if(!buckets.size)host.append(oglPlain('p','empty','Keine Auditereignisse gefunden.'));
|
||||
$('oglAuditMore').hidden=!data.pagination?.has_more;
|
||||
$('oglAuditStatus').textContent=oglAuditEvents.length+' Einträge geladen';
|
||||
$('oglAuditDot').className='dot good';
|
||||
}catch(error){$('oglAuditStatus').textContent=error.message;$('oglAuditDot').className='dot bad'}
|
||||
}
|
||||
$('oglLogsRefresh').addEventListener('click',oglLoadLogIndex);
|
||||
$('oglLogsService').addEventListener('change',oglLoadLogIndex);
|
||||
$('oglLogsSearch').addEventListener('input',oglFilterLogLines);
|
||||
$('oglAuditRefresh').addEventListener('click',()=>oglLoadAudit(false));
|
||||
$('oglAuditMore').addEventListener('click',()=>oglLoadAudit(true));
|
||||
function showPage(name){
|
||||
if(['secrets','nodes','grid','security','console'].includes(name)&&!adminIsActive()){
|
||||
if(['secrets','nodes','grid','security','console','logs','audit','users','groups','inventory','economy','profiles','marketplace','estates','experiences','discovery'].includes(name)&&!adminIsActive()){
|
||||
adminNextPage=name;
|
||||
name='adminlogin';
|
||||
adminUpdateStatus('Anmeldung mit UserLevel >= 200 erforderlich.',null);
|
||||
@@ -1042,6 +1313,8 @@ function showPage(name){
|
||||
document.querySelectorAll('.page').forEach(x=>x.classList.toggle('active',x.id==='page-'+name));
|
||||
document.querySelectorAll('.navbtn').forEach(x=>{x.classList.toggle('active',x.dataset.page===name);if(x.dataset.page===name)x.closest('details')?.setAttribute('open','');});
|
||||
if(name==='repository')oglLoadGithub();
|
||||
if(name==='logs')oglLoadLogIndex();
|
||||
if(name==='audit')oglLoadAudit(false);
|
||||
if(oglWorkspaceGroups[name])oglRenderWorkspaces();
|
||||
window.scrollTo({top:0,behavior:'smooth'});
|
||||
}
|
||||
|
||||
@@ -284,8 +284,14 @@ namespace NexVerse.Server.Api
|
||||
|
||||
try
|
||||
{
|
||||
bool accepted = m_Bus.Receive(nexEvent);
|
||||
Write(response, HttpStatusCode.Accepted, new
|
||||
bool isLogChunk = nexEvent.Name == "node.log.chunk";
|
||||
// Persist logs synchronously before acknowledging the sender.
|
||||
// Do NOT publish these private payloads to the general bus:
|
||||
// DistributedNexEventBus.Receive would fan them out to peers.
|
||||
bool accepted = isLogChunk
|
||||
? (m_Bus.ReceiveLogChunk?.Invoke(nexEvent) == true)
|
||||
: m_Bus.Receive(nexEvent);
|
||||
Write(response, isLogChunk && !accepted ? HttpStatusCode.Conflict : HttpStatusCode.Accepted, new
|
||||
{
|
||||
accepted,
|
||||
event_id = nexEvent.EventId
|
||||
|
||||
@@ -0,0 +1,104 @@
|
||||
// SPDX-License-Identifier: MPL-2.0
|
||||
// Signed NexBus chunks from registered simulator nodes are mirrored to
|
||||
// bin/logs/OpenSim_<NodeId>_<dd_MM_yyyy>.log, never to arbitrary paths.
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using log4net;
|
||||
using NexVerse.Core.ControlPlane;
|
||||
using NexVerse.Core.Messaging;
|
||||
|
||||
namespace NexVerse.Server.Api
|
||||
{
|
||||
internal sealed class NexBusRemoteLogArchive
|
||||
{
|
||||
private static readonly ILog s_Log = LogManager.GetLogger(typeof(NexBusRemoteLogArchive));
|
||||
internal static readonly Regex SafeNode = new Regex(
|
||||
@"^[A-Za-z0-9][A-Za-z0-9._-]{0,63}$", RegexOptions.Compiled | RegexOptions.CultureInvariant);
|
||||
private const int MaxChunk = 32 * 1024;
|
||||
private readonly NexNodeRegistry m_Nodes;
|
||||
private readonly string m_Folder;
|
||||
private readonly object m_Sync = new object();
|
||||
|
||||
internal NexBusRemoteLogArchive(NexNodeRegistry nodes)
|
||||
{
|
||||
m_Nodes = nodes ?? throw new ArgumentNullException(nameof(nodes));
|
||||
m_Folder = Path.GetFullPath(Path.Combine(AppContext.BaseDirectory, "logs"));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Invoked only by the HMAC-verified NexBus endpoint, without regular
|
||||
/// event-bus fan-out. HTTP 202 is sent ONLY after durable persistence
|
||||
/// or byte-for-byte replay of an already persisted chunk.
|
||||
/// </summary>
|
||||
internal bool TryReceive(NexEvent ev)
|
||||
{
|
||||
if (ev == null || ev.Name != "node.log.chunk" ||
|
||||
ev.Source != "nexverse.simulator" || ev.Data == null ||
|
||||
!ev.Data.TryGetValue("node_id", out string node) || !SafeNode.IsMatch(node) ||
|
||||
!ev.Data.TryGetValue("date", out string day) ||
|
||||
!DateTime.TryParseExact(day, "yyyy-MM-dd",
|
||||
CultureInfo.InvariantCulture, DateTimeStyles.None, out DateTime date) ||
|
||||
Math.Abs((DateTime.Today - date).TotalDays) > 14 ||
|
||||
!ev.Data.TryGetValue("offset", out string rawOffset) ||
|
||||
!long.TryParse(rawOffset, NumberStyles.None,
|
||||
CultureInfo.InvariantCulture, out long offset) ||
|
||||
offset < 0 || offset > 512L * 1024 * 1024 ||
|
||||
!ev.Data.TryGetValue("bytes_base64", out string b64) ||
|
||||
b64.Length > (MaxChunk * 4 / 3) + 8 ||
|
||||
m_Nodes.Get(node) == null)
|
||||
return false;
|
||||
|
||||
byte[] bytes;
|
||||
try { bytes = Convert.FromBase64String(b64); }
|
||||
catch (FormatException) { return false; }
|
||||
if (bytes.Length == 0 || bytes.Length > MaxChunk) return false;
|
||||
|
||||
string name = "OpenSim_" + node + "_" +
|
||||
date.ToString("dd_MM_yyyy", CultureInfo.InvariantCulture) + ".log";
|
||||
string path = Path.Combine(m_Folder, name);
|
||||
try
|
||||
{
|
||||
lock (m_Sync)
|
||||
{
|
||||
Directory.CreateDirectory(m_Folder);
|
||||
using var file = new FileStream(path, FileMode.OpenOrCreate,
|
||||
FileAccess.ReadWrite, FileShare.Read, 4096, FileOptions.None);
|
||||
// At-most-once reconstruction of an ordered byte stream.
|
||||
// The sender resends the same chunk if HTTP acknowledgement
|
||||
// is lost; reject gaps and non-identical overlapping data.
|
||||
if (offset > file.Length) return false;
|
||||
if (offset < file.Length)
|
||||
{
|
||||
if (offset + bytes.Length > file.Length) return false;
|
||||
file.Position = offset;
|
||||
byte[] previous = new byte[bytes.Length];
|
||||
if (file.Read(previous, 0, previous.Length) != previous.Length ||
|
||||
!System.Security.Cryptography.CryptographicOperations.FixedTimeEquals(previous, bytes))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
file.Position = file.Length;
|
||||
file.Write(bytes, 0, bytes.Length);
|
||||
file.Flush();
|
||||
if (!OperatingSystem.IsWindows())
|
||||
{
|
||||
try { File.SetUnixFileMode(path, UnixFileMode.UserRead | UnixFileMode.UserWrite); }
|
||||
catch (IOException) { }
|
||||
catch (UnauthorizedAccessException) { }
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
catch (Exception e) when (e is IOException || e is UnauthorizedAccessException)
|
||||
{
|
||||
s_Log.Warn("[OGL-LOG-RELAY]: Cannot persist remote simulator log chunk (" +
|
||||
e.GetType().Name + ").");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -529,6 +529,9 @@ namespace NexVerse.Server.Api
|
||||
"/api/v1/search");
|
||||
AppendCatalogGroup(md, requestedAudience, "public", "version",
|
||||
"/api/v1/version");
|
||||
AppendCatalogGroup(md, requestedAudience, "admin", "ROBUST und OpenSim Tageslogs – lokale Operatoren",
|
||||
"/api/v1/admin/logs",
|
||||
"/api/v1/admin/logs/{service}/{date}/entries");
|
||||
AppendCatalogGroup(md, requestedAudience, "public", "OpenGenesisLINK GitHub Stable/Development/CI Status",
|
||||
"/api/v1/repository/status");
|
||||
AppendCatalogGroup(md, requestedAudience, "public", "Oeffentliche Weltkarte",
|
||||
|
||||
@@ -0,0 +1,203 @@
|
||||
// SPDX-License-Identifier: MPL-2.0
|
||||
// Local, read-only, per-day operator logs; no arbitrary paths or remote shell.
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Text;
|
||||
using System.Text.Json;
|
||||
using System.Text.RegularExpressions;
|
||||
using NexVerse.Core.Security;
|
||||
using OpenSim.Framework.Servers.HttpServer;
|
||||
using OpenSim.Services.Interfaces;
|
||||
|
||||
namespace NexVerse.Server.Api
|
||||
{
|
||||
internal sealed class NexOperatorLogsApi
|
||||
{
|
||||
private const int MaxPage = 1000;
|
||||
private const int MaxOffset = 1000000;
|
||||
private static readonly Regex s_FileName = new Regex(
|
||||
@"^(Robust|OpenSim)(?:_([A-Za-z0-9][A-Za-z0-9._-]{0,63}))?_(\d{2})_(\d{2})_(\d{4})\.log$",
|
||||
RegexOptions.CultureInvariant | RegexOptions.Compiled);
|
||||
private static readonly Regex s_Secret = new Regex(
|
||||
@"(?i)(authorization\s*[:=]\s*bearer\s+|x-nexverse-api-key\s*[:=]\s*|password(?:hash|salt)?\s*[:=]\s*|token\s*[:=]\s*)([^\s,;]+)",
|
||||
RegexOptions.CultureInvariant | RegexOptions.Compiled);
|
||||
|
||||
private readonly NexApiAuthenticator m_Auth;
|
||||
private readonly string m_LogDirectory;
|
||||
|
||||
internal NexOperatorLogsApi(NexApiAuthenticator authenticator)
|
||||
{
|
||||
m_Auth = authenticator ?? throw new ArgumentNullException(nameof(authenticator));
|
||||
m_LogDirectory = Path.GetFullPath(Path.Combine(AppContext.BaseDirectory, "logs"));
|
||||
}
|
||||
|
||||
internal NexOperatorLogsApi(NexApiAuthenticator authenticator, string baseDirectory)
|
||||
{
|
||||
m_Auth = authenticator ?? throw new ArgumentNullException(nameof(authenticator));
|
||||
m_LogDirectory = Path.GetFullPath(Path.Combine(baseDirectory, "logs"));
|
||||
}
|
||||
|
||||
public void Handle(IOSHttpRequest request, IOSHttpResponse response)
|
||||
{
|
||||
response.KeepAlive = false;
|
||||
response.ContentType = "application/json; charset=utf-8";
|
||||
response.AddHeader("Cache-Control", "private, no-store");
|
||||
response.AddHeader("X-Content-Type-Options", "nosniff");
|
||||
if (request == null || request.HttpMethod != "GET")
|
||||
{
|
||||
Write(response, HttpStatusCode.MethodNotAllowed, new {error = "method_not_allowed"});
|
||||
return;
|
||||
}
|
||||
if (!m_Auth.TryAuthenticate(request, NexScopes.AdminAll,
|
||||
out NexPrincipal principal, out UserAccount account,
|
||||
out int status, out string reason))
|
||||
{
|
||||
Write(response, (HttpStatusCode)status, new {error = "admin_auth_required"});
|
||||
return;
|
||||
}
|
||||
if (account == null || !account.LocalToGrid || account.UserLevel < 200 ||
|
||||
!principal.HasScope(NexScopes.AdminAll))
|
||||
{
|
||||
Write(response, HttpStatusCode.Forbidden, new {error = "admin_level_required"});
|
||||
return;
|
||||
}
|
||||
|
||||
string path = (request.UriPath ?? "").TrimEnd('/');
|
||||
if (path == "/api/v1/admin/logs")
|
||||
{
|
||||
List(response);
|
||||
return;
|
||||
}
|
||||
|
||||
string[] parts = path.Trim('/').Split('/');
|
||||
if (parts.Length != 7 || parts[0] != "api" || parts[1] != "v1" ||
|
||||
parts[2] != "admin" || parts[3] != "logs" ||
|
||||
(parts[4] != "Robust" && parts[4] != "OpenSim") ||
|
||||
!DateTime.TryParseExact(parts[5], "yyyy-MM-dd",
|
||||
CultureInfo.InvariantCulture, DateTimeStyles.None, out DateTime date) ||
|
||||
parts[6] != "entries" ||
|
||||
date.Date > DateTime.UtcNow.Date.AddDays(1))
|
||||
{
|
||||
Write(response, HttpStatusCode.NotFound, new {error = "log_not_found"});
|
||||
return;
|
||||
}
|
||||
int limit = 500, offset = 0;
|
||||
if (request.QueryString?["limit"] is string l &&
|
||||
(!int.TryParse(l, out limit) || limit < 1 || limit > MaxPage) ||
|
||||
request.QueryString?["offset"] is string o &&
|
||||
(!int.TryParse(o, out offset) || offset < 0 || offset > MaxOffset))
|
||||
{
|
||||
Write(response, HttpStatusCode.BadRequest, new {error = "invalid_pagination"});
|
||||
return;
|
||||
}
|
||||
string nodeId = request.QueryString?["node_id"] ?? string.Empty;
|
||||
if (nodeId.Length != 0 &&
|
||||
(parts[4] != "OpenSim" || !NexBusRemoteLogArchive.SafeNode.IsMatch(nodeId)))
|
||||
{
|
||||
Write(response, HttpStatusCode.BadRequest, new {error = "invalid_node_id"});
|
||||
return;
|
||||
}
|
||||
ReadDay(response, parts[4], date, limit, offset, nodeId);
|
||||
}
|
||||
|
||||
private void List(IOSHttpResponse response)
|
||||
{
|
||||
try
|
||||
{
|
||||
var dates = new List<object>();
|
||||
if (Directory.Exists(m_LogDirectory))
|
||||
{
|
||||
foreach (string file in Directory.EnumerateFiles(m_LogDirectory, "*.log"))
|
||||
{
|
||||
string basename = Path.GetFileName(file);
|
||||
Match match = s_FileName.Match(basename);
|
||||
if (!match.Success ||
|
||||
!DateTime.TryParseExact(
|
||||
match.Groups[3].Value+"_"+match.Groups[4].Value+"_"+match.Groups[5].Value,
|
||||
"dd_MM_yyyy", CultureInfo.InvariantCulture, DateTimeStyles.None,
|
||||
out DateTime date)) continue;
|
||||
FileInfo info = new FileInfo(file);
|
||||
dates.Add(new
|
||||
{
|
||||
service = match.Groups[1].Value,
|
||||
node_id = match.Groups[2].Success ? match.Groups[2].Value : null,
|
||||
date = date.ToString("yyyy-MM-dd", CultureInfo.InvariantCulture),
|
||||
name = basename,
|
||||
bytes = info.Length,
|
||||
last_modified_utc = info.LastWriteTimeUtc.ToString("O")
|
||||
});
|
||||
}
|
||||
}
|
||||
// Same fields as ReadDay, grouped in descending date order by the browser.
|
||||
dates = dates.OrderByDescending(x => JsonSerializer.Serialize(x)).ToList();
|
||||
Write(response, HttpStatusCode.OK, new {files = dates, directory = "logs", format = "dd_MM_yyyy"});
|
||||
}
|
||||
catch (IOException)
|
||||
{
|
||||
Write(response, HttpStatusCode.ServiceUnavailable, new {error = "logs_unavailable"});
|
||||
}
|
||||
catch (UnauthorizedAccessException)
|
||||
{
|
||||
Write(response, HttpStatusCode.ServiceUnavailable, new {error = "logs_unavailable"});
|
||||
}
|
||||
}
|
||||
|
||||
private void ReadDay(IOSHttpResponse response, string service, DateTime date,
|
||||
int limit, int offset, string nodeId)
|
||||
{
|
||||
string filename = service+(string.IsNullOrEmpty(nodeId) ? "" : "_"+nodeId)+
|
||||
"_"+date.ToString("dd_MM_yyyy", CultureInfo.InvariantCulture)+".log";
|
||||
string file = Path.Combine(m_LogDirectory, filename);
|
||||
if (!File.Exists(file))
|
||||
{
|
||||
Write(response, HttpStatusCode.NotFound, new {error = "log_not_found"});
|
||||
return;
|
||||
}
|
||||
try
|
||||
{
|
||||
List<string> lines = new List<string>(limit + 1);
|
||||
using (var stream = new FileStream(file, FileMode.Open, FileAccess.Read,
|
||||
FileShare.ReadWrite | FileShare.Delete))
|
||||
using (var reader = new StreamReader(stream, Encoding.UTF8, true))
|
||||
{
|
||||
for (int i = 0; i < offset && reader.ReadLine() != null; i++) { }
|
||||
while (lines.Count <= limit)
|
||||
{
|
||||
string line = reader.ReadLine();
|
||||
if (line == null) break;
|
||||
line = s_Secret.Replace(line, "$1[REDACTED]");
|
||||
if (line.Length > 8192) line = line.Substring(0, 8192)+"…";
|
||||
lines.Add(line);
|
||||
}
|
||||
}
|
||||
bool hasMore = lines.Count > limit;
|
||||
if (hasMore) lines.RemoveAt(limit);
|
||||
Write(response, HttpStatusCode.OK, new
|
||||
{
|
||||
service, node_id = string.IsNullOrEmpty(nodeId) ? null : nodeId,
|
||||
date = date.ToString("yyyy-MM-dd", CultureInfo.InvariantCulture),
|
||||
file = filename, offset, limit, has_more = hasMore, next_offset = offset + lines.Count,
|
||||
lines
|
||||
});
|
||||
}
|
||||
catch (IOException)
|
||||
{
|
||||
Write(response, HttpStatusCode.ServiceUnavailable, new {error = "logs_unavailable"});
|
||||
}
|
||||
catch (UnauthorizedAccessException)
|
||||
{
|
||||
Write(response, HttpStatusCode.ServiceUnavailable, new {error = "logs_unavailable"});
|
||||
}
|
||||
}
|
||||
|
||||
private static void Write(IOSHttpResponse response, HttpStatusCode status, object payload)
|
||||
{
|
||||
response.StatusCode = (int)status;
|
||||
response.RawBuffer = JsonSerializer.SerializeToUtf8Bytes(payload);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -271,6 +271,12 @@ namespace NexVerse.Server.Api
|
||||
new NexNodeRegistry(
|
||||
eventBus,
|
||||
nodeStaleAfterSeconds);
|
||||
// Remote simulator logs arrive as authenticated NexBus events
|
||||
// from NodeAgents already registered by node.heartbeat.
|
||||
// Local ROBUST and local OpenSim log readers use the same folder.
|
||||
NexBusRemoteLogArchive remoteLogs = new NexBusRemoteLogArchive(nodeRegistry);
|
||||
if (eventBus is DistributedNexEventBus signedLogBus)
|
||||
signedLogBus.ReceiveLogChunk = remoteLogs.TryReceive;
|
||||
|
||||
// Console verbosity is independent of the persistent audit
|
||||
// store: suppress routine health checks without losing audited
|
||||
@@ -609,6 +615,12 @@ namespace NexVerse.Server.Api
|
||||
oauthStore,
|
||||
apiKeyStore,
|
||||
adminMinimumLevel);
|
||||
// Only the authenticated local UserLevel-200 operator may list
|
||||
// or read local daily logs. No shell / arbitrary file access.
|
||||
NexOperatorLogsApi operatorLogs = new NexOperatorLogsApi(authenticator);
|
||||
server.AddSimpleStreamHandler(new SimpleStreamHandler(
|
||||
"/api/v1/admin/logs", apiGate.Wrap(operatorLogs.Handle),
|
||||
"OpenGenesisLINK operator daily log archives"), true);
|
||||
|
||||
// Attach the existing, server-side native admin authenticator
|
||||
// once privileged services are available. No duplicate routing.
|
||||
|
||||
@@ -175,6 +175,10 @@ namespace NexVerse.Server.Api
|
||||
("post", "Einwohnersitzungen widerrufen und Sicherheitsstempel fortschreiben", "self or admin:*", "200")),
|
||||
["/api/v1/audit"] = AuthenticatedOperations(
|
||||
("get", "Persistente administrative Audit-Historie abfragen", "admin:*", "200")),
|
||||
["/api/v1/admin/logs"] = AuthenticatedOperations(
|
||||
("get", "Tagesarchiv-Liste von lokalem ROBUST und OpenSim, nur lokale Administratoren ab UserLevel 200", "admin:*", "200")),
|
||||
["/api/v1/admin/logs/{service}/{date}/entries"] = AuthenticatedOperations(
|
||||
("get", "Paginierte Logzeilen eines lokalen Tagesarchivs, 1-1000 pro Anfrage, sensitive Tokens maskiert", "admin:*", "200")),
|
||||
["/api/v1/statistics/summary"] = StatisticsOperation(),
|
||||
["/api/v1/grid/layout"] = AuthenticatedOperations(
|
||||
("get", "Gebundenes Welt-Raster mit Zellbelegung lesen", "regions:read", "200")),
|
||||
|
||||
@@ -213,14 +213,45 @@ label{display:block;color:#d3deed;font-size:12px;margin:18px 0 8px;font-weight:6
|
||||
#app{border:0;display:block;width:100%;height:100vh;background:#060b16}#app[hidden],#loginView[hidden]{display:none!important}
|
||||
@media(max-width:1000px){.stage{grid-template-columns:1fr;max-width:670px;padding-top:34px}.orbit{display:none}h1{font-size:clamp(43px,9vw,65px)}.intro{max-width:580px}.top{padding:22px 24px}.topright{font-size:9px}}@media(max-width:570px){.stage{gap:30px;padding:25px 18px 45px}.highlights{gap:7px}.highlight{font-size:11px;padding:8px 9px}.login{padding:25px 21px}.brand strong{font-size:15px}.sigil{width:41px;height:41px}.topright{display:none}.bottom{padding:15px 22px}}
|
||||
@media(prefers-reduced-motion:reduce){body:before{animation:none}.submit{transition:none}}
|
||||
|
||||
/* World API Operator Login 3.0 – cinematic but keyboard-accessible */
|
||||
:root{--a:#5bd6fa;--v:#7daeff;--paper:#eef8ff;--muted:#9bb8cf;--line:rgba(110,174,226,.3)}
|
||||
body{background:radial-gradient(ellipse at 8% 12%,rgba(29,109,160,.16),transparent 32%),radial-gradient(ellipse at 86% 77%,rgba(61,95,187,.14),transparent 41%),#040b16}
|
||||
body:before{opacity:.28}
|
||||
.top{background:rgba(6,16,29,.8);border-bottom:1px solid rgba(75,159,207,.26);min-height:88px}
|
||||
.brand strong{letter-spacing:-.025em;font-size:20px}.brand span{letter-spacing:.12em}
|
||||
.sigil{background:#0e2539;border-radius:14px;width:56px;height:56px}
|
||||
.sigil img{width:51px!important;height:51px!important;filter:drop-shadow(0 0 13px rgba(82,222,247,.32))}
|
||||
.topright{letter-spacing:.09em}
|
||||
.stage{max-width:1350px;min-height:calc(100vh - 160px);margin:auto;display:grid;grid-template-columns:minmax(0,1.2fr) minmax(340px,.8fr);align-items:center;gap:clamp(25px,4vw,75px);padding:clamp(38px,6vw,78px) clamp(22px,5vw,60px)}
|
||||
.showcase{position:relative;overflow:hidden;padding:20px 10px 20px 0}
|
||||
.showcase:before{content:'';position:absolute;top:20px;left:-100px;width:440px;height:440px;border:1px solid rgba(86,196,252,.13);border-radius:50%;pointer-events:none;box-shadow:0 0 0 40px rgba(70,172,230,.027),0 0 0 85px rgba(63,123,216,.025)}
|
||||
.showcase h1{font-weight:780;font-size:clamp(38px,4.3vw,66px);line-height:1.08;letter-spacing:-.055em;margin:18px 0}
|
||||
.showcase h1 em{font-style:normal;background:linear-gradient(90deg,#69e4fa,#86aaff);-webkit-background-clip:text;background-clip:text;color:transparent}
|
||||
.ogl-showcase-logo{width:158px;height:158px;display:grid;place-items:center;border-radius:36px;position:relative;background:radial-gradient(circle,rgba(36,154,228,.2),transparent 70%);filter:drop-shadow(0 0 24px rgba(44,175,245,.22))}
|
||||
.ogl-showcase-logo img{object-fit:contain;width:158px;height:158px}
|
||||
.showcase .intro{max-width:580px;color:#b3cadc;line-height:1.8}
|
||||
.highlights{gap:8px;flex-wrap:wrap}.highlight{border:1px solid rgba(67,139,204,.24);border-radius:8px;background:rgba(9,31,55,.75);font-size:12px}
|
||||
.orbit{display:none}
|
||||
.window{width:100%;max-width:460px;margin:0;justify-self:end;background:rgba(11,27,46,.96);border:1px solid rgba(79,178,227,.33);border-radius:20px;box-shadow:0 24px 85px rgba(0,0,0,.38),0 0 70px rgba(47,146,212,.04)}
|
||||
.login{padding:clamp(22px,3vw,43px)}.login h2{font-size:29px;letter-spacing:-.035em;color:#f1faff}
|
||||
.loginkicker{font-size:11px;letter-spacing:.13em;color:#66d8fc;font-weight:800}
|
||||
.login p{color:#acc6d9;line-height:1.6}
|
||||
.login input{min-height:47px;border-radius:9px;background:#09192c;border:1px solid #2d516b}
|
||||
.login input:focus-visible{outline:2px solid #60d9f7;outline-offset:2px}
|
||||
.submit{margin-top:20px;border-radius:9px;min-height:50px;background:linear-gradient(110deg,#1ca2ce,#4073c3);color:#f7fcff;font-weight:750;box-shadow:0 10px 28px rgba(16,128,199,.16)}
|
||||
.submit:hover{background:linear-gradient(110deg,#25bce6,#588de3)}
|
||||
.bottom{border-top:1px solid rgba(61,134,185,.22);background:#060f1d;color:#9bacc4}
|
||||
@media(max-width:1000px){.stage{grid-template-columns:1fr;max-width:630px}.window{max-width:none;justify-self:stretch}.showcase{text-align:left}.ogl-showcase-logo{width:110px;height:110px}.ogl-showcase-logo img{width:110px;height:110px}}
|
||||
@media(prefers-reduced-motion:reduce){.showcase:before,.ogl-showcase-logo{animation:none!important}}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div id="loginView">
|
||||
<header class="top"><div class="brand"><div class="sigil"><img src="OGL_LOGO_DATA_URI" width="44" height="44" alt="OpenGenesisLINK World API Logo" style="width:44px;height:44px;object-fit:contain;display:block"></div><div><strong>OpenGenesisLINK</strong><span>World API · Control Center</span></div></div><div class="topright"><i class="light" aria-hidden="true"></i> Secure administration <span> / </span> Live Control Plane</div></header>
|
||||
<main class="stage">
|
||||
<section class="showcase"><div class="eyebrow">The next generation of OpenSimulator</div><h1>Deine Welt.<br><em>Deine Kontrolle.</em></h1><div class="intro">Willkommen im OpenGenesisLINK Control Center. Verwalte Simulator-Nodes, Grid-Regionen, Dienste, Sicherheit, API-Zugänge und die Infrastruktur deiner virtuellen Welt an einem zentralen Ort.</div><div class="highlights"><div class="highlight">◈ Grid & Regions</div><div class="highlight">⬡ Simulator Control</div><div class="highlight">⌁ World API Explorer</div></div><div class="orbit" aria-hidden="true"></div></section>
|
||||
<div class="window"><section class="login"><div class="loginkicker">Authorized Personnel Only</div><h2>Administrator Login</h2><p>Bitte melde dich mit deinem lokalen GridUser-Konto an. Zugang für lokale GridUser ab <strong>UserLevel 200</strong>.</p><form id="adminForm" autocomplete="on"><label for="username">Grid-Benutzername</label><input id="username" name="username" autocomplete="username" maxlength="100" required placeholder="Vorname.Nachname"><div class="fieldhelp">Beispiel: Sleimer.Akina oder Vorname Resident</div><label for="password">Passwort</label><input id="password" name="password" autocomplete="current-password" type="password" maxlength="256" required placeholder="Dein Grid-Passwort"><div class="formlabel"><label for="totp">Zwei-Faktor-Code (falls aktiviert)</label><span>Optional</span></div><input id="totp" name="totp" autocomplete="one-time-code" inputmode="numeric" maxlength="12" placeholder="6-stelliger TOTP-Code"><button class="submit" id="submit" type="submit">Sicher anmelden →</button><div class="status" id="status" role="status" aria-live="polite">Mit Grid-Benutzername und Passwort anmelden.</div></form><div class="footnote">Benutzername, Passwort und UserLevel werden auf dem Server geprüft. HTTPS wird zum Schutz deiner Zugangsdaten empfohlen. Sitzungstokens bleiben nur im Arbeitsspeicher.</div></section></div>
|
||||
<section class="showcase"><div class="eyebrow">OPEN GENESIS LINK · WORLD CONTROL PLANE</div><div class="ogl-showcase-logo"><img src="OGL_LOGO_DATA_URI" alt="OpenGenesisLINK World API Logo" width="158" height="158"></div><h1>Control Center.<br><em>Grenzenlose Möglichkeiten.</em></h1><div class="intro">Willkommen im OpenGenesisLINK Control Center. Verwalte Simulator-Nodes, Grid-Regionen, Dienste, Sicherheit, API-Zugänge und die Infrastruktur deiner virtuellen Welt an einem zentralen Ort.</div><div class="highlights"><div class="highlight">◈ Grid- & Regionensteuerung</div><div class="highlight">⬡ Live-Diagnose & Audit</div><div class="highlight">⌁ API & Sicherheit</div></div><div class="orbit" aria-hidden="true"></div></section>
|
||||
<div class="window"><section class="login"><div class="loginkicker">SECURE ACCESS · ADMIN LEVEL 200</div><h2>Administrator-Anmeldung</h2><p>Bitte melde dich mit deinem lokalen GridUser-Konto an. Zugang für lokale GridUser ab <strong>UserLevel 200</strong>.</p><form id="adminForm" autocomplete="on"><label for="username">Grid-Benutzername</label><input id="username" name="username" autocomplete="username" maxlength="100" required placeholder="Vorname.Nachname"><div class="fieldhelp">Beispiel: Sleimer.Akina oder Vorname Resident</div><label for="password">Passwort</label><input id="password" name="password" autocomplete="current-password" type="password" maxlength="256" required placeholder="Dein Grid-Passwort"><div class="formlabel"><label for="totp">Zwei-Faktor-Code (falls aktiviert)</label><span>Optional</span></div><input id="totp" name="totp" autocomplete="one-time-code" inputmode="numeric" maxlength="12" placeholder="6-stelliger TOTP-Code"><button class="submit" id="submit" type="submit">Sicher anmelden →</button><div class="status" id="status" role="status" aria-live="polite">Mit Grid-Benutzername und Passwort anmelden.</div></form><div class="footnote">Benutzername, Passwort und UserLevel werden auf dem Server geprüft. HTTPS wird zum Schutz deiner Zugangsdaten empfohlen. Sitzungstokens bleiben nur im Arbeitsspeicher.</div></section></div>
|
||||
</main>
|
||||
<footer class="bottom"><div>© OpenGenesisLINK · OGL Server Technology</div><div>Protected administration environment</div></footer>
|
||||
</div>
|
||||
|
||||
@@ -30,9 +30,14 @@
|
||||
...
|
||||
-->
|
||||
|
||||
<appender name="LogFileAppender" type="log4net.Appender.FileAppender">
|
||||
<file value="OpenSim.log" />
|
||||
<!-- Daily files: bin/logs/OpenSim_dd_MM_yyyy.log. Keep previous days. -->
|
||||
<appender name="LogFileAppender" type="log4net.Appender.RollingFileAppender">
|
||||
<file value="logs/OpenSim_" />
|
||||
<appendToFile value="true" />
|
||||
<rollingStyle value="Date" />
|
||||
<datePattern value="dd_MM_yyyy'.log'" />
|
||||
<staticLogFileName value="false" />
|
||||
<lockingModel type="log4net.Appender.FileAppender+MinimalLock" />
|
||||
<filter type="log4net.Filter.LoggerMatchFilter">
|
||||
<loggerToMatch value="special"/>
|
||||
<acceptOnMatch value="false"/>
|
||||
|
||||
@@ -7,6 +7,11 @@
|
||||
NodeId = ""
|
||||
PeerUrl = "${Environment|NEXVERSE_NEXBUS_PEER_URL}"
|
||||
SharedKey = "${Environment|NEXVERSE_NEXBUS_SHARED_KEY}"
|
||||
; Daily OpenSim_<dd_MM_yyyy>.log is forwarded automatically to ROBUST
|
||||
; as signed NexBus chunks. This contains sensitive diagnostics:
|
||||
; only enable for trusted peers reachable over HTTPS.
|
||||
; ROBUST stores OpenSim_<NodeId>_<dd_MM_yyyy>.log under bin/logs.
|
||||
LogForwardingEnabled = true
|
||||
InboundPath = "/internal/nexbus/v1/events"
|
||||
HeartbeatSeconds = 30
|
||||
QueueCapacity = 2048
|
||||
|
||||
@@ -28,9 +28,14 @@
|
||||
...
|
||||
-->
|
||||
|
||||
<appender name="LogFileAppender" type="log4net.Appender.FileAppender">
|
||||
<file value="Robust.log" />
|
||||
<!-- Daily files: bin/logs/Robust_dd_MM_yyyy.log. Keep previous days. -->
|
||||
<appender name="LogFileAppender" type="log4net.Appender.RollingFileAppender">
|
||||
<file value="logs/Robust_" />
|
||||
<appendToFile value="true" />
|
||||
<rollingStyle value="Date" />
|
||||
<datePattern value="dd_MM_yyyy'.log'" />
|
||||
<staticLogFileName value="false" />
|
||||
<lockingModel type="log4net.Appender.FileAppender+MinimalLock" />
|
||||
<filter type="log4net.Filter.LoggerMatchFilter">
|
||||
<loggerToMatch value="special"/>
|
||||
<acceptOnMatch value="false"/>
|
||||
|
||||
@@ -0,0 +1,69 @@
|
||||
# OpenGenesisLINK – Betreiber-SQL, World-API und Tabellen-Lifecycle
|
||||
|
||||
Stand: 25.10.2026. Analyse der vom Betreiber bereitgestellten `nexverse_daten.sql` (**Datenexport; kein Schemasnapshot, keine CREATE TABLE-Befehle**) und Quervergleich gegen den aktuellen Code in `opengenesislink/opengenesislinkserver`.
|
||||
|
||||
## Datengrundlage und Grenzen
|
||||
|
||||
Der HeidiSQL-Export enthält **63 benannte Tabellen**, davon **44 mit INSERT-Anweisungen** und **19 mit ~0 Zeilen**. Die Angaben `~… rows` stammen aus Exportkommentaren und sind ungefähre Datensatzmengen. Die Anzahl der `INSERT INTO`-Zeilen ist durch Batch-Inserts nicht gleich der Zeilenanzahl. Der Export enthält personenbezogene Daten, Authentifizierungshashes und Inventar-/Assetdaten; deshalb werden **keine SQL-Nutzdaten** ins Repository übernommen und keine Benutzer-/Geheimdaten zitiert.
|
||||
|
||||
Repräsentative Tabellen im Dump (ungefähre Zeilen): `fsassets` 336.728; `primshapes` 11.178; `prims` 10.920; `inventoryitems` 10.279; `primitems` 3.660; `Avatars` 2.669; `inventoryfolders` 1.152; `portal_im_entries` 460; `GridUser` 233; `land` 159; `regionsettings`, `terrain`, `bakedterrain` und `estate_map` jeweils ca. 150; `regions` 49; `UserAccounts` 16. Für Tabellen ohne Datensätze sind Spaltendefinitionen im Datenexport **nicht enthalten**; die tatsächliche DDL ist mit `SHOW CREATE TABLE` zu verifizieren.
|
||||
|
||||
## World-API-Potenzial (keine direkt freigegebenen SQL-Endpunkte)
|
||||
|
||||
| Tabellen/Daten | Naheliegende API-Verwendung | Status/Schutz |
|
||||
|---|---|---|
|
||||
| `UserAccounts`, `auth`, `GridUser` | Benutzer anlegen, suchen, aktualisieren, sperren/deaktivieren, Online-/Home-Region | **Bestehende** `GET/POST /api/v1/users`, `GET/PATCH/DELETE /api/v1/users/{principalId}`; Authentifizierung nur über Account-Services, niemals Hash-/Salt-Ausgabe |
|
||||
| `Friends`, `Avatars`, `userprofile`, `userdata` | Anzeigenamen, soziale Beziehungen, Profilbilder und Sichtbarkeit | Profile/SocialGraph über vorhandene Dienste; Privacy und Owner/Administrator-Rechte |
|
||||
| `regions`, `regionsettings`, `regionextra`, `terrain`, `bakedterrain`, `spawn_points` | Grid/Regionenstatus, Estate-Einstellungen, Terrain- und Spawnverwaltung | API via bestehendem Region-/Grid-/Estate-Service; keine direkten DELETE-Tabellenoperationen |
|
||||
| `prims`, `primshapes`, `primitems`, `land` | Objekt-/Parzellen-Statistiken, begrenzte Regionen-/Land-Mutationen | Regionseigentum, Simulator-Zustand und Linkset-Integrität beachten; keine frei bearbeitbaren Rohdaten-REST-Tabellen |
|
||||
| `inventoryitems`, `inventoryfolders`, `fsassets` | Inventarstruktur, Asset-Vorschaubilder, Medientyp, Speicherstatistik | Bestehende Inventar- und Media-API; Kopier-/Transfer-/Owner-Rechte und AssetService-Weg strikt einhalten |
|
||||
| `os_groups_*` | Gruppen, Rollen, Einladungen, Notices, Länder-/Estate-Rechte | Bestehende NexGroups API; über Dienste und GroupPowers, nicht SQL-Manipulation |
|
||||
| `ogl_ledger_*`, `ogl_economy_*` | Konten, Ledger, Zahlungen, Handel und Land-Mietverträge | Bestehende BankingCommerce-/Ledger-Services; Transaktionen nur mit Double-Entry, Idempotenz und Audit |
|
||||
| `portal_im_entries` | Portalnachrichten und Zustellprotokoll | Eigene IM-/Portal-Dienste und Privatsphäre; kein globaler öffentlich lesbarer Nachrichtenfeed |
|
||||
| `ogl_password_recovery` | Reset-Challenges / Passwortänderung | Bestehende `/api/v1/auth/password-recovery`-Routen; niemals Tokens exportieren oder Roh-DELETE anbieten |
|
||||
|
||||
Neue generische `GET/PUT/POST/DELETE /table/{name}`-Endpunkte werden **nicht** implementiert: Das würde Gruppenrechte, Prim-Referenzen, Inventory-Permissions, atomare Buchungen und OpenSim-Konsistenz verletzen. Das neue Admin-Center kann alle bestehenden OpenAPI-Operationen unmittelbar mit signiertem Admin-Bearer und expliziter Bestätigung ausführen, inklusive Einwohneranlage, Soft-Delete, gruppen-/regionbezogenen Aktionen und Asset-Operationen, soweit diese serverseitig tatsächlich existieren.
|
||||
|
||||
## Die 19 im Export leeren Tabellen
|
||||
|
||||
**Nicht löschen – weiterhin im Quellcode/Migrationen referenziert:**
|
||||
|
||||
- `classifieds`: Profile/Search/Discovery und UserProfiles-Migrationen
|
||||
- `estateban`, `estate_groups`, `estate_users`: Estate-Zugriffslisten/Bans; MySQL/PGSQL/SQLite EstateStore-Migrationen
|
||||
- `hg_traveling_data`: Hypergrid-TravelService / HGTravelStore-Migrationen
|
||||
- `MuteList`: MuteListService-/Store-Implementierungen
|
||||
- `ogl_economy_commerce_orders`, `ogl_economy_land_leases`, `ogl_economy_land_listings`, `ogl_economy_payment_requests`, `ogl_economy_transfer_policies`, `ogl_ledger_account_events`: `NexLedgerSqlStore` und Economy-CI-Regressionspfade
|
||||
- `ogl_password_recovery`: `NexPasswordRecoveryStore` (0 offene Challenges ist erwartbar)
|
||||
- `os_groups_notices`: Gruppen-Notices und Gruppenmigration
|
||||
- `regionban`, `regionextra`, `regionwindlight`, `spawn_points`: RegionStore-/Simulator-Migrationen, Terrain/Environment/Regionzustand
|
||||
- `userdata`: UserProfilesStore und Benutzer-/Profilkompatibilität
|
||||
|
||||
**Ergebnis:** Aus diesem Export lässt sich **keine** Tabelle zweifelsfrei als totes Schema beweisen. Leer bedeutet „zum Zeitpunkt des Dumps nicht benutzt“, **nicht** „von Code und Migrationen ungenutzt“. Daher keine DROP TABLE-Anweisungen und kein riskantes Entfernen aus den Schema-Migrationen.
|
||||
|
||||
## Nächster sicherer Datenbankabgleich
|
||||
|
||||
Vor jeder späteren Schema-Entfernung vollständigen DDL-/Laufzeitabgleich erstellen, zum Beispiel in einer **isolierten Staging-DB**:
|
||||
|
||||
```sql
|
||||
SELECT TABLE_NAME, TABLE_ROWS, CREATE_TIME, UPDATE_TIME
|
||||
FROM information_schema.TABLES
|
||||
WHERE TABLE_SCHEMA = DATABASE()
|
||||
ORDER BY TABLE_NAME;
|
||||
|
||||
SELECT TABLE_NAME, COLUMN_NAME, DATA_TYPE, IS_NULLABLE, COLUMN_KEY
|
||||
FROM information_schema.COLUMNS
|
||||
WHERE TABLE_SCHEMA = DATABASE()
|
||||
ORDER BY TABLE_NAME, ORDINAL_POSITION;
|
||||
```
|
||||
|
||||
Dazu pro Tabelle Schreib-/Leseaufrufe, Migrationserzeugung für MySQL/PGSQL/SQLite, Konfigurations-Featureflags, Provider, Hypergrid- und Viewerkompatibilität prüfen; ausschließlich gesicherte, explizit freigegebene Migrationen verwenden.
|
||||
|
||||
## Ergänzte Operator-Funktionen
|
||||
|
||||
- Geschützter Tageslog-Endpunkt `GET /api/v1/admin/logs`; einzelne Logzeilen `GET /api/v1/admin/logs/{Robust|OpenSim}/{yyyy-MM-dd}/entries?limit=500&offset=0` ausschließlich für echte lokale Administratoren mit UserLevel >= 200.
|
||||
- Log4net schreibt pro Tag `bin/logs/Robust_dd_MM_yyyy.log` und `bin/logs/OpenSim_dd_MM_yyyy.log`. Auch vorhandene Altlogs im früheren `bin/*.log` müssen bei Bedarf gesondert archiviert werden.
|
||||
- **Fremde Nodes:** `NexVerseNodeAgent` sendet bis zu 32-KiB-Chunks signiert über denselben NexBus-HMAC-/HTTPS-Endpunkt. ROBUST quittiert erst nach Prüfen/Speichern; ein verlorener HTTP-Status führt zur byte-identischen Wiederholung. Der Dateiname enthält die vertraute `NodeId`: `bin/logs/OpenSim_<NodeId>_dd_MM_yyyy.log`. Keine Auslieferung dieser Daten an andere NexBus-Peers, keine frei zugängliche Log-URL.
|
||||
- Im Web-Dashboard: ausklappbare Tage für lokalen ROBUST sowie lokale/verbundene OpenSim-Nodes, Filter, Pagination und vorhandener persistenter Admin-Auditfeed `GET /api/v1/audit`.
|
||||
- Für fremde Server ist `LogForwardingEnabled=true` Standard im Beispieldokument; eine **HTTPS**-NexBus-Gegenstelle und sicher formatierte `NodeId` sind zwingend. Logs können vertrauliche Nutzerdaten enthalten; Zugriff nur für Betreiber, Rotations-/Retention-Policy organisatorisch festlegen.
|
||||
|
||||
**Produktionsabnahme:** Sicherung von MariaDB und bisherigen Logs, Update von ROBUST **und jeder beteiligten Simulator-Node**, überprüfter TLS-/NexBus-Rückkanal, Auth-/Log-Tests, Fehlerszenarien (Abbruch, Wiederholung, Partition, NodeId-Manipulation), Firestorm-/OpenSim-Login und SQL-Schema-Abgleich. Ein Merge ist keine Live-Installation.
|
||||
@@ -0,0 +1,91 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Regression guard for admin operator UI, daily local/remote logs and SQL safety."""
|
||||
from pathlib import Path
|
||||
import re
|
||||
import shutil
|
||||
import subprocess
|
||||
import tempfile
|
||||
import xml.etree.ElementTree as ET
|
||||
|
||||
root=Path(__file__).resolve().parents[2]
|
||||
page=(root/"NexVerse/Server/Api/NexApiDocsPage.cs").read_text()
|
||||
login=(root/"NexVerse/Server/Api/OglApiDocsAccess.cs").read_text()
|
||||
reader=(root/"NexVerse/Server/Api/NexOperatorLogsApi.cs").read_text()
|
||||
relay=(root/"NexVerse/Server/Api/NexBusRemoteLogArchive.cs").read_text()
|
||||
node=(root/"NexVerse/RegionModules/NodeAgent/NexVerseNodeAgentModule.cs").read_text()
|
||||
endpoint=(root/"NexVerse/Server/Api/NexBusHttpTransport.cs").read_text()
|
||||
bus=(root/"NexVerse/Core/Messaging/DistributedNexEventBus.cs").read_text()
|
||||
connector=(root/"NexVerse/Server/Api/NexVerseWorldApiConnector.cs").read_text()
|
||||
openapi=(root/"NexVerse/Server/Api/NexVerseWorldApiHandlers.cs").read_text()
|
||||
catalog=(root/"NexVerse/Server/Api/NexChatGptInstructionDownloads.cs").read_text()
|
||||
doc=(root/"doc/OpenGenesisLINK/WORLD_API_SQL_OPERATIONS_LOGS_AUDIT_2026-10-25.md").read_text()
|
||||
|
||||
for name in ("Robust", "OpenSim"):
|
||||
cfg=ET.parse(root/"bin"/f"{name}.exe.config")
|
||||
appender=cfg.find(".//appender[@name='LogFileAppender']")
|
||||
assert appender is not None
|
||||
assert appender.attrib["type"]=="log4net.Appender.RollingFileAppender"
|
||||
assert appender.find("file").attrib["value"]==f"logs/{name}_"
|
||||
assert appender.find("rollingStyle").attrib["value"]=="Date"
|
||||
assert appender.find("datePattern").attrib["value"]=="dd_MM_yyyy'.log'"
|
||||
assert appender.find("staticLogFileName").attrib["value"]=="false"
|
||||
|
||||
for item in ('"/api/v1/admin/logs"', '"/api/v1/admin/logs/{service}/{date}/entries"'):
|
||||
assert item in openapi
|
||||
assert "GET /api/v1/admin/logs" in doc
|
||||
assert "/{yyyy-MM-dd}/entries" in doc
|
||||
assert 'new NexOperatorLogsApi(authenticator)' in connector
|
||||
assert 'apiGate.Wrap(operatorLogs.Handle)' in connector
|
||||
for marker in ("NexScopes.AdminAll", "account.UserLevel < 200", "account.LocalToGrid",
|
||||
's_FileName.Match(basename)', 'node_id', 'TryParseExact',
|
||||
'"logs"', 'MaxPage = 1000', 'FileShare.ReadWrite | FileShare.Delete',
|
||||
's_Secret.Replace', 'NexBusRemoteLogArchive.SafeNode.IsMatch(nodeId)'):
|
||||
assert marker in reader, marker
|
||||
|
||||
for marker in ('m_Nodes.Get(node) == null','SafeNode.IsMatch(node)',
|
||||
'"OpenSim_" + node + "_"','offset > file.Length',
|
||||
'FixedTimeEquals(previous, bytes)', 'file.Flush();',
|
||||
'File.SetUnixFileMode', 'internal bool TryReceive(NexEvent ev)'):
|
||||
assert marker in relay, marker
|
||||
|
||||
for marker in ('LogForwardingEnabled','NexBusProtocol.Serialize(envelope)',
|
||||
'NexBusProtocol.Sign(payload, m_SharedKey)','"node.log.chunk"',
|
||||
'HttpStatusCode.Accepted','result.Content.ReadAsByteArrayAsync()',
|
||||
'cursor += count','Interlocked.CompareExchange(ref m_LogForwardRunning',
|
||||
'm_LogForwardOffsets[dayId] = cursor', 'peer.Scheme == Uri.UriSchemeHttps'):
|
||||
assert marker in node, marker
|
||||
|
||||
assert 'm_Bus.ReceiveLogChunk?.Invoke(nexEvent)' in endpoint
|
||||
assert 'm_Bus.Receive(nexEvent)' in endpoint
|
||||
assert 'isLogChunk && !accepted ? HttpStatusCode.Conflict' in endpoint
|
||||
assert 'public Func<NexEvent, bool> ReceiveLogChunk' in bus
|
||||
assert 'signedLogBus.ReceiveLogChunk = remoteLogs.TryReceive;' in connector
|
||||
|
||||
for marker in ('id="page-logs"','id="page-audit"',
|
||||
'id="oglUserCreate"','id="oglUserSearch"',
|
||||
'function oglLoadLogIndex()','function oglLoadAudit(next=false)',
|
||||
'function oglActionEditor(domain,entry)', 'function oglCreateUser(event)',
|
||||
'function oglSearchUsers()', 'new URLSearchParams',
|
||||
'DEAKTIVIEREN','AUSFÜHREN',
|
||||
'file.node_id?', 'encodeURIComponent(file.node_id)'):
|
||||
assert marker in page, marker
|
||||
assert 'OGL_LOGO_DATA_URI' in login
|
||||
assert 'UserLevel 200' in login
|
||||
assert "63 benannte Tabellen" in doc
|
||||
assert "19 mit ~0 Zeilen" in doc
|
||||
assert "keine" in doc.lower()
|
||||
assert "DROP TABLE" in doc
|
||||
|
||||
# Syntax-check actual browser programs, not disconnected sample files.
|
||||
if shutil.which("node") is None:
|
||||
raise RuntimeError("Node is necessary for browser admin regression")
|
||||
for code,filename in [(page,"panel.mjs"),(login,"login.mjs")]:
|
||||
match=re.search(r"<script>\s*('use strict';.*?)\s*</script>", code, re.S)
|
||||
assert match,filename
|
||||
with tempfile.TemporaryDirectory() as temp:
|
||||
path=Path(temp)/filename
|
||||
path.write_text(match.group(1))
|
||||
check=subprocess.run(["node","--check",str(path)],capture_output=True,text=True)
|
||||
assert check.returncode==0,filename+": "+check.stderr
|
||||
|
||||
print("Operator Center: daily ROBUST/OpenSim and NexBus NodeId archives, admin CRUD, audit, XML & JavaScript OK")
|
||||
@@ -51,7 +51,8 @@ assert "secretKeySearch" in page and "secretKeyState" in page
|
||||
assert "oglFilterKeys()" in page
|
||||
assert "entries.filter(x=>prefixes.some(p=>x.path.startsWith(p)))" in page
|
||||
assert "selectEntry(entry)" in page
|
||||
assert "['secrets','nodes','grid','security','console'].includes(name)" in page
|
||||
assert "['secrets','nodes','grid','security','console'," in page
|
||||
assert "'logs','audit','users','groups'" in page
|
||||
assert "keine unbeschränkte Shell" in page or "Keine unbeschränkte Shell" in page
|
||||
# Extract JS from the actual HTML page (do not create a separate, unused demo file).
|
||||
script=re.search(r"<script>\s*('use strict';.*?)\s*</script>",page,re.S)
|
||||
|
||||
Reference in new issue
Block a user