From 2fe80bc015d9a97c1c04db4e06ba4ad878b28ce2 Mon Sep 17 00:00:00 2001 From: spektr Date: Tue, 10 Nov 2026 19:42:06 +0100 Subject: [PATCH] =?UTF-8?q?M1-Sicherheitsabschluss=2010.11.2026:=20Fail2Ba?= =?UTF-8?q?n-Abnahme,=20hostunabh=C3=A4ngige=20LXC-Backups,=20Keycloak-Sta?= =?UTF-8?q?bi=20+=20NPM-R=C3=BCckfalltest,=20CT=20104=20entfernt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Fail2Ban CT 103 funktional abgenommen (Image/Digest, Jails, Filter-Dry-Run, kontrollierter Ban/Unban 203.0.113.66 mit nftables-Nachweis, Dienstneustart, pct-Reboot); Befund proxy-host-14 im Jail-Glob nach Restart + SOP; frischer Rollback-vzdump d4478c85... - Hostunabhängige LXC-Backups: frische Stop-Mode-vzdumps CT 100/102/103/105, Archiv auf ghostnet-ki (gn-backup, quellbeschränkter PVE-Key) mit SHA-256- Verifikation, Restore-Test CT 100 -> CT 150 bestanden; deklarative Rollen gn_backup_receiver (KI) + pve_lxc_backup_sync (PVE, nächtlicher Timer, Prune 4/CT), beide konvergent changed=0 - Keycloak CT 102: 26 Tage stabil (NRestarts=0), Ansible-Drift changed=0, praktischer NPM-Rückfalltest auf CT 104 bestanden (Hosts 7/13 -> .16 -> .4); danach CT 104 nach Betreiberfreigabe archiviert + entfernt, historische CT-102-Altbackups gelöscht (SHA-256 dokumentiert), 10.0.0.16 aus WG-Set server_admin_targets entfernt - WAN/IPv6-Exposure erfasst: WAN nur TCP 80/443 offen, keine AAAA-Records - Doku: GNAI-000/001/013, GNAI-006/007/012/016, pve-host README, ct-104 README Generated by Mistral Vibe. Co-Authored-By: Mistral Vibe --- docs/GNAI-000-DOC_Index.md | 41 +++++++++--- docs/GNAI-001-PLAN_Project-Roadmap.md | 16 +++-- ...rity-Closure-and-Repository-Restructure.md | 38 ++++++++--- .../GNAI-012-PLAN_Pi-hole-DNS-Handoff.md | 24 +++++++ .../GNAI-016-PLAN_Keycloak-Ansible-Rebuild.md | 61 +++++++++++++---- .../GNAI-006-SEC_Reverse-Proxy.md | 19 +++++- .../lxc/ct-105-wireguard/GNAI-007-SEC_VPN.md | 2 +- .../host/ansible/files/ssh/pve-backup.pub | 1 + llm-server/host/ansible/playbooks/host.yml | 1 + .../roles/gn_backup_receiver/README.md | 22 +++++++ .../gn_backup_receiver/defaults/main.yml | 24 +++++++ .../roles/gn_backup_receiver/tasks/main.yml | 52 +++++++++++++++ proxmox/lxc/ct-104-keycloak/README.md | 11 +++- proxmox/pve-host/README.md | 13 ++++ proxmox/pve-host/ansible/playbooks/site.yml | 1 + .../roles/pve_lxc_backup_sync/README.md | 26 ++++++++ .../pve_lxc_backup_sync/defaults/main.yml | 22 +++++++ .../files/ssh/pve-backup.pub | 1 + .../pve_lxc_backup_sync/handlers/main.yml | 4 ++ .../roles/pve_lxc_backup_sync/tasks/main.yml | 66 +++++++++++++++++++ .../ghostnet-lxc-backup-sync.service.j2 | 9 +++ .../templates/ghostnet-lxc-backup-sync.sh.j2 | 56 ++++++++++++++++ .../ghostnet-lxc-backup-sync.timer.j2 | 9 +++ 23 files changed, 481 insertions(+), 38 deletions(-) create mode 100644 llm-server/host/ansible/files/ssh/pve-backup.pub create mode 100644 llm-server/host/ansible/roles/gn_backup_receiver/README.md create mode 100644 llm-server/host/ansible/roles/gn_backup_receiver/defaults/main.yml create mode 100644 llm-server/host/ansible/roles/gn_backup_receiver/tasks/main.yml create mode 100644 proxmox/pve-host/ansible/roles/pve_lxc_backup_sync/README.md create mode 100644 proxmox/pve-host/ansible/roles/pve_lxc_backup_sync/defaults/main.yml create mode 100644 proxmox/pve-host/ansible/roles/pve_lxc_backup_sync/files/ssh/pve-backup.pub create mode 100644 proxmox/pve-host/ansible/roles/pve_lxc_backup_sync/handlers/main.yml create mode 100644 proxmox/pve-host/ansible/roles/pve_lxc_backup_sync/tasks/main.yml create mode 100644 proxmox/pve-host/ansible/roles/pve_lxc_backup_sync/templates/ghostnet-lxc-backup-sync.service.j2 create mode 100644 proxmox/pve-host/ansible/roles/pve_lxc_backup_sync/templates/ghostnet-lxc-backup-sync.sh.j2 create mode 100644 proxmox/pve-host/ansible/roles/pve_lxc_backup_sync/templates/ghostnet-lxc-backup-sync.timer.j2 diff --git a/docs/GNAI-000-DOC_Index.md b/docs/GNAI-000-DOC_Index.md index 96b093e..36149ea 100644 --- a/docs/GNAI-000-DOC_Index.md +++ b/docs/GNAI-000-DOC_Index.md @@ -1,8 +1,8 @@ # Ghostnet.AI – Dokumentationsindex und Projektstand -**Stand:** 2026-11-09 +**Stand:** 2026-11-10 -**Status:** Plattformgrundlage vorhanden; KI-Stack intern bis M4 abgenommen (Testing und Production live auf `10.0.0.90`, Monitoring produktiv); Sicherheitsabschluss-Restpunkte und externe KI-Freigabe (M6) offen +**Status:** Plattformgrundlage vorhanden; KI-Stack intern bis M4 abgenommen (Testing und Production live auf `10.0.0.90`, Monitoring produktiv); Sicherheitsabschluss: Fail2Ban-Abnahme und hostunabhängige Backups/Restore am 10.11.2026 geschlossen, WAN/IPv6-Fremdnetz-Rescan, NPM-Rückfalltest CT 104 und FRITZ!Box-Rollback noch offen; externe KI-Freigabe (M6) offen Dieses Dokument ist der zentrale Einstieg, nicht das technische Nachweisprotokoll. Details, historische Laufdaten und Bedienverfahren stehen ausschließlich in den @@ -90,10 +90,10 @@ Hauptverzeichnisse `llm-server/host/` (Grundkonfiguration des Servers), | GPU/ROCm | beide RX 6900 XT als `gfx1030`, `ROCm0` und `ROCm1` im gepinnten Testing-Image erkannt; Modellladen, Layer-Verteilung und reale Inferenz auf beiden GPUs; 64k- und 128k-Stabilität in Testing (GNAI-010 10.5–10.9); GPU-Sensoren im Monitoring mit Alarmgrenzen (GNMON-000 M4/M5, verifiziert 09.11.2026) | Hardware-Ursache des thermischen Defekts an Slot `03:00.0` (GNAI-010 10.10) — Lüfterkurven-Service überbrückt als Dauerlösung | | 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 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 | +| 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-Exposure-Erfassung 10.11.2026: nur TCP 80/443 offen, keine AAAA (GNAI-007 7); frischer Stop-Mode-vzdump + hostunabhängige Kopie auf `ghostnet-ki` am 10.11.2026 | Fremdnetz-WAN-Rescan vom Hotspot (UDP 51820, TCP-Portmatrix), FRITZ!Box-Forward-/IPv6-Abgleich, 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 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`); frischer Stop-Mode-vzdump + hostunabhängige Kopie auf `ghostnet-ki` + praktischer Restore-Test (CT 150) am 10.11.2026 (GNAI-012 10.2) | vollständige App-/OIDC-Regression, praktischer FRITZ!Box-Rollback, mobile DuckDuckGo-/IPv6-Strategie, WireGuard-Profile | +| 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-Funktionsabnahme (Jails, kontrollierter Ban/Unban, nftables-Nachweis, Dienstneustart, LXC-Reboot) am 10.11.2026 bestanden, frischer Rollback-vzdump + hostunabhängige Kopie auf `ghostnet-ki` (GNAI-006 10/12) | Fremdnetz-WAN-Rescan (Hotspot) und FRITZ!Box-Abgleich; 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; Stabilisierungsphase + praktischer NPM-Rückfalltest auf CT 104 am 10.11.2026 bestanden, CT 104 danach nach Betreiberfreigabe entfernt (GNAI-016 Phase F); Ansible-Drift CT 102 `changed=0`; frischer Stop-Mode-vzdump + hostunabhängige Kopie auf `ghostnet-ki` am 10.11.2026 | Betriebs-/Backup-/Restore-SOP | | 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–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 | @@ -132,12 +132,33 @@ vollständige Abnahme. Datierte Details stehen im zuständigen Fachdokument. Vor einer neuen öffentlichen KI-Schnittstelle müssen mindestens diese Befunde geschlossen sein: -1. Fail2Ban-Jails, kontrollierten Ban und Wiederanlauf nachweisen; -2. öffentliche IPv4-/IPv6-Exposure erneut erfassen; +1. Fail2Ban-Jails, kontrollierten Ban und Wiederanlauf nachweisen — **am + 10.11.2026 geschlossen** (GNAI-006 Abschnitt 12: Image/Digest, Config-Test, + Jails, Filter-Dry-Run, kontrollierter Ban/Unban mit nftables-Nachweis, + Dienstneustart, LXC-Reboot; Befund: neuer Proxy-Host `proxy-host-14` war + bis zum f2b-Restart nicht im Jail-Glob — SOP ergänzt); +2. öffentliche IPv4-/IPv6-Exposure erneut erfassen — **teilweise 10.11.2026** + (WAN-TCP-Scan: nur 80/443 offen; keine AAAA-Records; GNAI-007 Abschnitt 7); + Fremdnetz-Rescan vom Hotspot, FRITZ!Box-Forward-Abgleich und + FRITZ!Box-IPv6-Status bleiben Betreiberschritt; 3. die Keycloak-Stabilisierungsphase sowie den praktischen NPM-Rückfall auf - CT 104 abschließen; + CT 104 abschließen — **am 10.11.2026 geschlossen:** Stabilisierungsphase + nachgewiesen (26 Tage, `NRestarts=0`, keine Fehler) und praktischer + NPM-Rückfalltest bestanden (Hosts 7/13 auf `10.0.0.16:8080`, Discovery 200 + + kanonischer Issuer, `/admin/` öffentlich 403, auth-admin 302, Rückschaltung + auf `10.0.0.4` erneut positiv; CT 104 danach wieder gestoppt). Bekannte + Einschränkung des CT-104-Rückfallstands (Datenstand 13.10., neuere + OIDC-Clients fehlen) in GNAI-016 dokumentiert. **CT 104 am 10.11.2026 nach + ausdrücklicher Betreiberfreigabe entfernt** (Archiv + historische + Altbackups SHA-256-verifiziert auf `ghostnet-ki` archiviert, dann auf PVE + gelöscht; Details GNAI-016 Phase F); 4. für DNS, Reverse Proxy und Keycloak hostunabhängige Backups und mindestens - einen praktisch getesteten Restorepfad festlegen. + einen praktisch getesteten Restorepfad festlegen — **am 10.11.2026 + geschlossen** (frische Stop-Mode-vzdumps CT 100/102/103/105, + hostunabhängige Kopie auf `ghostnet-ki` mit SHA-256-Verifikation, nächtlicher + Sync-Timer auf dem PVE-Host, praktischer Restore-Test CT 100 → CT 150 + bestanden; GNAI-012 Abschnitt 10.2, GNAI-006 Abschnitt 10). Offen bleibt + nur der praktisch durchgespielte FRITZ!Box-DNS-Rollback auf einem Testclient. Die öffentliche Keycloak-Administration, der Vaultwarden-OIDC-Pfad und die serverseitigen WireGuard-Rollengrenzen sind zum Stand 14.10.2026 bereits diff --git a/docs/GNAI-001-PLAN_Project-Roadmap.md b/docs/GNAI-001-PLAN_Project-Roadmap.md index 66bba49..9683368 100644 --- a/docs/GNAI-001-PLAN_Project-Roadmap.md +++ b/docs/GNAI-001-PLAN_Project-Roadmap.md @@ -68,10 +68,18 @@ PostgreSQL 16.15 neu aufgebaut, aus CT 104 wiederhergestellt und über NPM in Betrieb genommen. Öffentlicher Adminzugriff wird abgewiesen; interner Adminzugriff, Vaultwarden-OIDC und LXC-Neustart sind abgenommen. Die WireGuard-Rollenpolicy einschließlich Positiv-, Negativ-, Gateway-INPUT- und -Wiederanlauftests ist ebenfalls nachgewiesen. Offen bleiben die -Fail2Ban-Funktionstests, eine erneute WAN-/IPv6-Exposure-Erfassung, die -Keycloak-Stabilisierungs- und Rückfallabnahme sowie hostunabhängige -Backup-/Restore-Nachweise. +Wiederanlauftests ist ebenfalls nachgewiesen. **Aktualisierung 10.11.2026:** +Fail2Ban-Funktionsabnahme bestanden (GNAI-006 12), hostunabhängige Backups +mit praktischem Restore-Test für CT 100/102/103/105 auf `ghostnet-ki` +eingerichtet (GNAI-012 10.2, GNAI-006 10, PVE-Rolle `pve_lxc_backup_sync`), +Keycloak-Stabilisierungsphase nachgewiesen (26 Tage, GNAI-016 Phase F) und +WAN/IPv6-Exposure teilweise erfasst (nur TCP 80/443 offen, keine AAAA; +GNAI-007 7). **Aktualisierung 10.11.2026 (später):** praktischer +NPM-Rückfalltest auf CT 104 bestanden und CT 104 nach Betreiberfreigabe +entfernt (GNAI-016 Phase F). Offen bleiben der Fremdnetz-WAN-Rescan vom +Hotspot mit FRITZ!Box-Abgleich, der praktische FRITZ!Box-DNS-Rollback und +hostunabhängige Restore-Tests für CT 102/103 (Restore-Pfad für CT 100 +praktisch belegt). **Aktualisierung 09.11.2026:** Der vollständige Ansible-Sollzustand beider Hosts liegt inzwischen im Repository — CT 100 (`proxmox/lxc/ct-100-dns/ansible/`, diff --git a/docs/GNAI-013-PLAN_Security-Closure-and-Repository-Restructure.md b/docs/GNAI-013-PLAN_Security-Closure-and-Repository-Restructure.md index 440a0bd..759cde2 100644 --- a/docs/GNAI-013-PLAN_Security-Closure-and-Repository-Restructure.md +++ b/docs/GNAI-013-PLAN_Security-Closure-and-Repository-Restructure.md @@ -49,7 +49,7 @@ ghostnet.ai-infrastructure/ │ ├── ct-100-dns/ # Hostwurzel + Ansible-Projekt; Production-Adoption offen (Stand 09.11.2026: kein ansible-deploy auf CT 100) │ ├── ct-102-keycloak/{ansible,scripts}/ │ ├── ct-103-reverse-proxy/ # Hostwurzel + Ansible-Projekt (adoptiert 07.11.2026, verifiziert 09.11.2026) -│ ├── ct-104-keycloak/ # erhaltener Rückfall-/Referenzstand +│ ├── ct-104-keycloak/ # nur noch Migrations-Referenz; CT 104 am 10.11.2026 nach Freigabe entfernt (GNAI-016 Phase F) │ └── ct-105-wireguard/ └── shared/ansible/ # gemeinsam genutzte Rollen und Pins ``` @@ -120,12 +120,27 @@ hostbezogenen Playbooks oder Inventare. ### D. Reverse Proxy, Fail2Ban und Recovery -- [ ] Fail2Ban-Konfiguration, aktive Jails und Imagezustand prüfen. -- [ ] Kontrollierten Ban/Unban für HTTP und HTTPS nachweisen. -- [ ] Dienst- und LXC-Wiederanlauf einschließlich Jails und Regeln testen. +- [x] Fail2Ban-Konfiguration, aktive Jails und Imagezustand prüfen — 10.11.2026: + Image `1.1.0-r2-ls43` (RepoDigest `sha256:f2401c3c...`), Fail2Ban v1.1.0, + `fail2ban-client -t` OK, Jails `npm-scanner`/`npm-badbots` aktiv (GNAI-006 12). +- [x] Kontrollierten Ban/Unban für HTTP und HTTPS nachweisen — 10.11.2026: + 3 injizierte `/.env`-Treffer von TEST-NET-3 `203.0.113.66` → Ban in Status + und nftables-Set `f2b-table` (reject 80/443), `unbanip` entfernt ihn wieder; + Filter-Dry-Run 3/3 matched. Befund: neuer Proxy-Host 14 war bis zum + f2b-Restart nicht im Jail-Glob → SOP: nach neuem NPM-Proxy-Host f2b + neu starten. +- [x] Dienst- und LXC-Wiederanlauf einschließlich Jails und Regeln testen — + 10.11.2026: `systemctl restart fail2ban` (Jails up, Bans persistiert) und + `pct reboot 103` (alle Units aktiv, Jails/Bans/nft-Regeln nach Boot + wiederhergestellt, öffentliche Endpunkte positiv). - [ ] Praktischen FRITZ!Box-DNS-Rollback auf einem Testclient durchführen. -- [ ] Hostunabhängige Backupkopien und mindestens einen Restore-Test planen - beziehungsweise abnehmen. +- [x] Hostunabhängige Backupkopien und mindestens einen Restore-Test planen + beziehungsweise abnehmen — 10.11.2026: frische Stop-Mode-vzdumps CT + 100/102/103/105, hostunabhängige Kopie auf `ghostnet-ki` + (`/var/lib/ghostnet-ai-backup/lxc/`, SHA-256 verifiziert, nächtlicher + Sync-Timer `ghostnet-lxc-backup-sync.timer` auf dem PVE-Host, Rolle + `pve_lxc_backup_sync`), praktischer Restore-Test CT 100 → CT 150 bestanden + (GNAI-012 10.2). ### E. Übergang zum LLM-Stack @@ -349,11 +364,16 @@ hostbezogenen Playbooks oder Inventare. bereinigt; Fremdnetz-, Positiv-, Negativ- und Wiederanlauftests sind abgeschlossen. - Fail2Ban läuft, seine aktuelle funktionale Ban-Wirkung ist aber nicht - abgenommen. + abgenommen. **10.11.2026: funktionale Abnahme bestanden** (Abschnitt D, + GNAI-006 Abschnitt 12). - Der KI-Server ist bewusst ausgeschaltet und wird für die Punkte A bis D - nicht benötigt. + nicht benötigt. **10.11.2026: KI-Server läuft produktiv (M2–M4), inkl. + automatischem Production-Recovery nach Host-Neustart.** - CT 102 befindet sich in der 14-tägigen Stabilisierungsphase; der praktische - NPM-Rückfall auf den ausgeschalteten CT 104 bleibt offen. + NPM-Rückfall auf den ausgeschalteten CT 104 bleibt offen. **10.11.2026: + Stabilisierungsphase nachgewiesen (26 Tage, NRestarts=0, keine Fehler) und + praktischer NPM-Rückfalltest auf CT 104 bestanden (GNAI-016); CT 104 ist + danach wieder ausgeschaltet.** ## 6. Pflege 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 d9eff70..f3d6b57 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 @@ -412,6 +412,30 @@ Nach Abschluss einen kompakten Bericht mit diesen Punkten liefern: | Backup | `/var/lib/vz/dump/vzdump-lxc-100-2026_10_01-18_49_00.tar.zst`; Stop-Mode, 18 Sekunden; 1.360.465.920 unkomprimierte Bytes, 492.997.570 Byte Archivgröße; `zstd --test` bestanden; SHA-256 `8dca820d72df0a38060ce85370bc3fc7441a408c7c73534821aa5137d6f21b66`; Dienstwiederanlauf bestanden | | Rollback | FRITZ!Box **Lokaler DNS-Server** auf `10.0.0.1` zurückstellen und Client-Lease erneuern. Das Verfahren ist beschrieben, wurde nach erfolgreichem Cutover aber nicht praktisch zurück- und wieder vorgespult. Das Backup liegt nur auf demselben Proxmox-Host; unabhängige Kopie und praktischer Restore-Test fehlen. | +### 10.2 Aktualisierung vom 10.11.2026 (Sicherheitsabschluss, GNAI-000 Abschnitt 4) + +- **Frisches Backup:** Stop-Mode-vzdump + `/var/lib/vz/dump/vzdump-lxc-100-2026_11_10-06_46_36.tar.zst` + (`zstd --test` OK, SHA-256 + `16c185e044ee344a03e8afb4e292f0889ee933b12b7ca4c30050c2538789ba5e`); CT 100 + nach 18 s wieder online, Pi-hole/SSH aktiv. +- **Hostunabhängige Kopie:** Alle LXC-vzdump-Archive (CT 100/102/103/105, alt + und neu) liegen verifiziert (SHA-256-Abgleich) auf `ghostnet-ki` unter + `/var/lib/ghostnet-ai-backup/lxc/` (Empfänger-Account `gn-backup`). + Nächtlicher Sync und Prune (4 Archive pro CT) laufen auf dem PVE-Host per + `ghostnet-lxc-backup-sync.timer` (Rolle `pve_lxc_backup_sync`, + `proxmox/pve-host/ansible`; `site.yml` zweiter Lauf `changed=0`). +- **Praktischer Restore-Test bestanden:** Das frische CT-100-Archiv wurde per + `pct restore 150 ... --storage local-lvm` als CT 150 wiederhergestellt, in + `/etc/pve/lxc/150.conf` auf `10.0.0.250/24` / `dns-restore-test` umkonfiguriert + und gestartet: Pi-hole- und SSH-Unit aktiv, keine failed units; + `dig @10.0.0.250` lieferte Split-DNS (`mon.ghostnet.selfhost.eu → 10.0.0.10`), + öffentlichen Namen und Upstream korrekt. CT 100 blieb unbeeindruckt. CT 150 + wurde anschließend gestoppt und inklusive Config gelöscht. +- **Weiterhin offen:** der praktische FRITZ!Box-DNS-Rollback auf einem + Testclient (Verfahren beschrieben, nie durchgespielt) und der + rollenbezogene WireGuard-DNS-Test. + Offene Abschlussarbeiten sind damit bewusst begrenzt auf die vollständige Anwendungs-/OIDC-Regression, einen praktisch durchgespielten FRITZ!Box-Rollback, die Entscheidung zum mobilen DuckDuckGo-DNS-Bypass, eine saubere IPv6-Strategie diff --git a/docs/platform/proxmox-server/lxc/ct-102-keycloak/GNAI-016-PLAN_Keycloak-Ansible-Rebuild.md b/docs/platform/proxmox-server/lxc/ct-102-keycloak/GNAI-016-PLAN_Keycloak-Ansible-Rebuild.md index fec06a1..efedbc0 100644 --- a/docs/platform/proxmox-server/lxc/ct-102-keycloak/GNAI-016-PLAN_Keycloak-Ansible-Rebuild.md +++ b/docs/platform/proxmox-server/lxc/ct-102-keycloak/GNAI-016-PLAN_Keycloak-Ansible-Rebuild.md @@ -329,23 +329,60 @@ eine eigenständige Architekturentscheidung. - [x] Vollständigen produktiven LXC-Neustart, Keycloak-/PostgreSQL-Wiederanlauf, Persistenz des Restores und anschließende Ansible-Konvergenz praktisch nachweisen. -- [ ] NPM-Rückfall auf CT 104 in einem kontrollierten Rückfalltest praktisch - nachweisen; CT 104 bis dahin ausgeschaltet und unverändert lassen. +- [x] NPM-Rückfall auf CT 104 in einem kontrollierten Rückfalltest praktisch + nachweisen. **Bestanden am 10.11.2026 (Betreiber-Umschaltung in NPM, Agent- + Probes):** CT 104 per `pct start 104` hochgefahren (`ghostnet-keycloak` + + `ghostnet-keycloak-postgres` auf `10.0.0.16:8080`). NPM-Proxy-Hosts 7 (auth) + und 13 (auth-admin) auf `10.0.0.16:8080` umgestellt — NPM-Log zeigte + `[Sent-to 10.0.0.16]`; OIDC-Discovery 200 mit kanonischem Issuer + `https://auth.ghostnet.selfhost.eu/realms/Ghost.net`; öffentlicher + `/admin/`-Pfad 403; interner `auth-admin`-Pfad 302; vault 200. Danach + Rückschaltung auf `10.0.0.4:8080`: alle Probes identisch bestanden, mon + wieder 302, PAR-Request 201 mit `[Sent-to 10.0.0.4]`. CT 104 anschließend + per `pct stop 104` wieder ausgeschaltet. **Bekannte Einschränkung des + Rückfallstands:** CT 104 enthält den Datenstand vom 13.10.2026 + (`keycloak-final-ct104-20261013T170621.dump`); OIDC-Clients, die danach auf + CT 102 angelegt wurden (z. B. `gnai-dashboard` Anfang 11.2026), existieren + auf CT 104 nicht — PAR/Token-Requests solcher Clients liefern dort 401 + (beobachtet: Dashboard `mon` lieferte 500, bis zurückgeschaltet wurde). Im + Katastrophenfall müssen diese Clients nach dem Restore neu angelegt werden. ### Phase F – Automatisierung zur Quelle der Wahrheit machen -- [ ] CT 102 mindestens 14 Tage beobachten; CT 104 ausgeschaltet und - unverändert als Rückfall behalten. -- [ ] Nicht deklarierte Drift zwischen Ansible und CT 102 erfassen und - beseitigen. +- [x] CT 102 mindestens 14 Tage beobachten; CT 104 ausgeschaltet und + unverändert als Rückfall behalten. **Nachweis 10.11.2026:** + `ghostnet-keycloak` auf CT 102 durchgehend aktiv seit 2026-10-14 14:25:56 + (26 Tage 16 h bis zum kontrollierten Stop für das Stop-Mode-Backup am + 10.11.), `NRestarts=0`, null Journal-Einträge mit Priorität `err` seit dem + 14.10., keine failed units; LXC-Uptime 26 Tage. Die 14-Tage-Phase ist damit + deutlich überschritten. +- [x] Nicht deklarierte Drift zwischen Ansible und CT 102 erfassen und + beseitigen — 10.11.2026: `site.yml --check` gegen CT 102 `changed=0`. - [ ] Betriebs-, Update-, Secret-Rotations-, Backup- und Restore-SOP anhand der Playbooks fertigstellen. -- [ ] Nach Betreiberfreigabe CT 104 archivieren oder entfernen und Inventar, - DNS/NPM-Dokumentation sowie Projektindex auf CT 102 aktualisieren. -- [ ] Erst nach vollständiger Abnahme, Stabilisierungsphase und ausdrücklicher - Betreiberfreigabe das historische Backup des ursprünglichen CT 102 gezielt - entfernen und die Löschung einschließlich betroffener Volumes, - Prüfsummenbelege und verbleibender Rückfallstände dokumentieren. +- [x] Nach Betreiberfreigabe CT 104 archivieren oder entfernen und Inventar, + DNS/NPM-Dokumentation sowie Projektindex auf CT 102 aktualisieren — + **10.11.2026 nach ausdrücklicher Betreiberfreigabe:** finales Archiv + `vzdump-lxc-104-2026_11_10-19_25_37.tar.zst` (SHA-256 + `985af29b5a46db986c708f91a7f9910551decca7af5f49e32f73a0ef989f0578`), + danach `pct set 104 --protection 0` + `pct destroy 104 --purge` + (Rootfs `local-lvm:vm-104-disk-0` entfernt, `104.conf`/`104.conf.bak` + gelöscht); `10.0.0.16` aus dem WG-Gateway-Set `server_admin_targets` auf + CT 105 entfernt (Runtime + `/etc/nftables.conf`, Syntax geprüft); keine + DNS-/NPM-Referenzen auf `10.0.0.16` mehr vorhanden. Archiviert auf + `ghostnet-ki` (`/var/lib/ghostnet-ai-backup/lxc/`, inkl. `conf-archive/`), + SHA-256 verifiziert. +- [x] Historisches Backup des ursprünglichen CT 102 gezielt entfernen — + **10.11.2026:** die geschützten Altarchive + `vzdump-lxc-102-2026_09_02-18_31_15.tar.zst` (`62d7d1da…`), + `vzdump-lxc-102-2026_10_05-19_37_11.tar.zst` (`ba095d5d…`), + `vzdump-lxc-102-2026_10_09-17_45_58.tar.zst` (`576a1048…`) sowie die + CT-104-Archive `2026_10_06-14_49_53` (`01739301…`), + `2026_10_12-02_21_43` (`8b69a466…`), `2026_10_12-14_58_14` (`a9f82488…`) + aus `/media/datenhdd2/dump/` gelöscht — nach hostunabhängiger Archivierung + auf `ghostnet-ki` mit SHA-256-Abgleich (alle 7 Archive identisch). Verbliebene + Rückfallstände: frische CT-102-vzdumps in `/var/lib/vz/dump` und auf + `ghostnet-ki` (nächtlicher Sync `ghostnet-lxc-backup-sync.timer`). ## 5. Abnahmekriterien 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 abcf55e..85d445d 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 @@ -475,6 +475,21 @@ strukturellen Änderungen an nftables, Proxy-Konfiguration oder Quadlets erneut einen aktuellen konsistenten Rückfallstand erstellen. Ein Snapshot kann ergänzen, ersetzt aber kein unabhängiges Backup. +**Aktualisierung 10.11.2026:** Neuer Stop-Mode-vzdump nach der +Fail2Ban-Funktionsabnahme: +`/var/lib/vz/dump/vzdump-lxc-103-2026_11_10-06_43_39.tar.zst` +(1.255.421.869 Byte, `zstd --test` OK, SHA-256 +`d4478c850d338c183f44935e7833a0d2390d0f5091030ebdb3846fbac8b952ab`, CT danach +in 137 s wieder online, alle Dienste aktiv). Hostunabhängige Kopie aller +LXC-vzdump-Archive (CT 100/102/103/105, alt und neu) auf `ghostnet-ki` +(`/var/lib/ghostnet-ai-backup/lxc/`, Empfänger `gn-backup`), SHA-256 auf der +KI-Seite verifiziert; nächtlicher Sync per +`ghostnet-lxc-backup-sync.timer` auf dem PVE-Host (Rolle +`pve_lxc_backup_sync`, `proxmox/pve-host/ansible`). Praktischer Restore-Test +am 10.11.2026 bestanden: CT-100-Archiv nach CT 150 wiederhergestellt, auf +`10.0.0.250` gestartet, Pi-hole/SSH aktiv, Split-DNS und Upstream-Auflösung +positiv, CT 150 anschließend gelöscht (Details GNAI-012). + --- ## 11. Keycloak: bestätigte öffentliche Administration und Korrekturverfahren @@ -598,6 +613,8 @@ Für die technische Abnahme sind noch Nachweise zu erfassen; aus „läuft wiede 4. Dienstneustart und später LXC-/Host-Neustart prüfen; danach Containerstatus, Jails und Filter erneut kontrollieren. 5. Laufenden Image-Digest und ein aktuelles konsistentes Backup als Rückfallstand festhalten. Ein Digest-Pin kann nach Manifest-/Architekturprüfung den Tag-Pin zusätzlich härten. +**Abnahme 10.11.2026 (Mistral Vibe, Deploy-Key `ansible-deploy@CT 103`):** Alle fünf Punkte bestanden. Effektives Image `lscr.io/linuxserver/fail2ban:1.1.0-r2-ls43`, RepoDigest `sha256:f2401c3c05912be43e6a4ef4453850b8bbbf1464c7f6919d10924115dbf9773d`, Fail2Ban v1.1.0, `fail2ban-client -t` OK. Jails `npm-scanner` + `npm-badbots` aktiv; zu Testbeginn ein realer Scanner-Ban (84.233.199.140) und zwei Badbot-Bans (66.132.172.143, 66.132.195.120) in Status und nftables-Set `inet f2b-table` (reject TCP 80/443) vorhanden. Filter-Dry-Run (`fail2ban-regex` auf 3 synthetische `/.env`-Zeilen): 3 matched. Kontrollierter Ban: 3 injizierte Logzeilen von TEST-NET-3 `203.0.113.66` in `proxy-host-1_access.log` (hostseitig; `/remotelogs` ist im Container read-only) lösten einen Ban aus (Status + nft-Set), `unbanip` entfernte ihn wieder. **Befund:** `proxy-host-14` (mon, öffentlich seit 09.11.) war nicht im Jail-Glob (13 Dateien) — nach `systemctl restart fail2ban` werden 14 Dateien überwacht; SOP ergänzt: nach jedem neuen NPM-Proxy-Host den Fail2Ban-Dienst neu starten. Restart-Test: Jails aktiv, Bans persistiert, nft-Sets intakt. LXC-Reboot-Test (`pct reboot 103`): alle Units aktiv, keine failed units, Jails/Bans/nft-Regeln nach Boot wiederhergestellt; Endpunkte danach positiv: mon 302, `auth.../admin/` öffentlich 403, OIDC-Discovery 200, vault 200, NPM-Admin `http://10.0.0.10:81/` von LAN 200. Rollback-Stand: frischer Stop-Mode-vzdump siehe Abschnitt 10. + Upstream-Anwendung und Container-Build bleiben getrennte Versionsachsen. Vor einem späteren Upgrade sind LinuxServer-Release, enthaltene Fail2Ban-Version, Architektur und lokale Filter/Jails erneut zu prüfen. [Fail2Ban-Releases](https://github.com/fail2ban/fail2ban/releases), [LinuxServer-Images](https://docs.linuxserver.io/images/docker-fail2ban/) ## 13. Bewusste Betriebsentscheidung: generische HTTP-Clients bleiben gesperrt @@ -614,5 +631,5 @@ LLM Admins dürfen nur `.90` erreichen und haben keinen allgemeinen NPM-/LXC-Zug | --- | --- | | Keycloak Admin extern nutzbar | am 14.10.2026 geschlossen: öffentlich 403, intern 200, OIDC und realer Vaultwarden-Login bestanden | | TLS-Zuordnung des auth-Hosts unklar | am 14.10.2026 für öffentlichen und internen HTTPS-vHost funktional abgenommen | -| Fail2Ban auf `1.1.0-r2-ls43` gepinnt und Container wieder laufend | effektives Image und Version dokumentiert; Jail-/Filter-/Ban-/Dienstneustart-/Reboottests bestanden | +| Fail2Ban auf `1.1.0-r2-ls43` gepinnt und Container wieder laufend | am 10.11.2026 geschlossen: Image/Version/Digest, Config-Test, Jails, Filter-Dry-Run, kontrollierter Ban/Unban mit nftables-Nachweis, Dienstneustart und LXC-Reboot bestanden (Abschnitt 12) | | NPM-Daten und Logs lokal weltlesbar beziehungsweise weltbeschreibbar | am 22.09.2026 korrigiert und positiv/negativ regressionsgeprüft; künftige Dateierzeugung und Logrotation weiter beobachten | diff --git a/docs/platform/proxmox-server/lxc/ct-105-wireguard/GNAI-007-SEC_VPN.md b/docs/platform/proxmox-server/lxc/ct-105-wireguard/GNAI-007-SEC_VPN.md index 02ef56f..8002479 100644 --- a/docs/platform/proxmox-server/lxc/ct-105-wireguard/GNAI-007-SEC_VPN.md +++ b/docs/platform/proxmox-server/lxc/ct-105-wireguard/GNAI-007-SEC_VPN.md @@ -340,7 +340,7 @@ Paketupdates werden mindestens monatlich sowie vor sicherheitsrelevanten | Familie → Heimnetz-PC | offen, einschließlich Host-Firewall und Authentifizierung | | Server Admin → Server erlaubt, nicht freigegebenes aktives Ziel gesperrt | bestanden am 05.10.2026 im Fremdnetz; Proxmox parallel erlaubt, FRITZ!Box `.1` nach absichtlicher Routenerweiterung gesperrt, nftables-Zähler geprüft | | LLM Admin → KI-Server erlaubt, Proxmox/NPM/Gateway-GUI gesperrt | offen, auch bei erweiterten lokalen AllowedIPs prüfen | -| WAN → TCP 22/51821 und IPv6-Exposure | offen | +| WAN → TCP 22/51821 und IPv6-Exposure | teilweise erfasst 10.11.2026: WAN-TCP-Scan (Hairpin von LAN) gegen `93.208.172.133` zeigt nur 80/443 offen (→ CT 103 NPM); 22, 25, 53, 81, 3000, 8006, 8080, 8081, 8096, 8443, 51820/tcp, 51821, 3001, 9000 refused. Öffentliche DNS: alle `*.ghostnet.selfhost.eu`-Namen nur A `93.208.172.133`, keine AAAA → keine DNS-basierte IPv6-Exposure. CT 105 lauscht auf UDP 51820 (auch `[::]`) und TCP 22/51821. Fremdnetz-Rescan (Hotspot), FRITZ!Box-Forward-Abgleich und FRITZ!Box-IPv6-Status bleiben Betreiberschritt. **10.11.2026:** `10.0.0.16` (entfernter CT 104) aus `server_admin_targets` entfernt (Runtime + `/etc/nftables.conf`) | | Reboot / Firewall-Reload / Restore | LXC-Neustart und persistente Firewall am 05.10.2026 bestanden; tatsächlicher Restore offen | Tests von einem fremden Netz ausführen, nicht nur aus dem Heimnetz. Für Isolation zuerst sicherstellen, dass das gesperrte Ziel von einem erlaubten Peer tatsächlich erreichbar ist. Handshake und VPN-Routen prüfen, dann bewusst clientseitiges Routing zu einem gesperrten Ziel ergänzen. Timeout allein ist ohne aktiven Zielservice und nachvollziehbare Firewallwirkung kein ausreichender Isolationsnachweis. Ergebnisse mit Datum, Quellnetz, Peer, Ziel, Port und Regelzählern dokumentieren; Secrets auslassen. diff --git a/llm-server/host/ansible/files/ssh/pve-backup.pub b/llm-server/host/ansible/files/ssh/pve-backup.pub new file mode 100644 index 0000000..04ad680 --- /dev/null +++ b/llm-server/host/ansible/files/ssh/pve-backup.pub @@ -0,0 +1 @@ +ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIqx/qtzU4KXBGL0MOTNZoJ6AglcmxClIA/mrOv/mung ghostnet-backup@pve diff --git a/llm-server/host/ansible/playbooks/host.yml b/llm-server/host/ansible/playbooks/host.yml index 9f0cf5d..cddb69f 100644 --- a/llm-server/host/ansible/playbooks/host.yml +++ b/llm-server/host/ansible/playbooks/host.yml @@ -12,5 +12,6 @@ - role: host_baseline - role: podman_runtime - role: workload_accounts + - role: gn_backup_receiver - role: amd_gpu_access - role: gpu_fan_control diff --git a/llm-server/host/ansible/roles/gn_backup_receiver/README.md b/llm-server/host/ansible/roles/gn_backup_receiver/README.md new file mode 100644 index 0000000..78fe389 --- /dev/null +++ b/llm-server/host/ansible/roles/gn_backup_receiver/README.md @@ -0,0 +1,22 @@ +# gn_backup_receiver + +Dedicated receiver account `gn-backup` (UID 999, GID 987) on `ghostnet-ki` +for host-independent LXC backups. The Proxmox host pushes its vzdump +archives here over SSH (role `pve_lxc_backup_sync` in +`proxmox/pve-host/ansible`), so the LXC backups survive a full loss of the +PVE host (GNAI-000 section 4, blocker 4). + +- Locked password, no sudo, real shell only because ssh executes the + receiving `tar` through it. +- `authorized_keys` holds the PVE backup key + (`files/ssh/pve-backup.pub`, fingerprint + `SHA256:tabCXnfrKhWI2+0F8vZgLqg7JtWn1Xt4ifo8o2KuPNc`) restricted with + `from="10.0.0.2"` and no forwarding. +- Home `/var/lib/ghostnet-ai-backup` stays root-owned `0711` (traversable + for sshd StrictModes, not writable); the AI backup archives written by + the root `gnai-ai-backup` timer stay root-owned. Only `lxc/` and `.ssh/` + belong to `gn-backup`. + +Verified 2026-11-10: archives for CT 100/102/103/105 copied from PVE, +SHA-256 match confirmed; practical restore test of the CT 100 archive to a +scratch CT passed. diff --git a/llm-server/host/ansible/roles/gn_backup_receiver/defaults/main.yml b/llm-server/host/ansible/roles/gn_backup_receiver/defaults/main.yml new file mode 100644 index 0000000..47b6830 --- /dev/null +++ b/llm-server/host/ansible/roles/gn_backup_receiver/defaults/main.yml @@ -0,0 +1,24 @@ +--- +# Dedicated receiver account for host-independent LXC backups (GNAI-000 +# section 4, blocker 4). The Proxmox host pushes vzdump archives here over +# SSH (see proxmox/pve-host/ansible role pve_lxc_backup_sync). The account +# has no sudo and a locked password; the key is source-restricted to the +# PVE host. It needs a real shell because ssh executes the tar/rsync +# receiver command through it. +gn_backup_account: + name: gn-backup + uid: 999 + gid: 987 + comment: Ghostnet LXC backup receiver (host-independent vzdump copies from PVE) + home: /var/lib/ghostnet-ai-backup + shell: /bin/bash + +# The home directory itself stays root-owned; only traversal (0711) is +# needed so sshd can read ~/.ssh/authorized_keys under StrictModes. The +# AI backup archives written by the root backup timer remain root-owned. +gn_backup_home_mode: "0711" +gn_backup_lxc_dir: /var/lib/ghostnet-ai-backup/lxc + +# Restrictions for the PVE backup key (public key in files/ssh/pve-backup.pub). +gn_backup_ssh_options: 'from="10.0.0.2",no-agent-forwarding,no-port-forwarding,no-X11-forwarding,no-user-rc' +gn_backup_pubkey_file: pve-backup.pub diff --git a/llm-server/host/ansible/roles/gn_backup_receiver/tasks/main.yml b/llm-server/host/ansible/roles/gn_backup_receiver/tasks/main.yml new file mode 100644 index 0000000..fa9565d --- /dev/null +++ b/llm-server/host/ansible/roles/gn_backup_receiver/tasks/main.yml @@ -0,0 +1,52 @@ +--- +- name: Create the gn-backup group + ansible.builtin.group: + name: gn-backup + gid: "{{ gn_backup_account.gid }}" + system: true + state: present + +- name: Create the locked gn-backup receiver account + ansible.builtin.user: + name: "{{ gn_backup_account.name }}" + uid: "{{ gn_backup_account.uid }}" + group: gn-backup + comment: "{{ gn_backup_account.comment }}" + home: "{{ gn_backup_account.home }}" + shell: "{{ gn_backup_account.shell }}" + create_home: false + system: true + password_lock: true + state: present + +- name: Keep the backup home traversable but root-owned + ansible.builtin.file: + path: "{{ gn_backup_account.home }}" + state: directory + owner: root + group: root + mode: "{{ gn_backup_home_mode }}" + +- name: Create the gn-backup .ssh directory + ansible.builtin.file: + path: "{{ gn_backup_account.home }}/.ssh" + state: directory + owner: "{{ gn_backup_account.name }}" + group: gn-backup + mode: "0700" + +- name: Install the source-restricted PVE backup key + ansible.builtin.copy: + content: "{{ gn_backup_ssh_options }} {{ lookup('ansible.builtin.file', role_path ~ '/../../files/ssh/' ~ gn_backup_pubkey_file) }}" + dest: "{{ gn_backup_account.home }}/.ssh/authorized_keys" + owner: "{{ gn_backup_account.name }}" + group: gn-backup + mode: "0600" + +- name: Create the LXC backup target directory + ansible.builtin.file: + path: "{{ gn_backup_lxc_dir }}" + state: directory + owner: "{{ gn_backup_account.name }}" + group: gn-backup + mode: "0700" diff --git a/proxmox/lxc/ct-104-keycloak/README.md b/proxmox/lxc/ct-104-keycloak/README.md index a61badc..33286a7 100644 --- a/proxmox/lxc/ct-104-keycloak/README.md +++ b/proxmox/lxc/ct-104-keycloak/README.md @@ -1,4 +1,13 @@ -# CT 104 – Keycloak Podman target +# CT 104 – Keycloak Podman target (historical reference only) + +**CT 104 was decommissioned on 2026-11-10** after the stabilization phase and +the practical NPM fallback test passed and the operator gave explicit release +(GNAI-016 Phase F): final archive `vzdump-lxc-104-2026_11_10-19_25_37.tar.zst` +(SHA-256 `985af29b…`, archived on `ghostnet-ki` under +`/var/lib/ghostnet-ai-backup/lxc/`), then `pct destroy 104 --purge`. This +directory remains only as the migration reference for the CT 102 rebuild; the +LXC no longer exists and `10.0.0.16` was removed from the WG gateway target +set on CT 105. This directory contains reviewed host-level configuration artifacts for CT 104 at `10.0.0.16`. The LXC hostname intentionally remains `keycloak`, so CT ID and diff --git a/proxmox/pve-host/README.md b/proxmox/pve-host/README.md index 5a99d4a..89e012f 100644 --- a/proxmox/pve-host/README.md +++ b/proxmox/pve-host/README.md @@ -25,6 +25,19 @@ Aktuell verwaltete Host-State: - **LXC-Configs**: Entfernen der Ganesha-Ära-`lxc.seccomp.profile:`-Leerzeile aus `/etc/pve/lxc/101.conf` — Rolle `pve_lxc_conf` (wirksam beim nächsten CT-Start/Reboot). +- **Hostunabhängige LXC-Backups**: Rolle `pve_lxc_backup_sync` — Skript + `/usr/local/sbin/ghostnet-lxc-backup-sync.sh` plus Timer + `ghostnet-lxc-backup-sync.timer` (täglich 03:30) kopieren alle + `vzdump-lxc-*`-Archive aus `/var/lib/vz/dump` per `tar | ssh` zum + `gn-backup`-Account auf `ghostnet-ki` (`10.0.0.90`, eigene Hardware), + verifizieren jede Archiv-Prüfsumme (SHA-256) auf der Empfängerseite und + prunen auf die 4 neuesten Archive pro CT. Schlüssel: + `/root/.ssh/id_ed25519_ghostnet_backup` (öffentlich in + `ansible/roles/pve_lxc_backup_sync/files/ssh/pve-backup.pub`, auf + ghostnet-ki quellbeschränkt via Rolle `gn_backup_receiver`); KI-Hostkey in + `/root/.ssh/known_hosts` gepinnt. Log: + `/var/log/ghostnet-lxc-backup-sync.log`. Eingerichtet am 10.11.2026 + (GNAI-000 Abschnitt 4 Punkt 4; erster Lauf und Restore-Test bestanden). Die CT-Lebenszyklus-Skripte (`proxmox/lxc//scripts/`: `pct create`, Dist-Upgrade) bleiben Bootstrap-Skripte und laufen einmalig manuell als diff --git a/proxmox/pve-host/ansible/playbooks/site.yml b/proxmox/pve-host/ansible/playbooks/site.yml index 069e47e..535b723 100644 --- a/proxmox/pve-host/ansible/playbooks/site.yml +++ b/proxmox/pve-host/ansible/playbooks/site.yml @@ -8,3 +8,4 @@ - role: pve_lxc_conf - role: pve_media_cron - role: pve_nfs_export + - role: pve_lxc_backup_sync diff --git a/proxmox/pve-host/ansible/roles/pve_lxc_backup_sync/README.md b/proxmox/pve-host/ansible/roles/pve_lxc_backup_sync/README.md new file mode 100644 index 0000000..d099cc6 --- /dev/null +++ b/proxmox/pve-host/ansible/roles/pve_lxc_backup_sync/README.md @@ -0,0 +1,26 @@ +# pve_lxc_backup_sync + +Nightly host-independent copy of all LXC vzdump archives from +`/var/lib/vz/dump` to the `gn-backup` account on `ghostnet-ki` +(`10.0.0.90:/var/lib/ghostnet-ai-backup/lxc`) — a separate physical host, so +the LXC backups survive a total loss of the PVE host (GNAI-000 section 4, +blocker 4). + +- Script `{{ pve_backup_sync_script }}` (systemd oneshot) transfers all + `vzdump-lxc-*` archives and logs via `tar | ssh`, verifies every archive + by SHA-256 on the receiver and prunes the receiver to the newest + `pve_backup_sync_keep_per_ct` (4) archives per CT. Log: + `/var/log/ghostnet-lxc-backup-sync.log`. +- Timer `ghostnet-lxc-backup-sync.timer`, daily 03:30, persistent. +- Auth: dedicated key `/root/.ssh/id_ed25519_ghostnet_backup` + (fingerprint `SHA256:tabCXnfrKhWI2+0F8vZgLqg7JtWn1Xt4ifo8o2KuPNc`), created + once as root@pve; the public key lives in `files/ssh/pve-backup.pub` and + is installed on ghostnet-ki by the `gn_backup_receiver` role there + (source-restricted to `10.0.0.2`). The KI host key is pinned in + `/root/.ssh/known_hosts` by this role (verified 2026-11-10 against the + workstation known_hosts). + +First run 2026-11-10 (manual): archives for CT 100/102/103/105 transferred, +SHA-256 match confirmed on the receiver; practical restore test of the +CT 100 archive to scratch CT 150 passed (Pi-hole answered on its test IP, +split-DNS intact, CT 150 destroyed afterwards). diff --git a/proxmox/pve-host/ansible/roles/pve_lxc_backup_sync/defaults/main.yml b/proxmox/pve-host/ansible/roles/pve_lxc_backup_sync/defaults/main.yml new file mode 100644 index 0000000..62b8d55 --- /dev/null +++ b/proxmox/pve-host/ansible/roles/pve_lxc_backup_sync/defaults/main.yml @@ -0,0 +1,22 @@ +--- +# Host-independent LXC backup copies (GNAI-000 section 4, blocker 4). +# Nightly, the vzdump archives in /var/lib/vz/dump are pushed to the +# dedicated gn-backup account on ghostnet-ki (10.0.0.90, separate physical +# host), verified by SHA-256 and pruned to the newest archives per CT. +pve_backup_sync_source_dir: /var/lib/vz/dump +pve_backup_sync_archive_glob: 'vzdump-lxc-*.tar.zst' +pve_backup_sync_log_glob: 'vzdump-lxc-*.log' +pve_backup_sync_target_host: 10.0.0.90 +pve_backup_sync_target_user: gn-backup +pve_backup_sync_target_dir: /var/lib/ghostnet-ai-backup/lxc +pve_backup_sync_ssh_key: /root/.ssh/id_ed25519_ghostnet_backup +pve_backup_sync_known_hosts: /root/.ssh/known_hosts +pve_backup_sync_script: /usr/local/sbin/ghostnet-lxc-backup-sync.sh +pve_backup_sync_log: /var/log/ghostnet-lxc-backup-sync.log +pve_backup_sync_keep_per_ct: 4 +pve_backup_sync_timer_oncalendar: '*-*-* 03:30:00' + +# ghostnet-ki host key (ed25519), verified 2026-11-10 against the +# workstation known_hosts entry for 10.0.0.90 before first use. +pve_backup_sync_ki_host_key_ed25519: >- + ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAID1UMrhG0WoKlRfadNadWdZogijlhjCz8uXfWbjvxuf8 diff --git a/proxmox/pve-host/ansible/roles/pve_lxc_backup_sync/files/ssh/pve-backup.pub b/proxmox/pve-host/ansible/roles/pve_lxc_backup_sync/files/ssh/pve-backup.pub new file mode 100644 index 0000000..04ad680 --- /dev/null +++ b/proxmox/pve-host/ansible/roles/pve_lxc_backup_sync/files/ssh/pve-backup.pub @@ -0,0 +1 @@ +ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIqx/qtzU4KXBGL0MOTNZoJ6AglcmxClIA/mrOv/mung ghostnet-backup@pve diff --git a/proxmox/pve-host/ansible/roles/pve_lxc_backup_sync/handlers/main.yml b/proxmox/pve-host/ansible/roles/pve_lxc_backup_sync/handlers/main.yml new file mode 100644 index 0000000..8f99013 --- /dev/null +++ b/proxmox/pve-host/ansible/roles/pve_lxc_backup_sync/handlers/main.yml @@ -0,0 +1,4 @@ +--- +- name: Reload systemd daemon + ansible.builtin.systemd_service: + daemon_reload: true diff --git a/proxmox/pve-host/ansible/roles/pve_lxc_backup_sync/tasks/main.yml b/proxmox/pve-host/ansible/roles/pve_lxc_backup_sync/tasks/main.yml new file mode 100644 index 0000000..0befa8d --- /dev/null +++ b/proxmox/pve-host/ansible/roles/pve_lxc_backup_sync/tasks/main.yml @@ -0,0 +1,66 @@ +--- +- name: Require the PVE backup key to exist (created once as root, see README) + ansible.builtin.stat: + path: "{{ pve_backup_sync_ssh_key }}" + register: pve_backup_sync_key + +- name: Fail when the PVE backup key is missing + ansible.builtin.fail: + msg: >- + {{ pve_backup_sync_ssh_key }} is missing. Create it once as root@pve: + ssh-keygen -t ed25519 -N '' -C ghostnet-backup@pve -f {{ pve_backup_sync_ssh_key }} + and authorize the public key for gn-backup on ghostnet-ki. + when: not pve_backup_sync_key.stat.exists + +- name: Pin the ghostnet-ki host key for the backup sync + ansible.builtin.lineinfile: + path: "{{ pve_backup_sync_known_hosts }}" + regexp: '^10\.0\.0\.90 ssh-ed25519 ' + line: "10.0.0.90 {{ pve_backup_sync_ki_host_key_ed25519 }}" + owner: root + group: root + mode: "0600" + create: true + +- name: Install the backup sync script + ansible.builtin.template: + src: ghostnet-lxc-backup-sync.sh.j2 + dest: "{{ pve_backup_sync_script }}" + owner: root + group: root + mode: "0750" + +- name: Install the backup sync systemd service + ansible.builtin.template: + src: ghostnet-lxc-backup-sync.service.j2 + dest: /etc/systemd/system/ghostnet-lxc-backup-sync.service + owner: root + group: root + mode: "0644" + notify: Reload systemd daemon + +- name: Install the backup sync systemd timer + ansible.builtin.template: + src: ghostnet-lxc-backup-sync.timer.j2 + dest: /etc/systemd/system/ghostnet-lxc-backup-sync.timer + owner: root + group: root + mode: "0644" + notify: Reload systemd daemon + +- name: Create the backup sync log file + ansible.builtin.file: + path: "{{ pve_backup_sync_log }}" + state: touch + owner: root + group: root + mode: "0640" + modification_time: preserve + access_time: preserve + +- name: Enable and start the backup sync timer + ansible.builtin.systemd_service: + name: ghostnet-lxc-backup-sync.timer + enabled: true + state: started + daemon_reload: true diff --git a/proxmox/pve-host/ansible/roles/pve_lxc_backup_sync/templates/ghostnet-lxc-backup-sync.service.j2 b/proxmox/pve-host/ansible/roles/pve_lxc_backup_sync/templates/ghostnet-lxc-backup-sync.service.j2 new file mode 100644 index 0000000..4206a2b --- /dev/null +++ b/proxmox/pve-host/ansible/roles/pve_lxc_backup_sync/templates/ghostnet-lxc-backup-sync.service.j2 @@ -0,0 +1,9 @@ +[Unit] +Description=Ghostnet host-independent LXC backup sync to ghostnet-ki +After=network-online.target +Wants=network-online.target + +[Service] +Type=oneshot +ExecStart={{ pve_backup_sync_script }} +# Runs as root: reads /var/lib/vz/dump and the root backup key. diff --git a/proxmox/pve-host/ansible/roles/pve_lxc_backup_sync/templates/ghostnet-lxc-backup-sync.sh.j2 b/proxmox/pve-host/ansible/roles/pve_lxc_backup_sync/templates/ghostnet-lxc-backup-sync.sh.j2 new file mode 100644 index 0000000..dd29ec6 --- /dev/null +++ b/proxmox/pve-host/ansible/roles/pve_lxc_backup_sync/templates/ghostnet-lxc-backup-sync.sh.j2 @@ -0,0 +1,56 @@ +#!/bin/bash +# {{ ansible_managed }} +# Host-independent copy of LXC vzdump archives to ghostnet-ki (gn-backup). +# GNAI-000 section 4 blocker 4; installed by role pve_lxc_backup_sync. +set -euo pipefail + +SRC="{{ pve_backup_sync_source_dir }}" +TARGET="{{ pve_backup_sync_target_user }}@{{ pve_backup_sync_target_host }}" +TARGET_DIR="{{ pve_backup_sync_target_dir }}" +KEY="{{ pve_backup_sync_ssh_key }}" +KNOWN_HOSTS="{{ pve_backup_sync_known_hosts }}" +LOG="{{ pve_backup_sync_log }}" +KEEP={{ pve_backup_sync_keep_per_ct }} + +SSH=(ssh -i "$KEY" -o BatchMode=yes -o StrictHostKeyChecking=yes -o UserKnownHostsFile="$KNOWN_HOSTS") + +log() { echo "$(date -u +%FT%TZ) $*" >> "$LOG"; } + +cd "$SRC" +FILES=$(ls {{ pve_backup_sync_archive_glob }} {{ pve_backup_sync_log_glob }} 2>/dev/null | sort || true) +if [ -z "$FILES" ]; then + log "INFO no archives found in $SRC, nothing to do" + exit 0 +fi + +log "START transfer of $(echo "$FILES" | wc -l) files to $TARGET:$TARGET_DIR" +tar -C "$SRC" -cf - $FILES | "${SSH[@]}" "$TARGET" "tar -C '$TARGET_DIR' -xf -" + +fail=0 +for f in $(ls {{ pve_backup_sync_archive_glob }} 2>/dev/null); do + local_sum=$(sha256sum "$SRC/$f" | awk '{print $1}') + remote_sum=$("${SSH[@]}" "$TARGET" "sha256sum '$TARGET_DIR/$f'" | awk '{print $1}') + if [ "$local_sum" = "$remote_sum" ]; then + log "OK sha256 $f $local_sum" + else + log "FAIL sha256 mismatch $f local=$local_sum remote=$remote_sum" + fail=1 + fi +done + +# Prune on the receiver: keep the newest KEEP archives and logs per CT. +"${SSH[@]}" "$TARGET" bash -c " + set -euo pipefail + cd '$TARGET_DIR' + for ct in \$(ls {{ pve_backup_sync_archive_glob }} | sed -E 's/vzdump-lxc-([0-9]+)-.*/\1/' | sort -u); do + ls -1t vzdump-lxc-\$ct-*.tar.zst 2>/dev/null | tail -n +$((KEEP + 1)) | xargs -r rm -f + ls -1t vzdump-lxc-\$ct-*.log 2>/dev/null | tail -n +$((KEEP + 1)) | xargs -r rm -f + done +" + +if [ "$fail" -eq 0 ]; then + log "DONE all archives verified on receiver" +else + log "DONE with checksum mismatches (see FAIL lines)" +fi +exit "$fail" diff --git a/proxmox/pve-host/ansible/roles/pve_lxc_backup_sync/templates/ghostnet-lxc-backup-sync.timer.j2 b/proxmox/pve-host/ansible/roles/pve_lxc_backup_sync/templates/ghostnet-lxc-backup-sync.timer.j2 new file mode 100644 index 0000000..97b487b --- /dev/null +++ b/proxmox/pve-host/ansible/roles/pve_lxc_backup_sync/templates/ghostnet-lxc-backup-sync.timer.j2 @@ -0,0 +1,9 @@ +[Unit] +Description=Nightly host-independent LXC backup sync to ghostnet-ki + +[Timer] +OnCalendar={{ pve_backup_sync_timer_oncalendar }} +Persistent=true + +[Install] +WantedBy=timers.target