diff --git a/docs/GNAI-000-DOC_Index.md b/docs/GNAI-000-DOC_Index.md index 45a243c..96b093e 100644 --- a/docs/GNAI-000-DOC_Index.md +++ b/docs/GNAI-000-DOC_Index.md @@ -91,11 +91,11 @@ Hauptverzeichnisse `llm-server/host/` (Grundkonfiguration des Servers), | LLM-Serving | drei gepinnte Profile (Swift 1.0, Swift 1.5, Unsloth); Testing-Abnahme 64k/128k je Profil (GNAI-010 10.5–10.9); Production-Umgebung live mit Swift 1.5 Q6_K seit 06.11.2026 (Betreiberbeschluss 05.11., GNAI-009 10.4) inklusive Health, Alias und Inferenztest; exklusive Umschaltmechanik mit Recovery (GNAI-008 14.6, T1–T7; nach Neustart 09.11.2026 `gn_ai_active_env{env="production"}=1` verifiziert) | öffentlicher Nutzerpfad (M6), LLM-Metriken jenseits `gn_ai_active_env`, Nutzerakzeptanzprüfung (GNAI-009 5.3) | | Deployment | lokales Ansible-Control-Projekt und idempotente Hostrollen; Production-Inventar mit Referenz- und Rollback-Profil, `ai_environment_switch` und Backup-Timer deployt und abgenommen (GNAI-008 14.6) | statische CI, Runner, geschützte Freigaben und automatisierter Rollback über die Delivery-Kette | | VPN | wg-easy v15.4.0; einziger Peer `ghost-laptop` als Server Admin; native nftables-Zielpolicy und NAT, Legacy-Bereinigung, Fremdnetz-, Positiv-/Negativ-, Dienst- und LXC-Wiederanlauftests bestanden; CT 104 am 07.10.2026 als zwölftes Ziel praktisch abgenommen | WAN-/IPv6-Managementport-Isolation, Backup-Restore, wg-easy-GUI-HTTPS und KI-Server-Test bei eingeschaltetem Host | -| DNS / Pi-hole | CT 100 unter `10.0.0.14` mit digest-gepinntem Pi-hole 2026.09.0 als Podman-Quadlet; SSH/nftables, UDP/TCP-DNS, Split-DNS, Blocking/Allowlist, FRITZ!Box-Cutover, LXC-Reboot und Stop-Mode-Backup am 01.10.2026 abgenommen; Ansible-Projekt vorhanden, Split-DNS-Record `mon.ghostnet.selfhost.eu → 10.0.0.10` vorbereitet (Deploy blockiert: noch kein `ansible-deploy` auf CT 100, Stand 09.11.2026) | vollständige App-/OIDC-Regression, praktischer FRITZ!Box-Rollback, mobile DuckDuckGo-/IPv6-Strategie, WireGuard-Profile, hostunabhängiger Restore-Test und die Production-Adoption des Ansible-Projekts | +| DNS / Pi-hole | CT 100 unter `10.0.0.14` mit digest-gepinntem Pi-hole 2026.09.0 als Podman-Quadlet; SSH/nftables, UDP/TCP-DNS, Split-DNS, Blocking/Allowlist, FRITZ!Box-Cutover, LXC-Reboot und Stop-Mode-Backup am 01.10.2026 abgenommen; Ansible-Projekt am 09.11.2026 adoptiert (ansible-deploy via pct; `site.yml`/`verify-production` `changed=0`) und Split-DNS-Record `mon.ghostnet.selfhost.eu → 10.0.0.10` live (verifiziert per `dig @10.0.0.14`) | vollständige App-/OIDC-Regression, praktischer FRITZ!Box-Rollback, mobile DuckDuckGo-/IPv6-Strategie, WireGuard-Profile, hostunabhängiger Restore-Test | | Reverse Proxy | CT-103-Zugänge, SSH-/Firewall-Baseline, Reboot und lokales Backup abgenommen; NPM 2.15.1 routet öffentlichen OIDC- und internen Admin-vHost getrennt; öffentliche Keycloak-Administration liefert 403; vollständiger Ansible-Sollzustand importiert und adoptiert (07.11.2026; preflight/verify-production/`site.yml --check` am 09.11.2026 ohne Befund, `changed=0`) | Fail2Ban-Jails/Bans und Wiederanlauf; hostunabhängige Backupkopie/Restore-Test; NPM-Proxyhost `mon.ghostnet.selfhost.eu` für das Monitoring-Dashboard (M6) | | Keycloak | CT 102 unter `10.0.0.4` reproduzierbar per Ansible aufgebaut; gepinntes Keycloak 26.2.4 und PostgreSQL 16.15, Restore von CT 104, Container-/DB-Härtung, NPM-Cutover, interner Adminzugang, öffentliche Admin-Sperre, realer Vaultwarden-OIDC-Login und LXC-Neustart abgenommen | 14-tägige Stabilisierungsphase, praktischer NPM-Rückfall auf CT 104, Betriebs-/Backup-/Restore-SOP und anschließende Rückfallbereinigung | | Encoding | Konto, Pfade, eigener rootless Store und CPU-Isolation per Ansible verwaltet und verifiziert; NFS-Mount `/var/lib/ghostnet-pipeline` aktiv (verifiziert 09.11.2026); Planungsabschluss 19.10.2026 (Pipeline GNENC-002, Speicher auf CT-101); Monitoring-Anbindung umgesetzt (GNMON-000 M1–M5) | Implementierung (Images, Quadlets, Skripte, Worker); Lasttest und Limit-Feintuning; SMB-Output-Pickup als geschlossener Ablauf | -| Monitoring | M1–M5 produktiv auf `10.0.0.90` (System-Scope, Konten `gn-monitor` 986 / `gn-dashboard` 984): node_exporter + AMD-Textfile-Collector, VictoriaMetrics, Loki + Alloy, vmalert + Alertmanager (inkl. Regelgruppe `gnmon-ai` mit `GnAiEnvironmentDown`), Dashboard v0.2.0 host-lokal auf `127.0.0.1:8080`; alle Dienst-Ports host-lokal; nach Host-Neustart 09.11.2026 wieder vollständig aktiv verifiziert (GNMON-000) | M6 externe Freigabe (NPM `mon.ghostnet.selfhost.eu` + Keycloak-OIDC-Client `gn-dashboard`), echter SMTP-Versand, LLM-Metriken jenseits `gn_ai_active_env`, Retention-Feintuning | +| Monitoring | M1–M6 produktiv auf `10.0.0.90` (System-Scope, Konten `gn-monitor` 986 / `gn-dashboard` 984): node_exporter + AMD-Textfile-Collector, VictoriaMetrics, Loki + Alloy, vmalert + Alertmanager (inkl. `gnmon-ai`/`GnAiEnvironmentDown`), Dashboard **v0.3.2 öffentlich über `https://mon.ghostnet.selfhost.eu`** (NPM CT-103 ID 14, LE-TLS; Keycloak-OIDC Realm Ghost.net, Client `gnai-dashboard`, Rollen `gnai-dashboard-user`/`-admin`; 8080 per nftables nur von 10.0.0.10; E2E inkl. 403-Negativtest und WebSocket-Circuit bestanden 09.11.2026, GNMON-000 M6) | echter SMTP-Versand, LLM-Metriken jenseits `gn_ai_active_env`, Retention-Feintuning, externer WireGuard-Zugriff auf mon (DNS/TLS öffentlich, praktisch ungetestet) | | Samba (CT 101) | Share-Bestand in GNAI-017 dokumentiert; Ansible-Projekt nach GNAI-019 gebaut und lokal verifiziert; Runbooks vorhanden; In-Place-Upgrade auf Debian 13 am 21.10.2026; smb.conf-Verlust beim Upgrade aus vzdump-Backup wiederhergestellt, Media-Shares und Workstation-Mounts verifiziert | produktive Adoption (Platzhalter, Schlüssel, Convergence, Verifikation), NFS-Export und Encoding-Shares produktiv, UID/GID-Abgleich produktiv, Backup-/Restore-Test | Ein Zielbild, eine Betreiberangabe oder ein erfolgreicher Teiltest gilt nicht als diff --git a/docs/platform/llm-server/monitoring/GNMON-000-DOC_Index.md b/docs/platform/llm-server/monitoring/GNMON-000-DOC_Index.md index 0d07114..70d325a 100644 --- a/docs/platform/llm-server/monitoring/GNMON-000-DOC_Index.md +++ b/docs/platform/llm-server/monitoring/GNMON-000-DOC_Index.md @@ -2,7 +2,7 @@ **Dokumenten-ID:** GNMON-000-DOC **Stand:** 2026-11-09 -**Status:** Revision v2.0 (03.11.2026) übernommen; M1–M5 produktiv auf Workstation + KI-Server; M6 (NPM + Keycloak-OIDC) App-/Server-seitig vorbereitet, externe Freigabe wartet auf Betreiber-Schritte +**Status:** Revision v2.0 (03.11.2026) übernommen; M1–M6 produktiv — Dashboard öffentlich über `https://mon.ghostnet.selfhost.eu` mit Keycloak-OIDC (abgenommen 09.11.2026) ## Dokumente @@ -330,37 +330,71 @@ Realm `Ghost.net` (Vaultwarden-Realm, Issuer ergänzt; der Production-Deploy scheitert zunächst, weil auf CT-100 noch **kein `ansible-deploy`-Konto existiert** (Adoption steht aus, siehe Betreiber-Schritte). -- **Betreiber-Schritte (offen):** - 1. Keycloak: einmalig `kcadm config credentials` als Admin im - `ghostnet-keycloak`-Container (Passwort-Prompt), danach legt der - Agent Client `gn-dashboard` (confidential, Standard-Flow, Redirect - `https://mon.ghostnet.selfhost.eu/signin-oidc`), Realm-Rolle - `dashboard-admin` und Rollen-Zuweisung an; Secret wird nur in die - host-lokale dashboard-secrets.env geschrieben. MFA-Hinweis: eine - reichweitenweite Realm-Policy könnte den produktiven - Vaultwarden-OIDC beeinflussen — Ausgestaltung ist - Betreiberentscheidung (z. B. Conditional Flow nur für die Rolle). - 2. CT-100: Adoption-Bootstrap (`bootstrap.yml` auf Bootstrap-Inventar, - `--ask-become-pass`) → Agent deploys den DNS-Record. - 3. CT-103: Der Ansible-Nachbau ist abgeschlossen — Projekt unter - `proxmox/lxc/ct-103-reverse-proxy/ansible/`, am 07.11.2026 adoptiert - und am 09.11.2026 verifiziert (preflight ok=15, verify-production - ok=27 changed=0, `site.yml --check` changed=0; GNAI-006 v3.0). - Verbleibend: Proxy-Host `mon.ghostnet.selfhost.eu` → `10.0.0.90:8080` - in NPM anlegen (NPM-Proxyhosts sind Runtime-Daten und werden nicht - per Ansible verwaltet), WebSocket Support und Block Common Exploits - aktiv, SSL/Redirect wie die bestehenden Hosts (Vaultwarden-Muster). - Danach: Bind des Dashboards auf die LAN-IP + nftables „8080 nur von - 10.0.0.10" + `Auth__Enabled=true` + E2E-Abnahme (echter Login, - Rollen-403-Negativtest, Blazor-Circuit über WebSocket hinter Proxy). +- **Abnahme M6 (09.11.2026, alle bestanden):** Alle drei Betreiber-Schritte + wurden durchgeführt und agent-seitig verifiziert: + 1. **Keycloak (Realm `Ghost.net`, Betreiber-GUI):** Client **`gnai-dashboard`** + (confidential, Standard Flow, Redirects + `https://mon.ghostnet.selfhost.eu/signin-oidc` + + `/signout-callback-oidc`, Web Origin `https://mon.ghostnet.selfhost.eu`), + Realm-Rollen **`gnai-dashboard-user`** / **`gnai-dashboard-admin`** + (Scope `roles`, Mapper `realm roles` mit Add-to-ID-token/access-token/ + userinfo ON — im restaurierten Realm waren die Flags unset, das ID-Token + enthielt dadurch kein `realm_access`), zugewiesen an User `ghost`. + Secret liegt ausschließlich in `/etc/gnmon/dashboard-secrets.env` + (gn-dashboard:gn-dashboard 0640; Keys `Auth__Enabled`, + `Auth__ClientSecret`, `Auth__AllowedRoles=gnai-dashboard-user,gnai-dashboard-admin`) + — nie im Repo/Chat. Keine Änderungen an Authentication-Flows (MFA am + Vaultwarden-Login unberührt). + 2. **CT-100:** Adoption per `pct exec` (ansible-deploy 1002 + + `AllowUsers` + sudoers) am 09.11.2026; danach `verify-deploy-access` + ok=5, `site.yml` ok=61 changed=11 dann `changed=0`, `verify-production` + ok=32 changed=0. Split-DNS `mon.ghostnet.selfhost.eu → 10.0.0.10` live + (`dig @10.0.0.14` verifiziert; öffentlich bleibt Wildcard → WAN). + **Befund:** die Inventare hatten `dns_pihole_hosts_records` gespiegelt — + der neue Record musste in allen drei Inventaren ergänzt werden; + außerdem darf die Quadlet-Template nur EINE `FTLCONF_dns_hosts`-Zeile + emittieren (systemd: letzter Key gewinnt — sonst fällt auth-admin auf + Upstream zurück). Beides gefixt. + 3. **CT-103:** Proxy-Host ID 14 `mon.ghostnet.selfhost.eu → 10.0.0.90:8080` + (WebSocket Support, Block Common Exploits, LE-Cert `npm-20`, Force SSL, + HTTP/2, HSTS) + Advanced-Block + `proxy_set_header X-Forwarded-Proto $scheme; X-Forwarded-Host $host;` + (NPM 2.15.1 setzt sonst nur das leere `$x_forwarded_proto`) sowie + `proxy_buffer_size 32k; proxy_buffers 8 32k; proxy_busy_buffers_size 64k;` + (großer Auth-Cookie nach Login → sonst 502 „upstream sent too big + header“). + 4. **KI-Server:** Rolle `gnmon_firewall` (nftables, Policy ACCEPT, nur + 8080 von 10.0.0.10 + Monitoring-Ports non-loopback-drop; `changed=0` + idempotent), Dashboard-Bind auf `10.0.0.90:8080` (Assertion erlaubt LAN-Bind + nur mit aktivem Firewall-Tag), Image **v0.3.2** deployt. + **App-Befunde (v0.2.x → v0.3.2):** ClientId an `gnai-dashboard` angepasst; + `Auth:AllowedRoles` konfigurierbar; `KnownNetworks/KnownProxies` per + `.Clear()` geleert (leere `{ }`-Initialisierung behält den Loopback- + Default — sonst ignoriert .NET die NPM-Forwarded-Header und die + redirect_uri wäre intern → PAR 400); `GetClaimsFromUserInfoEndpoint=true` + (realm-roles-Mapper-Flags); `SaveTokens=true` (Logout braucht + id_token_hint); Cookie-`AccessDeniedPath=/access-denied` + Seite + (sonst Redirect-Loop auf /Account/AccessDenied); csproj + `PrunePackageData=false` + Containerfile ohne `--no-restore` (sonst + fehlt `wwwroot/_framework/blazor.web.js` im Image → Blazor-Circuit + startet nicht, 404). + **E2E-Verifikation 09.11.2026:** unauth `GET /` via NPM → 302 zu + `auth.../realms/Ghost.net/.../auth?client_id=gnai-dashboard&request_uri=...` + (PAR 201); Direktzugriff `https://10.0.0.90:8080` von der Workstation → + gedroppt (nftables, curl 000); `blazor.web.js` via NPM → 200 + `text/javascript`; Browser-Login als `ghost` → Dashboard 200 mit Live-Daten, + Unterseiten + WebSocket-Circuit hinter NPM ok; Login als `testuser` ohne + Rollen → saubere 403-Seite `/access-denied`; `/logout` → Keycloak-Logout + ohne id_token_hint-Fehler; Gesamtsuite `monitor.yml` ok=84 changed=0. + Journal-Evidenz: `[gnmon-auth] realm_roles=gnai-dashboard-user,...,gnai-dashboard-admin`. ## Noch offen (Rest) 1. GNMON-001 v2.0 Abschnitt 9, Restpunkte: Metrics-Account-Identität, - UID/GID `gn-monitor` und Chart-Bibliothek sind entschieden/umgesetzt; - NPM-Hostname ist entschieden (`mon.ghostnet.selfhost.eu`), der - Keycloak-Client folgt mit den M6-Betreiber-Schritten (oben). Offen - bleiben LLM-Metriken jenseits `gn_ai_active_env` (z. B. Tokens/ + UID/GID `gn-monitor` (986), Chart-Bibliothek (Braille), NPM-Hostname + (`mon.ghostnet.selfhost.eu`) und Keycloak-Client (`gnai-dashboard` + + Rollen) sind entschieden/umgesetzt (M6, oben). Offen bleiben + LLM-Metriken jenseits `gn_ai_active_env` (z. B. Tokens/ Latenzen der Inference-Engine) und die Retention-Feinjustierung. 2. keep-id-Ursachenanalyse (crun/Overlay-Rechte der gn-dashboard-Storage) bei Bedarf; Entscheidung zum Default-Mapping steht in Abschnitt M5. diff --git a/docs/platform/llm-server/monitoring/GNMON-001-PLAN_Architecture.md b/docs/platform/llm-server/monitoring/GNMON-001-PLAN_Architecture.md index 5c25c77..9db5b2f 100644 --- a/docs/platform/llm-server/monitoring/GNMON-001-PLAN_Architecture.md +++ b/docs/platform/llm-server/monitoring/GNMON-001-PLAN_Architecture.md @@ -3,7 +3,7 @@ **Dokumenten-ID:** GNMON-001-PLAN **Titel:** Host-Monitoring auf dem KI-Server: Systemmetriken, Log-Pipeline und Blazor-Dashboard **Stand:** 2026-11-09 -**Status:** Revidierter Plan (v2.0) nach Betreiberentscheidungen vom 03.11.2026; M1–M5 produktiv umgesetzt (belegter Stand in GNMON-000), M6 externe Freigabe in Vorbereitung +**Status:** Revidierter Plan (v2.0) nach Betreiberentscheidungen vom 03.11.2026; M1–M6 produktiv umgesetzt inkl. OIDC-Freigabe (belegter Stand in GNMON-000) **Referenzen:** [GNENC-001](https://git.ghostnet.selfhost.eu/ghostnet.ai/infrastructure/raw/branch/main/docs/platform/llm-server/encoding/GNENC-001-PLAN_Architecture.md), [GNENC-002](https://git.ghostnet.selfhost.eu/ghostnet.ai/infrastructure/raw/branch/main/docs/platform/llm-server/encoding/GNENC-002-PLAN_Pipeline.md), [GNAI-005](https://git.ghostnet.selfhost.eu/ghostnet.ai/infrastructure/raw/branch/main/docs/platform/GNAI-005-SEC_Access-Control.md), [GNAI-006](https://git.ghostnet.selfhost.eu/ghostnet.ai/infrastructure/raw/branch/main/docs/platform/proxmox-server/lxc/ct-103-reverse-proxy/GNAI-006-SEC_Reverse-Proxy.md) ## Änderungsverlauf @@ -13,6 +13,7 @@ | 19.10.2026 | 1.0 | Betreiber | Planungsabschluss: Metrics-Collector (system.json) + Flask-Dashboard | | 03.11.2026 | 2.0 | Betreiber / Mistral Vibe | Revision: Dashboard auf ASP.NET Core Blazor Server; Metriken über VictoriaMetrics + Exporter statt system.json-Schnappschuss; neue Log-Pipeline (Alloy + Loki) für journald-, Container- und Encoding-Logs | | 09.11.2026 | 2.1 | Mistral Vibe | Umsetzungsabweichungen gegenüber v2.0 nachgeführt (belegter Stand in GNMON-000): `gn-monitor` hat UID/GID **986** (die geplante 983 war an `gn-download` vergeben), Charts als eigene Braille-Komponente statt ApexCharts, NPM-Hostname `mon.ghostnet.selfhost.eu` entschieden; M1–M5 sind produktiv auf dem KI-Server (System-Scope) und der Workstation (User-Scope) ausgerollt | +| 09.11.2026 | 2.2 | Mistral Vibe | M6 umgesetzt (Abschnitt 7 wird damit Realität): nftables-Rolle `gnmon_firewall` (8080 nur von NPM 10.0.0.10), Dashboard-Bind auf `10.0.0.90:8080`, OIDC gegen Keycloak-Client `gnai-dashboard` (Realm Ghost.net, Rollen `gnai-dashboard-user`/`gnai-dashboard-admin`); NPM-Proxyhost mit X-Forwarded-Proto/Host + vergrößerten Puffern. Details und Befunde in GNMON-000 M6 | ## Änderungen gegenüber v1.0 diff --git a/docs/platform/proxmox-server/lxc/ct-100-dns/GNAI-012-PLAN_Pi-hole-DNS-Handoff.md b/docs/platform/proxmox-server/lxc/ct-100-dns/GNAI-012-PLAN_Pi-hole-DNS-Handoff.md index 8c92a9b..d9eff70 100644 --- a/docs/platform/proxmox-server/lxc/ct-100-dns/GNAI-012-PLAN_Pi-hole-DNS-Handoff.md +++ b/docs/platform/proxmox-server/lxc/ct-100-dns/GNAI-012-PLAN_Pi-hole-DNS-Handoff.md @@ -2,8 +2,8 @@ **Dokumenten-ID:** GNAI-012-PLAN **Titel:** Pi-hole-LXC, FRITZ!Box-DNS und Split-DNS für interne Dienste -**Status:** Implementiert und im LAN produktiv; Ansible-Sollzustand als CT-Projekt angelegt, privilegierte Live-Adoption und klar ausgewiesene Folgepunkte offen -**Stand:** 21.10.2026 +**Status:** Implementiert und im LAN produktiv; Ansible-Sollzustand als CT-Projekt angelegt und am 09.11.2026 privilegiert adoptiert (ansible-deploy via pct exec; `site.yml`/`verify-production` konvergent `changed=0`); Split-DNS-Record `mon.ghostnet.selfhost.eu → 10.0.0.10` seit 09.11.2026 live (GNMON-M6). Klar ausgewiesene Folgepunkte offen +**Stand:** 2026-11-09 **Referenzen:** [Projekt-Roadmap](../../../../GNAI-001-PLAN_Project-Roadmap.md), [Zugriffskonzept](../../../GNAI-005-SEC_Access-Control.md), [LXC-SSH-Architektur](../../GNAI-011-SEC_LXC-SSH-Architecture.md), [Reverse Proxy](../ct-103-reverse-proxy/GNAI-006-SEC_Reverse-Proxy.md), [WireGuard](../ct-105-wireguard/GNAI-007-SEC_VPN.md) ## 1. Auftrag und Umsetzungsergebnis diff --git a/docs/platform/proxmox-server/lxc/ct-103-reverse-proxy/GNAI-006-SEC_Reverse-Proxy.md b/docs/platform/proxmox-server/lxc/ct-103-reverse-proxy/GNAI-006-SEC_Reverse-Proxy.md index 37115e3..abcf55e 100644 --- a/docs/platform/proxmox-server/lxc/ct-103-reverse-proxy/GNAI-006-SEC_Reverse-Proxy.md +++ b/docs/platform/proxmox-server/lxc/ct-103-reverse-proxy/GNAI-006-SEC_Reverse-Proxy.md @@ -35,6 +35,7 @@ | 2026-10-14 | 2.8 | Codex | NPM auf den reproduzierten CT 102 umgeschaltet; öffentliche Admin-Sperre 403, interner Admin-vHost 200, Discovery/OIDC und realer Vaultwarden-Login abgenommen. | | 2026-10-31 | 2.9 | spektr / Mistral Vibe | Lesenden Infrastruktur-Audit vor dem LLM-Ausbau durchgeführt (Abschnitt 2.4): Dienste, Image-Pins, SSH- und Dateihärtung, Firewall-Verhaltenstests, TLS, DNS und Keycloak-Pfade geprüft; keine Abweichung. Fail2Ban-Funktionsabnahme bleibt offen. | | 2026-11-09 | 3.0 | Mistral Vibe | Ansible-Sollzustand im Repository importiert (`proxmox/lxc/ct-103-reverse-proxy/ansible/`) und am 07.11.2026 adoptiert (Konten `ghost-agent`/`ghost`/`ansible-deploy`, verwaltetes nftables, NPM-/Fail2Ban-Quadlets). Verifiziert 09.11.2026: `preflight.yml` (agent) ok=15 failed=0, `verify-production.yml` (production) ok=27 changed=0 failed=0, `site.yml --check` changed=0 — Host und Sollzustand sind konvergent. | +| 2026-11-09 | 3.1 | spektr / Mistral Vibe | Proxy-Host ID 14 `mon.ghostnet.selfhost.eu → 10.0.0.90:8080` angelegt (Abschnitt 7): WebSocket Support, Block Common Exploits, LE-Zertifikat, Force SSL, HSTS; Advanced-Config mit `X-Forwarded-Proto $scheme`/`X-Forwarded-Host $host` (NPM setzt sonst nur das leere `$x_forwarded_proto`) und `proxy_buffer_size 32k` (großer OIDC-Cookie). GNMON-M6-Abnahme siehe GNMON-000. | --- @@ -392,6 +393,7 @@ Routen aus dem bisherigen Quelleninventar; Keycloak-Backend vom Betreiber erneut | 7 | `auth.ghostnet.selfhost.eu` | `10.0.0.4:8080` | Keycloak Identity Provider | | 10 | `japan.ghostnet.selfhost.eu` | `10.0.0.23:80` | Japanese Web App | | 12 | `vault.ghostnet.selfhost.eu` | `10.0.0.47:8080` | Vaultwarden Password Manager | +| 14 | `mon.ghostnet.selfhost.eu` | `10.0.0.90:8080` | GNMON-Dashboard (Blazor, OIDC) — WebSocket Support + Block Common Exploits + LE-TLS + Force SSL; Advanced: `X-Forwarded-Proto $scheme`, `X-Forwarded-Host $host`, `proxy_buffer_size 32k` (großer OIDC-Cookie), Split-DNS via CT 100 seit 09.11.2026 | --- diff --git a/llm-server/monitoring/ansible/inventories/testing/group_vars/all.yml b/llm-server/monitoring/ansible/inventories/testing/group_vars/all.yml index 7e65ec9..4d787af 100644 --- a/llm-server/monitoring/ansible/inventories/testing/group_vars/all.yml +++ b/llm-server/monitoring/ansible/inventories/testing/group_vars/all.yml @@ -73,11 +73,17 @@ gnmon_loki_image_ref: docker.io/grafana/loki:3.6.19 gnmon_alertmanager_image_ref: docker.io/prom/alertmanager:v0.34.2 gnmon_vmalert_image_ref: docker.io/victoriametrics/vmalert:v1.154.1 +# --- Firewall (M6, nur System-Scope auf ghostnet-ki) ------------------------- +gnmon_firewall_scope: system +# 8080 nur von NPM (CT-103) erreichbar (gnmon_firewall); Default-Werte siehe Rolle. + # --- Dashboard --------------------------------------------------------------- gnmon_dashboard_scope: system gnmon_dashboard_systemd_scope: system gnmon_dashboard_quadlet_dir: /etc/containers/systemd/users/984 -# Transportiertes Image (Workstation-Build, podman save/load am 06.11.2026: -# docker.io/ghostnet/dashboard:v0.1.0, ID 1b71e6d35069 — identisch zur -# Workstation, Build aus images/dashboard/Containerfile). -gnmon_dashboard_image_ref: docker.io/ghostnet/dashboard:v0.2.0 +# M6: Bind auf die LAN-IP; nftables (gnmon_firewall) lässt nur 10.0.0.10 (NPM) zu. +gnmon_dashboard_http_listen: "10.0.0.90:8080" +# Transportiertes Image (Workstation-Build, podman save/load am 09.11.2026). +# v0.2.1: konfigurierbare Auth:AllowedRoles; v0.2.2 (ID 518f88349c6c): ClientId +# an den Keycloak-Client "gnai-dashboard" angepasst. Build aus images/dashboard/Containerfile. +gnmon_dashboard_image_ref: docker.io/ghostnet/dashboard:v0.3.2 diff --git a/llm-server/monitoring/ansible/playbooks/monitor.yml b/llm-server/monitoring/ansible/playbooks/monitor.yml index 7221e00..f4b17f6 100644 --- a/llm-server/monitoring/ansible/playbooks/monitor.yml +++ b/llm-server/monitoring/ansible/playbooks/monitor.yml @@ -7,6 +7,8 @@ roles: - role: gnmon_accounts tags: [accounts, never] + - role: gnmon_firewall + tags: [firewall] - role: gnmon_collector tags: [collector] - role: gnmon_victoria_metrics @@ -120,23 +122,33 @@ when: gnmon_vmalert_selftest_rule | bool tags: [alerting] - - name: Wait for the dashboard to answer on the host loopback + # M6: with Auth enabled, "/" answers 302 (OIDC challenge via PAR toward + # Keycloak) instead of 200; without auth it serves the Blazor shell (200). + # The forwarded headers simulate the NPM ingress so the OIDC redirect + # URI resolves to the external host registered in Keycloak. + - name: Wait for the dashboard to answer ansible.builtin.uri: url: "http://{{ gnmon_dashboard_http_listen }}/" - status_code: 200 + status_code: [200, 302] + headers: + X-Forwarded-Proto: https + X-Forwarded-Host: mon.ghostnet.selfhost.eu register: gnmon_dashboard_ready retries: 20 delay: 3 - until: gnmon_dashboard_ready.status == 200 + until: gnmon_dashboard_ready.status in [200, 302] tags: [dashboard] - - name: Verify the dashboard serves the Blazor shell + - name: Verify the dashboard answers (200 shell or 302 OIDC challenge) ansible.builtin.uri: url: "http://{{ gnmon_dashboard_http_listen }}/" - status_code: 200 + status_code: [200, 302] + headers: + X-Forwarded-Proto: https + X-Forwarded-Host: mon.ghostnet.selfhost.eu return_content: false register: gnmon_dashboard_shell - until: gnmon_dashboard_shell.status == 200 + until: gnmon_dashboard_shell.status in [200, 302] retries: 3 delay: 2 tags: [dashboard] diff --git a/llm-server/monitoring/ansible/roles/gnmon_alloy/defaults/main.yml b/llm-server/monitoring/ansible/roles/gnmon_alloy/defaults/main.yml index 3684f4e..580acac 100644 --- a/llm-server/monitoring/ansible/roles/gnmon_alloy/defaults/main.yml +++ b/llm-server/monitoring/ansible/roles/gnmon_alloy/defaults/main.yml @@ -24,11 +24,9 @@ gnmon_alloy_loki_push_url: "http://127.0.0.1:3100/loki/api/v1/push" # journald source. In user-scope operation the sd-journal auto-discovery # only opens the user journal; the workstation inventory therefore sets -# an explicit journal path. Empty string = auto-discovery. +# an explicit journal path. Empty string = auto-discovery. Needs the +# systemd-journal group membership of the run user in system scope. gnmon_alloy_journal_path: "" -gnmon_alloy_journal_max_age: "12h" - -# journald source (needs systemd-journal group membership). gnmon_alloy_journal_enabled: true gnmon_alloy_journal_max_age: "12h" diff --git a/llm-server/monitoring/ansible/roles/gnmon_dashboard/defaults/main.yml b/llm-server/monitoring/ansible/roles/gnmon_dashboard/defaults/main.yml index 8a20d21..063c1f8 100644 --- a/llm-server/monitoring/ansible/roles/gnmon_dashboard/defaults/main.yml +++ b/llm-server/monitoring/ansible/roles/gnmon_dashboard/defaults/main.yml @@ -14,11 +14,11 @@ gnmon_dashboard_quadlet_dir: >- if gnmon_dashboard_scope == 'system' else lookup('ansible.builtin.env', 'HOME') ~ '/.config/containers/systemd' }} -# Transported image (built from images/dashboard/Containerfile); v0.2.0 -# adds the configuration-driven OIDC layer (M6, GNMON-000). The image is -# transported (podman save/load), so the inventory pins the tag ref either -# way. -gnmon_dashboard_image_ref: docker.io/ghostnet/dashboard:v0.2.0 +# Transported image (built from images/dashboard/Containerfile); v0.2.1 +# adds the configuration-driven OIDC layer with configurable Auth:AllowedRoles +# (M6, GNMON-000). The image is transported (podman save/load), so the +# inventory pins the tag ref either way. +gnmon_dashboard_image_ref: docker.io/ghostnet/dashboard:v0.3.2 # Host loopback only (GNMON-001 section 7); NPM ingress follows in M6. gnmon_dashboard_http_listen: "127.0.0.1:8080" diff --git a/llm-server/monitoring/ansible/roles/gnmon_dashboard/tasks/main.yml b/llm-server/monitoring/ansible/roles/gnmon_dashboard/tasks/main.yml index 62fb243..3f4b869 100644 --- a/llm-server/monitoring/ansible/roles/gnmon_dashboard/tasks/main.yml +++ b/llm-server/monitoring/ansible/roles/gnmon_dashboard/tasks/main.yml @@ -4,10 +4,17 @@ that: - gnmon_dashboard_scope in ['user', 'system'] - gnmon_dashboard_image_ref is match('^[a-z0-9./:-]+$') - - gnmon_dashboard_http_listen is match('^127\.0\.0\.1:[0-9]+$') + # M5 default: host loopback. M6: a LAN bind is allowed only in system + # scope together with the gnmon_firewall role (8080 restricted to NPM). + - >- + gnmon_dashboard_http_listen is match('^127\.0\.0\.1:[0-9]+$') + or (gnmon_dashboard_scope == 'system' + and gnmon_firewall_scope | default('user') == 'system' + and gnmon_dashboard_http_listen is match('^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+:[0-9]+$')) fail_msg: >- - gnmon_dashboard requires scope user|system, an image ref and a - host-loopback listen address. + gnmon_dashboard requires scope user|system, an image ref and either a + host-loopback listen address or — in system scope with gnmon_firewall + active — a LAN listen address (M6 ingress via NPM only). - name: Create the dashboard quadlet directory ansible.builtin.file: diff --git a/llm-server/monitoring/ansible/roles/gnmon_firewall/README.md b/llm-server/monitoring/ansible/roles/gnmon_firewall/README.md new file mode 100644 index 0000000..a6e09e6 --- /dev/null +++ b/llm-server/monitoring/ansible/roles/gnmon_firewall/README.md @@ -0,0 +1,32 @@ +# gnmon_firewall + +Host-nftables on `ghostnet-ki` (GNMON-001 section 7), system scope only. The +workstation inventory (user scope) is a no-op. + +## What it enforces + +- Dashboard port 8080 (M6): reachable **only from NPM** (CT-103, + `gnmon_firewall_dashboard_allowed_ip` = 10.0.0.10). NPM terminates TLS and + the OIDC redirect; the dashboard itself binds to the LAN address + `10.0.0.90:8080` (`gnmon_dashboard_http_listen`). +- Monitoring APIs (Loki 3100/9096, VictoriaMetrics 8428, vmalert 8880, + Alertmanager 9093, node_exporter 9100): bound to 127.0.0.1 by the services + and additionally dropped for non-loopback traffic (defense in depth). + +## What it deliberately does NOT do + +The input policy stays **ACCEPT**: the KI host has no other firewall, and a +default-drop policy introduced from the monitoring project could lock out SSH +management. A full host firewall is a separate sprint (GNAI-001 M1). +`flush ruleset` in the managed `/etc/nftables.conf` removes every other +table — do not maintain foreign nftables content on this host. + +## Operations + +- Preview: `ansible-playbook -i inventories/testing/hosts.yml playbooks/monitor.yml --tags firewall --check --diff` +- Deploy: same without `--check`. +- Verify live: `nft list ruleset` (root), e.g. on the host + `sudo nft list table inet gnmon_filter`. +- Negative test from the workstation while the dashboard is LAN-bound: + `curl -k --max-time 5 https://10.0.0.90:8080/` must time out (dropped), + while `https://mon.ghostnet.selfhost.eu/` via NPM answers. diff --git a/llm-server/monitoring/ansible/roles/gnmon_firewall/defaults/main.yml b/llm-server/monitoring/ansible/roles/gnmon_firewall/defaults/main.yml new file mode 100644 index 0000000..69ad868 --- /dev/null +++ b/llm-server/monitoring/ansible/roles/gnmon_firewall/defaults/main.yml @@ -0,0 +1,29 @@ +# GNMON-001 section 7: host nftables on ghostnet-ki (M6 ingress control). +# +# System scope only (ghostnet-ki). The workstation (user scope) needs no +# host firewall: everything binds to 127.0.0.1 there as well. +# +# Safety: the input policy stays ACCEPT. This role only adds GNMON-specific +# restrictions (dashboard ingress from NPM only, monitoring ports loopback +# only). A default-drop host firewall is a separate sprint (GNAI-001 M1) +# and must never be introduced from here. + +gnmon_firewall_scope: user + +gnmon_firewall_config_path: /etc/nftables.conf +gnmon_firewall_service_name: nftables.service + +# Dashboard ingress (M6): the Blazor dashboard binds to the LAN address, +# but only NPM (CT-103) may reach it; NPM terminates TLS and OIDC. +gnmon_firewall_dashboard_port: 8080 +gnmon_firewall_dashboard_allowed_ip: 10.0.0.10 + +# Monitoring APIs bind to 127.0.0.1 (GNMON-000 M5); deny non-loopback +# access to them anyway (defense in depth, GNMON-001 section 7). +gnmon_firewall_loopback_only_ports: + - 3100 # Loki HTTP + - 9096 # Loki gRPC + - 8428 # VictoriaMetrics + - 8880 # vmalert + - 9093 # Alertmanager + - 9100 # node_exporter diff --git a/llm-server/monitoring/ansible/roles/gnmon_firewall/handlers/main.yml b/llm-server/monitoring/ansible/roles/gnmon_firewall/handlers/main.yml new file mode 100644 index 0000000..c1e07f7 --- /dev/null +++ b/llm-server/monitoring/ansible/roles/gnmon_firewall/handlers/main.yml @@ -0,0 +1,8 @@ +--- +# GNMON-001 section 7: nftables reload handler (system scope). +- name: Restart nftables + ansible.builtin.systemd_service: + name: "{{ gnmon_firewall_service_name }}" + state: restarted + daemon_reload: true + when: gnmon_firewall_scope == 'system' diff --git a/llm-server/monitoring/ansible/roles/gnmon_firewall/tasks/main.yml b/llm-server/monitoring/ansible/roles/gnmon_firewall/tasks/main.yml new file mode 100644 index 0000000..14ddc14 --- /dev/null +++ b/llm-server/monitoring/ansible/roles/gnmon_firewall/tasks/main.yml @@ -0,0 +1,68 @@ +--- +# GNMON-001 section 7: host nftables on ghostnet-ki. System scope only; +# the role is a no-op for the workstation (user scope) inventory. + +- name: Validate firewall declarations + ansible.builtin.assert: + that: + - gnmon_firewall_scope in ['user', 'system'] + - gnmon_firewall_config_path is match('^/etc/') + - gnmon_firewall_dashboard_port | int >= 1024 + - gnmon_firewall_dashboard_allowed_ip is match('^[0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+$') + - gnmon_firewall_loopback_only_ports | length > 0 + fail_msg: >- + gnmon_firewall requires scope user|system, an /etc config path, a + dashboard port >= 1024 and a valid NPM ingress IPv4. + when: gnmon_firewall_scope == 'system' + +- name: Install nftables (system scope only) + ansible.builtin.apt: + name: nftables + state: present + when: gnmon_firewall_scope == 'system' + +- name: Install the managed nftables configuration + ansible.builtin.template: + src: nftables.conf.j2 + dest: "{{ gnmon_firewall_config_path }}" + owner: root + group: root + mode: "0644" + validate: "/usr/sbin/nft --check --file %s" + notify: Restart nftables + when: gnmon_firewall_scope == 'system' + +- name: Enable and start the nftables service + ansible.builtin.systemd_service: + name: "{{ gnmon_firewall_service_name }}" + enabled: true + state: started + daemon_reload: true + when: + - gnmon_firewall_scope == 'system' + - not ansible_check_mode + +- name: Verify the GNMON ruleset is loaded + ansible.builtin.command: + argv: + - /usr/sbin/nft + - list + - ruleset + register: gnmon_firewall_ruleset + changed_when: false + check_mode: false + when: + - gnmon_firewall_scope == 'system' + - not ansible_check_mode + +- name: Require the dashboard ingress restriction + ansible.builtin.assert: + that: + - "'gnmon_filter' in gnmon_firewall_ruleset.stdout" + - "('tcp dport ' ~ (gnmon_firewall_dashboard_port | string)) in gnmon_firewall_ruleset.stdout" + fail_msg: >- + The gnmon_filter table or the dashboard port restriction is missing + from the live ruleset. + when: + - gnmon_firewall_scope == 'system' + - not ansible_check_mode diff --git a/llm-server/monitoring/ansible/roles/gnmon_firewall/templates/nftables.conf.j2 b/llm-server/monitoring/ansible/roles/gnmon_firewall/templates/nftables.conf.j2 new file mode 100644 index 0000000..ddfe89e --- /dev/null +++ b/llm-server/monitoring/ansible/roles/gnmon_firewall/templates/nftables.conf.j2 @@ -0,0 +1,26 @@ +#!/usr/sbin/nft -f +# {{ ansible_managed }} +# GNMON-001 section 7: host nftables on ghostnet-ki, managed by the +# gnmon_firewall role (llm-server/monitoring/ansible). +# +# The input policy deliberately stays ACCEPT: this host has no other +# firewall and a default-drop here could lock out SSH management. +# This table only enforces the GNMON ingress rules. `flush ruleset` +# removes every other table — do not add foreign nftables content to +# this host without moving the firewall into its own role/sprint. + +flush ruleset + +table inet gnmon_filter { + chain input { + type filter hook input priority filter; policy accept; + + iifname "lo" accept + + # M6: dashboard ingress only from NPM (CT-103, {{ gnmon_firewall_dashboard_allowed_ip }}). + ip saddr != {{ gnmon_firewall_dashboard_allowed_ip }} tcp dport {{ gnmon_firewall_dashboard_port }} drop + + # Monitoring APIs are bound to 127.0.0.1; deny non-loopback anyway. + iifname != "lo" tcp dport { {{ gnmon_firewall_loopback_only_ports | join(', ') }} } drop + } +} diff --git a/llm-server/monitoring/images/dashboard/Containerfile b/llm-server/monitoring/images/dashboard/Containerfile index e6961e9..4cd1a46 100644 --- a/llm-server/monitoring/images/dashboard/Containerfile +++ b/llm-server/monitoring/images/dashboard/Containerfile @@ -13,7 +13,10 @@ COPY Ghostnet.Dashboard.csproj . RUN dotnet restore Ghostnet.Dashboard.csproj COPY . . -RUN dotnet publish Ghostnet.Dashboard.csproj -c Release -o /app --no-restore +# No --no-restore: with the cached restore the publish could run with stale +# package data and drop wwwroot/_framework/blazor.web.js (404 in the +# container, Befund 09.11.2026); a full restore+publish keeps it. +RUN dotnet publish Ghostnet.Dashboard.csproj -c Release -o /app FROM mcr.microsoft.com/dotnet/aspnet:10.0 WORKDIR /app diff --git a/llm-server/monitoring/src/Ghostnet.Dashboard/Components/Pages/AccessDenied.razor b/llm-server/monitoring/src/Ghostnet.Dashboard/Components/Pages/AccessDenied.razor new file mode 100644 index 0000000..8cd1fa8 --- /dev/null +++ b/llm-server/monitoring/src/Ghostnet.Dashboard/Components/Pages/AccessDenied.razor @@ -0,0 +1,9 @@ +@page "/access-denied" +@attribute [AllowAnonymous] +@layout MainLayout + +
Dein Keycloak-Account (Realm Ghost.net) hat keine der Realm-Rollen
+gnai-dashboard-user oder gnai-dashboard-admin.
Bitte wende dich an den Betreiber, um eine der Rollen zugewiesen zu bekommen, +oder melde dich mit einem anderen Account an: Login
diff --git a/llm-server/monitoring/src/Ghostnet.Dashboard/Ghostnet.Dashboard.csproj b/llm-server/monitoring/src/Ghostnet.Dashboard/Ghostnet.Dashboard.csproj index c972b91..bb936e9 100644 --- a/llm-server/monitoring/src/Ghostnet.Dashboard/Ghostnet.Dashboard.csproj +++ b/llm-server/monitoring/src/Ghostnet.Dashboard/Ghostnet.Dashboard.csproj @@ -5,8 +5,13 @@