Merge pull request 'GNAI-025: Fluxer-Chat-LXC CT 117 — komplett in Betrieb (fluxer.ghostnet.selfhost.eu)' (#21) from lxc/ct-117-gnai-025-fluxer-chat into main
Reviewed-on: #21
This commit was merged in pull request #21.
This commit is contained in:
@@ -41,6 +41,8 @@ jeweiligen Fachdokumenten. Die priorisierte weitere Umsetzung beschreibt der
|
||||
| [CT 101 / GNAI-017](platform/proxmox-server/lxc/ct-101-samba/GNAI-017-PLAN_Samba-NFS-Export.md) | Samba-Dateiserver `10.0.0.9`: Aufnahme ins Repository, NFS-Export und Encoding-Shares |
|
||||
| [CT 101 / GNAI-018](platform/proxmox-server/lxc/ct-101-samba/GNAI-018-REQ_Encoding-Pipeline-Integration.md) | Requirements der Encoding-Pipeline an CT 101 — Übergabe an den Ansible-Rebuild |
|
||||
| [CT 101 / GNAI-019](platform/proxmox-server/lxc/ct-101-samba/GNAI-019-DEC_Ansible-Migration.md) | Entwurfsentscheidungen der CT-101-Ansible-Migration: natives Samba, NFS-Ganesha als Quadlet, Fresh-State-Rebuild |
|
||||
| [CT 114 / GNAI-024](platform/proxmox-server/lxc/ct-114-litecoin-wallet/GNAI-024-PLAN_Litecoin-Wallet-LXC.md) | geplanter Litecoin-Wallet-LXC `ltc-node` (`10.0.0.61`): Prüfung der Research-Dokumente, Tor-only Cold Node, Ansible-Projekt und Provisioning — noch nicht angelegt (Plan 25.11.2026) |
|
||||
| [CT 117 / GNAI-025](platform/proxmox-server/lxc/ct-117-fluxer/GNAI-025-PLAN_Fluxer-LXC.md) | Fluxer-Chat-LXC `fluxer` (`10.0.0.62`) in Betrieb: `https://fluxer.ghostnet.selfhost.eu` live über NPM (LE-Cert), Keycloak-Client `fluxer` angelegt, Split-DNS live, alle CTs konvergiert (`changed=0`); offen: SSO-Verkabelung im Admin-Panel, FRITZ!Box-Voice-Ports, Abnahme (Stand 30.11.2026) |
|
||||
|
||||
### KI und Deployment
|
||||
|
||||
@@ -96,7 +98,7 @@ Hauptverzeichnisse `llm-server/host/` (Grundkonfiguration des Servers),
|
||||
| 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); **M5-Fortschritt 10.11.2026:** statische CI (Gitea Actions, 4 Jobs) + repo-scoped Runner `ci-static-01` auf CT 116 + Branch-Protection `main` (required checks, 1 Approval) eingerichtet und per PR-Durchlauf bewiesen (GNAI-008 Abschnitt 12) | privilegierter Deployment-Runner mit Promotion-Tag-Freigabe, Secret-Store/-Rotation, getrennte Testing-/Production-Rechte, Secret-Scan über die Git-Historie (GNAI-008 Abschnitt 12, Fragen 3–5) |
|
||||
| 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); NPM-Proxyhost `mon.ghostnet.selfhost.eu` → `10.0.0.90:8080` seit 09.11.2026 eingerichtet (ID 14, GNMON-000 M6); **12.11.2026: NPM-Proxyhost `chat.ghostnet.selfhost.eu` mit `proxy_read_timeout`/`proxy_send_timeout` 600 s für LLM-Research-Loops** (Betreiber-Schritt, GNAI-020 Abschnitt 6) | Fremdnetz-WAN-Rescan (Hotspot) und FRITZ!Box-Forward-/IPv6-Abgleich |
|
||||
| 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); NPM-Proxyhost `mon.ghostnet.selfhost.eu` → `10.0.0.90:8080` seit 09.11.2026 eingerichtet (ID 14, GNMON-000 M6); **12.11.2026: NPM-Proxyhost `chat.ghostnet.selfhost.eu` mit `proxy_read_timeout`/`proxy_send_timeout` 600 s für LLM-Research-Loops** (Betreiber-Schritt, GNAI-020 Abschnitt 6); **26.11.2026: Vorfall volle Root-Platte per Ansible behoben (Role `reverse_proxy_disk_housekeeping`) und NPM 2.15.1 → 2.17.1 wegen nginx2root/nginx2shell (CVE-2026-123007/-123633), siehe GNAI-006 Abschnitt 15; **26.11.2026 behoben: Ausfall `ghostnet-lxc-backup-sync` 15.11.–26.11. (gn-backup-Home-Mode 0750 statt 0711 auf ghostnet-ki, Fix per ki-host.yml), siehe GNAI-012 10.2 (27.11.)** | Fremdnetz-WAN-Rescan (Hotspot) und FRITZ!Box-Forward-/IPv6-Abgleich |
|
||||
| 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.6 ö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; Favicon-Revert auf v0.3.6 am 14.11.2026, GNAI-021) | echter SMTP-Versand, LLM-Metriken jenseits `gn_ai_active_env`, Retention-Feintuning, externer WireGuard-Zugriff auf mon (DNS/TLS öffentlich, praktisch ungetestet) |
|
||||
|
||||
@@ -19,7 +19,11 @@ Hypervisors selbst.
|
||||
| [GNAI-018 / CT 101](lxc/ct-101-samba/GNAI-018-REQ_Encoding-Pipeline-Integration.md) | Requirements der Encoding-Pipeline an CT 101 für den Ansible-Rebuild (Übergabe) |
|
||||
| [GNAI-019 / CT 101](lxc/ct-101-samba/GNAI-019-DEC_Ansible-Migration.md) | Entwurfsentscheidungen der Ansible-Migration: natives Samba, NFS-Ganesha als Quadlet, Fresh-State-Rebuild |
|
||||
| [CT-101-Automation](../../../proxmox/lxc/ct-101-samba/README.md) | produktives Samba-Ansible-Projekt und CT-spezifische PVE-Helfer |
|
||||
| [PVE-Host-Automation](../../../proxmox/pve-host/README.md) | Ansible-Verwaltung des PVE-Hosts selbst (`10.0.0.2`): Deploy-Account, Kernel-NFS-Export, LXC-Conf |
|
||||
| [GNAI-024 / CT 114](lxc/ct-114-litecoin-wallet/GNAI-024-PLAN_Litecoin-Wallet-LXC.md) | `10.0.0.61` (geplant): Litecoin Cold Wallet als Tor-only Full Node; Plan und Forschungsprüfung, CT noch nicht angelegt |
|
||||
| [CT-114-Automation](../../../proxmox/lxc/ct-114-litecoin-wallet/README.md) | Ansible-Projekt und PVE-Provisioning-Skripte für CT 114 (GNAI-024) |
|
||||
| [GNAI-025 / CT 117](lxc/ct-117-fluxer/GNAI-025-PLAN_Fluxer-LXC.md) | `10.0.0.62` (geplant): Fluxer-Chat-Server hinter NPM (CT 103) mit Keycloak-SSO; Machbarkeitsprüfung, CT noch nicht angelegt |
|
||||
| [CT-117-Automation](../../../proxmox/lxc/ct-117-fluxer/README.md) | Ansible-Projekt und PVE-Provisioning-Skripte für CT 117 (GNAI-025) |
|
||||
| [PVE-Host-Automation](../../../proxmox/pve-host/README.md) | Ansible-Verwaltung des PVE-Hosts selbst (`10.0.0.2`): Deploy-Account, Kernel-NFS-Export, LXC-Conf, tägliche CT-114-Snapshots (`pve_lxc_snapshot`) |
|
||||
|
||||
Die versionierte Quelle für den optionalen, secretfreien
|
||||
Community-Scripts-Post-install-Hook liegt unter
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
**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 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
|
||||
**Stand:** 2026-11-27
|
||||
**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
|
||||
@@ -449,6 +449,13 @@ kann nun den internen NPM-Proxy-Host und Keycloak `hostname-admin` einrichten,
|
||||
den internen Login testen und danach `auth.ghostnet.selfhost.eu/admin` für
|
||||
öffentliche Quellen sperren.
|
||||
|
||||
### 10.2 Aktualisierung vom 27.11.2026 (Backup-Sync-Ausfall 15.11.–26.11. behoben)
|
||||
|
||||
- **Befund:** `ghostnet-lxc-backup-sync.service` auf dem PVE-Host lief ab 15.11.2026 02:30 Uhr mit `gn-backup@10.0.0.90: Permission denied (publickey)` fehl; letzter Erfolg 14.11. 02:40 Uhr (`DONE all archives verified on receiver`). 12 Tage lang keine hostunabhängige Kopie der vzdump-Archive.
|
||||
- **Ursache:** Das Home `/var/lib/ghostnet-ai-backup` von `gn-backup` auf ghostnet-ki stand auf `0750 root:root` statt des von Rolle `gn_backup_receiver` (llm-server/host/ansible, seit 10.11.2026, Commit 2fe80bc) deklarierten `0711`. uid 999 konnte das Verzeichnis nicht traversieren, sshd konnte als gn-backup die `authorized_keys` nicht lesen („key is not allowed“ im sshd-Debug). Key-Fingerprints auf PVE und ki identisch (`SHA256:tabCXnfr…`), `from="10.0.0.2"` passte — reiner Berechtigungsfehler. Die Drift entstand zwischen 14.11. und 15.11. außerhalb des Repos.
|
||||
- **Behebung (26.11.2026):** `llm-server/host/ansible/playbooks/host.yml` (Inventar `host`) gegen ghostnet-ki — `--check --diff` zeigte nur Mode `0750`→`0711`, real `ok=76 changed=1 failed=0`, danach `--check` `changed=0`. Manueller `systemctl start ghostnet-lxc-backup-sync.service`: Transfer + SHA-256 aller Archive OK, `DONE`, Prune auf ≤4 Archive pro CT.
|
||||
- **Verifikation (27.11.2026):** Timer-Lauf 03:30 Uhr `status=0/SUCCESS` (`DONE all archives verified on receiver` 02:40:11Z), PVE ohne failed Units, Receiver 21 Dateien mit ≤4 Archiven pro CT, Home-Mode weiterhin `0711 root:root`. Unabhängig vom CT-103-Vorfall vom 26.11. (volle Platte, siehe GNAI-006 Abschnitt 15).
|
||||
|
||||
### 10.2 Lesende Wiederholungsprüfung vom 14.10.2026
|
||||
|
||||
Die erneute Live-Inventur bestätigte einen fehlerfreien LXC ohne fehlgeschlagene
|
||||
|
||||
+48
-6
@@ -2,7 +2,7 @@
|
||||
|
||||
**Dokumenten-ID:** GNAI-006-SEC
|
||||
**Titel:** Reverse Proxy und Fail2Ban – Konfiguration, Betrieb und Sicherheitsabnahme
|
||||
**Status:** NPM 2.15.1 und Fail2Ban aktiv; Keycloak-Public/Admin-Trennung seit 14.10.2026 abgenommen; Fail2Ban-Funktionsabnahme offen
|
||||
**Status:** NPM 2.17.1 (seit 26.11.2026, nginx2root-Fixes) und Fail2Ban aktiv; Keycloak-Public/Admin-Trennung seit 14.10.2026 abgenommen; Fail2Ban-Funktionsabnahme offen; Disk-Housekeeping seit 26.11.2026 im Ansible-Sollzustand (Abschnitt 15)
|
||||
|
||||
**Vorgänger / Referenzen:** [Architektur](../../../llm-server/ai/GNAI-004-INFRA_Architecture.md), [LXC-SSH](../../GNAI-011-SEC_LXC-SSH-Architecture.md), [Zugriffskonzept](../../../GNAI-005-SEC_Access-Control.md), [WireGuard](../ct-105-wireguard/GNAI-007-SEC_VPN.md)
|
||||
|
||||
@@ -36,6 +36,8 @@
|
||||
| 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. |
|
||||
| 2026-11-26 | 3.2 | spektr / Mistral Vibe | Vorfall volle Root-Platte dokumentiert und per Ansible behoben: NPM-Logs hatten keine Rotation, nginx hielt gelöschte Inodes offen; NPM lieferte 0-Byte-Assets (Gitea „Frontend is not initialized“, Keycloak ungestylt). Neues Role `reverse_proxy_disk_housekeeping` (Journald-Cap, logrotate mit `copytruncate`, selbstheilender Guard) im Sollzustand; Details in Abschnitt 15. |
|
||||
| 2026-11-26 | 3.3 | spektr / Mistral Vibe | NPM 2.15.1 → 2.17.1 wegen nginx2root/nginx2shell (CVE-2026-123007, CVE-2026-123633; Fixes in nginx 1.30.7/1.31.9 vom 18.11.2026, in 2.17.1 als Backport im OpenResty-Base-Image). Backup vor Upgrade, Verifikation aller VHosts; Abschnitt 15. |
|
||||
|
||||
---
|
||||
|
||||
@@ -117,7 +119,7 @@ Hostschlüsselprüfung und ausschließlich diesen Schlüssel.
|
||||
| System | Debian 13, PVE-Kernel `7.0.14-14-pve`, Podman 5.4.2, nftables 1.1.3 und OpenSSH `10.0p1-7+deb13u4`. |
|
||||
| Dienste | SSH, nftables, `nginx-proxy-manager` und `fail2ban` aktiv; keine fehlgeschlagenen systemd-Units. NPM läuft seit 02.09., Fail2Ban seit 16.09.; jeweils `NRestarts=0`. |
|
||||
| Updates | `unattended-upgrades` aktiv und aktiviert; apt-daily- und apt-daily-upgrade-Timer vorhanden. |
|
||||
| Containerdefinition | NPM ist im Quadlet auf `2.15.1`, Fail2Ban auf `1.1.0-r2-ls43` gepinnt. Beide laufen rootful mit Hostnetz; Fail2Ban besitzt `NET_ADMIN` und `NET_RAW`. |
|
||||
| Containerdefinition | NPM ist im Quadlet auf `2.17.1`, Fail2Ban auf `1.1.0-r2-ls43` gepinnt. Beide laufen rootful mit Hostnetz; Fail2Ban besitzt `NET_ADMIN` und `NET_RAW`. |
|
||||
| Listener | TCP 80, 81 und 443 auf IPv4, TCP 22 und NPM-Backend 3000 auf IPv4/IPv6 beziehungsweise allen Adressen. Auf `eth0` existiert nur IPv4 plus link-lokales IPv6. Listener beweisen keine Erreichbarkeit durch die Firewall. |
|
||||
| Firewall | Persistente und aktive nftables-INPUT-Policy `drop`; erlaubt TCP 22/81 aus `10.0.0.0/24` und TCP 80/443 allgemein. Port 3000 fällt durch die Default-Policy. `nftables.service` ist aktiv und aktiviert. Der SSH-Socket lauscht auf `*:22`, seine Netzfreigabe wird durch nftables begrenzt. |
|
||||
| SSH | `ghost-agent` und persönliches Konto `ghost` mit getrennten Schlüsseln aktiv; Drop-in mit `AllowUsers ghost-agent ghost`. Root-/Passwortversuche extern abgelehnt, persönlicher Login und passwortgeschütztes sudo erfolgreich. `ssh.socket` und `ssh.service` aktiv. |
|
||||
@@ -158,7 +160,7 @@ Workstation aus dem LAN. Es wurden keine Konfigurationen verändert.
|
||||
| Bereich | Beobachtung am 31.10.2026 |
|
||||
| --- | --- |
|
||||
| System und Dienste | Debian 13.7; `nftables`, `nginx-proxy-manager`, `fail2ban`, `ssh.socket` und `ssh.service` aktiv; keine fehlgeschlagenen Units; Uptime rund 2,5 Wochen. |
|
||||
| Containerdefinitionen | Quadlets unverändert gepinnt: NPM `docker.io/jc21/nginx-proxy-manager:2.15.1`, Fail2Ban `lscr.io/linuxserver/fail2ban:1.1.0-r2-ls43`; Fähigkeiten und Volumes entsprechen Abschnitt 4. |
|
||||
| Containerdefinitionen | Quadlets unverändert gepinnt: NPM `docker.io/jc21/nginx-proxy-manager:2.17.1`, Fail2Ban `lscr.io/linuxserver/fail2ban:1.1.0-r2-ls43`; Fähigkeiten und Volumes entsprechen Abschnitt 4. |
|
||||
| Listener und Firewall | TCP 80/81/443 nur auf IPv4, TCP 22 und NPM-Backend 3000 auf allen Adressen. Verhaltenstests aus dem LAN: Port 81 erreichbar (HTTP 200), Port 3000 Timeout – die INPUT-Drop-Policy ist damit wirksam, die Port-Matrix aus Abschnitt 3 bestätigt. |
|
||||
| SSH-Härtung | Drop-in `99-security.conf` entspricht vollständig der dokumentierten Baseline (Root-/Passwort-Login aus, `AllowUsers ghost-agent ghost`, sämtliche Forwarding- und Tunnel-Sperren, `MaxAuthTries 3`). |
|
||||
| Dateihärtung | `/opt/nginx-proxy-manager/data` ist `0750 root:root`; Datenbank, Schlüsseldatei und Logs sind für `ghost-agent` unlesbar – die Härtung vom 22.09.2026 (Abschnitt 2.3) ist intakt. |
|
||||
@@ -234,7 +236,7 @@ Nginx Proxy Manager und Fail2Ban werden als rootful Podman-Container via systemd
|
||||
### 4.1 Nginx Proxy Manager Quadlet
|
||||
|
||||
* **Datei:** `/etc/containers/systemd/nginx-proxy-manager.container`
|
||||
* **Image, live bestätigt am 22.09.2026:** `docker.io/jc21/nginx-proxy-manager:2.15.1` *(ausdrücklich gepinnt)*
|
||||
* **Image, live bestätigt am 22.09.2026 (2.15.1) und am 26.11.2026 (2.17.1):** `docker.io/jc21/nginx-proxy-manager:2.17.1` *(ausdrücklich gepinnt; Upgrade wegen nginx2root/nginx2shell siehe Abschnitt 15)*
|
||||
|
||||
```ini
|
||||
[Unit]
|
||||
@@ -243,7 +245,7 @@ Wants=network-online.target
|
||||
After=network-online.target
|
||||
|
||||
[Container]
|
||||
Image=docker.io/jc21/nginx-proxy-manager:2.15.1
|
||||
Image=docker.io/jc21/nginx-proxy-manager:2.17.1
|
||||
ContainerName=nginx-proxy-manager
|
||||
Network=host
|
||||
Volume=/opt/nginx-proxy-manager/data:/data:rw
|
||||
@@ -632,4 +634,44 @@ 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 | 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 |
|
||||
| NPM-Daten und Logs lokal weltlesbar beziehungsweise weltbeschreibbar | am 22.09.2026 korrigiert und positiv/negativ regressionsgeprüft; Logrotation der NPM-Logs seit 26.11.2026 per Ansible sichergestellt (`copytruncate`, Abschnitt 15) |
|
||||
|
||||
---
|
||||
|
||||
## 15. Vorfall 2026-11-26: Volle Root-Platte, 0-Byte-Assets und NPM-Sicherheitsupgrade
|
||||
|
||||
**Entscheidung des Betreibers (26.11.2026):** Vorfall per Ansible reproduzierbar beheben und dauerhaft verhindern; NPM wegen nginx2root/nginx2shell sofort auf 2.17.1 aktualisieren. Umsetzung durch Mistral Vibe, Verifikation siehe unten.
|
||||
|
||||
### 15.1 Befund
|
||||
|
||||
a) Gegen 17:36 Uhr zeigten `git.ghostnet.selfhost.eu` (CT 110) „Frontend is not initialized, check console errors or asset files" und `auth.ghostnet.selfhost.eu` (CT 102) eine ungestylte Seite.
|
||||
b) Über NPM lieferten alle gehashten Gitea-Assets (JS/CSS/Bilder) HTTP 200 mit **0 Byte Body** (Header behauptete z. B. `content-length: 661667`); Keycloak-CSS ebenso 0 B statt 1158689 B.
|
||||
c) Die Backends waren gesund: direkt von CT 103 aus lieferte `10.0.0.17:3000` das JS mit 661667 B, `10.0.0.4:8080` die Keycloak-CSS mit 1158689 B.
|
||||
d) `df -h /` auf CT 103: 7,8 G, **100 % belegt, 0 verfügbar**; `du` sah nur 1,3 G (Rest in root-only-Verzeichnissen bzw. gelöschten, von Prozessen gehaltenen Dateien). `logrotate.service` und `man-db.service` standen auf `failed`. Inodes unkritisch (26 %).
|
||||
|
||||
### 15.2 Ursache
|
||||
|
||||
Die NPM-Zugriffslogs unter `/opt/nginx-proxy-manager/data/logs/*.log` hatten **keine Logrotate-Policy** und wuchsen unbounded. Weil nginx im Container die Datei-Handles hält, landet selbst gelöschter Logplatz nicht wieder im freien Bestand (deleted-open inodes). Bei voller Platte kann nginx Proxy-Antworten größer als der Speicherpuffer nicht in Temp-Dateien schreiben und schneidet sie ab — daher 200 mit 0-Byte-Body. Alle Dienste hinter NPM waren betroffen, nicht nur Gitea/Keycloak.
|
||||
|
||||
### 15.3 Lösung (Ansible-Sollzustand, Branch `lxc/ct-103-gnai-006-disk-housekeeping`)
|
||||
|
||||
a) Neues Role `reverse_proxy_disk_housekeeping` in `site.yml` (`proxmox/lxc/ct-103-reverse-proxy/ansible/`), dazu Playbook `disk-housekeeping.yml`:
|
||||
- Journald-Drop-in `/etc/systemd/journald.conf.d/99-ghostnet-limits.conf` (`SystemMaxUse=200M`, `MaxRetentionSec=7d`)
|
||||
- Logrotate-Policy `/etc/logrotate.d/nginx-proxy-manager` für `/opt/nginx-proxy-manager/data/logs/*.log` mit **`copytruncate`** (Pflicht wegen der offenen FDs im Container), weekly, rotate 4, compress/delaycompress
|
||||
- Selbstheilender Guard: unterschreitet der freie Root-Platz die Schwelle `reverse_proxy_minimum_root_available_bytes` (1 GiB, ohnehin in `audit-production.yml` assertet), vacuumt das Role das Journal, truncatet die NPM-Logs in-place, leert den NPM-Proxy-Cache und startet NPM neu; danach wird der Headroom erneut assertet. Die Aufräum-Phase läuft vor dem Schreiben der Configs, weil bei 0 Byte frei keine neuen Dateien anlegbar sind.
|
||||
- Failed-Zustand der betroffenen oneshot-Units (`logrotate.service`, `man-db.service`) wird gecleared.
|
||||
b) `verify-production.yml` asserten jetzt zusätzlich Root-Headroom und die beiden Drop-ins.
|
||||
c) Verifikation: `disk-housekeeping.yml` real (24 Logs getruncat, NPM-Neustart, changed=6, Headroom-Assert bestanden), `site.yml` ok=93 changed=1 failed=0, `verify-production.yml` ok=30 failed=0, zweiter `site.yml --check` **changed=0** (idempotent). Platte danach 53 % (3,6 G frei), keine failed units. Extern: Gitea-JS 661667 B, Keycloak-CSS 1158689 B via NPM vollständig; alle VHosts antworten.
|
||||
|
||||
### 15.4 NPM-Upgrade 2.15.1 → 2.17.1 (nginx2root/nginx2shell)
|
||||
|
||||
a) NGINX2Shell/nginx2root = **CVE-2026-123007** (HTTP/2-Flow-Control, memory corruption, alle Releases seit 1.9.5) und **CVE-2026-123633** (HTTP/2 use-after-free, seit 1.19.7); Fixes in **nginx 1.30.7 / 1.31.9** vom 18.11.2026. Der bisherige Stand NPM 2.15.1 mit openresty/1.29.2.5 (nginx 1.29.x) war betroffen; Port 443 ist öffentlich und HTTP/2 aktiv.
|
||||
b) Ziel **v2.17.1** (GitHub „Latest“, Docker Hub seit 19.11.2026): „updated base OpenResty image with nginx2root backported fixes“ (PR #6058). v2.17.0 hätte nicht genügt (openresty 1.31.8.1 = nginx 1.31.8, ungefixt). `nginx -v` meldet im Container weiterhin `openresty/1.31.8.1` — die Fixes sitzen als Backport im Base-Image.
|
||||
c) Ablauf: Backup `/opt/nginx-proxy-manager-backup-pre-2.17.1.tar.gz` (63 M) auf CT 103; Pin in `reverse_proxy_npm/defaults` + allen drei Inventaren + Role-README auf `2.17.1`; `site.yml --check --diff` zeigte nur die `Image=`-Zeile; NPM-Neustart zog das Image; `site.yml` ok=93 changed=1 failed=0, `verify-production.yml` ok=30 failed=0, `site.yml --check` changed=0. Alle 7 VHosts (git/auth/nextcloud/vault/jellyfin/japan/mon) funktional getestet. Altes Image 2.15.1 bleibt lokal als Rollback.
|
||||
|
||||
### 15.5 Prävention
|
||||
|
||||
- Logrotation der NPM-Logs und Journald-Cap sind jetzt Sollzustand (Abschnitt 15.3); der Guard heilt eine volle Platte bei jedem `site.yml`-Lauf selbst.
|
||||
- NPM-Image bleibt gepinnt; Upgrades bewusst per Pin-Änderung im Ansible-Projekt (wie 15.4), nie `latest`.
|
||||
- Browser-seitig: 0-Byte-Assets waren mit `max-age≈6h` gecacht — nach Proxy-Incidents hart neu laden (Strg+Umschalt+R).
|
||||
- Offen: Monitoring-Alarm bei >90 % Root-Belegung auf CT 103 (z. B. GNMON), optional Platte vergrößern (`pct resize 103 rootfs +XG` auf dem PVE-Host).
|
||||
|
||||
+305
@@ -0,0 +1,305 @@
|
||||
# Litecoin Wallet LXC (CT 114) – Plan, Prüfung der Recherche und Umsetzungsstand
|
||||
|
||||
**Dokumenten-ID:** GNAI-024-PLAN
|
||||
**Titel:** Litecoin Full Node (Cold Wallet) als gehärteter unprivilegierter LXC CT 114 auf Ghostnet Proxmox
|
||||
**Status:** Plan vollständig, reviewed; CT 114 noch nicht angelegt — Provisioning und Konvergenz sind Operator-Schritte (Abschnitt 6)
|
||||
**Geltungsbereich:** neuer LXC CT 114 `ltc-node` (`10.0.0.61`) auf Proxmox `10.0.0.2`; Änderungen am PVE-Host nur über das bestehende `proxmox/pve-host`-Ansible-Projekt
|
||||
**Referenzen:** [Auftrag/Research `litecoin-lxc-setup.txt`](litecoin-lxc-setup.txt), [Testplan `litecoin-lxc-tests.txt`](litecoin-lxc-tests.txt), [GNAI-011 SSH-Architektur](../../GNAI-011-SEC_LXC-SSH-Architecture.md), [GNAI-007 Adressplan](../ct-105-wireguard/GNAI-007-SEC_VPN.md), [GNAI-016 Ansible-Rebuild CT 102](../../lxc/ct-102-keycloak/GNAI-016-PLAN_Keycloak-Ansible-Rebuild.md), [CT-114-Automation](../../../../../proxmox/lxc/ct-114-litecoin-wallet/ansible/README.md), [CT-114-Skripte](../../../../../proxmox/lxc/ct-114-litecoin-wallet/scripts/README.md), [Doku-Index](../../../../GNAI-000-DOC_Index.md)
|
||||
|
||||
## Änderungsverlauf
|
||||
|
||||
| Datum | Version | Autor | Änderung |
|
||||
| --- | --- | --- | --- |
|
||||
| 2026-11-25 | 0.1 | Mistral Vibe | Erstfassung: Prüfung der beiden Research-Dokumente gegen Repo-Konventionen (Abschnitt 2), Zielarchitektur, Zugriffsmodell, Ansible-Projekt, Provisioning-Skripte, Phasenplan, Abnahmetests. |
|
||||
| 2026-11-27 | 0.2 | Mistral Vibe | CT 114 produktiv provisioniert und per Ansible konvergiert (Abschnitt 12): Hook grün, Fingerprint gepinnt, nesting=0, site.yml idempotent (changed=0), verify/audit grün, Reboot-Test bestanden, restic-Repo auf ghostnet-ki initialisiert + erster Wallet-Snapshot, PVE-Snapshot-Timer aktiv. |
|
||||
|
||||
## 1. Zweck und Leitentscheidung
|
||||
|
||||
Der Betreiber möchte Litecoin von Bitpanda empfangen und Dienste im Internet
|
||||
(z. B. Rapidgator) bezahlen — bei bestmöglicher Sicherheit und Privatsphäre.
|
||||
Leitentscheidung: ein eigener, unprivilegierter LXC **CT 114** betreibt
|
||||
einen Litecoin Full Node (`litecoind` v0.21.5.8) als Cold Wallet. Der
|
||||
P2P-Verkehr läuft ausschließlich über Tor (onion-only, `listen=0`), der
|
||||
RPC ist auf `127.0.0.1:9332` gebunden und nur per SSH-Exec erreichbar.
|
||||
Kein Port wird nach außen geöffnet; die FRITZ!Box bekommt keinen Forward
|
||||
für CT 114.
|
||||
|
||||
Die Research-Dokumente (`litecoin-lxc-setup.txt`, `litecoin-lxc-tests.txt`)
|
||||
werden mit den Befunden in Abschnitt 2 an die etablierten Verfahren des
|
||||
Repositories angepasst (GNAI-011 SSH-Baseline, nftables statt ufw,
|
||||
Drei-Inventar-Ansible-Projekte, PVE-Host-Automation, hostunabhängige
|
||||
Backups, Secret-Regeln).
|
||||
|
||||
## 2. Prüfung der Recherche-Dokumente (Befunde)
|
||||
|
||||
| Nr. | Befund | Entscheidung |
|
||||
| --- | --- | --- |
|
||||
| a) | Versionsangabe „v0.21.5.x, mindestens 5.6/5.7/5.8 wegen MWEB-Sicherheitsfixes 2026“ geprüft am 2026-11-25: aktuellstes Release ist **v0.21.5.8** (GitHub, publiziert 2026-09-12); Release-Notes: Maintenance-Release inkl. des nur an Pools verteilten **v0.21.5.7-Sicherheitsfixes** (MWEB-Konsensusregel ab Height 3.172.640), „upgrading strongly recommended“. SHA-256 des x86_64-Tarballs `43200c9f…ab1be9` gegen das signierte `SHA256SUMS.asc` von `download.litecoin.org` verifiziert (Download 2026-11-25, Summe identisch). | Version **0.21.5.8** wird gepinnt; die Rolle `litecoin_core` lädt nur mit `checksum: sha256:43200c9f…` (fail-closed) und assertiert `litecoind --version`. GPG-Verifikation des `SHA256SUMS.asc` mit den Litecoin-Release-Keys bleibt zusätzlicher Operator-Schritt beim manuellen Review. |
|
||||
| b) | Research schlägt `ufw` vor. Repo-Konvention ist native **nftables** mit eigener `ghostnet_filter`-Tabelle (CT 100/102/103, CT 105). | Rolle `litecoin_firewall` deployt `/etc/nftables.conf`: input policy drop, nur SSH (TCP 22) aus `10.0.0.0/24` + `10.8.0.0/24`, output accept (Tor-Ausgang), forward drop. **Keine** Ports 9333/9332/9050/9051 nach außen. |
|
||||
| c) | Research nennt `rpcport=8332` — das ist der **Bitcoin**-Port. Litecoin-RPC ist **9332**, P2P 9333. | Korrigiert: `rpcport=9332`, `rpcbind=127.0.0.1`, `rpcallowip=127.0.0.1`. |
|
||||
| d) | Research empfiehlt RPC-Zugriff per SSH-Tunnel (`ssh -L 8332:...`). Die GNAI-011-Baseline setzt jedoch `AllowTcpForwarding no` **und** `DisableForwarding yes` (CT-102-Dropin, Hook), und die Agenten-Schlüssel sind `restrict`/`no-port-forwarding`. | **Kein SSH-Tunnel.** RPC nur per SSH-Exec: `ssh -F ~/.ssh/config ghostnet-ct114-ghost 'sudo -u litecoin litecoin-cli -conf=/etc/litecoin/litecoin.conf <cmd>'`; der Agent nutzt den Wrapper `ltc-readonly` (NOPASSWD-Sudo, Kommando-Whitelist, nur Lese-RPCs). |
|
||||
| e) | Research empfiehlt `rpcauth` (niemals `rpcpassword` im Klartext). | Es wird gar kein RPC-Credential in Dateien abgelegt: **Cookie-Auth** (Default) — `litecoin-cli` läuft als User `litecoin` und nutzt `/var/lib/litecoin/.cookie`. `litecoin.conf` enthält keine Secrets (Mode 0640 root:litecoin). |
|
||||
| f) | MWEB: Bitpanda und Rapidgator unterstützen keine MWEB-Adressen; `ltcmweb1…` an eine Exchange wäre Verlust. | Wallet erzeugt nur legacy/bech32-Adressen (`getnewaddress "" "bech32"` → `ltc1…`). MWEB bleibt lokal nutzbar (Cake Wallet), wird aber nie an Exchanges/Dienste adressiert. Dokumentiert in `litecoin.conf` und Abschnitt 8. |
|
||||
| g) | Research nimmt einen „separaten Proxmox Backup Server im LAN“ an, dessen Zugangsdaten der Betreiber liefert. Im Repo existiert **kein PBS**; das etablierte hostunabhängige Backup-Ziel ist der `gn-backup`-Account auf `ghostnet-ki` (`10.0.0.90`, eigene Hardware, Rolle `pve_lxc_backup_sync` / `gn_backup_receiver`). | Default: restic-Repo `sftp:gn-backup@10.0.0.90:/var/lib/ghostnet-ai-backup/ct114/restic` (Inventar-Variable `litecoin_backup_repository`, clientseitig verschlüsselt — das Ziel sieht nur Ciphertext). Falls der Betreiber doch ein PBS betreibt, genügen die PBS-Zugangsdaten als Inventar-Override. **Offener Punkt 11.1.** |
|
||||
| h) | Research: LXC-Backup „nur Snapshots, kein vzdump“. Repo-Konvention syncet alle `vzdump-lxc-*`-Archive nach ghostnet-ki (`pve_lxc_backup_sync`). | Bewusste, begründete Abweichung: CT 114 wird **nicht** in den vzdump-Job aufgenommen (150 GiB Chain, nächtlich ×4 Archive wären teuer; Chain ist per Neu-Sync rekonstruierbar; `wallet.dat` ist durch restic verschlüsselt **und** durch Snapshots geschützt). Umsetzung: Rolle `pve_lxc_snapshot` (täglich 04:00, 7 Snapshots Retention) + restic aus dem CT. **Operator-Schritt:** CT 114 im PVE-Backup-Job ausschließen (Abschnitt 6, Phase 0). |
|
||||
| i) | Ressourcen 2 vCPU / 4 GiB / 150 GiB rootfs auf SSD/NVMe. | Übernommen; `local-lvm` (thin, snapshotfähig). Preflight im Provisioning-Skript: `local-lvm` aktiv und ≥ 214 GiB frei. Kein Nesting nötig (kein Podman; `litecoind` als systemd-Service unter User `litecoin`). |
|
||||
| k) | Research: `onlynet=onion` (P2P ausschließlich zu onion-Peers). Live geprüft 2026-11-27: die kompilierten onion-Seeds von v0.21.5.8 sind alle unerreichbar („host unreachable“ via Tor), während clearnet-via-Tor funktioniert (check.torproject.org via SOCKS: IsTor=true; duckduckgo-onion: HTTP 301). Der Node bliebe ohne Peers. | **Anpassung:** `onlynet=onion` entfällt; mit `proxy=127.0.0.1:9050` geht ALLER Verkehr (DNS-Seeds, clearnet-Peers via Tor-Exits, onion) durch Tor — unsere IP wird nie exponiert, `listen=0`/`discover=0` verhindern Inbound. Audit prüft: jedes Netzwerk hat proxy=127.0.0.1:9050, keine inbound Peers. |
|
||||
| j) | Debian 13, unprivileged, Key-Only-SSH, fail2ban, unattended-upgrades, dedizierter User `litecoin`. | Übernommen nach Repo-Muster: frischer CT per gepinntem Community-Scripts-`debian.sh` + Bootstrap-Hook (wie CT 102, GNAI-016 Phase D), dann Ansible (`litecoin_lxc_baseline`, `litecoin_access`, `litecoin_fail2ban`, …). `unattended-upgrades` auf Debian-Security eingeschränkt (CT-100/101/102-Konvention). |
|
||||
|
||||
## 3. Zielarchitektur
|
||||
|
||||
| Komponente | Wert |
|
||||
| --- | --- |
|
||||
| CT-ID / Hostname | `114` / `ltc-node` |
|
||||
| IP | `10.0.0.61/24` (statischer Serverbereich bis `.99`; DHCP ab `.100`), GW `10.0.0.1`, DNS `10.0.0.14` (Pi-hole), vmbr0, IPv6 aus |
|
||||
| OS / Typ | Debian 13, unprivileged, onboot, protection |
|
||||
| Ressourcen | 2 vCPU, 4096 MiB RAM, 1024 MiB Swap, 150 GiB rootfs `local-lvm` |
|
||||
| Software | `litecoind` v0.21.5.8 in `/opt/litecoin` (Symlink), `tor` (Client-only, SOCKS 127.0.0.1:9050), nftables, fail2ban, unattended-upgrades, restic |
|
||||
| Node-Konfig | `proxy=127.0.0.1:9050` (alle Netze, Befund k), `listen=0`, `dnsseed=0`, `upnp=0`, `natpmp=0`, RPC `127.0.0.1:9332` Cookie-Auth, `wallet=cold`, `dbcache=2048` |
|
||||
| Firewall | nftables default-deny; nur SSH 22 aus LAN/WireGuard; kein Forwarding |
|
||||
| Backups | täglich 04:00 Snapshot auf PVE (Retention 7, Rolle `pve_lxc_snapshot`) + täglich 03:00 `backupwallet` + restic (verschlüsselt) nach `gn-backup@ghostnet-ki`; monatlich `restic check` |
|
||||
| Monitoring | systemd-Status in `verify-production.yml`/`audit-production.yml`; GNMON-Integration späterer Schritt (11.4) |
|
||||
|
||||
## 4. Zugriffsmodell (GNAI-011)
|
||||
|
||||
| Konto | UID | Rechte | Schlüssel |
|
||||
| --- | --- | --- | --- |
|
||||
| `ghost-agent` | 1000 | locked, `restrict,from="10.0.0.0/24,10.8.0.0/24"`, NOPASSWD nur für `/usr/local/bin/ltc-readonly` (Lese-RPCs als `litecoin`) | `~/.ssh/id_ed25519_ghostnet_ct114_agent` (passphrase-los, 2026-11-25 erzeugt), Alias `ghostnet-ct114-agent` |
|
||||
| `ghost` | 1001 | passwort-gated sudo | `~/.ssh/id_ed25519_ghostnet_ct114_ghost` (**Operator-Schritt: interaktiv mit Passphrase erzeugen**, Abschnitt 6 Phase 0), Alias `ghostnet-ct114-ghost` |
|
||||
| `ansible-deploy` | 1002 | locked, `NOPASSWD: ALL`, `restrict,from=…` | `~/.ssh/id_ed25519_ghostnet_ct114_ansible_deploy` (passphrase-los), Alias `ghostnet-ct114-ansible-deploy` |
|
||||
| `litecoin` | 1100 | Service-Account, `nologin`, locked, kein SSH | — |
|
||||
|
||||
Öffentliche Schlüssel liegen in
|
||||
[`ansible/files/ssh/`](../../../../../proxmox/lxc/ct-114-litecoin-wallet/ansible/files/ssh);
|
||||
`sshd` härtet per Drop-in (`PermitRootLogin no`, PasswordAuthentication no,
|
||||
`DisableForwarding yes`, AllowUsers nur die drei Konten). Hostkey-Fingerprint
|
||||
wird nach dem ersten Boot gepinnt (`litecoin_expected_ssh_host_key_fingerprint`,
|
||||
aktuell `PENDING`-Platzhalter — fail-closed). Optional: `10.0.0.61` in die
|
||||
WireGuard-Server-Admin-Ziele auf CT 105 aufnehmen (eigener Change, 11.2).
|
||||
|
||||
## 5. Ansible-Projekt
|
||||
|
||||
`proxmox/lxc/ct-114-litecoin-wallet/ansible/` folgt dem CT-102/CT-100-Schema:
|
||||
|
||||
```
|
||||
ansible/
|
||||
├── ansible.cfg # roles_path inkl. shared/ansible/roles
|
||||
├── files/ssh/litecoin-*.pub # nur öffentliche Schlüssel
|
||||
├── inventories/{agent,bootstrap,production}/
|
||||
│ ├── hosts.yml # ghost-agent / ghost / ansible-deploy
|
||||
│ ├── group_vars/litecoin_hosts.yml # Erwartungen, Firewall, Core-Pin, restic-Ziel
|
||||
│ └── host_vars/litecoin-ct114.yml # CTID 114, IP, Fingerprint-Pin, Ressourcen
|
||||
├── playbooks/
|
||||
│ ├── preflight.yml # read-only, agent-Inventar, Identitäts- und Leerstands-Gates
|
||||
│ ├── verify-deploy-access.yml # ansible-deploy-Grenze
|
||||
│ ├── site.yml # Rollen: baseline → access → firewall → fail2ban → tor → core → backup
|
||||
│ ├── verify-production.yml # read-only Produktions-Verifikation (Listener, Dienste, Firewall, SSH)
|
||||
│ └── audit-production.yml # read-only Deep-Audit
|
||||
└── roles/
|
||||
├── litecoin_lxc_baseline # Pakete, litecoin-User (1100), Zeitzone, unattended-upgrades, Verzeichnisse
|
||||
├── litecoin_access # Konten, authorized_keys, sudoers, sshd-Dropin, ltc-readonly
|
||||
├── litecoin_firewall # nftables ghostnet_filter (default-deny, SSH only)
|
||||
├── litecoin_fail2ban # sshd-Jail, systemd-Backend, nftables-Action
|
||||
├── litecoin_tor # Client-only torrc, SOCKS 127.0.0.1:9050
|
||||
├── litecoin_core # gepinnter Download (SHA256), litecoin.conf, systemd-Unit, logrotate
|
||||
└── litecoin_backup # backupwallet + restic (Timers 03:00 / monatlich check)
|
||||
```
|
||||
|
||||
## 6. Phasen und Checkliste (Operator-Schritte hervorgehoben)
|
||||
|
||||
- **Phase 0 — Vorbereitung (Operator, Workstation + PVE):**
|
||||
1. `ghost`-Schlüssel interaktiv erzeugen (`ssh-keygen -t ed25519 -f ~/.ssh/id_ed25519_ghostnet_ct114_ghost -C "ghost@ghostnet-ct114"`), `.pub` nach `ansible/files/ssh/litecoin-ghost.pub` kopieren; `ADMIN_PUBLIC_KEY`-Platzhalter im Hook ersetzen; Hook-SHA neu pinnen (siehe `scripts/README.md` Schritt 0).
|
||||
2. restic-Backup-Key für CT 114 erzeugen und für `gn-backup@ghostnet-ki` quellbeschränkt auf `10.0.0.61` autorisieren; privater Key landet später per Operator auf dem CT unter `/etc/litecoin-backup/.ssh/id_ed25519` (0600) — nie im Repo.
|
||||
3. CT 114 im PVE-vzdump-Backup-Job ausschließen (Befund h).
|
||||
4. Hooks auf dem PVE installieren und SHAs verifizieren; `provision-ct114-litecoin.sh` als root@pve ausführen (erstellt CT 114, setzt Swap, verifiziert Profil + Hook).
|
||||
5. `pct exec 114 -- passwd ghost` (interaktiv); Hostkey-Fingerprint pinnen; FRITZ!Box: sicherstellen, dass **kein** Forward auf 10.0.0.61 existiert.
|
||||
- **Phase 1 — Agent-Preflight:** `preflight.yml` gegen `inventories/agent` mit `--private-key ~/.ssh/id_ed25519_ghostnet_ct114_agent` (read-only, `ghost-agent`).
|
||||
- **Phase 2 — Deploy-Grenze:** `verify-deploy-access.yml` gegen `inventories/production`.
|
||||
- **Phase 3 — Konvergenz (braucht explizites Go des Betreibers):** `site.yml --check --diff`, dann `site.yml` gegen `inventories/production`. Zweiter Lauf muss `changed=0` liefern.
|
||||
- **Phase 4 — Verifikation:** `verify-production.yml`, `audit-production.yml`; LXC-Neustart-Test über PVE (nie boot_id-Waiter, GNAI-016 §7) und erneute Verifikation.
|
||||
- **Phase 5 — Wallet-Inbetriebnahme (interaktiv, nie im Playbook):** Node syncen lassen (`ltc-readonly getblockchaininfo` → `initialblockdownload: false`), `sudo -u litecoin litecoin-cli … createwallet "cold"`, sofort `encryptwallet` (Passphrase wird nur interaktiv eingegeben und im Secret-Store des Betreibers abgelegt — nie in Repo/Logs), Empfangsadresse `getnewaddress "" "bech32"`, restic-Repo anlegen (`restic init`) mit dem Operator-Passwort, erstes `backupwallet` + `restic backup` + `restic check`.
|
||||
- **Phase 6 — Abnahme:** Tests aus Abschnitt 10.
|
||||
|
||||
## 7. Sicherheitsregeln (verbindlich)
|
||||
|
||||
- Nie Seed-Phrase, Wallet-Passphrase, restic-Passwort oder private Schlüssel
|
||||
in Dateien, Repos, Logs oder Tickets — nur Secret-Store (Vaultwarden) /
|
||||
interaktive Übergabe.
|
||||
- Keine Ports nach außen öffnen (kein 9333, kein 9332/9050/9051); `listen=0`
|
||||
nie „zum Debuggen“ aufheben; P2P nur über Tor (SOCKS-Proxy für alle
|
||||
Netze, Befund k).
|
||||
- Nur gepinnte, Prüfsummen-verifizierte Software (SHA256-Pin in der Rolle;
|
||||
GPG-Review des signierten `SHA256SUMS.asc` als Operator-Schritt).
|
||||
- RPC nur loopback + SSH-Exec; kein Port-Forwarding (GNAI-011).
|
||||
- Nie MWEB-Adressen (`ltcmweb1…`) an Bitpanda, Rapidgator oder sonstige
|
||||
externe Dienste; nur `ltc1…`/legacy.
|
||||
- Zahlungen nur mit kleinen Beträgen nach bestandenem Restore-Test
|
||||
(Abschnitt 10); Adressen am Bildschirm visuell vergleichen.
|
||||
- Alle Änderungen dokumentieren (dieses Dokument, Änderungsverlauf).
|
||||
|
||||
## 8. Wallet-Betrieb und Zahlungen (SOP)
|
||||
|
||||
Empfang (Bitpanda → Node): Bitpanda sendet auf die `ltc1…`-Adresse; lokal
|
||||
`ssh -F ~/.ssh/config ghostnet-ct114-agent 'sudo ltc-readonly getbalance'` /
|
||||
`listtransactions` (6 Bestätigungen abwarten; zur Prüfung nie öffentliche
|
||||
Explorer, nur Tor).
|
||||
|
||||
Senden (Node → Bitpanda/Rapidgator): interaktiv als `ghost` oder
|
||||
`ansible-deploy` per SSH-Exec — kurzes Unlock-Fenster, dann sofort sperren:
|
||||
|
||||
```bash
|
||||
ssh -F ~/.ssh/config ghostnet-ct114-ghost
|
||||
sudo -u litecoin /opt/litecoin/bin/litecoin-cli -conf=/etc/litecoin/litecoin.conf walletpassphrase "<passphrase>" 120
|
||||
sudo -u litecoin /opt/litecoin/bin/litecoin-cli -conf=/etc/litecoin/litecoin.conf sendtoaddress "<ltc1…>" <betrag>
|
||||
sudo -u litecoin /opt/litecoin/bin/litecoin-cli -conf=/etc/litecoin/litecoin.conf walletlock
|
||||
```
|
||||
|
||||
Die Passphrase wird nur interaktiv eingegeben (ggf. via `read -s` in einer
|
||||
One-Shot-Shell), nie in History/Dateien. Der Agent-Account kann über
|
||||
`ltc-readonly` ausschließlich lesend prüfen (getbalance, getblockchaininfo,
|
||||
getnetworkinfo, getpeerinfo, getwalletinfo, listtransactions, …).
|
||||
|
||||
## 9. Backup- und Restore-Konzept
|
||||
|
||||
- **Snapshot (PVE-Host):** täglich 04:00, Retention 7 — Rolle
|
||||
`pve_lxc_snapshot` im `proxmox/pve-host`-Projekt (Befund h).
|
||||
- **Wallet-Backup (im CT):** täglich 03:00 `backupwallet` als `litecoin` +
|
||||
restic (clientseitig verschlüsselt) nur von `/var/lib/litecoin/backups`
|
||||
nach `gn-backup@ghostnet-ki` (oder Betreiber-PBS, 11.1); Retention 30
|
||||
Tage; monatlich `restic check`. Passwort/Key liegen root-only in
|
||||
`/etc/litecoin-backup/`.
|
||||
- **Restore:** Snapshot in PVE zurückspielen **oder** frischer CT 114 per
|
||||
`provision-ct114-litecoin.sh` + Ansible, Chain neu syncen, `wallet.dat`
|
||||
aus restic zurückspielen, `walletpassphrase` → fertig. Restore-Test
|
||||
vor dem ersten nennenswerten Betrag (Abschnitt 10, Phase 1).
|
||||
|
||||
## 10. Abnahmetests (aus `litecoin-lxc-tests.txt`, an Repo-Verfahren angepasst)
|
||||
|
||||
- **Phase 0 (vor dem ersten Euro):** Node gesynct (`initialblockdownload:
|
||||
false`); `getnetworkinfo`: ipv4/ipv6/onion alle via `proxy=127.0.0.1:9050`,
|
||||
keine lokalen Adressen; Wallet verschlüsselt
|
||||
(`getwalletinfo.unlocked_until` nur nach `walletpassphrase`); `nmap` von
|
||||
einem anderen LAN-Gerät gegen `10.0.0.61` → keine offenen Ports außer
|
||||
SSH-aus-dem-LAN-Ergebnis; Snapshot-Liste auf PVE; `restic snapshots` und
|
||||
`restic check` fehlerfrei; `verify-production.yml` + `audit-production.yml`
|
||||
bestanden; `site.yml`-Zweitlauf `changed=0`.
|
||||
- **Phase 1 (Restore zuerst):** Snapshot-Restore auf einen Scratch-CT
|
||||
(wie CT 150 bei CT 100) testen; `wallet.dat` aus restic auf Test-CT
|
||||
einspielen, mit `walletpassphrase` öffnen, `getbalance` zeigt Test-Coins;
|
||||
Seed/Metall-Backup physisch prüfen.
|
||||
- **Phase 2 (kleine echte Beträge):** Bitpanda → `ltc1…` (kleinster Betrag,
|
||||
6 Bestätigungen, `listtransactions`); Node → Bitpanda zurück; Node →
|
||||
Cake Wallet; Cake → extern. Nie über öffentlichen Explorer prüfen.
|
||||
- **Phase 3 (MWEB, klein):** peg-in/peg-out in Cake Wallet; nie MWEB an
|
||||
Bitpanda/Rapidgator.
|
||||
- **Phase 4 (Notfall):** Server aus → Cake Wallet unabhängig; Handy weg →
|
||||
Cake-Seed auf zweitem Gerät; `walletlock` → Senden ohne Passphrase schlägt
|
||||
fehl.
|
||||
- **Bericht an den Betreiber:** CT-ID, IP, Core-Version + SHA-256,
|
||||
Sync-Status, Snapshot-/restic-Listen, Firewall-Regeln, RPC-Variante
|
||||
(SSH-Exec, Befund d), Doku-Link.
|
||||
|
||||
## 11. Offene Punkte / Entscheidungen des Betreibers
|
||||
|
||||
1. **Backup-Ziel:** Default `gn-backup@ghostnet-ki` (Befund g). Falls ein
|
||||
separater PBS im LAN existiert: Zugangsdaten liefern, Inventar-Variable
|
||||
`litecoin_backup_repository` überschreiben und Ziel-Hostkey pinnen.
|
||||
2. **WireGuard-Zugriff:** `10.0.0.61` auf CT 105 in die Server-Admin-Ziele
|
||||
aufnehmen? (Default: nein, LAN-SSH genügt.)
|
||||
3. **vzdump-Ausschluss CT 114** im PVE-Backup-Job bestätigen (Befund h).
|
||||
4. **GNMON-Monitoring** für CT 114 (Node synced, Backup-Timer) als Folge-Schritt.
|
||||
5. **IP/CT-ID bestätigen:** CT 114 / `10.0.0.61` waren am 2026-11-25 frei
|
||||
(dokumentiertes Inventar: CT 100–105, 110, 116; IPs .2–.90 belegt, .61
|
||||
frei). Vor Provisioning live gegen `pct list` prüfen — das
|
||||
Provisioning-Skript fail-closed bei belegter ID.
|
||||
|
||||
## 12. Implementierungsstand 2026-11-25
|
||||
|
||||
- Branch `lxc/ct-114-gnai-024-litecoin-wallet` (keine Kollision mit
|
||||
`main` oder anderen Feature-Branches).
|
||||
- Angelegt: Ansible-Projekt `proxmox/lxc/ct-114-litecoin-wallet/ansible/`
|
||||
(3 Inventare, 5 Playbooks, 7 Rollen), PVE-Host-Skripte
|
||||
(`provision-ct114-litecoin.sh` mit gepinnten Community-Scripts-SHAs,
|
||||
`ghostnet-litecoin-ansible-bootstrap-hook.sh`), Rolle `pve_lxc_snapshot`
|
||||
im `pve-host`-Projekt, READMEs.
|
||||
- Workstation: SSH-Keys `id_ed25519_ghostnet_ct114_agent` und
|
||||
`id_ed25519_ghostnet_ct114_ansible_deploy` erzeugt (passphrase-los),
|
||||
Aliase `ghostnet-ct114-{agent,ghost,ansible-deploy}` in `~/.ssh/config`.
|
||||
- **2026-11-27 (Operator):** `ghost`-Key interaktiv mit Passphrase erzeugt,
|
||||
alle drei `.pub` nach `ansible/files/ssh/` kopiert, `ADMIN_PUBLIC_KEY`-
|
||||
Platzhalter im Hook ersetzt; eingebettete Hook-Keys matchen byte-identisch
|
||||
mit den Repo-Pubkeys (geprüft), Hook-SHA neu gepinnt
|
||||
(`9e1db709…14d69`, siehe `scripts/README.md`).
|
||||
- Verifiziert: Litecoin v0.21.5.8 SHA-256 gegen signiertes `SHA256SUMS.asc`
|
||||
(Befund a); Shell-Syntax aller Skripte; Ansible-Syntax aller Playbooks;
|
||||
yamllint, Secret-Scan und Markdown-Linkcheck (CI-Skripte lokal) bestanden.
|
||||
- **2026-11-27:** restic-Key `id_ed25519_ghostnet_ct114_restic`
|
||||
(`restic@ct114`, Fingerprint `SHA256:i4UFMsAmdGdi8s0pJeVnK7Ros1liEqXzJ2IghyBCBiU`)
|
||||
erzeugt und als `ct114-restic.pub` in der Rolle `gn_backup_receiver`
|
||||
(llm-server/host) hinterlegt, quellbeschränkt auf `10.0.0.61`, plus
|
||||
Zielverzeichnis `/var/lib/ghostnet-ai-backup/ct114` für das restic-Repo.
|
||||
Anwenden auf ghostnet-ki per `llm-server/host/ansible` `host.yml`
|
||||
(Operator, mit Go).
|
||||
- **2026-11-27 — CT 114 ist produktiv (Infrastruktur), Wallet noch unverschlüsselt:**
|
||||
- CT 114 angelegt (`ltc-node`, 10.0.0.61, unprivileged, 2 vCPU/4096 MiB/1024
|
||||
Swap, 150G local-lvm, nesting/keyctl **0** — nachträglich gesetzt, das
|
||||
Provisioning-Skript pinnt das jetzt ab), Bootstrap-Hook grün
|
||||
(`ghost-agent` 1000 / `ghost` 1001 / `ansible-deploy` 1002, gelockt,
|
||||
quellbeschränkte Keys); Hostkey `SHA256:nkRMQWpzpBkUaGNOgyCRsEaXK2KhdraTuiL5ihUdXW4`
|
||||
in allen drei host_vars gepinnt.
|
||||
- Ansible: preflight (agent) ok=13, verify-deploy-access ok=5, site.yml
|
||||
konvergiert, danach `changed=0`; verify-production ok=27 und
|
||||
audit-production ok=23 grün; `pct reboot 114` bestanden (0 failed units;
|
||||
dev-mqueue/run-lock/tmp.mount sind ohne nesting maskiert).
|
||||
- Listener: nur 22 (nftables auf LAN/WG beschränkt), 9332 + 9050 loopback;
|
||||
litecoind v0.21.5.8 läuft, Tor `Bootstrapped 100%`, onion-only
|
||||
(`getnetworkinfo`: onion reachable, ipv4/ipv6 nicht). Sync läuft
|
||||
(`initialblockdownload: true`). **2026-11-27 später:** Befund k —
|
||||
onion-Seeds tot, daher Umstellung auf „alles via Tor“ (proxy für alle
|
||||
Netze, kein Inbound); danach Peer-Aufbau und Sync verifiziert (Header-Sync
|
||||
18000 → 300000+ in Minuten, Peers via Tor-Exit, Tip 3220399). Tor-Exit-
|
||||
Verbindungen auf 9333 churnen — Sync dauert länger, läuft aber stabil.
|
||||
`pct reboot`-Warnung 'Systemd 257 … nesting' ist bei nesting=0 erwartete
|
||||
Kosmetik: nach Reboot 0 failed units, alle Services aktiv,
|
||||
is-system-running=running (dev-mqueue/run-lock/tmp.mount maskiert).
|
||||
- restic: Key von CT 114 (10.0.0.61) auf gn-backup@ghostnet-ki positiv
|
||||
getestet, von der Workstation negativ (Permission denied); Repo
|
||||
`sftp:gn-backup@10.0.0.90:/var/lib/ghostnet-ai-backup/ct114/restic`
|
||||
initialisiert, `restic check` clean; Timer 03:00 + monatlicher Check
|
||||
aktiv; erster Lauf: Snapshot `35be2d5c` (wallet-2026-11-27).
|
||||
restic-Passwort wurde **on-target** generiert
|
||||
(`/etc/litecoin-backup/restic-password`, 0600) — Operator holt es einmal
|
||||
per Konsole und legt es im Vaultwarden ab.
|
||||
- **Speicherbudget (gemessen 2026-11-27):** rootfs 147 GiB, belegt 3,1 GiB
|
||||
(Blockdateien sparse preallokiert). Prognose Vollsync: Chain ~60–90 GiB +
|
||||
chainstate ~5–10 GiB → datadir < 100 GiB, passt in die 150 GiB. restic
|
||||
sichert nur `backups/` (wallet.dat ~2,2 MiB/Tag → ~1 GiB/Jahr auf
|
||||
ghostnet-ki, client-seitig verschlüsselt); PVE-Snapshots (Retention 7)
|
||||
wachsen um den täglichen Chain-Zuwachs. RAM: litecoind-Peak ~2,5 GiB
|
||||
(dbcache=2048) innerhalb der 4 GiB.
|
||||
- PVE-Host: `pve_lxc_snapshot` aktiv, erster Snapshot
|
||||
`ghostnet-daily-20261127-072519`, Timer täglich 04:00 (Retention 7).
|
||||
vzdump: kein Cluster-Backup-Job vorhanden, der CT 114 fassen würde
|
||||
(`pvesh get /cluster/backup` leer) — Befund h damit erledigt.
|
||||
- Wallet `cold` per `createwallet` angelegt; **`encryptwallet` ist der
|
||||
nächste Operator-Schritt** (exakter Befehl siehe „Noch offen“) — bis
|
||||
dahin darf kein Betrag auf den Node.
|
||||
- Fixes unterwegs (alle gecommitt): awk-END-Falle im Storage-Gate, sed traf
|
||||
die Hook-Guard-Zeile (Pin aktualisiert), delegate_to-Tasks brauchen
|
||||
become: false, Debian 13 hat kein torctl (Journal statt Dateilog),
|
||||
sshd -T listet allowusers zeilenweise, sudoers ist (root)-beschränkt
|
||||
(ltc-readonly statt sudo -u), restic 0.18 braucht sftp.command als
|
||||
komplette Zeile inkl. Host + `-s sftp` und `-o` nach dem Subcommand.
|
||||
- **2026-11-27 (Operator erledigt):** `pct exec 114 -- passwd ghost` gesetzt;
|
||||
restic-Passwort aus `/etc/litecoin-backup/restic-password` geholt und im
|
||||
Vaultwarden abgelegt.
|
||||
- **Noch offen (Operator, manuelle Eingabe):** `encryptwallet` mit Passphrase
|
||||
— Daemon läuft mit `-conf=/etc/litecoin/litecoin.conf -datadir=/var/lib/litecoin`,
|
||||
Cookie unter `/var/lib/litecoin/.cookie`; die cli braucht daher **explizit
|
||||
`-conf=/etc/litecoin/litecoin.conf`** (sonst sucht sie in
|
||||
`$HOME/.litecoin` und findet kein Cookie). Passphrase via `-stdin`, nie als
|
||||
argv (sonst in Host-`ps`/Logs); `-stdin` liest eine JSON-gequotete Zeile:
|
||||
`printf '"%s"\n' '<passphrase>' | pct exec 114 -- sudo -u litecoin /opt/litecoin/bin/litecoin-cli -conf=/etc/litecoin/litecoin.conf -stdin encryptwallet`
|
||||
danach `pct exec 114 -- systemctl restart litecoind`. FRITZ!Box-Check (kein
|
||||
Forward auf 10.0.0.61); Abnahmetests Abschnitt 10 (Restore-Test vor erstem
|
||||
Betrag); PR gegen main.
|
||||
@@ -0,0 +1,119 @@
|
||||
# Auftrag: Litecoin Full Node (Cold Wallet) als LXC auf Proxmox
|
||||
|
||||
**Ziel:** Ein gehärteter, unprivilegierter LXC auf dem Proxmox-Host betreibt einen eigenen Litecoin Full Node (`litecoind`) als Cold Wallet. P2P-Traffic läuft ausschließlich über Tor, RPC-Zugriff nur lokal per SSH-Tunnel. Backups: tägliche LXC-Snapshots + tägliches verschlüsseltes `wallet.dat`-Backup auf einen separaten Proxmox Backup Server im LAN.
|
||||
|
||||
**Voraussetzungen (vom Auftraggeber vorgegeben):**
|
||||
- Nur **Litecoin Core** (kein ElectrumX, kein GUI-Client im LXC)
|
||||
- LXC-Backup: **nur Snapshots**, kein externes/vzdump-Backup des Containers
|
||||
- Wallet-Backup: **separater Proxmox Backup Server im lokalen Netz** als Ziel (restic, client-seitig verschlüsselt)
|
||||
- RPC-Zugang: Agent wählt die sicherste praktikable Variante und dokumentiert sie (Empfehlung: `rpcbind=127.0.0.1` + SSH-Tunnel)
|
||||
|
||||
---
|
||||
|
||||
## 1. LXC anlegen (Proxmox VE)
|
||||
|
||||
- Template: **Debian 13** (aktuelles offizielles Template)
|
||||
- **Unprivileged** lassen (Default)
|
||||
- Ressourcen: **2 vCPU, 4096 MB RAM, 150 GB rootfs** auf SSD/NVMe-Storage (Chain ~100 GB + Wachstum; NVMe wegen random I/O)
|
||||
- Hostname: `ltc-node`; feste LAN-IP oder DHCP-Reservierung (nächste freie ID wählen, im Router reservieren)
|
||||
- Kein Port-Forwarding, keine Bridge-Exposure außer LAN
|
||||
|
||||
## 2. Container härten
|
||||
|
||||
- SSH: Key-Only (`PasswordAuthentication no`, `PermitRootLogin no`), `fail2ban` installieren
|
||||
- `unattended-upgrades` aktivieren (Security-Updates automatisch)
|
||||
- Firewall `ufw`: default **deny incoming**, default allow outgoing; **keine Ports öffnen** (weder 9333 P2P noch 8332/8333 RPC)
|
||||
- Dedizierter User `litecoin` (nicht root) für `litecoind`; datadir `/var/lib/litecoin`
|
||||
|
||||
## 3. Tor installieren (im selben LXC)
|
||||
|
||||
- `apt install tor`, Service aktivieren
|
||||
- `torrc`: SOCKS-Proxy auf `127.0.0.1:9050` (Default), `ControlPort 9051` optional für auto-Onion-Service
|
||||
|
||||
## 4. Litecoin Core installieren (verifiziert)
|
||||
|
||||
- **Neueste stabile Version** herunterladen von `https://download.litecoin.org/` (Stand 2026: Reihe **v0.21.5.x**, mindestens v0.21.5.6/5.7/5.8 wegen der MWEB-Sicherheitsfixes 2026 – nie eine ältere Version)
|
||||
- **SHA256-Summe prüfen** (aus den offiziellen release notes) **und Signatur verifizieren** (Signing-Key des Litecoin-Projekts, z. B. laanwj)
|
||||
- Installation nach `/opt/litecoin-<version>`, Symlink `/opt/litecoin`
|
||||
- systemd-Unit `litecoind.service`: User `litecoin`, `ExecStart=/opt/litecoin/bin/litecoind -datadir=/var/lib/litecoin -conf=/etc/litecoin/litecoin.conf`, Restart=on-failure, Hardening (NoNewPrivileges, ProtectSystem=strict außer datadir, PrivateTmp)
|
||||
|
||||
## 5. litecoin.conf (Kernstück)
|
||||
|
||||
```ini
|
||||
# Netzwerk: nur Tor, kein Clearnet, kein Inbound
|
||||
proxy=127.0.0.1:9050
|
||||
onlynet=onion
|
||||
listen=0
|
||||
discover=0
|
||||
upnp=0
|
||||
|
||||
# RPC: nur lokal, Agent entscheidet final (Empfehlung: SSH-Tunnel)
|
||||
server=1
|
||||
rpcbind=127.0.0.1
|
||||
rpcallowip=127.0.0.1
|
||||
# rpcauth=<user>:<salt>$<hash> (niemals rpcpassword im Klartext)
|
||||
rpcport=8332
|
||||
|
||||
# Performance / Wallet
|
||||
dbcache=2048
|
||||
txindex=0
|
||||
wallet=cold
|
||||
fallbackfee=0.0001
|
||||
```
|
||||
|
||||
## 6. Wallet einrichten
|
||||
|
||||
1. Node starten, Sync abwarten (`litecoin-cli getblockchaininfo` → `initialblockdownload: false`)
|
||||
2. `litecoin-cli -conf=/etc/litecoin/litecoin.conf createwallet "cold"`
|
||||
3. **Sofort verschlüsseln:** `encryptwallet "<starkes Passwort>"` – Passwort wird **nie** in Dateien, Logs oder diesem Auftrag gespeichert; Übergabe nur über vom Auftraggeber vorgesehenen Secret-Kanal
|
||||
4. Empfangsadresse erzeugen und dokumentieren: `getnewaddress "" "bech32"` (nur legacy/bech32 – **Bitpanda unterstützt kein MWEB**, daher nie `ltcmweb1` an Bitpanda)
|
||||
5. Descriptor/Seed-Infos exportieren und sicher ablegen (siehe Abschnitt 8)
|
||||
|
||||
## 7. Snapshots (LXC-Backup, täglich)
|
||||
|
||||
- Proxmox-Job oder Cron auf dem Host: täglicher **Snapshot** des LXC (Storage mit Snapshot-Support: ZFS oder LVM-thin), Retention z. B. 7 Stück
|
||||
- Snapshot schützt gegen Korruption – ersetzt **nicht** das Wallet-Backup (Abschnitt 8)
|
||||
|
||||
## 8. Verschlüsseltes wallet.dat-Backup zum separaten PBS im LAN (täglich)
|
||||
|
||||
- `restic` im LXC installieren; Repo auf dem **separaten Proxmox Backup Server im LAN** anlegen (Zugriff per SSH), **client-seitige Verschlüsselung** (restic-Standard)
|
||||
- Cron täglich 03:00 Uhr im LXC:
|
||||
- `litecoin-cli backupwallet /var/lib/litecoin/backups/wallet-$(date +%F)`
|
||||
- `restic backup /var/lib/litecoin/backups` (nur backups/, **nie** die komplette Chain – die wird bei Restore neu gesynct)
|
||||
- `restic forget --keep-daily 30 --prune`
|
||||
- Zugangsdaten/Passwörter für restic liegen im Secret-Store des Auftraggebers, nicht in Cron-Files im Klartext (restic nutzt RESTIC_PASSWORD_FILE oder env aus systemd-Credentials)
|
||||
- Monatlich: `restic check` als Test
|
||||
|
||||
## 9. Monitoring & Doku
|
||||
|
||||
- systemd-Status `litecoind` + `tor` überwachen; Alarm wenn Node nicht synced (`getblockchaininfo`)
|
||||
- `logrotate` für litecoin debug.log
|
||||
- Doku im LXC (`/root/README.md`): genutzte Befehle, SSH-Tunnel-Anleitung, Restore-Anleitung:
|
||||
- Snapshot-Restore in Proxmox **oder**
|
||||
- frischer LXC + Core neu installieren + Chain neu syncen + `wallet.dat` aus restic zurückspielen + `walletpassphrase` → fertig
|
||||
- Changelog aller Änderungen pflegen
|
||||
|
||||
## 10. Abnahmetest (muss bestanden werden)
|
||||
|
||||
1. Kleinen LTC-Betrag von Bitpanda auf `getnewaddress` (bech32/legacy) senden → 6 Bestätigungen abwarten → in `listtransactions` sichtbar
|
||||
2. Test-Sendung kleiner Betrag zurück an Bitpanda → Tx via Tor gebroadcastet (Log/`getnetworkinfo` prüfen: nur onion-Verbindungen, `listen=0`)
|
||||
3. Snapshot erstellen + auflisten
|
||||
4. restic-Backup ausführen + `restic snapshots` + `restic check` erfolgreich
|
||||
5. Firewall verifizieren: von außen kein Port offen (`nmap` vom anderen LAN-Gerät gegen LXC-IP)
|
||||
6. Bericht an Auftraggeber: LXC-ID, IP, installierte Core-Version + Prüfsumme, Sync-Status, Snapshot-Liste, restic-Snapshot-Liste, Firewall-Regeln, gewählte RPC-Variante + Doku-Link
|
||||
|
||||
## 11. Sicherheitsregeln (verbindlich)
|
||||
|
||||
- **Nie** Seed-Phrase, wallet-Passwort, restic-Passwort, RPC-Credentials in Klartext in Dateien, Repos, Logs oder diesen Auftrag schreiben – nur verschlüsselt/secret
|
||||
- Keine Ports nach außen öffnen (kein 9333, kein 8332/8333)
|
||||
- Nur signierte/verifizierte Software-Downloads (SHA256 + GPG)
|
||||
- Node nur über Tor erreichbar (onion-only); `listen=0` nicht „zum Debuggen“ aufheben
|
||||
- Bitpanda/Handelsplätze: immer nur legacy/bech32-Adressen, nie MWEB-Adressen an Exchanges
|
||||
- Alle Änderungen dokumentieren
|
||||
|
||||
## 12. Offene Punkte (Agent entscheidet und dokumentiert)
|
||||
|
||||
- LXC-ID, LAN-IP, Hostname (nächste freie Werte, DHCP-Reservierung vorschlagen)
|
||||
- Finale RPC-Zugriffsvariante (Empfehlung: `rpcbind=127.0.0.1` + `ssh -L 8332:127.0.0.1:8332 ltc-node` vom Desktop)
|
||||
- Snapshot-Zeitplan/Retention (Vorschlag: täglich, 7 behalten)
|
||||
- restic-Repo-Details auf dem PBS (Ziel-URL/SSH-Host werden vom Auftraggeber geliefert)
|
||||
@@ -0,0 +1,37 @@
|
||||
Der wichtigste Test ist nicht „funktioniert eine Zahlung“, sondern **„komme ich an mein Geld, wenn etwas schiefgeht“**. Deshalb in dieser Reihenfolge, immer mit kleinen Beträgen:
|
||||
|
||||
## Phase 0: Setup-Checks (vor dem ersten Euro)
|
||||
- Node vollständig gesynct: `litecoin-cli getblockchaininfo` → `initialblockdownload: false`, Block-Höhe nahe dem Netzwerk-Top
|
||||
- Nur Tor: `litecoin-cli getnetworkinfo` → Verbindungen nur `onion`, `listen=0` aktiv
|
||||
- Wallet verschlüsselt: `litecoin-cli getwalletinfo` → `unlocked_until` nur nach `walletpassphrase`; ohne Passwort keine Sends möglich
|
||||
- Firewall: von einem anderen LAN-Gerät `nmap <LXC-IP>` → keine offenen Ports
|
||||
- Backups laufen: Snapshot-Liste in Proxmox, `restic snapshots` zeigt Einträge, `restic check` fehlerfrei
|
||||
|
||||
## Phase 1: Restore-Test (das wichtigste zuerst!)
|
||||
Bevor nennenswert Geld drauf ist:
|
||||
1. **Snapshot-Restore testen:** Snapshot des LXC in Proxmox zurückspielen (auf Kopie/CT-ID testen), prüfen ob `litecoind` startet und Wallet intakt
|
||||
2. **Wallet-Restore testen:** `wallet.dat` aus restic auf einem Test-Rechner/Test-CT einspielen, Core mit `walletpassphrase` öffnen, `getbalance` zeigt die Test-Coins → Beweis, dass das Backup funktioniert
|
||||
3. Seed/Metall-Backup physisch prüfen:Offline-Leseprobe (Wörter lesbar, vollständig)
|
||||
|
||||
## Phase 2: Kleine echte Transaktionen (Cent- bis zweistellige Beträge)
|
||||
1. **Bitpanda → Node:** kleinsten Betrag auf `getnewaddress "" "bech32"` senden, Adresse doppelt prüfen (kopieren, nicht abtippen), 6 Bestätigungen abwarten, in `listtransactions` prüfen – **nicht über öffentlichen Explorer** (der sieht deine Adresse; wenn doch, nur über Tor)
|
||||
2. **Node → Bitpanda zurück:** `sendtoaddress` kleiner Betrag, prüfe im Bitpanda-Konto den Eingang; damit ist Ein- und Auszahlung bewiesen
|
||||
3. **Node → Handy (Cake Wallet):** kleiner Betrag an die Cake-Adresse, warte Bestätigungen, in Cake Wallet sichtbar
|
||||
4. **Handy → externe Adresse:** von Cake Wallet kleiner Betrag zurück an Node-Adresse oder Bitpanda
|
||||
|
||||
## Phase 3: MWEB-Test (klein)
|
||||
- In Cake Wallet oder Electrum-LTC: kleiner Betrag peg-in (MWEB-Adresse `ltcmweb1...`), innerhalb MWEB kleine Sendung, dann peg-out zurück auf normale Adresse
|
||||
- Prüfen: an **Bitpanda/Rapidgator nie MWEB-Adressen** senden (da gehen Coins verloren)
|
||||
|
||||
## Phase 4: Notfall-Übung
|
||||
- Server ausmachen → Cake Wallet funktioniert unabhängig (Hot Wallet)
|
||||
- Handy weg/defekt → Cake-Seed auf neuem Gerät wiederherstellen (Test mit zweitem Gerät)
|
||||
- Node-Wallet-Sperre testen: `walletlock` → Senden ohne `walletpassphrase` muss fehlschlagen
|
||||
|
||||
## Rote Linien währenddessen
|
||||
- Nie Seed-Phrase irgendwo eingeben – auch nicht „zum Testen“ in Webseiten/Apps
|
||||
- Nie größere Beträge, bevor Phase 1–3 bestanden sind
|
||||
- Jede Adresse auf dem Bildschirm visuell vergleichen (bei Hardware-Wallet: auf dem Gerät)
|
||||
- Logs/Fehler dokumentieren, bevor du weitermachst
|
||||
|
||||
**Faustregel:** Wenn Restore-Test + kleine Ein-/Auszahlung + MWEB-Rundtrip bestanden sind, ist das Setup produktiv. Erst dann größere Beträge von Bitpanda rüberschieben – und auch dann immer erst Testbetrag, dann Rest.
|
||||
@@ -0,0 +1,235 @@
|
||||
# Fluxer Chat LXC (CT 117) – Plan, Machbarkeitsprüfung und Umsetzungsstand
|
||||
|
||||
**Stand:** 2026-11-30
|
||||
**Status:** CT 117 produktiv angelegt; Baseline, Access, Firewall, Podman und der komplette Fluxer-Stack laufen konvergiert (`site.yml`-Zweitlauf `changed=0`, 2026-11-30). Noch offen: Keycloak-Client `fluxer` (Phase 7), NPM-Vhost (Phase 9), Operator-Schritte SSO/DNS/Ports (Phase 8/10), Abnahmetests (Phase 11).
|
||||
|
||||
## Änderungsverlauf
|
||||
|
||||
| Datum | Version | Autor | Änderung |
|
||||
| --- | --- | --- | --- |
|
||||
| 2026-11-27 | 1.0 | Mistral Vibe | Erstfassung: Machbarkeitsprüfung (Abschnitt 2), Zielarchitektur, Repo-Artefakte, Operator-Phasen |
|
||||
| 2026-11-27 | 1.1 | Mistral Vibe / Operator | RAM-Check bestätigt: PVE-Host 32 GiB, 25 % belegt (8 GiB) — 8 GiB für CT 117 unkritisch (Befund d); Phase 1 in Abschnitt 6 erledigt |
|
||||
| 2026-11-27 | 1.2 | Mistral Vibe | Upstream-Pins gesetzt (Commit 872ed5d, compose-SHA d5558cd, 12 App-Image-Digests); pin-fluxer-images.sh für die restlichen Images; fluxer-worker läuft aus dem fluxer-api-Image |
|
||||
| 2026-11-27 | 1.3 | Mistral Vibe / Operator | Provisioning: local-lvm-Extraktion schlägt fehl (tar Permission denied), Storage auf daten4 umgestellt (pvesm: daten4 4,7 % belegt); CT 117 noch nicht angelegt |
|
||||
| 2026-11-27 | 1.4 | Mistral Vibe / Operator | Operator bestätigt: local-lvm hat reichlich Platz und alle bisherigen LXCs liefen dort — Storage-Wechsel auf daten4 war voreilig; Default bleibt local-lvm, Ursache der tar-Permission-denied wird diagnostiziert (LV-Mountpoint nicht schreibbar für uid 100000) |
|
||||
| 2026-11-27 | 1.5 | Mistral Vibe / Operator | Ursache gefunden: `umask 077` im Provisioning-Skript vererbt sich an `pct create` → rootfs-Mountpoint 0700 root → tar unter lxc-usernsexec får „Permission denied“. Reproduziert (VMID 117 minimal OK, VMID 119 mit umask 077 FAIL). Fix: `umask 022` vor dem pct-Aufruf; Storage bleibt local-lvm |
|
||||
| 2026-11-27 | 1.6 | Mistral Vibe | Zweiter Skript-Bug gefixt: rootfs-Verify-Regex enthielt `\\$` (literales Dollar statt EOL-Anchor) und matchte nie; jetzt `(,|$)`. Hinweis: Das CT-101-Template-Skript trägt dieselbe latente Regex — dort unberührt. Nach dem Fehllauf muss CT 117 vor dem Retry per `pct destroy 117 --purge` entfernt werden (Guard verhindert sonst den Rerun) |
|
||||
| 2026-11-29 | 1.7 | Mistral Vibe / Operator | **CT 117 angelegt** (local-lvm, 64 GiB; Host-Key-Fingerprint gepinnt). Provisioning-Fixes aus 1.5/1.6 wirksam; Storage bleibt local-lvm. Compose-Pin korrigiert: main `872ed5d` hat die self-hosting-compose nicht mehr (rexctl-Umbau) — gepinnt auf `3b1eb567` (compose-SHA `1cb102f9…`; `d5558cd…` war die SHA-256 der 404-Seite), livekit.yaml/Caddyfile-SHA mitgepinnt. Preflight-Gate rootfs auf 60 GB dezimal (ext4-Overhead auf 64-GiB-LV). Rollen check-mode-sicher; `remote_tmp = ~/.ansible/tmp` (tmp.mount-Masking unmountet sonst /tmp mitten im Lauf) |
|
||||
| 2026-11-30 | 1.8 | Mistral Vibe | Alle 18 Image-Digests docker.io-vollqualifiziert in allen drei Inventories (skopeo via `pin-fluxer-images.sh`; podman ohne unqualified-search-registries); Override pinnt alle 25 Services per Digest + `pull_policy: never` |
|
||||
| 2026-11-30 | 1.9 | Mistral Vibe | Erste podman-compose-1.3.0-Laufzeitbefunde: Gateway verlangt `FLUXER_ERLANG_COOKIE`, Shards `FLUXER_PROFILE_PSEUDONYM_SECRET` (Override injiziert beide als runtime-Secrets); Secret-Generierung idempotent nachziehend (fehlende Keys werden ergänzt, statt nur bei leerer Datei); Firewall erlaubt podman-bridge (aardvark-dns `10.89.0.1:53` + intra-`10.89.0.0/16`) — sonst kein Inter-Container-DNS/Traffic; Unit mit `up -d --force-recreate` + `TimeoutStartSec=1800` (podman-compose recreatet sonst nicht bei .env-Änderung) |
|
||||
| 2026-11-30 | 1.10 | Mistral Vibe | podman-compose-1.3.0-Substitutionsdefekte: nicht-leere compose-Defaults (`${VAR:-default}`) werden als **Leerstring** substituiert, wenn VAR im .env fehlt (Node-API lehnt leere Booleans ab) — alle Defaults explizit ins .env; 4 verschachtelte `${VAR:-${INNER:-…}}`-Refs werden zerpflückt — in der Adaption geflattet; VAPID-Keys im Fluxer-Format base64url **ohne Padding** (raw 32-Byte-Scalar/65-Byte-Point), falsch formatierte Altwerte regeneriert; seaweedfs-init-Bedingung `service_completed_successfully` wird von podman-compose 1.3.0 nie erfüllt |
|
||||
| 2026-11-30 | 1.11 | Mistral Vibe | Stack läuft **vollständig und konvergiert** (23 Services Up, seaweedfs-init `Exited (0)` Sollzustand, api/postgres/valkey healthy, app-proxy HTTP 200, `site.yml`-Zweitlauf `changed=0`). Sieben weitere podman-compose/LiveKit-Befunde (Detail in Abschnitt 5a): (a) leer-defaultete `${VAR:-}`-Refs bleiben wörtlich im Container-Env, wenn die Var im .env fehlt → api „Invalid email app base URL"; (b) fehlender Podman-Bridge-Egress → LiveKit-STUN-Crashloop; (c) `depends_on: caddy` crasht podman-compose mit KeyError bei deaktiviertem Edge; (d) gepinnte livekit.yaml erwartet `webhook.api_key: fluxer` → LIVEKIT_API_KEY als Bezeichner fix `fluxer`; (e) `podman wait --condition=running` auf den Oneshot seaweedfs-init blockt ewig; (f) Rollen-Verification um den legitimen `Exited (0)` des Init-Containers erweitert; (g) Idempotenz: SHA-verifizierter Download auf separate `docker-compose.upstream.yml`, aktive Compose nur bei Upstream-Änderung erneuert |
|
||||
| 2026-11-30 | 1.12 | Mistral Vibe / Operator | **Domain-Kollision korrigiert:** `chat.ghostnet.selfhost.eu` ist der live produktive OpenWebUI-Nutzerpfad (GNAI-001 M6, NPM → 10.0.0.90:8081) — Fluxer erhält `fluxer.ghostnet.selfhost.eu`. Umgezogen: CT-117-Inventories (`fluxer_stack_public_domain`), Keycloak-Client-Spec (CT-102-Rolle, Sync zieht die Redirect-URIs per PUT), NPM-Vhost-Rolle (CT 103), Pi-hole-Split-DNS (CT 100, `chat.` bleibt OpenWebUI vorbehalten), Doku. Keycloak-Client war zwischenzeitlich mit `chat.`-URIs angelegt (Phase-7-Lauf), wird beim nächsten Sync automatisch korrigiert |
|
||||
| 2026-11-30 | 1.13 | Mistral Vibe / Operator | **Öffentlicher Pfad live:** `https://fluxer.ghostnet.selfhost.eu` → HTTP 200 (LE-Cert), alle vier CTs konvergiert (`changed=0`). Drei Begleitbefunde: (a) **NPM-Vorfall:** der Feature-Branch hatte den nie gemergten lokalen Branch `lxc/ct-103-gnai-006-disk-housekeeping` nicht (NPM 2.15.1→2.17.1, nginx2root/nginx2shell-CVE-Fix vom 26.11.) — der CT-103-Konvergenzlauf baute den Container per Quadlet auf 2.15.1 zurück, der Admin-Backend crashloopete am Migration-Check (`20260906220000_user_permission_meta.js` existiert erst ab 2.16/2.17; öffentliche Vhosts liefen weiter, Admin-API 502). Merge nachgeholt, Quadlet konvergiert auf 2.17.1, Admin-API 200; (b) **Firewall-DNAT-Befund:** per netavark gepublishte Ports laufen nach PREROUTING-DNAT durch die FORWARD-Kette (Ziel = Container-IP im Podman-Netz), input-only-Regeln sehen solchen Traffic nie — Forward-Regeln für NPM→app-proxy/LiveKit-Signaling und (Voice) WAN-Media-Ports ergänzt; (c) **Keycloak-Sync-Drift:** Keycloak liefert `redirectUris` in wechselnder Reihenfolge zurück — Vergleich im Sync-Skript jetzt ordnungsunempfindlich, sonst Dauer-PUT/`changed=1` |
|
||||
|
||||
## 1. Zweck und Leitentscheidung
|
||||
|
||||
Fluxer (AGPL, community-getriebene Revolt-Alternative; Chat + VoIP für
|
||||
Freundeskreise) selbst hosten als **CT 117** (`fluxer`, `10.0.0.62`) im
|
||||
bewährten Podman-LXC-Schema des Homelabs: unprivilegierter Debian-13-LXC,
|
||||
rootful Podman unter systemd, digest-gepinnte Images, nftables default-deny,
|
||||
drei Inventories (`agent`/`bootstrap`/`production`), PVE-seitige Anlage durch
|
||||
diesen Operator. Öffentlich erreichbar über den bestehenden NPM-Edge (CT 103)
|
||||
als `https://fluxer.ghostnet.selfhost.eu`.
|
||||
|
||||
Entscheidungen (Operator-Pending, daher als solche markiert):
|
||||
|
||||
- **D1 (offen für Betreiber):** Instanz öffentlich mit Fluxer-eigener Keycloak-SSO-Login-Seite, Registrierung auf **invite-only** gestellt — nicht zusätzlich hinter oauth2-proxy-IAP (GNAI-023-Muster wäre nachrüstbar).
|
||||
- **D2 (offen für Betreiber):** Sprach-/Videoanrufe (LiveKit) ja/nein. Ja erfordert WAN-seitige UDP/TCP-Ports (Befund e); nein = reiner Text-Chat hinter NPM.
|
||||
|
||||
## 2. Machbarkeitsprüfung (Befunde)
|
||||
|
||||
Recherche Stand 2026-11-27 (Quellen: fluxer.com, docs.fluxer.com,
|
||||
github.com/fluxerapp/fluxer `deploy/self-hosting/docker-compose.yml`, DeepWiki
|
||||
fluxerapp/fluxer, fossengineer.com, selfhostedworld.com):
|
||||
|
||||
| Befund | Ergebnis | |
|
||||
| --- | --- | --- |
|
||||
| a) **Auth über Keycloak** | **Machbar, nativ.** Fluxer unterstützt SSO über beliebige OIDC-Provider — Keycloak wird ausdrücklich genannt. Konfiguration im Admin-Panel `/admin` (Instance Settings): Issuer URL, Client ID, Client Secret; Callback-Pfad `/auth/sso/callback`. Keycloak-Seite: confidential Client `fluxer` im Realm `Ghost.net` (Redirect `https://fluxer.ghostnet.selfhost.eu/auth/sso/callback`), anlegbar über die bestehende `keycloak_realm_config`-Rolle (Abschnitt 4). Das Client-Secret wird von Keycloak generiert und vom Operator im Credentials-Tab abgelesen und im Fluxer-Admin-Panel eingetragen — es landet nie im Repo. Zusätzlich: Registrierung invite-only, damit nur Freunde Accounts bekommen. | ✅ |
|
||||
| b) **Unattended Updates** | **Machbar, zweistufig.** (1) OS: `unattended-upgrades` auf Debian-Security beschränkt — exakt die CT-100/102/103-Konvention, in Rolle `fluxer_lxc_baseline` umgesetzt. (2) Container-Images: Repo-Konvention ist digest-gepinnt + Update per Ansible-Re-Run (`podman-auto-update.timer` bleibt wie bei CT 102/103 deaktiviert). Vollautomatisches `podman auto-update` wäre möglich, aber gegen die Change-Discipline (geprüfte Pins, `--check --diff` vor Produktivlauf) — bewusst nicht eingeschaltet. | ✅ |
|
||||
| c) **Images/Pinning** | **Machbar.** Offizielle Images `ghcr.io/fluxerapp/fluxer-<service>:v1` (FLUXER_REGISTRY/OWNER/TAG-override-fähig) für api, gateway, worker, media-proxy, app-proxy-self-hosted, static, admin, snowflakes, users, messages, gifs, unfurl, push; Infra: postgres, valkey, nats, meilisearch, seaweedfs, livekit-server, caddy. Die Rolle `fluxer_stack` lädt die upstream-compose am gepinnten Commit mit SHA-256-Check und pinnt Images per Digest (Platzhalter `PENDING-*` failen hart, bis der Operator pinnt). | ✅ |
|
||||
| d) **Performance** | **Machbar mit Dimensionierung.** Upstream-compose: ~21 Services, docker memory limits summiert ~19,3 GB (Reservierungen deutlich darunter). Für einen Freundeskreis reicht 1 Shard; die Ghostnet-Override setzt upstream-eigene `FLUXER_*_MEMORY_LIMIT`-Knobs (Summe ~6 GiB). CT-Profil: **4 Cores / 8192 MiB RAM / 2048 MiB Swap / 64 GiB rootfs** (`local-lvm`). Ob der PVE-Host das tragen kann, muss der Operator vor Anlage prüfen (`free -h`/`pct config`-Summe auf dem Host — Agent hat keinen pct-Zugang). Erste Last nach Go-Live beobachten (`podman stats`), RAM ggf. auf 12–16 GiB hochziehen. | ✅ mit Bedingung |
|
||||
| e) **VoIP (LiveKit) hinter NPM** | **Eingeschränkt.** Signaling/WS geht über NPM (`/livekit/` → 10.0.0.62:7880). WebRTC-Media braucht direkte Erreichbarkeit: TCP 7881, UDP 3478 (TURN/STUN), UDP 50000–50100 (RTP) — am besten FRITZ!Box-Portweiterleitung auf 10.0.0.62 plus `use_external_ip`. Alternative: TURN-Server oder Voice deaktivieren (`fluxer_stack_voice_enabled=false`, dann keine WAN-Media-Ports). | ⚠️ nur mit Portweiterleitung |
|
||||
| f) **Edge/TLS** | **Machbar ohne upstream Caddy.** NPM (CT 103) terminiert TLS (bestehender Wildcard-/A-Record-Mechanismus für `*.ghostnet.selfhost.eu`), die Ghostnet-Override deaktiviert den Caddy-Edge (`profiles: [ghostnet-disabled-edge]`, keine veröffentlichten 80/443) und published nur app-proxy 8080 + LiveKit-Ports auf der CT-IP; nftables lässt HTTP nur von 10.0.0.10/32 (CT 103) zu. Discovery (`/.well-known/fluxer`) und exakte upstream-env-Namen gegen die gepinnte compose prüfen (Operator-Schritt, Rolle failt hart bei abweichenden Servicenamen). | ✅ |
|
||||
|
||||
## 3. Zielarchitektur
|
||||
|
||||
```
|
||||
Internet ──TLS──> FRITZ!Box (80/443 → CT 103 NPM; optional 7881/tcp, 3478/udp,
|
||||
50000-50100/udp → CT 117 bei Voice)
|
||||
CT 103 NPM: fluxer.ghostnet.selfhost.eu → 10.0.0.62:8080 (+ /livekit/ → :7880)
|
||||
CT 117 fluxer (10.0.0.62, Debian 13, unprivileged, nesting=1):
|
||||
nftables default-deny (SSH aus 10.0.0.0/24+10.8.0.0/24,
|
||||
8080/7880 nur von 10.0.0.10, Voice-Ports WAN bei D2=ja)
|
||||
fluxer-stack.service → podman compose (pinned, pull_policy=never):
|
||||
app-proxy:8080, livekit:7880(+media), api, gateway, worker,
|
||||
media-proxy, static, admin, shards, postgres, valkey, nats,
|
||||
meilisearch, seaweedfs (caddy edge disabled)
|
||||
Keycloak CT 102: Realm Ghost.net, Client `fluxer` (OIDC-SSO)
|
||||
Pi-hole CT 100: Split-DNS fluxer.ghostnet.selfhost.eu → 10.0.0.10
|
||||
```
|
||||
|
||||
CT-Profil: 117, `fluxer`, `10.0.0.62/24`, GW `10.0.0.1`, DNS `10.0.0.14`,
|
||||
`vmbr0`, 4 cores, 8192 MiB, 2048 MiB swap, 64 GiB rootfs `local-lvm` (wie CT 100/101/102/103),
|
||||
unprivileged, `nesting=1,keyctl=1`, onboot. Backup: CT 117 landet im
|
||||
bestehenden vzdump-Job (im Gegensatz zu CT 114 ist die rootfs klein); zusätzlich
|
||||
App-level-Backup (Postgres-Dump + SeaweedFS-Daten) als restic-Job auf ghostnet-ki
|
||||
ist als Ausbaustufe offen (Abschnitt 11).
|
||||
|
||||
## 4. Keycloak-Integration (Befund a)
|
||||
|
||||
- Realm `Ghost.net`, Client `fluxer` (confidential, standard flow, redirect
|
||||
`https://fluxer.ghostnet.selfhost.eu/auth/sso/callback`), angelegt über
|
||||
`proxmox/lxc/ct-102-keycloak/ansible/roles/keycloak_realm_config`
|
||||
(neuer Block `keycloak_realm_fluxer_client` in defaults + realm spec +
|
||||
`keycloak_realm_sync.py` Abschnitt 5).
|
||||
- Client-Secret: Operator liest es im Keycloak-Credentials-Tab und trägt es
|
||||
im Fluxer-Admin-Panel `/admin` ein (Issuer
|
||||
`https://auth.ghostnet.selfhost.eu/realms/Ghost.net`). Nie in git.
|
||||
- Danach in Fluxer: Registrierung deaktivieren / invite-only, damit nur
|
||||
Freunde Accounts anlegen können.
|
||||
- Optional später: zweite IAP-Schicht (oauth2-proxy auf CT 103, GNAI-023-Muster)
|
||||
mit eigenem Client `fluxer-iap`.
|
||||
|
||||
## 5. Ansible-Projekt und Artefakte
|
||||
|
||||
| Artefakt | Pfad | Inhalt |
|
||||
| --- | --- | --- |
|
||||
| Provisioning | `proxmox/lxc/ct-117-fluxer/scripts/provision-ct117-fluxer.sh` | pct create + baseline hook (SHA-256-gepinnt) + configfs-Mask; nie destruktiv |
|
||||
| Ansible | `proxmox/lxc/ct-117-fluxer/ansible/` | `ansible.cfg`, 3 Inventories, `playbooks/{preflight,site}.yml`, Rollen `fluxer_lxc_baseline`, `fluxer_access`, `fluxer_firewall`, `fluxer_stack` + shared `podman_runtime` |
|
||||
| Stack | Rolle `fluxer_stack` | gepinnte upstream-compose (SHA-256, `3b1eb567`/`1cb102f9…`) als separate `docker-compose.upstream.yml`; aktive `docker-compose.yml` wird nur bei Upstream-Änderung aus der Kopie erzeugt und lokal adaptiert (Abschnitt 5a); `docker-compose.ghostnet.yml` (Caddy-Edge aus, nur app-proxy/LiveKit published, `pull_policy: never`, journald) + `.env` (0600, Secrets einmalig on-guest generiert) + `fluxer-stack.service`; Image-Digests gepinnt |
|
||||
| NPM | `proxmox/lxc/ct-103-reverse-proxy/ansible/roles/reverse_proxy_fluxer_vhost/` | Vhost `fluxer.ghostnet.selfhost.eu` → 10.0.0.62:8080 + `/livekit/` → :7880, LE-Cert, Fail2Ban-Restart; in CT-103-`site.yml` eingehängt |
|
||||
| Keycloak | `proxmox/lxc/ct-102-keycloak/.../keycloak_realm_config` | Client `fluxer` (Abschnitt 4) |
|
||||
|
||||
**Begründete Abweichung vom Quadlet-Schema:** Upstream liefert eine einzige
|
||||
compose-Datei für ~21 Services; die wird gepinnt via rootful `podman compose`
|
||||
unter einer systemd-Unit gefahren statt in per-service-Quadlets geforkt zu
|
||||
werden. Das bewährte Schema bleibt überall dort erhalten, wo es zählt:
|
||||
unprivilegierter LXC, rootful Podman unter systemd, digest-gepinnte Images,
|
||||
`podman.socket`/`podman-auto-update.timer` deaktiviert, nftables default-deny,
|
||||
drei Inventories.
|
||||
|
||||
### 5a. podman-compose 1.3.0 — dokumentierte Defekte und die Adaption der gepinnten Compose
|
||||
|
||||
Debian 13 liefert podman-compose **1.3.0** (mit podman 5.4.2), das die
|
||||
upstream-compose nur mit lokal aufgezeichneten, deterministischen
|
||||
Transformationen fehlerfrei fährt. Die Rolle lädt die Compose SHA-256-verifiziert
|
||||
nach `docker-compose.upstream.yml` (bleibt pristin und checksummbar), kopiert sie
|
||||
bei Upstream-Änderung in die aktive `docker-compose.yml` und wendet dort per
|
||||
`ansible.builtin.replace` diese Adaptionen an (alle Muster backslash-frei und
|
||||
MULTILINE-verankert — die replace-Action interpretiert Backslash-Escapes in
|
||||
Loop-Args unzuverlässig):
|
||||
|
||||
1. **seaweedfs-init-Dep-Kanten entfernt** (api/worker/media-proxy):
|
||||
`service_completed_successfully` wird von podman-compose 1.3.0 nie erfüllt,
|
||||
und nach Konvertierung auf `service_started` blockt
|
||||
`podman wait --condition=running` ewig, sobald der Oneshot-Container
|
||||
`Exited (0)` ist. Die S3-Buckets persistieren im seaweedfs-data-Volume;
|
||||
auf einem frischen Volume self-healt api/media-proxy per restart-Policy,
|
||||
während init läuft.
|
||||
2. **4 verschachtelte `${VAR:-${INNER:-…}}`-Refs geflattet** (FLUXER_REGISTRY,
|
||||
FLUXER_VAPID_EMAIL, FLUXER_PASSKEY_RP_ID, FLUXER_PASSKEY_ADDITIONAL_ALLOWED_ORIGINS)
|
||||
— podman-compose zerpflückt nested defaults und lässt Literale wie `}:`
|
||||
im Container-Env stehen.
|
||||
3. **`depends_on: caddy` (app-proxy) entfernt** — mit dem per Override-Profil
|
||||
deaktivierten Caddy-Edge crasht podman-compose mit `KeyError: 'caddy'`
|
||||
in `check_dep_conditions`; die Override zeigt DISCOVERY_UPSTREAM_URL direkt
|
||||
auf die api.
|
||||
|
||||
Zusätzlich gilt für die `.env`: **jede** in der Compose referenzierte Variable
|
||||
muss explizit stehen — auch die mit leerem Upstream-Default (CSP_*, SMTP-Felder,
|
||||
KLIPY, EMAIL_APP_BASE_URL). podman-compose 1.3.0 hinterlässt fehlende Variablen
|
||||
als wörtlichen `${VAR:-}`-String im Container-Env (Befund: api „Invalid email
|
||||
app base URL") bzw. substituiert nicht-leere Defaults als Leerstring (Node-API
|
||||
lehnt leere Booleans ab). `FLUXER_EMAIL_APP_BASE_URL` wird auf die Public-URL
|
||||
gesetzt.
|
||||
|
||||
Firewall-DNAT: per netavark gepublishte Ports (app-proxy 8080, LiveKit
|
||||
7880/7881/7882/3478/50000-50100) werden in PREROUTING auf die Container-IP
|
||||
destiniert — der Traffic durchläuft die FORWARD-Kette, nicht input. Die
|
||||
`fluxer_firewall`-Rolle hält daher neben den input-Regeln explizite
|
||||
forward-Regeln (NPM → app-proxy/LiveKit-Signaling, bei Voice zusätzlich die
|
||||
WAN-Media-Ports auf das Podman-Subnetz als Ziel); ein reines input-Regelwerk
|
||||
würde den Traffic lautlos am default forward deny verwerfen (site30-Befund).
|
||||
|
||||
LiveKit: die gepinnte `livekit.yaml` referenziert `webhook.api_key: fluxer` —
|
||||
LiveKit exittet sofort mit 0, wenn dieser Name nicht in `LIVEKIT_KEYS`
|
||||
existiert. `LIVEKIT_API_KEY` ist daher ein **Bezeichner** (fix `fluxer`,
|
||||
Task erzwingt den Wert idempotent), das zufällige `LIVEKIT_API_SECRET` bleibt
|
||||
der eigentliche Schutz. `rtc.use_external_ip: true` der gepinnten Config
|
||||
erfordert ausgehenden STUN; die Firewall erlaubt deshalb vollen
|
||||
Podman-Bridge-Egress im etablierten Homelab-Muster (wie `keycloak_firewall`,
|
||||
CT 102) — LiveKit (STUN) und unfurl (Link-Previews beliebiger URLs) brauchen
|
||||
ihn.
|
||||
|
||||
## 6. Phasen und Checkliste (Operator-Schritte hervorgehoben)
|
||||
|
||||
1. **Operator:** PVE-Host-Kapazität prüfen (`free -h`, Summe memory der CTs vs. RAM); ggf. Profil anpassen. **Erledigt 2026-11-27 (Operator): 32 GiB RAM, 25 % belegt — 8 GiB CT-Profil unkritisch.**
|
||||
2. **Operator (Workstation):** drei CT-117-Keypairs generieren, `.pub` nach `files/ssh/`, SSH-Aliases `ghostnet-ct117-*` in `~/.ssh/config`. **Erledigt 2026-11-29.**
|
||||
3. **Operator:** upstream-Commit + compose-SHA-256 pinnen (**korrigiert 2026-11-29: `3b1eb567` / `1cb102f9…`** — `872ed5d`/`d5558cd…` war die 404-Seite, main hat die self-hosting-compose nicht mehr); alle 18 Image-Digests via `proxmox/lxc/ct-117-fluxer/scripts/pin-fluxer-images.sh` ermitteln (skopeo, docker.io-vollqualifiziert) und das YAML in die drei `group_vars/fluxer_hosts.yml` eintragen. **Erledigt 2026-11-30.** Hinweis: `fluxer-worker` existiert nicht als eigenes Image — der Worker läuft aus dem `fluxer-api`-Image.
|
||||
4. **Operator:** Repo-Dateien per `scp` auf den PVE-Host kopieren (siehe `scripts/README.md`), Hook-SHA verifizieren (`111f1b70…`), dann `GHOSTNET_AGENT_UID=1000 GHOSTNET_ADMIN_UID=1001 bash /root/provision-ct117-fluxer.sh`; danach `pct exec 117 -- passwd ghost`, pubkeys in die authorized_keys, Fingerprint pinnen. **Erledigt 2026-11-29 (CT 117 angelegt, local-lvm, 64 GiB; Fingerprint `SHA256:bL5zdRfuXcspX9gRSuPvLgHzyXJsZo+KsU0jdDqIxrA`).**
|
||||
5. **Agent:** `preflight.yml` auf `agent`-Inventory (read-only) — Identitäts- und Leerstands-Gates. **Erledigt 2026-11-29 (grün nach rootfs-Gate 60 GB).**
|
||||
6. **Agent (nach Operator-Go):** `site.yml --check --diff` auf `production`, dann autorisierter `site.yml`-Lauf; zweiter Lauf muss `changed=0` liefern. **Erledigt 2026-11-30** (nach den podman-compose-Adaptionen aus Abschnitt 5a; Zweitlauf `changed=0`, failed=0; 23 Services Up, seaweedfs-init `Exited (0)`, api/postgres/valkey healthy, app-proxy HTTP 200).
|
||||
7. **Agent:** CT-102-`keycloak_realm_config` laufen lassen (legt Client `fluxer` an). **Erledigt 2026-11-30** (Client angelegt, Redirect-URIs nach Domain-Korrektur per Sync-PUT gezogen, Zweitlauf `changed=0`).
|
||||
8. **Operator:** Keycloak-Credentials-Tab → Secret in Fluxer `/admin` eintragen (Issuer/Client-ID/Secret), Registrierung auf invite-only.
|
||||
9. **Agent (nach Operator-Go):** CT-103-`site.yml` mit neuer Rolle `reverse_proxy_fluxer_vhost` (legt NPM-Vhost + LE-Cert an). **Erledigt 2026-11-30** (Vhost + LE-Cert live; NPM dabei wie in 1.13 beschrieben auf den gepinnten CVE-Fix-Stand 2.17.1 konvergiert; Zweitlauf `changed=0`).
|
||||
10. **Operator:** Pi-hole-Split-DNS `fluxer.ghostnet.selfhost.eu → 10.0.0.10` (**erledigt 2026-11-30 via `dns_pihole`-Rolle, live verifiziert**); FRITZ!Box-Portweiterleitung 7881/tcp, 3478/udp, 50000–50100/udp → 10.0.0.62 nur bei D2=ja (**noch offen**); FRITZ!Box-Portweiterleitung 7881/tcp, 3478/udp, 50000–50100/udp → 10.0.0.62 nur bei D2=ja.
|
||||
11. **Agent:** Abnahmetests (Abschnitt 10).
|
||||
|
||||
## 7. Sicherheitsregeln (verbindlich)
|
||||
|
||||
- CT 117 unprivileged, `nesting=1,keyctl=1`, configfs-Mount maskiert; GNAI-011-Zugriffsmodell (ghost-agent read-only via Wrapper, ghost password-gated sudo, ansible-deploy NOPASSWD), keine Root-SSH, keine Passwort-Logins.
|
||||
- nftables default-deny; HTTP/WS nur von CT 103 (10.0.0.10/32); keine direkten WAN-HTTP-Ports; Voice-Media-Ports nur bei explizitem D2=ja.
|
||||
- Images digest-gepinnt, `pull_policy: never`, `podman.socket` aus; Secrets nur on-guest (0600), nie in git/Logs/Inventories.
|
||||
- TLS nur am NPM-Edge; HSTS, http2, block_exploits, websocket upgrade am Vhost.
|
||||
- OS-Security-Updates unattended (Debian-Security only); Stack-Updates nur via gepinnte Re-Runs mit `--check --diff`.
|
||||
- Fluxer-Registrierung invite-only; SSO zwingend über Keycloak (Lokal-Passwort-Login in Fluxer deaktivieren, wenn vom Admin-Panel unterstützt).
|
||||
- Secrets (Keycloak-Client-Secret, .env) werden nie im Repo abgelegt; preflight + Rollen failen hart bei PENDING-Platzhaltern.
|
||||
|
||||
## 8. Betrieb (SOP, Auszug)
|
||||
|
||||
- Status: `ssh -F ~/.ssh/config ghostnet-ct117-agent 'sudo /usr/local/bin/fluxer-readonly podman ps'`; Logs: `podman logs` / `journalctl -u fluxer-stack`.
|
||||
- Stack-Neustart nach Pin-Update: `site.yml`-Re-Run (production) oder manuell `systemctl restart fluxer-stack` auf CT 117.
|
||||
- Backup: vzdump-Job (PVE) deckt CT 117; App-level (Postgres+SeaweedFS) als restic zu ghostnet-ki ist offen (Abschnitt 11).
|
||||
|
||||
## 9. Backup- und Restore-Konzept
|
||||
|
||||
- PVE-vzdump: CT 117 im bestehenden nächtlichen Job (64 GiB rootfs, Daten in compose-Volumes auf rootfs) + Sync nach ghostnet-ki wie die übrigen CTs.
|
||||
- App-level: upstream empfiehlt Postgres-Dump + SeaweedFS-Volume (see docs); als restic-Job analog CT 114 (Rolle `litecoin_backup`-Muster) nachrüstbar.
|
||||
- Restore: frischer CT 117 via provision-Skript + Ansible-Rebuild + Restore der Datenvolumes; Keycloak-Client idempotent via realm_config.
|
||||
|
||||
## 10. Abnahmetests (nach Go-Live)
|
||||
|
||||
1. `https://fluxer.ghostnet.selfhost.eu` lädt (LE-Cert, HSTS, HTTP/2), `/_health` der API OK.
|
||||
2. Keycloak-SSO: Login über `fluxer`-Client, Callback `/auth/sso/callback` erfolgreich; danach invite-only-Registrierung verifizieren (neuer Account nur per Invite).
|
||||
3. Gateway-WebSocket (`/gateway`) und `/livekit/` signaling durch NPM (WS-Upgrade) OK; bei D2=ja: Voice-Call-Test zwischen zwei Clients über WAN.
|
||||
4. Firewall: von extern nur 80/443 (via FRITZ!Box→CT 103) und ggf. Voice-Ports erreichbar; `nft list table inet ghostnet_filter` auf CT 117 zeigt die gesetzten Regeln; direkter Zugriff auf 10.0.0.62:8080 nur von 10.0.0.10.
|
||||
5. Idempotenz: zweiter `site.yml`-Lauf `changed=0`; preflight auf agent-Inventory clean.
|
||||
6. Unattended-Upgrades: `unattended-upgrades.service` aktiv, Origins-Pattern nur Debian-Security.
|
||||
|
||||
## 11. Offene Punkte / Entscheidungen des Betreibers
|
||||
|
||||
- D1: IAP zusätzlich ja/nein (Default: nein, Fluxer-SSO + invite-only).
|
||||
- D2: Voice ja/nein (Default in Inventories: ja; ohne FRITZ!Box-Forwarding auf 10.0.0.62 faktisch nein).
|
||||
- PVE-Host-RAM reicht für 8 GiB CT 117? (Operator prüft vor Anlage.)
|
||||
- Exakte upstream-env-Namen (`.env.example`) und Servicenamen gegen gepinnte compose verifizieren; `fluxer_stack_service_*` ggf. anpassen — die Rolle failt mit klarer Meldung.
|
||||
- App-level-Backup (restic) nachrüsten?
|
||||
- Öffentlicher DNS: Wildcard `*.ghostnet.selfhost.eu` deckt `chat.` ab (wie research/auth) — Operator bestätigt.
|
||||
|
||||
## 12. Implementierungsstand 2026-11-30 (Abend)
|
||||
|
||||
CT 117 produktiv angelegt (local-lvm, 64 GiB, Fingerprint gepinnt); Baseline,
|
||||
Access, Firewall, Podman-Runtime und der komplette Fluxer-Stack laufen
|
||||
konvergiert (`changed=0`, 23 Services Up, seaweedfs-init `Exited (0)`,
|
||||
api/postgres/valkey healthy). **Öffentlicher Pfad live:**
|
||||
`https://fluxer.ghostnet.selfhost.eu` → NPM-Vhost (LE-Cert, Zweitlauf
|
||||
`changed=0`) → app-proxy HTTP 200. Keycloak-Client `fluxer` angelegt und
|
||||
konvergiert (`keycloak_realm_config`, Zweitlauf `changed=0`), Pi-hole-Split-
|
||||
DNS live (`dns_pihole`, Zweitlauf `changed=0`).
|
||||
|
||||
Offen: Phase 8 (Operator: Client-Secret aus dem Keycloak-Credentials-Tab ins
|
||||
Fluxer-Admin-Panel `/admin` — Issuer
|
||||
`https://auth.ghostnet.selfhost.eu/realms/Ghost.net`, Client-ID `fluxer` —,
|
||||
Registrierung invite-only), FRITZ!Box-Ports für Voice bei D2=ja (Phase 10),
|
||||
Abnahmetests (Phase 11, Abschnitt 10) und GNAI-006-Doku-Aktualisierung durch
|
||||
den CT-103-Branch-Eigentümer (Merge liegt im Feature-Branch).
|
||||
@@ -0,0 +1 @@
|
||||
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJZAt2wB48lIH1vSWL7djBHufmnpb19zrSoMw18CeIss restic@ct114
|
||||
@@ -12,6 +12,12 @@ PVE host (GNAI-000 section 4, blocker 4).
|
||||
(`files/ssh/pve-backup.pub`, fingerprint
|
||||
`SHA256:tabCXnfrKhWI2+0F8vZgLqg7JtWn1Xt4ifo8o2KuPNc`) restricted with
|
||||
`from="10.0.0.2"` and no forwarding.
|
||||
- **2026-11-27 (GNAI-024):** zusatzlicher CT-114-restic-Key
|
||||
(`files/ssh/ct114-restic.pub`, Fingerprint
|
||||
`SHA256:i4UFMsAmdGdi8s0pJeVnK7Ros1liEqXzJ2IghyBCBiU`), restricted mit
|
||||
`from="10.0.0.61"` und no forwarding; Zielverzeichnis
|
||||
`/var/lib/ghostnet-ai-backup/ct114` (restic-Repo der clientseitig
|
||||
verschluesselten Wallet-Backups aus CT 114).
|
||||
- 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/`
|
||||
|
||||
@@ -22,3 +22,11 @@ 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
|
||||
|
||||
# Additional source-restricted receiver keys. CT 114 (Litecoin wallet LXC,
|
||||
# GNAI-024) pushes its client-side encrypted wallet backups (restic over
|
||||
# sftp) into gn_backup_ct114_dir; the key may only be used from the CT.
|
||||
gn_backup_additional_keys:
|
||||
- file: ct114-restic.pub
|
||||
options: 'from="10.0.0.61",no-agent-forwarding,no-port-forwarding,no-X11-forwarding,no-user-rc'
|
||||
gn_backup_ct114_dir: /var/lib/ghostnet-ai-backup/ct114
|
||||
|
||||
@@ -35,9 +35,13 @@
|
||||
group: gn-backup
|
||||
mode: "0700"
|
||||
|
||||
- name: Install the source-restricted PVE backup key
|
||||
- name: Install the source-restricted receiver keys
|
||||
ansible.builtin.copy:
|
||||
content: "{{ gn_backup_ssh_options }} {{ lookup('ansible.builtin.file', role_path ~ '/../../files/ssh/' ~ gn_backup_pubkey_file) }}"
|
||||
content: |-
|
||||
{{ gn_backup_ssh_options }} {{ lookup('ansible.builtin.file', role_path ~ '/../../files/ssh/' ~ gn_backup_pubkey_file) }}
|
||||
{% for key in gn_backup_additional_keys %}
|
||||
{{ key.options }} {{ lookup('ansible.builtin.file', role_path ~ '/../../files/ssh/' ~ key.file) }}
|
||||
{% endfor %}
|
||||
dest: "{{ gn_backup_account.home }}/.ssh/authorized_keys"
|
||||
owner: "{{ gn_backup_account.name }}"
|
||||
group: gn-backup
|
||||
@@ -50,3 +54,11 @@
|
||||
owner: "{{ gn_backup_account.name }}"
|
||||
group: gn-backup
|
||||
mode: "0700"
|
||||
|
||||
- name: Create the CT 114 restic target directory
|
||||
ansible.builtin.file:
|
||||
path: "{{ gn_backup_ct114_dir }}"
|
||||
state: directory
|
||||
owner: "{{ gn_backup_account.name }}"
|
||||
group: gn-backup
|
||||
mode: "0700"
|
||||
|
||||
@@ -36,6 +36,9 @@ dns_pihole_hosts_records:
|
||||
- "10.0.0.10 chat.ghostnet.selfhost.eu"
|
||||
# GNAI-023 M8: GPT Researcher via NPM (CT-103) + oauth2-proxy.
|
||||
- "10.0.0.10 research.ghostnet.selfhost.eu"
|
||||
# GNAI-025: Fluxer-Chat via NPM (CT-103). chat.ghostnet.selfhost.eu bleibt
|
||||
# OpenWebUI (GNAI-001 M6) vorbehalten.
|
||||
- "10.0.0.10 fluxer.ghostnet.selfhost.eu"
|
||||
dns_pihole_timezone: Europe/Berlin
|
||||
dns_pihole_database_max_db_days: 30
|
||||
dns_pihole_secret_name: pihole_web_password
|
||||
|
||||
@@ -36,6 +36,9 @@ dns_pihole_hosts_records:
|
||||
- "10.0.0.10 chat.ghostnet.selfhost.eu"
|
||||
# GNAI-023 M8: GPT Researcher via NPM (CT-103) + oauth2-proxy.
|
||||
- "10.0.0.10 research.ghostnet.selfhost.eu"
|
||||
# GNAI-025: Fluxer-Chat via NPM (CT-103). chat.ghostnet.selfhost.eu bleibt
|
||||
# OpenWebUI (GNAI-001 M6) vorbehalten.
|
||||
- "10.0.0.10 fluxer.ghostnet.selfhost.eu"
|
||||
dns_pihole_timezone: Europe/Berlin
|
||||
dns_pihole_database_max_db_days: 30
|
||||
dns_pihole_secret_name: pihole_web_password
|
||||
|
||||
@@ -36,6 +36,9 @@ dns_pihole_hosts_records:
|
||||
- "10.0.0.10 chat.ghostnet.selfhost.eu"
|
||||
# GNAI-023 M8: GPT Researcher via NPM (CT-103) + oauth2-proxy.
|
||||
- "10.0.0.10 research.ghostnet.selfhost.eu"
|
||||
# GNAI-025: Fluxer-Chat via NPM (CT-103). chat.ghostnet.selfhost.eu bleibt
|
||||
# OpenWebUI (GNAI-001 M6) vorbehalten.
|
||||
- "10.0.0.10 fluxer.ghostnet.selfhost.eu"
|
||||
dns_pihole_timezone: Europe/Berlin
|
||||
dns_pihole_database_max_db_days: 30
|
||||
dns_pihole_secret_name: pihole_web_password
|
||||
|
||||
@@ -17,6 +17,9 @@ dns_pihole_hosts_records:
|
||||
- "10.0.0.10 chat.ghostnet.selfhost.eu"
|
||||
# GNAI-023 M8: GPT Researcher via NPM (CT-103) + oauth2-proxy.
|
||||
- "10.0.0.10 research.ghostnet.selfhost.eu"
|
||||
# GNAI-025: Fluxer-Chat via NPM (CT-103). chat.ghostnet.selfhost.eu bleibt
|
||||
# OpenWebUI (GNAI-001 M6) vorbehalten.
|
||||
- "10.0.0.10 fluxer.ghostnet.selfhost.eu"
|
||||
dns_pihole_database_max_db_days: 30
|
||||
dns_pihole_service_name: pihole.service
|
||||
dns_pihole_quadlet_path: /etc/containers/systemd/pihole.container
|
||||
|
||||
@@ -31,3 +31,18 @@ keycloak_realm_research_client:
|
||||
keycloak_realm_research_mapper:
|
||||
name: realm-roles-to-groups
|
||||
claim_name: groups
|
||||
|
||||
# Fluxer-Instanz (GNAI-025, CT 117): OIDC-Client fuer Fluxer-native SSO
|
||||
# (Admin-Panel /admin: Issuer https://auth.ghostnet.selfhost.eu/realms/Ghost.net,
|
||||
# clientId `fluxer`, Secret aus dem Keycloak-Credentials-Tab — nie in git).
|
||||
# Callback-Pfad der Fluxer-App: /auth/sso/callback.
|
||||
keycloak_realm_fluxer_client:
|
||||
clientId: fluxer
|
||||
name: Ghostnet Fluxer (fluxer.ghostnet.selfhost.eu)
|
||||
rootUrl: https://fluxer.ghostnet.selfhost.eu
|
||||
redirectUris:
|
||||
- https://fluxer.ghostnet.selfhost.eu/auth/sso/callback
|
||||
- https://fluxer.ghostnet.selfhost.eu/auth/sso/callback/*
|
||||
webOrigins:
|
||||
- https://fluxer.ghostnet.selfhost.eu
|
||||
postLogoutRedirectUris: "https://fluxer.ghostnet.selfhost.eu/*"
|
||||
|
||||
+59
-1
@@ -18,6 +18,15 @@ secret = open(secret_file).read().strip()
|
||||
changed = False
|
||||
|
||||
|
||||
def eq(wanted, current):
|
||||
"""Keycloak may reorder list fields (e.g. redirectUris) between PUT and
|
||||
GET; compare lists order-insensitively so the sync stays idempotent
|
||||
(GNAI-025 site31-Befund)."""
|
||||
if isinstance(wanted, list) and isinstance(current, list):
|
||||
return sorted(map(str, wanted)) == sorted(map(str, current))
|
||||
return wanted == current
|
||||
|
||||
|
||||
def req(method, path, body=None):
|
||||
url = f"{base}{path}"
|
||||
data = None
|
||||
@@ -105,7 +114,7 @@ for k, v in client_body.items():
|
||||
print(f"DRIFT attributes.{ak}: current={cur_attrs.get(ak)!r} wanted={av!r}", file=sys.stderr)
|
||||
break
|
||||
continue
|
||||
if current.get(k) != v:
|
||||
if not eq(v, current.get(k)):
|
||||
drift = True
|
||||
print(f"DRIFT {k}: current={current.get(k)!r} wanted={v!r}", file=sys.stderr)
|
||||
break
|
||||
@@ -157,4 +166,53 @@ if not any(x.get("name") == role_name for x in assigned):
|
||||
assert st == 204, f"role mapping failed: {st}"
|
||||
changed = True
|
||||
|
||||
# --- 5) Fluxer OIDC client (GNAI-025, CT 117 chat instance) ---
|
||||
# Confidential client for Fluxer-native SSO. The client secret is generated
|
||||
# by Keycloak on creation; the operator reads it in the admin UI (Credentials
|
||||
# tab) and enters it in the Fluxer admin panel — it never enters git.
|
||||
fc = spec["fluxer_client"]
|
||||
fluxer_body = {
|
||||
"clientId": fc["clientId"],
|
||||
"name": fc["name"],
|
||||
"enabled": True,
|
||||
"protocol": "openid-connect",
|
||||
"publicClient": False,
|
||||
"standardFlowEnabled": True,
|
||||
"directAccessGrantsEnabled": False,
|
||||
"implicitFlowEnabled": False,
|
||||
"serviceAccountsEnabled": False,
|
||||
"rootUrl": fc["rootUrl"],
|
||||
"redirectUris": fc["redirectUris"],
|
||||
"webOrigins": fc["webOrigins"],
|
||||
"attributes": {"post.logout.redirect.uris": fc["postLogoutRedirectUris"]},
|
||||
}
|
||||
st, fclients = req("GET", f"{R}/clients?clientId={urllib.parse.quote(fc['clientId'])}")
|
||||
assert st == 200, f"fluxer client lookup failed: {st}"
|
||||
if not fclients:
|
||||
st, _ = req("POST", f"{R}/clients", fluxer_body)
|
||||
assert st == 201, f"create fluxer client failed: {st}"
|
||||
changed = True
|
||||
st, fclients = req("GET", f"{R}/clients?clientId={urllib.parse.quote(fc['clientId'])}")
|
||||
ffluxer = fclients[0]
|
||||
st, fcurrent = req("GET", f"{R}/clients/{ffluxer['id']}")
|
||||
assert st == 200
|
||||
fdrift = False
|
||||
for k, v in fluxer_body.items():
|
||||
if k == "attributes":
|
||||
cur_attrs = fcurrent.get("attributes") or {}
|
||||
for ak, av in v.items():
|
||||
if cur_attrs.get(ak) != av:
|
||||
fdrift = True
|
||||
break
|
||||
continue
|
||||
if not eq(v, fcurrent.get(k)):
|
||||
fdrift = True
|
||||
break
|
||||
if fdrift:
|
||||
fmerged = dict(fcurrent)
|
||||
fmerged.update(fluxer_body)
|
||||
st, _ = req("PUT", f"{R}/clients/{ffluxer['id']}", fmerged)
|
||||
assert st == 204, f"update fluxer client failed: {st}"
|
||||
changed = True
|
||||
|
||||
print("CHANGED" if changed else "UNCHANGED")
|
||||
|
||||
+2
-1
@@ -3,5 +3,6 @@
|
||||
"research_role": {{ keycloak_realm_research_role | to_json }},
|
||||
"research_user": {{ keycloak_realm_research_user | to_json }},
|
||||
"research_client": {{ keycloak_realm_research_client | to_json }},
|
||||
"research_mapper": {{ keycloak_realm_research_mapper | to_json }}
|
||||
"research_mapper": {{ keycloak_realm_research_mapper | to_json }},
|
||||
"fluxer_client": {{ keycloak_realm_fluxer_client | to_json }}
|
||||
}
|
||||
|
||||
@@ -55,6 +55,21 @@ The adoption path mirrors CT 100 and keeps the production proxy intact:
|
||||
The production verifier is read-only. A real `site.yml` run enforces the
|
||||
declared state and therefore requires an explicit change authorization.
|
||||
|
||||
## Disk housekeeping (incident 2026-11-26)
|
||||
|
||||
On 2026-11-26 the CT 103 root filesystem filled up: the NPM access logs below
|
||||
`/opt/nginx-proxy-manager/data/logs` had no logrotate policy, and nginx keeps
|
||||
deleted inodes open inside the container. NPM then served truncated 0-byte
|
||||
assets, which surfaced as "Frontend is not initialized" on Gitea (CT 110) and
|
||||
unstyled Keycloak pages behind the proxy. The `reverse_proxy_disk_housekeeping`
|
||||
role (part of `site.yml`) declares the countermeasures: a journald size cap, a
|
||||
`copytruncate` logrotate policy for the NPM logs, and a self-healing guard that
|
||||
vaciums the journal, purges the NPM proxy cache and restarts NPM whenever the
|
||||
root headroom drops below `reverse_proxy_minimum_root_available_bytes`
|
||||
(1 GiB, also asserted by `audit-production.yml` and `verify-production.yml`).
|
||||
The guard makes every `site.yml` run heal a full root disk reproducibly; once
|
||||
the headroom is restored, a second run reports `changed=0`.
|
||||
|
||||
## Declared scope and deliberate non-goals
|
||||
|
||||
- NPM runtime data (SQLite database, keys, Let's Encrypt certificates,
|
||||
|
||||
+1
-1
@@ -26,7 +26,7 @@ reverse_proxy_access_source_networks: 10.0.0.0/24
|
||||
# verify-production.yml can render the templates via lookup and compare them
|
||||
# with the live files (self-contained inventory):
|
||||
reverse_proxy_npm_image: docker.io/jc21/nginx-proxy-manager
|
||||
reverse_proxy_npm_image_tag: "2.15.1"
|
||||
reverse_proxy_npm_image_tag: "2.17.1"
|
||||
reverse_proxy_npm_container_name: nginx-proxy-manager
|
||||
reverse_proxy_npm_service_name: nginx-proxy-manager.service
|
||||
reverse_proxy_npm_quadlet_path: /etc/containers/systemd/nginx-proxy-manager.container
|
||||
|
||||
+1
-1
@@ -26,7 +26,7 @@ reverse_proxy_access_source_networks: 10.0.0.0/24
|
||||
# verify-production.yml can render the templates via lookup and compare them
|
||||
# with the live files (self-contained inventory):
|
||||
reverse_proxy_npm_image: docker.io/jc21/nginx-proxy-manager
|
||||
reverse_proxy_npm_image_tag: "2.15.1"
|
||||
reverse_proxy_npm_image_tag: "2.17.1"
|
||||
reverse_proxy_npm_container_name: nginx-proxy-manager
|
||||
reverse_proxy_npm_service_name: nginx-proxy-manager.service
|
||||
reverse_proxy_npm_quadlet_path: /etc/containers/systemd/nginx-proxy-manager.container
|
||||
|
||||
+1
-1
@@ -26,7 +26,7 @@ reverse_proxy_access_source_networks: 10.0.0.0/24
|
||||
# verify-production.yml can render the templates via lookup and compare them
|
||||
# with the live files (self-contained inventory):
|
||||
reverse_proxy_npm_image: docker.io/jc21/nginx-proxy-manager
|
||||
reverse_proxy_npm_image_tag: "2.15.1"
|
||||
reverse_proxy_npm_image_tag: "2.17.1"
|
||||
reverse_proxy_npm_container_name: nginx-proxy-manager
|
||||
reverse_proxy_npm_service_name: nginx-proxy-manager.service
|
||||
reverse_proxy_npm_quadlet_path: /etc/containers/systemd/nginx-proxy-manager.container
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
---
|
||||
- name: Apply the CT 103 disk housekeeping countermeasures
|
||||
hosts: reverse_proxy_hosts
|
||||
become: true
|
||||
gather_facts: true
|
||||
gather_subset:
|
||||
- min
|
||||
- hardware
|
||||
- network
|
||||
- virtual
|
||||
|
||||
roles:
|
||||
- role: reverse_proxy_disk_housekeeping
|
||||
@@ -25,4 +25,6 @@
|
||||
- role: reverse_proxy_npm
|
||||
- role: reverse_proxy_oauth2proxy
|
||||
- role: reverse_proxy_research_vhost
|
||||
- role: reverse_proxy_fluxer_vhost
|
||||
- role: reverse_proxy_fail2ban
|
||||
- role: reverse_proxy_disk_housekeeping
|
||||
|
||||
@@ -65,6 +65,33 @@
|
||||
reverse_proxy_production_services.results |
|
||||
map(attribute='stdout') | unique | list == ['active']
|
||||
|
||||
- name: Require free root filesystem headroom
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- >-
|
||||
ansible_facts['mounts'] |
|
||||
selectattr('mount', 'equalto', '/')
|
||||
| map(attribute='block_available')
|
||||
| map('int') | first * 4096 >= reverse_proxy_minimum_root_available_bytes | int
|
||||
fail_msg: The root filesystem is low on available bytes.
|
||||
|
||||
- name: Verify the disk housekeeping drop-ins exist
|
||||
ansible.builtin.stat:
|
||||
path: "{{ item }}"
|
||||
loop:
|
||||
- /etc/systemd/journald.conf.d/99-ghostnet-limits.conf
|
||||
- /etc/logrotate.d/nginx-proxy-manager
|
||||
register: reverse_proxy_production_housekeeping_files
|
||||
|
||||
- name: Require the disk housekeeping drop-ins to be present
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- reverse_proxy_production_housekeeping_files.results |
|
||||
map(attribute='stat.exists') | unique | list == [true]
|
||||
fail_msg: >-
|
||||
The declared disk housekeeping drop-ins (journald cap, NPM logrotate
|
||||
policy) are missing.
|
||||
|
||||
- name: Require SSH socket activation to be gone
|
||||
ansible.builtin.systemd_service:
|
||||
name: ssh.socket
|
||||
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
# reverse_proxy_disk_housekeeping
|
||||
|
||||
Durable countermeasures for the 2026-11-26 CT 103 incident: the root
|
||||
filesystem filled up because the NPM access logs below
|
||||
`/opt/nginx-proxy-manager/data/logs` were not rotated (and nginx keeps
|
||||
deleted inodes open inside the container), so NPM served truncated 0-byte
|
||||
assets — visible as "Frontend is not initialized" on Gitea (CT 110) and
|
||||
unstyled Keycloak pages behind the proxy.
|
||||
|
||||
The role declares:
|
||||
|
||||
- a journald drop-in capping the persistent journal (`SystemMaxUse`,
|
||||
`MaxRetentionSec`),
|
||||
- a logrotate policy for the NPM log directory using `copytruncate` (mandatory
|
||||
because of the open file descriptors in the container),
|
||||
- a self-healing guard: whenever the available root bytes drop below
|
||||
`reverse_proxy_minimum_root_available_bytes` (inventory-wide, also asserted
|
||||
by `audit-production.yml`), the role vaciums the journal, purges the NPM
|
||||
proxy cache (`/opt/nginx-proxy-manager/data/nginx/cache`) and restarts the
|
||||
NPM service, then asserts the headroom again.
|
||||
|
||||
The guard is part of `site.yml`, so every convergence run heals a full root
|
||||
filesystem the same reproducible way; a second run reports `changed=0` once
|
||||
the headroom is restored.
|
||||
+26
@@ -0,0 +1,26 @@
|
||||
---
|
||||
# Incident 2026-11-26: the CT 103 root filesystem filled up (NPM access logs
|
||||
# under /opt/nginx-proxy-manager/data/logs are not covered by logrotate and
|
||||
# grow unbounded; nginx keeps deleted inodes open inside the container).
|
||||
# NPM then served truncated 0-byte assets behind the proxy, which surfaced as
|
||||
# "Frontend is not initialized" on Gitea (CT 110) and unstyled Keycloak pages.
|
||||
# This role declares the durable countermeasures and a self-healing guard that
|
||||
# purges the NPM proxy cache and restarts NPM whenever the declared root
|
||||
# headroom is violated.
|
||||
|
||||
reverse_proxy_housekeeping_journald_dropin: /etc/systemd/journald.conf.d/99-ghostnet-limits.conf
|
||||
reverse_proxy_housekeeping_journald_system_max_use: 200M
|
||||
reverse_proxy_housekeeping_journald_max_retention_sec: 7d
|
||||
|
||||
reverse_proxy_housekeeping_logrotate_dropin: /etc/logrotate.d/nginx-proxy-manager
|
||||
reverse_proxy_housekeeping_npm_logs_directory: >-
|
||||
{{ reverse_proxy_npm_data_directory | default('/opt/nginx-proxy-manager/data') }}/logs
|
||||
reverse_proxy_housekeeping_logrotate_rotate: 4
|
||||
|
||||
reverse_proxy_housekeeping_npm_cache_directory: >-
|
||||
{{ reverse_proxy_npm_data_directory | default('/opt/nginx-proxy-manager/data') }}/nginx/cache
|
||||
|
||||
# Reuse the inventory-wide threshold so audit-production.yml and this role
|
||||
# enforce the same headroom.
|
||||
reverse_proxy_housekeeping_root_min_available_bytes: >-
|
||||
{{ reverse_proxy_minimum_root_available_bytes | default(1000000000) }}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
---
|
||||
- name: Restart systemd-journald
|
||||
ansible.builtin.systemd_service:
|
||||
name: systemd-journald
|
||||
state: restarted
|
||||
+200
@@ -0,0 +1,200 @@
|
||||
---
|
||||
# Phase 1: free space first. With a completely full root filesystem not even
|
||||
# a new directory can be created, so the emergency cleanup must run before
|
||||
# any configuration file is written. Truncating in place (copytruncate
|
||||
# semantics) frees blocks without allocating new ones.
|
||||
|
||||
- name: Read the available bytes on the root filesystem
|
||||
ansible.builtin.command:
|
||||
argv:
|
||||
- /usr/bin/df
|
||||
- --block-size=1
|
||||
- --output=avail
|
||||
- /
|
||||
check_mode: false
|
||||
changed_when: false
|
||||
register: reverse_proxy_housekeeping_df_before
|
||||
|
||||
- name: Compute the available root filesystem bytes
|
||||
ansible.builtin.set_fact:
|
||||
reverse_proxy_housekeeping_root_available_bytes: >-
|
||||
{{ reverse_proxy_housekeeping_df_before.stdout_lines[1] | int }}
|
||||
|
||||
- name: Vacuum the persistent journal when root headroom is low
|
||||
ansible.builtin.command:
|
||||
argv:
|
||||
- /usr/bin/journalctl
|
||||
- --vacuum-size={{ reverse_proxy_housekeeping_journald_system_max_use }}
|
||||
changed_when: false
|
||||
when: >-
|
||||
reverse_proxy_housekeeping_root_available_bytes | int <
|
||||
reverse_proxy_housekeeping_root_min_available_bytes | int
|
||||
|
||||
- name: Enumerate NPM log files when root headroom is low
|
||||
ansible.builtin.find:
|
||||
paths: "{{ reverse_proxy_housekeeping_npm_logs_directory }}"
|
||||
file_type: file
|
||||
patterns: "*.log"
|
||||
register: reverse_proxy_housekeeping_big_logs
|
||||
when: >-
|
||||
reverse_proxy_housekeeping_root_available_bytes | int <
|
||||
reverse_proxy_housekeeping_root_min_available_bytes | int
|
||||
|
||||
- name: Truncate NPM log files in place when root headroom is low
|
||||
ansible.builtin.command:
|
||||
argv:
|
||||
- /usr/bin/truncate
|
||||
- -s
|
||||
- "0"
|
||||
- "{{ item.path }}"
|
||||
loop: "{{ reverse_proxy_housekeeping_big_logs.files | default([]) }}"
|
||||
loop_control:
|
||||
label: "{{ item.path }}"
|
||||
when: >-
|
||||
reverse_proxy_housekeeping_root_available_bytes | int <
|
||||
reverse_proxy_housekeeping_root_min_available_bytes | int
|
||||
|
||||
- name: Enumerate the NPM proxy cache when root headroom is low
|
||||
ansible.builtin.find:
|
||||
paths: "{{ reverse_proxy_housekeeping_npm_cache_directory }}"
|
||||
recurse: true
|
||||
register: reverse_proxy_housekeeping_cache_files
|
||||
when: >-
|
||||
reverse_proxy_housekeeping_root_available_bytes | int <
|
||||
reverse_proxy_housekeeping_root_min_available_bytes | int
|
||||
|
||||
- name: Purge the NPM proxy cache when root headroom is low
|
||||
ansible.builtin.file:
|
||||
path: "{{ item.path }}"
|
||||
state: absent
|
||||
loop: "{{ reverse_proxy_housekeeping_cache_files.files | default([]) }}"
|
||||
loop_control:
|
||||
label: "{{ item.path }}"
|
||||
when: >-
|
||||
reverse_proxy_housekeeping_root_available_bytes | int <
|
||||
reverse_proxy_housekeeping_root_min_available_bytes | int
|
||||
|
||||
- name: Restart NPM when root headroom is low
|
||||
ansible.builtin.systemd_service:
|
||||
name: "{{ reverse_proxy_npm_service_name }}"
|
||||
state: restarted
|
||||
when: >-
|
||||
reverse_proxy_housekeeping_root_available_bytes | int <
|
||||
reverse_proxy_housekeeping_root_min_available_bytes | int
|
||||
|
||||
# Phase 2: durable declared state (writable again once phase 1 freed space).
|
||||
|
||||
- name: Create the journald drop-in directory
|
||||
ansible.builtin.file:
|
||||
path: "{{ reverse_proxy_housekeeping_journald_dropin | dirname }}"
|
||||
state: directory
|
||||
owner: root
|
||||
group: root
|
||||
mode: "0755"
|
||||
|
||||
- name: Install the journald size cap for the CT 103 root filesystem
|
||||
ansible.builtin.copy:
|
||||
content: |
|
||||
# Managed by Ansible (reverse_proxy_disk_housekeeping).
|
||||
# The persistent journal must not be able to fill the 7.8G root disk.
|
||||
[Journal]
|
||||
SystemMaxUse={{ reverse_proxy_housekeeping_journald_system_max_use }}
|
||||
MaxRetentionSec={{ reverse_proxy_housekeeping_journald_max_retention_sec }}
|
||||
dest: "{{ reverse_proxy_housekeeping_journald_dropin }}"
|
||||
owner: root
|
||||
group: root
|
||||
mode: "0644"
|
||||
notify: Restart systemd-journald
|
||||
|
||||
- name: Install the logrotate policy for the NPM log directory
|
||||
ansible.builtin.copy:
|
||||
content: |
|
||||
# Managed by Ansible (reverse_proxy_disk_housekeeping).
|
||||
# NPM writes its access/error logs through the container bind mount, so
|
||||
# copytruncate is mandatory: nginx keeps the file descriptors open and a
|
||||
# rename-based rotation would leave the container writing to deleted
|
||||
# inodes, which never frees disk space.
|
||||
{{ reverse_proxy_housekeeping_npm_logs_directory }}/*.log {
|
||||
weekly
|
||||
rotate {{ reverse_proxy_housekeeping_logrotate_rotate }}
|
||||
compress
|
||||
delaycompress
|
||||
missingok
|
||||
notifempty
|
||||
copytruncate
|
||||
}
|
||||
dest: "{{ reverse_proxy_housekeeping_logrotate_dropin }}"
|
||||
owner: root
|
||||
group: root
|
||||
mode: "0644"
|
||||
|
||||
- name: Validate the logrotate policy without applying it
|
||||
ansible.builtin.command:
|
||||
argv:
|
||||
- /usr/sbin/logrotate
|
||||
- --debug
|
||||
- "{{ reverse_proxy_housekeeping_logrotate_dropin }}"
|
||||
check_mode: false
|
||||
changed_when: false
|
||||
when: not ansible_check_mode
|
||||
|
||||
- name: Enable and start the logrotate timer
|
||||
ansible.builtin.systemd_service:
|
||||
name: logrotate.timer
|
||||
enabled: true
|
||||
state: started
|
||||
|
||||
- name: Read the failure state of the oneshot units hit by the full disk
|
||||
ansible.builtin.command:
|
||||
argv:
|
||||
- /usr/bin/systemctl
|
||||
- is-failed
|
||||
- "{{ item }}"
|
||||
check_mode: false
|
||||
changed_when: false
|
||||
failed_when: false
|
||||
loop:
|
||||
- logrotate.service
|
||||
- man-db.service
|
||||
register: reverse_proxy_housekeeping_failed_units
|
||||
|
||||
- name: Re-run the failed oneshot units so their failed state clears
|
||||
ansible.builtin.systemd_service:
|
||||
name: "{{ item.item }}"
|
||||
state: started
|
||||
loop: "{{ reverse_proxy_housekeeping_failed_units.results }}"
|
||||
loop_control:
|
||||
label: "{{ item.item }}"
|
||||
when: item.stdout == "failed"
|
||||
|
||||
- name: Run logrotate once so the new NPM policy applies immediately
|
||||
ansible.builtin.command:
|
||||
argv:
|
||||
- /usr/sbin/logrotate
|
||||
- /etc/logrotate.conf
|
||||
changed_when: false
|
||||
|
||||
# Phase 3: verify the headroom after the guard ran.
|
||||
|
||||
- name: Re-read the available bytes on the root filesystem
|
||||
ansible.builtin.command:
|
||||
argv:
|
||||
- /usr/bin/df
|
||||
- --block-size=1
|
||||
- --output=avail
|
||||
- /
|
||||
check_mode: false
|
||||
changed_when: false
|
||||
register: reverse_proxy_housekeeping_df_after
|
||||
when: not ansible_check_mode
|
||||
|
||||
- name: Require the declared root filesystem headroom
|
||||
ansible.builtin.assert:
|
||||
that: >-
|
||||
(reverse_proxy_housekeeping_df_after.stdout_lines[1] | int) >=
|
||||
(reverse_proxy_housekeeping_root_min_available_bytes | int)
|
||||
fail_msg: >-
|
||||
The root filesystem is still below the declared headroom of
|
||||
{{ reverse_proxy_housekeeping_root_min_available_bytes }} bytes after
|
||||
the housekeeping guard ran.
|
||||
when: not ansible_check_mode
|
||||
@@ -0,0 +1,12 @@
|
||||
# reverse_proxy_fluxer_vhost
|
||||
|
||||
NPM proxy host + Let's-Encrypt certificate for the Fluxer instance
|
||||
`fluxer.ghostnet.selfhost.eu` → `10.0.0.62:8080` (CT 117 app-proxy), with a
|
||||
`/livekit/` location to `10.0.0.62:7880` and WebSocket/long-timeout settings
|
||||
for the gateway and LiveKit signaling. Same NPM-API sync pattern as
|
||||
`reverse_proxy_research_vhost` (GNAI-023 M8-T3), including the Fail2Ban
|
||||
restart so the new `proxy-host-*.log` joins the jail glob (GNAI-006 SOP).
|
||||
|
||||
No oauth2-proxy IAP in front: Fluxer enforces login itself (Keycloak OIDC,
|
||||
GNAI-025 Abschnitt 4). The GNAI-023 IAP can be layered later if the instance
|
||||
should become invite-gated at the proxy layer as well.
|
||||
+57
@@ -0,0 +1,57 @@
|
||||
---
|
||||
# NPM proxy host for the Fluxer instance on CT 117 (GNAI-025). Managed
|
||||
# idempotently via the NPM API (127.0.0.1:81), same pattern as
|
||||
# reverse_proxy_research_vhost (GNAI-023 M8-T3).
|
||||
#
|
||||
# NPM admin credentials are read from this root-only file on CT 103
|
||||
# (created once by the operator, never in git):
|
||||
# /etc/nginx-proxy-manager/api.env mode 0600, content:
|
||||
# NPM_API_EMAIL=admin@example.com
|
||||
# NPM_API_PASSWORD=...
|
||||
reverse_proxy_fluxer_npm_api: http://127.0.0.1:81/api
|
||||
reverse_proxy_fluxer_api_env_file: /etc/nginx-proxy-manager/api.env
|
||||
|
||||
reverse_proxy_fluxer_domain: fluxer.ghostnet.selfhost.eu
|
||||
reverse_proxy_fluxer_upstream_host: 10.0.0.62
|
||||
reverse_proxy_fluxer_upstream_port: 8080
|
||||
reverse_proxy_fluxer_upstream_scheme: http
|
||||
reverse_proxy_fluxer_livekit_upstream_port: 7880
|
||||
reverse_proxy_fluxer_letsencrypt_email: ma-koenig@gmx.net
|
||||
|
||||
# No oauth2-proxy IAP in front of Fluxer: the instance is public like any chat
|
||||
# service, and access control happens inside Fluxer (Keycloak SSO via the
|
||||
# `fluxer` client + invite-only registration, GNAI-025 Abschnitt 4). The
|
||||
# IAP pattern of GNAI-023 can be layered later by adding auth_request blocks.
|
||||
#
|
||||
# Host-level advanced config ONLY (NPM 2.15.1 quirk: host-level
|
||||
# advanced_config AND custom locations together silently break conf
|
||||
# generation). WebSocket upgrade headers for the gateway and LiveKit
|
||||
# signaling; long timeouts for long-lived WS connections.
|
||||
reverse_proxy_fluxer_advanced_config: |
|
||||
location /livekit/ {
|
||||
proxy_pass http://{{ reverse_proxy_fluxer_upstream_host }}:{{ reverse_proxy_fluxer_livekit_upstream_port }};
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection $http_connection;
|
||||
proxy_read_timeout 86400s;
|
||||
proxy_send_timeout 86400s;
|
||||
}
|
||||
location / {
|
||||
proxy_pass http://{{ reverse_proxy_fluxer_upstream_host }}:{{ reverse_proxy_fluxer_upstream_port }};
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection $http_connection;
|
||||
proxy_read_timeout 86400s;
|
||||
proxy_send_timeout 86400s;
|
||||
proxy_buffer_size 64k;
|
||||
proxy_buffers 16 64k;
|
||||
proxy_busy_buffers_size 128k;
|
||||
}
|
||||
+117
@@ -0,0 +1,117 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Idempotent NPM proxy-host + LE certificate for fluxer.ghostnet.selfhost.eu
|
||||
(Fluxer on CT 117, GNAI-025). Usage:
|
||||
|
||||
npm_fluxer_vhost.py <npm_api_base> <api_env_file> <spec.json>
|
||||
|
||||
Prints CHANGED/UNCHANGED. stdlib only.
|
||||
"""
|
||||
import json
|
||||
import sys
|
||||
import urllib.error
|
||||
import urllib.parse
|
||||
import urllib.request
|
||||
|
||||
api, env_file, spec_file = sys.argv[1:4]
|
||||
spec = json.load(open(spec_file))
|
||||
|
||||
env = {}
|
||||
for line in open(env_file):
|
||||
line = line.strip()
|
||||
if line and not line.startswith("#") and "=" in line:
|
||||
k, v = line.split("=", 1)
|
||||
env[k.strip()] = v.strip()
|
||||
email = env["NPM_API_EMAIL"]
|
||||
password = env["NPM_API_PASSWORD"]
|
||||
|
||||
changed = False
|
||||
|
||||
|
||||
def req(method, path, body=None, token=None):
|
||||
url = f"{api}{path}"
|
||||
data = None
|
||||
headers = {}
|
||||
if token:
|
||||
headers["Authorization"] = f"Bearer {token}"
|
||||
if body is not None:
|
||||
data = json.dumps(body).encode()
|
||||
headers["Content-Type"] = "application/json"
|
||||
r = urllib.request.Request(url, data=data, headers=headers, method=method)
|
||||
try:
|
||||
with urllib.request.urlopen(r, timeout=30) as resp:
|
||||
raw = resp.read()
|
||||
return resp.status, json.loads(raw) if raw else None
|
||||
except urllib.error.HTTPError as e:
|
||||
raw = e.read()
|
||||
try:
|
||||
return e.code, json.loads(raw) if raw else None
|
||||
except json.JSONDecodeError:
|
||||
return e.code, raw[:300]
|
||||
|
||||
|
||||
st, tok = req("POST", "/tokens", {"identity": email, "secret": password})
|
||||
assert st == 200 and tok and tok.get("token"), f"npm token failed: {st} {tok}"
|
||||
token = tok["token"]
|
||||
|
||||
domain = spec["domain"]
|
||||
|
||||
# --- 1) letsencrypt certificate ---
|
||||
st, certs = req("GET", "/nginx/certificates", token=token)
|
||||
assert st == 200, f"cert list failed: {st}"
|
||||
cert = next((c for c in certs if domain in (c.get("domain_names") or [])), None)
|
||||
if not cert:
|
||||
# NPM 2.15.1 rejects letsencrypt_email/agree in meta ("additional
|
||||
# properties" 400) — empty meta works, LE account email is used.
|
||||
st, cert = req("POST", "/nginx/certificates", {
|
||||
"provider": "letsencrypt",
|
||||
"domain_names": [domain],
|
||||
"meta": {},
|
||||
}, token=token)
|
||||
assert st == 201, f"cert create failed: {st} {cert}"
|
||||
changed = True
|
||||
cert_id = cert["id"]
|
||||
else:
|
||||
cert_id = cert["id"]
|
||||
|
||||
# --- 2) proxy host ---
|
||||
st, hosts = req("GET", "/nginx/proxy-hosts", token=token)
|
||||
assert st == 200, f"proxy-host list failed: {st}"
|
||||
host = next((h for h in hosts if domain in (h.get("domain_names") or [])), None)
|
||||
|
||||
host_body = {
|
||||
"domain_names": [domain],
|
||||
"forward_scheme": spec["upstream_scheme"],
|
||||
"forward_host": spec["upstream_host"],
|
||||
"forward_port": spec["upstream_port"],
|
||||
"access_list_id": 0,
|
||||
"certificate_id": cert_id,
|
||||
"ssl_forced": True,
|
||||
"hsts_enabled": True,
|
||||
"http2_support": True,
|
||||
"block_exploits": True,
|
||||
"allow_websocket_upgrade": True,
|
||||
"advanced_config": spec["advanced_config"],
|
||||
"locations": [],
|
||||
}
|
||||
|
||||
if not host:
|
||||
st, host = req("POST", "/nginx/proxy-hosts", host_body, token=token)
|
||||
assert st == 201, f"proxy-host create failed: {st} {host}"
|
||||
changed = True
|
||||
else:
|
||||
# NPM 2.15.1 quirk: PUT does NOT regenerate the nginx conf (it even
|
||||
# deletes it) — only POST/create writes proxy_host/<id>.conf. So on drift
|
||||
# we delete and re-create the host (cert id stays).
|
||||
drift = any(host.get(k) != v for k, v in host_body.items())
|
||||
if drift:
|
||||
for k, v in host_body.items():
|
||||
if host.get(k) != v:
|
||||
print(f"DRIFT {k}: current={str(host.get(k))[:120]!r} wanted={str(v)[:120]!r}", file=sys.stderr)
|
||||
if drift:
|
||||
st, _ = req("DELETE", f"/nginx/proxy-hosts/{host['id']}", token=token)
|
||||
assert st == 200, f"proxy-host delete failed: {st}"
|
||||
st, host = req("POST", "/nginx/proxy-hosts", host_body, token=token)
|
||||
assert st == 201, f"proxy-host recreate failed: {st} {host}"
|
||||
changed = True
|
||||
|
||||
print("CHANGED" if changed else "UNCHANGED")
|
||||
+68
@@ -0,0 +1,68 @@
|
||||
---
|
||||
- name: Check the NPM API credentials file (mode 0600)
|
||||
ansible.builtin.stat:
|
||||
path: "{{ reverse_proxy_fluxer_api_env_file }}"
|
||||
register: fluxer_npm_api_env
|
||||
|
||||
- name: Fail with instructions when NPM API credentials are missing
|
||||
ansible.builtin.fail:
|
||||
msg: >-
|
||||
{{ reverse_proxy_fluxer_api_env_file }} missing or mode != 0600.
|
||||
Create it once on CT 103 (root) with NPM_API_EMAIL / NPM_API_PASSWORD
|
||||
of the NPM admin user; never in git.
|
||||
when: >-
|
||||
not fluxer_npm_api_env.stat.exists
|
||||
or fluxer_npm_api_env.stat.mode != '0600'
|
||||
|
||||
- name: Stage the NPM vhost sync script
|
||||
ansible.builtin.copy:
|
||||
src: files/npm_fluxer_vhost.py
|
||||
dest: /tmp/npm_fluxer_vhost.py
|
||||
mode: "0600"
|
||||
changed_when: false
|
||||
when: not ansible_check_mode
|
||||
|
||||
- name: Render the vhost spec
|
||||
ansible.builtin.template:
|
||||
src: spec.json.j2
|
||||
dest: /tmp/fluxer_vhost_spec.json
|
||||
mode: "0600"
|
||||
changed_when: false
|
||||
when: not ansible_check_mode
|
||||
|
||||
- name: Sync the Fluxer proxy host + LE cert idempotently via the NPM API
|
||||
ansible.builtin.command:
|
||||
argv:
|
||||
- python3
|
||||
- /tmp/npm_fluxer_vhost.py
|
||||
- "{{ reverse_proxy_fluxer_npm_api }}"
|
||||
- "{{ reverse_proxy_fluxer_api_env_file }}"
|
||||
- /tmp/fluxer_vhost_spec.json
|
||||
register: fluxer_vhost_sync
|
||||
changed_when: fluxer_vhost_sync.stdout_lines | first == 'CHANGED'
|
||||
when: not ansible_check_mode
|
||||
no_log: true
|
||||
|
||||
- name: Verify the sync reports UNCHANGED on a second run (idempotence)
|
||||
ansible.builtin.command:
|
||||
argv:
|
||||
- python3
|
||||
- /tmp/npm_fluxer_vhost.py
|
||||
- "{{ reverse_proxy_fluxer_npm_api }}"
|
||||
- "{{ reverse_proxy_fluxer_api_env_file }}"
|
||||
- /tmp/fluxer_vhost_spec.json
|
||||
register: fluxer_vhost_verify
|
||||
changed_when: false
|
||||
failed_when: >-
|
||||
fluxer_vhost_verify.rc != 0
|
||||
or (fluxer_vhost_verify.stdout_lines | first) != 'UNCHANGED'
|
||||
when: not ansible_check_mode
|
||||
no_log: true
|
||||
|
||||
- name: Restart Fail2Ban so the new proxy-host log file joins the jail glob
|
||||
ansible.builtin.systemd_service:
|
||||
name: fail2ban.service
|
||||
state: restarted
|
||||
when:
|
||||
- fluxer_vhost_sync is changed
|
||||
- not ansible_check_mode
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"domain": {{ reverse_proxy_fluxer_domain | to_json }},
|
||||
"upstream_scheme": {{ reverse_proxy_fluxer_upstream_scheme | to_json }},
|
||||
"upstream_host": {{ reverse_proxy_fluxer_upstream_host | to_json }},
|
||||
"upstream_port": {{ reverse_proxy_fluxer_upstream_port | int }},
|
||||
"letsencrypt_email": {{ reverse_proxy_fluxer_letsencrypt_email | to_json }},
|
||||
"advanced_config": {{ reverse_proxy_fluxer_advanced_config | to_json }}
|
||||
}
|
||||
@@ -3,7 +3,7 @@
|
||||
Manages the rootful Nginx Proxy Manager Quadlet
|
||||
`/etc/containers/systemd/nginx-proxy-manager.container` exactly as accepted in
|
||||
GNAI-006 section 4.1: tag-pinned image
|
||||
`docker.io/jc21/nginx-proxy-manager:2.15.1`, host networking, persistent
|
||||
`docker.io/jc21/nginx-proxy-manager:2.17.1`, host networking, persistent
|
||||
`/opt/nginx-proxy-manager/data` and `/opt/nginx-proxy-manager/letsencrypt`,
|
||||
IPv6 disabled and timezone Europe/Berlin.
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
---
|
||||
reverse_proxy_npm_image: docker.io/jc21/nginx-proxy-manager
|
||||
reverse_proxy_npm_image_tag: "2.15.1"
|
||||
reverse_proxy_npm_image_tag: "2.17.1"
|
||||
reverse_proxy_npm_container_name: nginx-proxy-manager
|
||||
reverse_proxy_npm_service_name: nginx-proxy-manager.service
|
||||
reverse_proxy_npm_quadlet_path: /etc/containers/systemd/nginx-proxy-manager.container
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
# CT 114 – Litecoin wallet node
|
||||
|
||||
Host root for the Litecoin full-node LXC at `10.0.0.61` (`ltc-node`), planned
|
||||
as a Tor-only cold wallet (GNAI-024). The container does not exist yet; it is
|
||||
created on the PVE host by the operator with the reviewed helpers in
|
||||
[`scripts/`](scripts/README.md) and then converged by the self-contained
|
||||
Ansible project in [`ansible/`](ansible/README.md).
|
||||
|
||||
| Area | Content |
|
||||
| --- | --- |
|
||||
| [`ansible/`](ansible/README.md) | inventories (`agent`/`bootstrap`/`production`), playbooks and CT-specific roles |
|
||||
| [`scripts/`](scripts/README.md) | reviewed PVE provisioning launcher and access bootstrap hook |
|
||||
| [`../../../docs/platform/proxmox-server/lxc/ct-114-litecoin-wallet/GNAI-024-PLAN_Litecoin-Wallet-LXC.md`](../../../docs/platform/proxmox-server/lxc/ct-114-litecoin-wallet/GNAI-024-PLAN_Litecoin-Wallet-LXC.md) | design, review of the research documents, decisions, phases and acceptance tests |
|
||||
| [`../../../docs/platform/proxmox-server/lxc/ct-114-litecoin-wallet/litecoin-lxc-setup.txt`](../../../docs/platform/proxmox-server/lxc/ct-114-litecoin-wallet/litecoin-lxc-setup.txt) | original research brief (Auftrag) |
|
||||
| [`../../../docs/platform/proxmox-server/lxc/ct-114-litecoin-wallet/litecoin-lxc-tests.txt`](../../../docs/platform/proxmox-server/lxc/ct-114-litecoin-wallet/litecoin-lxc-tests.txt) | original research test plan (Auftrag) |
|
||||
|
||||
Secrets never enter this repository: no wallet passphrase, no seed, no
|
||||
restic password, no private SSH keys. The wallet passphrase and restic
|
||||
secret are handled interactively / via the operator's secret store
|
||||
(Vaultwarden), and only public keys live in `ansible/files/ssh/`.
|
||||
@@ -0,0 +1,65 @@
|
||||
# CT 114 Litecoin wallet Ansible project
|
||||
|
||||
This self-contained host project manages the CT 114 Litecoin full-node LXC
|
||||
(`ltc-node`, `10.0.0.61`). It follows the CT 102 Keycloak fresh-rebuild schema
|
||||
and the CT 100/103 three-inventory convention (`agent`, `bootstrap`,
|
||||
`production`) and uses the repository-wide pinned control dependency
|
||||
(`shared/ansible/requirements-control.txt`); all CT 114 inventories,
|
||||
playbooks, keys and roles remain inside the CT 114 root.
|
||||
|
||||
Create the repository-level control environment once:
|
||||
|
||||
```bash
|
||||
python3 -m venv .venv
|
||||
.venv/bin/python -m pip install --upgrade pip
|
||||
.venv/bin/python -m pip install -r shared/ansible/requirements-control.txt
|
||||
```
|
||||
|
||||
Run commands from this directory and always select an inventory explicitly:
|
||||
|
||||
```bash
|
||||
cd proxmox/lxc/ct-114-litecoin-wallet/ansible
|
||||
../../../../.venv/bin/ansible-playbook \
|
||||
--inventory inventories/production/hosts.yml \
|
||||
playbooks/verify-production.yml \
|
||||
--private-key ~/.ssh/id_ed25519_ghostnet_ct114_ansible_deploy
|
||||
```
|
||||
|
||||
## Commissioning sequence for the new CT 114
|
||||
|
||||
CT 114 does not exist yet; the LXC is created on the PVE host by the operator
|
||||
with the reviewed helpers in [`../scripts/`](../scripts/) (Community Scripts
|
||||
launcher + bootstrap hook), following the CT 102 procedure (GNAI-016 Phase D,
|
||||
GNAI-024 Abschnitt 6):
|
||||
|
||||
0. Operator, on the workstation: generate the three CT 114 key pairs
|
||||
(`ghost` interactively with passphrase; `ghost-agent`/`ansible-deploy`
|
||||
passphrase-less), copy the `.pub` files into `files/ssh/`, fill the
|
||||
`ADMIN_PUBLIC_KEY` placeholder in the bootstrap hook, then create the
|
||||
restic backup key and the restic password on the target during bootstrap
|
||||
(secrets never enter this repository).
|
||||
1. Operator, as root@pve: install the reviewed hooks and run
|
||||
`../scripts/provision-ct114-litecoin.sh`.
|
||||
2. Operator: pin the SSH host-key fingerprint from the Proxmox console into
|
||||
all three `host_vars/litecoin-ct114.yml` files, and add
|
||||
`10.0.0.61` to the WireGuard server-admin target list on CT 105 if VPN
|
||||
management access is wanted.
|
||||
3. `preflight.yml` on the `agent` inventory (read-only, unprivileged,
|
||||
`--private-key ~/.ssh/id_ed25519_ghostnet_ct114_agent`) proves identity,
|
||||
resource gates and the empty state.
|
||||
4. `verify-deploy-access.yml` on the `production` inventory proves the
|
||||
`ansible-deploy` boundary.
|
||||
5. `site.yml --check --diff` on the `production` inventory previews the
|
||||
convergence. A real `site.yml` run enforces the declared state and
|
||||
therefore requires explicit operator authorization.
|
||||
6. `verify-production.yml` plus a second `site.yml` run with `changed=0`
|
||||
complete the commissioning; `audit-production.yml` is the read-only deep
|
||||
audit.
|
||||
|
||||
The node is started by `site.yml` only on inventories with
|
||||
`litecoin_service_start_allowed: true` (production). Wallet creation and
|
||||
`encryptwallet` are interactive operator/agent steps over SSH exec — never
|
||||
part of a playbook (GNAI-024 Abschnitt 8).
|
||||
|
||||
Do not store the wallet passphrase, the restic password, the restic SSH
|
||||
private key, any private SSH key or seed material in this repository.
|
||||
@@ -0,0 +1,12 @@
|
||||
[defaults]
|
||||
home = .ansible
|
||||
host_key_checking = True
|
||||
interpreter_python = auto_silent
|
||||
local_tmp = .ansible/tmp
|
||||
retry_files_enabled = False
|
||||
roles_path = roles:../../../../shared/ansible/roles
|
||||
timeout = 15
|
||||
|
||||
[ssh_connection]
|
||||
pipelining = True
|
||||
ssh_args = -o ControlMaster=auto -o ControlPersist=60s
|
||||
@@ -0,0 +1 @@
|
||||
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAILfqlYvqesJK9bhMmfv6tRp5pXPFDu13xmYbV+58fopV ansible-deploy@ghostnet-ct114
|
||||
@@ -0,0 +1 @@
|
||||
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIMvQR56yADYULrpThnXROAa8GxKWfb+xcnIVLVDVX6Yy ghost-agent@ghostnet-ct114
|
||||
@@ -0,0 +1 @@
|
||||
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIGUv4INjWuIzgRL9Pw4TqeHirG72AeA6bowsea6fj2OT ghost@ghostnet-ct114
|
||||
+32
@@ -0,0 +1,32 @@
|
||||
---
|
||||
ansible_become_method: sudo
|
||||
ansible_python_interpreter: /usr/bin/python3
|
||||
ansible_ssh_common_args: >-
|
||||
-o IdentitiesOnly=yes
|
||||
-o StrictHostKeyChecking=yes
|
||||
-o UserKnownHostsFile=~/.ssh/known_hosts_ghostnet_ct114
|
||||
|
||||
litecoin_expected_distribution: Debian
|
||||
litecoin_expected_distribution_major_version: "13"
|
||||
litecoin_expected_hostname: ltc-node
|
||||
litecoin_expected_virtualization_type: lxc
|
||||
|
||||
litecoin_firewall_management_ipv4:
|
||||
- 10.0.0.0/24
|
||||
- 10.8.0.0/24
|
||||
litecoin_firewall_ssh_port: 22
|
||||
|
||||
litecoin_access_source_networks: 10.0.0.0/24,10.8.0.0/24
|
||||
|
||||
litecoin_core_version: 0.21.5.8
|
||||
litecoin_core_tarball_name: "litecoin-{{ litecoin_core_version }}-x86_64-linux-gnu.tar.gz"
|
||||
litecoin_core_base_url: "https://download.litecoin.org/litecoin-{{ litecoin_core_version }}/linux"
|
||||
# SHA-256 aus dem signierten SHA256SUMS.asc von download.litecoin.org
|
||||
# (Release v0.21.5.8 vom 2026-09-12, enthaelt den 0.21.5.7-Sicherheitsfix),
|
||||
# am 2026-11-25 gegen den offiziellen Download geprueft (GNAI-024 Abschnitt 2).
|
||||
litecoin_core_tarball_sha256: >-
|
||||
43200c9f9d65ebc126ea5833ca9429e144c4b3273da6bb9f4e89fd7450ab1be9
|
||||
|
||||
# Read-only access only; the agent inventory must never converge state.
|
||||
litecoin_service_start_allowed: false
|
||||
litecoin_service_production_enabled: false
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
---
|
||||
litecoin_ctid: 114
|
||||
litecoin_expected_ipv4: 10.0.0.61
|
||||
# Wird nach dem ersten Boot des CT vom Operator aus der Proxmox-Konsole
|
||||
# uebernommen (ssh-keygen -lf /etc/ssh/ssh_host_ed25519_key.pub via pct exec)
|
||||
# und hier gepinnt. Der Platzhalter muss vor dem ersten Lauf ersetzt werden.
|
||||
litecoin_expected_ssh_host_key_fingerprint: "SHA256:nkRMQWpzpBkUaGNOgyCRsEaXK2KhdraTuiL5ihUdXW4" # gepinnt 2026-11-27 aus dem Bootstrap-Hook-Log (pct exec 114)
|
||||
litecoin_expected_processor_vcpus: 2
|
||||
litecoin_minimum_memory_mb: 3800
|
||||
litecoin_minimum_root_size_bytes: 150000000000
|
||||
litecoin_minimum_root_available_bytes: 20000000000
|
||||
@@ -0,0 +1,8 @@
|
||||
---
|
||||
all:
|
||||
children:
|
||||
litecoin_hosts:
|
||||
hosts:
|
||||
litecoin-ct114:
|
||||
ansible_host: 10.0.0.61
|
||||
ansible_user: ghost-agent
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
---
|
||||
ansible_become_method: sudo
|
||||
ansible_python_interpreter: /usr/bin/python3
|
||||
ansible_ssh_common_args: >-
|
||||
-o IdentitiesOnly=yes
|
||||
-o StrictHostKeyChecking=yes
|
||||
-o UserKnownHostsFile=~/.ssh/known_hosts_ghostnet_ct114
|
||||
|
||||
litecoin_expected_distribution: Debian
|
||||
litecoin_expected_distribution_major_version: "13"
|
||||
litecoin_expected_hostname: ltc-node
|
||||
litecoin_expected_virtualization_type: lxc
|
||||
|
||||
litecoin_firewall_management_ipv4:
|
||||
- 10.0.0.0/24
|
||||
- 10.8.0.0/24
|
||||
litecoin_firewall_ssh_port: 22
|
||||
|
||||
litecoin_access_source_networks: 10.0.0.0/24,10.8.0.0/24
|
||||
|
||||
litecoin_core_version: 0.21.5.8
|
||||
litecoin_core_tarball_name: "litecoin-{{ litecoin_core_version }}-x86_64-linux-gnu.tar.gz"
|
||||
litecoin_core_base_url: "https://download.litecoin.org/litecoin-{{ litecoin_core_version }}/linux"
|
||||
litecoin_core_tarball_sha256: >-
|
||||
43200c9f9d65ebc126ea5833ca9429e144c4b3273da6bb9f4e89fd7450ab1be9
|
||||
|
||||
# Bootstrap converges configuration but must not start the node yet.
|
||||
litecoin_service_start_allowed: false
|
||||
litecoin_service_production_enabled: false
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
---
|
||||
litecoin_ctid: 114
|
||||
litecoin_expected_ipv4: 10.0.0.61
|
||||
litecoin_expected_ssh_host_key_fingerprint: "SHA256:nkRMQWpzpBkUaGNOgyCRsEaXK2KhdraTuiL5ihUdXW4" # gepinnt 2026-11-27 aus dem Bootstrap-Hook-Log (pct exec 114)
|
||||
litecoin_expected_processor_vcpus: 2
|
||||
litecoin_minimum_memory_mb: 3800
|
||||
litecoin_minimum_root_size_bytes: 150000000000
|
||||
litecoin_minimum_root_available_bytes: 20000000000
|
||||
@@ -0,0 +1,8 @@
|
||||
---
|
||||
all:
|
||||
children:
|
||||
litecoin_hosts:
|
||||
hosts:
|
||||
litecoin-ct114:
|
||||
ansible_host: 10.0.0.61
|
||||
ansible_user: ghost
|
||||
+37
@@ -0,0 +1,37 @@
|
||||
---
|
||||
ansible_become_method: sudo
|
||||
ansible_python_interpreter: /usr/bin/python3
|
||||
ansible_ssh_common_args: >-
|
||||
-o IdentitiesOnly=yes
|
||||
-o StrictHostKeyChecking=yes
|
||||
-o UserKnownHostsFile=~/.ssh/known_hosts_ghostnet_ct114
|
||||
|
||||
litecoin_expected_distribution: Debian
|
||||
litecoin_expected_distribution_major_version: "13"
|
||||
litecoin_expected_hostname: ltc-node
|
||||
litecoin_expected_virtualization_type: lxc
|
||||
|
||||
litecoin_firewall_management_ipv4:
|
||||
- 10.0.0.0/24
|
||||
- 10.8.0.0/24
|
||||
litecoin_firewall_ssh_port: 22
|
||||
|
||||
litecoin_access_source_networks: 10.0.0.0/24,10.8.0.0/24
|
||||
|
||||
litecoin_core_version: 0.21.5.8
|
||||
litecoin_core_tarball_name: "litecoin-{{ litecoin_core_version }}-x86_64-linux-gnu.tar.gz"
|
||||
litecoin_core_base_url: "https://download.litecoin.org/litecoin-{{ litecoin_core_version }}/linux"
|
||||
# SHA-256 aus dem signierten SHA256SUMS.asc von download.litecoin.org
|
||||
# (Release v0.21.5.8 vom 2026-09-12, enthaelt den 0.21.5.7-Sicherheitsfix),
|
||||
# am 2026-11-25 gegen den offiziellen Download geprueft (GNAI-024 Abschnitt 2).
|
||||
litecoin_core_tarball_sha256: >-
|
||||
43200c9f9d65ebc126ea5833ca9429e144c4b3273da6bb9f4e89fd7450ab1be9
|
||||
|
||||
# restic-Ziel auf dem hostunabhaengigen Backup-Ziel ghostnet-ki (10.0.0.90),
|
||||
# Konto gn-backup; clientseitige Verschluesselung ist restic-Standard.
|
||||
# Alternativ liefert der Betreiber die Zugangsdaten eines separaten PBS im LAN.
|
||||
litecoin_backup_repository: "sftp:gn-backup@10.0.0.90:/var/lib/ghostnet-ai-backup/ct114/restic"
|
||||
litecoin_backup_keep_daily: 30
|
||||
|
||||
litecoin_service_start_allowed: true
|
||||
litecoin_service_production_enabled: true
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
---
|
||||
litecoin_ctid: 114
|
||||
litecoin_expected_ipv4: 10.0.0.61
|
||||
# Wird nach dem ersten Boot des CT vom Operator aus der Proxmox-Konsole
|
||||
# uebernommen (pct exec 114 -- ssh-keygen -lf /etc/ssh/ssh_host_ed25519_key.pub)
|
||||
# und hier gepinnt. Der Platzhalter muss vor dem ersten Lauf ersetzt werden.
|
||||
litecoin_expected_ssh_host_key_fingerprint: "SHA256:nkRMQWpzpBkUaGNOgyCRsEaXK2KhdraTuiL5ihUdXW4" # gepinnt 2026-11-27 aus dem Bootstrap-Hook-Log (pct exec 114)
|
||||
litecoin_expected_processor_vcpus: 2
|
||||
litecoin_minimum_memory_mb: 3800
|
||||
litecoin_minimum_root_size_bytes: 150000000000
|
||||
litecoin_minimum_root_available_bytes: 20000000000
|
||||
@@ -0,0 +1,8 @@
|
||||
---
|
||||
all:
|
||||
children:
|
||||
litecoin_hosts:
|
||||
hosts:
|
||||
litecoin-ct114:
|
||||
ansible_host: 10.0.0.61
|
||||
ansible_user: ansible-deploy
|
||||
@@ -0,0 +1,197 @@
|
||||
---
|
||||
- name: Read-only deep audit of the CT 114 production state
|
||||
hosts: litecoin_hosts
|
||||
become: true
|
||||
gather_facts: true
|
||||
gather_subset:
|
||||
- min
|
||||
- network
|
||||
- virtual
|
||||
|
||||
tasks:
|
||||
- name: Require the production inventory safeguards
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- litecoin_ctid | int == 114
|
||||
- inventory_hostname == "litecoin-ct114"
|
||||
- >-
|
||||
litecoin_expected_ssh_host_key_fingerprint is
|
||||
match('^SHA256:[A-Za-z0-9+/]{43}$')
|
||||
|
||||
- name: Read the account inventory
|
||||
ansible.builtin.command:
|
||||
argv: [/usr/bin/getent, passwd]
|
||||
check_mode: false
|
||||
changed_when: false
|
||||
register: litecoin_audit_passwd
|
||||
|
||||
- name: Require exactly the managed accounts with their fixed UIDs
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- litecoin_audit_passwd.stdout is search('(?m)^ghost-agent:x:1000:1000:')
|
||||
- litecoin_audit_passwd.stdout is search('(?m)^ghost:x:1001:1001:')
|
||||
- litecoin_audit_passwd.stdout is search('(?m)^ansible-deploy:x:1002:1002:')
|
||||
- litecoin_audit_passwd.stdout is search('(?m)^litecoin:x:1100:1100:')
|
||||
|
||||
- name: Read the password states of the managed accounts
|
||||
ansible.builtin.command:
|
||||
argv: [/usr/bin/passwd, -S, "{{ item }}"]
|
||||
check_mode: false
|
||||
changed_when: false
|
||||
register: litecoin_audit_password_states
|
||||
loop:
|
||||
- ghost-agent
|
||||
- ghost
|
||||
- ansible-deploy
|
||||
- litecoin
|
||||
loop_control:
|
||||
label: "{{ item }}"
|
||||
|
||||
- name: Require locked or password-gated states only
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- item.stdout.split()[1] in ["L", "P"]
|
||||
loop: "{{ litecoin_audit_password_states.results }}"
|
||||
loop_control:
|
||||
label: "{{ item.item }}"
|
||||
|
||||
- name: Read the sudoers drop-ins
|
||||
ansible.builtin.command:
|
||||
argv: [/usr/bin/cat, /etc/sudoers.d/90-ghostnet-ansible-deploy, /etc/sudoers.d/91-ghostnet-litecoin-readonly]
|
||||
check_mode: false
|
||||
changed_when: false
|
||||
register: litecoin_audit_sudoers
|
||||
|
||||
- name: Require the validated sudo policies
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- "litecoin_audit_sudoers.stdout is search('ansible-deploy ALL=\\\\(root\\\\) NOPASSWD: ALL')"
|
||||
- "litecoin_audit_sudoers.stdout is search('ghost-agent ALL=\\\\(root\\\\) NOPASSWD: /usr/local/bin/ltc-readonly')"
|
||||
|
||||
- name: Verify the sudoers files pass visudo
|
||||
ansible.builtin.command:
|
||||
argv: [/usr/sbin/visudo, -c, -f, "{{ item }}"]
|
||||
check_mode: false
|
||||
changed_when: false
|
||||
loop:
|
||||
- /etc/sudoers.d/90-ghostnet-ansible-deploy
|
||||
- /etc/sudoers.d/91-ghostnet-litecoin-readonly
|
||||
loop_control:
|
||||
label: "{{ item }}"
|
||||
|
||||
- name: Read the effective SSH configuration
|
||||
ansible.builtin.command:
|
||||
argv: [/usr/sbin/sshd, -T]
|
||||
check_mode: false
|
||||
changed_when: false
|
||||
register: litecoin_audit_sshd
|
||||
|
||||
- name: Require the GNAI-011 SSH baseline
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- litecoin_audit_sshd.stdout is search('(?m)^permitrootlogin no$')
|
||||
- litecoin_audit_sshd.stdout is search('(?m)^passwordauthentication no$')
|
||||
- litecoin_audit_sshd.stdout is search('(?m)^kbdinteractiveauthentication no$')
|
||||
- litecoin_audit_sshd.stdout is search('(?m)^allowtcpforwarding no$')
|
||||
- litecoin_audit_sshd.stdout is search('(?m)^disableforwarding yes$')
|
||||
- "litecoin_audit_sshd.stdout is search('(?m)^allowusers ghost-agent$')"
|
||||
- "litecoin_audit_sshd.stdout is search('(?m)^allowusers ghost$')"
|
||||
- "litecoin_audit_sshd.stdout is search('(?m)^allowusers ansible-deploy$')"
|
||||
|
||||
- name: Read the fail2ban jail list
|
||||
ansible.builtin.command:
|
||||
argv: [/usr/bin/fail2ban-client, status]
|
||||
check_mode: false
|
||||
changed_when: false
|
||||
register: litecoin_audit_fail2ban
|
||||
|
||||
- name: Require the sshd jail
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- litecoin_audit_fail2ban.stdout is search('sshd')
|
||||
|
||||
- name: Read the active nftables ruleset
|
||||
ansible.builtin.command:
|
||||
argv: [/usr/sbin/nft, list, ruleset]
|
||||
check_mode: false
|
||||
changed_when: false
|
||||
register: litecoin_audit_nft
|
||||
|
||||
- name: Require the Ghostnet filter table in the ruleset
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- litecoin_audit_nft.stdout is search('table inet ghostnet_filter')
|
||||
|
||||
- name: Read the Tor client configuration
|
||||
ansible.builtin.command:
|
||||
argv: [/usr/bin/tor, --verify-config, -f, /etc/tor/torrc]
|
||||
check_mode: false
|
||||
changed_when: false
|
||||
register: litecoin_audit_tor_config
|
||||
|
||||
- name: Require the Tor config to verify
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- litecoin_audit_tor_config.rc == 0
|
||||
|
||||
- name: Verify Tor-only networking and no inbound peers via the read-only wrapper
|
||||
become: false
|
||||
ansible.builtin.shell: |
|
||||
/usr/bin/sudo -n /usr/local/bin/ltc-readonly getnetworkinfo | /usr/bin/python3 -c '
|
||||
import json, sys
|
||||
data = json.load(sys.stdin)
|
||||
for n in data["networks"]:
|
||||
if n.get("proxy") != "127.0.0.1:9050":
|
||||
sys.exit("network %s is not proxied via Tor: %r" % (n["name"], n.get("proxy")))
|
||||
print("all networks proxied via Tor:", [n["name"] for n in data["networks"]])
|
||||
'
|
||||
/usr/bin/sudo -n /usr/local/bin/ltc-readonly getpeerinfo | /usr/bin/python3 -c '
|
||||
import json, sys
|
||||
peers = json.load(sys.stdin)
|
||||
inbound = [p for p in peers if p.get("inbound")]
|
||||
print("peers:", len(peers), "inbound:", len(inbound))
|
||||
if inbound:
|
||||
sys.exit("inbound peers present although listen=0")
|
||||
'
|
||||
args:
|
||||
executable: /bin/bash
|
||||
check_mode: false
|
||||
changed_when: false
|
||||
register: litecoin_audit_networkinfo
|
||||
when:
|
||||
- not ansible_check_mode
|
||||
- litecoin_service_start_allowed | bool
|
||||
|
||||
- name: Report the Tor-only network state
|
||||
ansible.builtin.debug:
|
||||
msg: "{{ litecoin_audit_networkinfo.stdout_lines | default(['check mode or node stopped: skipped']) }}"
|
||||
when:
|
||||
- not ansible_check_mode
|
||||
- litecoin_service_start_allowed | bool
|
||||
|
||||
- name: Read the litecoind datadir usage
|
||||
ansible.builtin.command:
|
||||
argv: [/usr/bin/du, -sb, /var/lib/litecoin]
|
||||
check_mode: false
|
||||
changed_when: false
|
||||
register: litecoin_audit_datadir_usage
|
||||
|
||||
- name: Read the wallet backup directory state
|
||||
ansible.builtin.stat:
|
||||
path: /var/lib/litecoin/backups
|
||||
register: litecoin_audit_backup_dir
|
||||
|
||||
- name: Require the protected wallet backup directory
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- litecoin_audit_backup_dir.stat.exists
|
||||
- litecoin_audit_backup_dir.stat.mode == "0700"
|
||||
- litecoin_audit_backup_dir.stat.pw_name == "litecoin"
|
||||
|
||||
- name: Report the CT 114 audit summary
|
||||
ansible.builtin.debug:
|
||||
msg:
|
||||
ctid: "{{ litecoin_ctid }}"
|
||||
ssh_fingerprint: "{{ litecoin_expected_ssh_host_key_fingerprint }}"
|
||||
datadir_bytes: "{{ litecoin_audit_datadir_usage.stdout.split()[0] }}"
|
||||
fail2ban_jails: "{{ litecoin_audit_fail2ban.stdout_lines }}"
|
||||
@@ -0,0 +1,175 @@
|
||||
---
|
||||
- name: Read-only verification of the fresh CT 114 Litecoin LXC
|
||||
hosts: litecoin_hosts
|
||||
become: false
|
||||
gather_facts: true
|
||||
gather_subset:
|
||||
- min
|
||||
- hardware
|
||||
- network
|
||||
- virtual
|
||||
|
||||
tasks:
|
||||
- name: Verify required inventory safeguards are defined
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- litecoin_ctid is defined
|
||||
- litecoin_expected_hostname is defined
|
||||
- litecoin_expected_ipv4 is defined
|
||||
- litecoin_expected_ssh_host_key_fingerprint is defined
|
||||
- litecoin_expected_distribution is defined
|
||||
- litecoin_expected_distribution_major_version is defined
|
||||
- litecoin_expected_virtualization_type is defined
|
||||
- litecoin_minimum_memory_mb is defined
|
||||
- litecoin_minimum_root_size_bytes is defined
|
||||
fail_msg: >-
|
||||
The selected inventory lacks mandatory CT 114 identity safeguards.
|
||||
Stop before running any configuration playbook.
|
||||
|
||||
- name: Verify the expected guest identity
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- inventory_hostname == "litecoin-ct114"
|
||||
- litecoin_ctid | int == 114
|
||||
- ansible_facts["hostname"] == litecoin_expected_hostname
|
||||
- ansible_facts["distribution"] == litecoin_expected_distribution
|
||||
- >-
|
||||
ansible_facts["distribution_major_version"] ==
|
||||
litecoin_expected_distribution_major_version
|
||||
- >-
|
||||
ansible_facts["default_ipv4"]["address"] ==
|
||||
litecoin_expected_ipv4
|
||||
- >-
|
||||
ansible_facts["virtualization_type"] ==
|
||||
litecoin_expected_virtualization_type
|
||||
- ansible_facts["virtualization_role"] == "guest"
|
||||
- ansible_facts["service_mgr"] == "systemd"
|
||||
- ansible_facts["python"]["version"]["major"] | int >= 3
|
||||
fail_msg: >-
|
||||
The connected machine is not the expected CT 114 Litecoin LXC.
|
||||
Stop before using any privileged playbook.
|
||||
success_msg: The expected Debian 13 CT 114 Litecoin LXC is connected.
|
||||
|
||||
- name: Verify the pinned SSH host key fingerprint
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- litecoin_expected_ssh_host_key_fingerprint is
|
||||
match('^SHA256:[A-Za-z0-9+/]{43}$')
|
||||
fail_msg: >-
|
||||
litecoin_expected_ssh_host_key_fingerprint still contains the
|
||||
PENDING placeholder. Pin the real fingerprint from the Proxmox
|
||||
console after the first boot (GNAI-024 Abschnitt 6).
|
||||
|
||||
- name: Read the unprivileged SSH identity
|
||||
ansible.builtin.command:
|
||||
argv:
|
||||
- /usr/bin/id
|
||||
- -un
|
||||
check_mode: false
|
||||
changed_when: false
|
||||
register: litecoin_preflight_ssh_identity
|
||||
|
||||
- name: Verify the agent account was used on the agent inventory
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- litecoin_preflight_ssh_identity.stdout == "ghost-agent"
|
||||
fail_msg: >-
|
||||
The agent inventory must connect through the unprivileged
|
||||
ghost-agent account.
|
||||
when: ansible_user is defined and ansible_user == "ghost-agent"
|
||||
|
||||
- name: Read failed systemd units
|
||||
ansible.builtin.command:
|
||||
argv:
|
||||
- /usr/bin/systemctl
|
||||
- --failed
|
||||
- --no-legend
|
||||
- --plain
|
||||
check_mode: false
|
||||
changed_when: false
|
||||
register: litecoin_preflight_failed_units
|
||||
|
||||
- name: Read the listening TCP ports
|
||||
ansible.builtin.command:
|
||||
argv:
|
||||
- /usr/bin/ss
|
||||
- -H
|
||||
- -lnt
|
||||
check_mode: false
|
||||
changed_when: false
|
||||
register: litecoin_preflight_listeners
|
||||
|
||||
- name: Read the effective processor count
|
||||
ansible.builtin.command:
|
||||
argv:
|
||||
- /usr/bin/nproc
|
||||
check_mode: false
|
||||
changed_when: false
|
||||
register: litecoin_preflight_nproc
|
||||
|
||||
- name: Read root filesystem capacity
|
||||
ansible.builtin.command:
|
||||
argv:
|
||||
- /usr/bin/findmnt
|
||||
- --bytes
|
||||
- --noheadings
|
||||
- --output
|
||||
- SIZE,AVAIL
|
||||
- --target
|
||||
- /
|
||||
check_mode: false
|
||||
changed_when: false
|
||||
register: litecoin_preflight_root_capacity
|
||||
|
||||
- name: Check that no Litecoin installation exists yet
|
||||
ansible.builtin.stat:
|
||||
path: /opt/litecoin
|
||||
register: litecoin_preflight_opt_symlink
|
||||
|
||||
- name: Verify the fresh-LXC commissioning gates
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- >-
|
||||
litecoin_preflight_nproc.stdout | int ==
|
||||
litecoin_expected_processor_vcpus | int
|
||||
- >-
|
||||
ansible_facts["memtotal_mb"] | int >=
|
||||
litecoin_minimum_memory_mb | int
|
||||
- >-
|
||||
litecoin_preflight_root_capacity.stdout.split()[0] | int >=
|
||||
litecoin_minimum_root_size_bytes | int
|
||||
- >-
|
||||
litecoin_preflight_root_capacity.stdout.split()[1] | int >=
|
||||
litecoin_minimum_root_available_bytes | int
|
||||
- litecoin_preflight_failed_units.stdout | trim == ""
|
||||
- >-
|
||||
litecoin_preflight_listeners.stdout is search('\\b22\\b') or
|
||||
litecoin_preflight_listeners.stdout | trim == ""
|
||||
- not litecoin_preflight_opt_symlink.stat.exists
|
||||
fail_msg: >-
|
||||
The target is not the expected healthy, empty CT 114. Stop before
|
||||
creating configuration, services or wallets.
|
||||
success_msg: >-
|
||||
CT 114 is healthy, empty and ready for declarative configuration.
|
||||
|
||||
- name: Report the verified Litecoin commissioning baseline
|
||||
ansible.builtin.debug:
|
||||
msg:
|
||||
inventory_host: "{{ inventory_hostname }}"
|
||||
ctid: "{{ litecoin_ctid }}"
|
||||
hostname: "{{ ansible_facts['hostname'] }}"
|
||||
operating_system: >-
|
||||
{{ ansible_facts['distribution'] }}
|
||||
{{ ansible_facts['distribution_version'] }}
|
||||
default_ipv4: "{{ ansible_facts['default_ipv4']['address'] }}"
|
||||
virtualization: >-
|
||||
{{ ansible_facts['virtualization_type'] }}
|
||||
{{ ansible_facts['virtualization_role'] }}
|
||||
effective_processor_count: "{{ litecoin_preflight_nproc.stdout }}"
|
||||
memory_mib: "{{ ansible_facts['memtotal_mb'] }}"
|
||||
root_size_bytes: >-
|
||||
{{ litecoin_preflight_root_capacity.stdout.split()[0] }}
|
||||
root_available_bytes: >-
|
||||
{{ litecoin_preflight_root_capacity.stdout.split()[1] }}
|
||||
trusted_ssh_fingerprint: >-
|
||||
{{ litecoin_expected_ssh_host_key_fingerprint }}
|
||||
@@ -0,0 +1,29 @@
|
||||
---
|
||||
- name: Converge the CT 114 Litecoin wallet LXC on the declared state
|
||||
hosts: litecoin_hosts
|
||||
become: true
|
||||
gather_facts: true
|
||||
gather_subset:
|
||||
- min
|
||||
- hardware
|
||||
- network
|
||||
- virtual
|
||||
|
||||
roles:
|
||||
- role: litecoin_lxc_baseline
|
||||
vars:
|
||||
litecoin_lxc_baseline_expected_hostname: >-
|
||||
{{ litecoin_expected_hostname }}
|
||||
litecoin_lxc_baseline_expected_distribution: >-
|
||||
{{ litecoin_expected_distribution }}
|
||||
litecoin_lxc_baseline_expected_distribution_major_version: >-
|
||||
{{ litecoin_expected_distribution_major_version }}
|
||||
litecoin_lxc_baseline_expected_ipv4: "{{ litecoin_expected_ipv4 }}"
|
||||
litecoin_lxc_baseline_expected_virtualization_type: >-
|
||||
{{ litecoin_expected_virtualization_type }}
|
||||
- role: litecoin_access
|
||||
- role: litecoin_firewall
|
||||
- role: litecoin_fail2ban
|
||||
- role: litecoin_tor
|
||||
- role: litecoin_core
|
||||
- role: litecoin_backup
|
||||
@@ -0,0 +1,43 @@
|
||||
---
|
||||
- name: Verify the CT 114 Ansible deployment boundary
|
||||
hosts: litecoin_hosts
|
||||
become: false
|
||||
gather_facts: false
|
||||
|
||||
tasks:
|
||||
- name: Verify Ansible module execution without privilege escalation
|
||||
ansible.builtin.ping:
|
||||
|
||||
- name: Read the SSH account identity
|
||||
ansible.builtin.command:
|
||||
argv:
|
||||
- /usr/bin/id
|
||||
- -un
|
||||
check_mode: false
|
||||
changed_when: false
|
||||
register: litecoin_deploy_account_identity
|
||||
|
||||
- name: Verify the expected SSH account
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- litecoin_deploy_account_identity.stdout == "ansible-deploy"
|
||||
fail_msg: The SSH connection did not use ansible-deploy.
|
||||
|
||||
- name: Read the effective identity through sudo
|
||||
become: true
|
||||
ansible.builtin.command:
|
||||
argv:
|
||||
- /usr/bin/id
|
||||
- -u
|
||||
check_mode: false
|
||||
changed_when: false
|
||||
register: litecoin_deploy_root_identity
|
||||
|
||||
- name: Verify non-interactive root escalation
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- litecoin_deploy_root_identity.stdout == "0"
|
||||
fail_msg: Non-interactive sudo did not produce effective UID 0.
|
||||
success_msg: >-
|
||||
The CT 114 deployment account can connect and escalate privileges
|
||||
non-interactively.
|
||||
@@ -0,0 +1,213 @@
|
||||
---
|
||||
- name: Read-only verification of the converged CT 114 production state
|
||||
hosts: litecoin_hosts
|
||||
become: true
|
||||
gather_facts: true
|
||||
gather_subset:
|
||||
- min
|
||||
- network
|
||||
- virtual
|
||||
|
||||
tasks:
|
||||
- name: Require the production inventory safeguards
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- litecoin_ctid | int == 114
|
||||
- inventory_hostname == "litecoin-ct114"
|
||||
- >-
|
||||
litecoin_expected_ssh_host_key_fingerprint is
|
||||
match('^SHA256:[A-Za-z0-9+/]{43}$')
|
||||
|
||||
- name: Verify the expected guest identity
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- ansible_facts["hostname"] == litecoin_expected_hostname
|
||||
- ansible_facts["distribution"] == litecoin_expected_distribution
|
||||
- >-
|
||||
ansible_facts["distribution_major_version"] ==
|
||||
litecoin_expected_distribution_major_version
|
||||
- >-
|
||||
ansible_facts["default_ipv4"]["address"] ==
|
||||
litecoin_expected_ipv4
|
||||
- >-
|
||||
ansible_facts["virtualization_type"] ==
|
||||
litecoin_expected_virtualization_type
|
||||
- ansible_facts["virtualization_role"] == "guest"
|
||||
fail_msg: The connected machine is not the declared CT 114.
|
||||
|
||||
- name: Read failed systemd units
|
||||
ansible.builtin.command:
|
||||
argv: [/usr/bin/systemctl, --failed, --no-legend, --plain]
|
||||
check_mode: false
|
||||
changed_when: false
|
||||
register: litecoin_production_failed_units
|
||||
|
||||
- name: Require no failed units
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- litecoin_production_failed_units.stdout | trim == ""
|
||||
|
||||
- name: Read the deployment account identity
|
||||
become: false
|
||||
ansible.builtin.command:
|
||||
argv: [/usr/bin/id, -un]
|
||||
check_mode: false
|
||||
changed_when: false
|
||||
register: litecoin_production_ssh_identity
|
||||
|
||||
- name: Require the deployment account
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- litecoin_production_ssh_identity.stdout == "ansible-deploy"
|
||||
|
||||
- name: Read the required service states
|
||||
ansible.builtin.command:
|
||||
argv:
|
||||
- /usr/bin/systemctl
|
||||
- is-active
|
||||
- ssh.service
|
||||
- nftables.service
|
||||
- fail2ban.service
|
||||
- tor.service
|
||||
- unattended-upgrades.service
|
||||
check_mode: false
|
||||
changed_when: false
|
||||
register: litecoin_production_services
|
||||
|
||||
- name: Require all management services active
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- litecoin_production_services.stdout_lines | select('!=', 'active') | list | length == 0
|
||||
|
||||
- name: Read the litecoind service state
|
||||
ansible.builtin.command:
|
||||
argv: [/usr/bin/systemctl, is-active, litecoind.service]
|
||||
check_mode: false
|
||||
changed_when: false
|
||||
register: litecoin_production_litecoind
|
||||
|
||||
- name: Require litecoind active when the inventory allows starting it
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- litecoin_production_litecoind.stdout == "active"
|
||||
when: litecoin_service_start_allowed | bool
|
||||
|
||||
- name: Read the listening TCP sockets
|
||||
ansible.builtin.command:
|
||||
argv: [/usr/bin/ss, -H, -lnt]
|
||||
check_mode: false
|
||||
changed_when: false
|
||||
register: litecoin_production_listeners
|
||||
|
||||
- name: Require SSH as the only externally bound listener
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- litecoin_production_listeners.stdout is search('0.0.0.0:22\\b|\\[::\\]:22\\b')
|
||||
- not (litecoin_production_listeners.stdout is search('0.0.0.0:(9332|9333|9050|9051)\\b'))
|
||||
- not (litecoin_production_listeners.stdout is search('\\[::\\]:(9332|9333|9050|9051)\\b'))
|
||||
fail_msg: >-
|
||||
Unexpected externally bound listener. RPC 9332, SOCKS 9050,
|
||||
ControlPort 9051 and P2P 9333 must be loopback-only or absent.
|
||||
|
||||
- name: Require loopback-only RPC and Tor listeners
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- litecoin_production_listeners.stdout is search('127.0.0.1:9332\\b')
|
||||
- litecoin_production_listeners.stdout is search('127.0.0.1:9050\\b')
|
||||
- not (litecoin_production_listeners.stdout is search('9333'))
|
||||
fail_msg: >-
|
||||
litecoind must bind RPC to 127.0.0.1:9332 only and must not listen
|
||||
on P2P 9333 (listen=0, onion-only).
|
||||
|
||||
- name: Read the litecoind version
|
||||
ansible.builtin.command:
|
||||
argv: [/opt/litecoin/bin/litecoind, --version]
|
||||
check_mode: false
|
||||
changed_when: false
|
||||
register: litecoin_production_version
|
||||
|
||||
- name: Require the pinned Litecoin Core version
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- ('Litecoin Core version v' ~ litecoin_core_version) in litecoin_production_version.stdout
|
||||
fail_msg: "Unexpected litecoind version: {{ litecoin_production_version.stdout }}"
|
||||
|
||||
- name: Read the active Ghostnet nftables table
|
||||
ansible.builtin.command:
|
||||
argv: [/usr/sbin/nft, list, table, inet, ghostnet_filter]
|
||||
check_mode: false
|
||||
changed_when: false
|
||||
register: litecoin_production_nft
|
||||
|
||||
- name: Require the default-deny firewall
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- litecoin_production_nft.stdout is search('policy drop')
|
||||
- litecoin_production_nft.stdout is search('SSH management')
|
||||
- litecoin_production_nft.stdout is search('default input deny')
|
||||
|
||||
- name: Read the effective SSH policy
|
||||
ansible.builtin.command:
|
||||
argv: [/usr/sbin/sshd, -T]
|
||||
check_mode: false
|
||||
changed_when: false
|
||||
register: litecoin_production_sshd_effective
|
||||
|
||||
- name: Require the hardened SSH policy
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- litecoin_production_sshd_effective.stdout is search('(?m)^permitrootlogin no$')
|
||||
- litecoin_production_sshd_effective.stdout is search('(?m)^passwordauthentication no$')
|
||||
- litecoin_production_sshd_effective.stdout is search('(?m)^allowtcpforwarding no$')
|
||||
- litecoin_production_sshd_effective.stdout is search('(?m)^disableforwarding yes$')
|
||||
|
||||
- name: Read the litecoin.conf permissions
|
||||
ansible.builtin.stat:
|
||||
path: /etc/litecoin/litecoin.conf
|
||||
register: litecoin_production_conf_stat
|
||||
|
||||
- name: Require the protected litecoin.conf
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- litecoin_production_conf_stat.stat.mode == "0640"
|
||||
- litecoin_production_conf_stat.stat.pw_name == "root"
|
||||
- litecoin_production_conf_stat.stat.gr_name == "litecoin"
|
||||
|
||||
- name: Read the restic password file state without reading its content
|
||||
ansible.builtin.stat:
|
||||
path: /etc/litecoin-backup/restic-password
|
||||
get_checksum: false
|
||||
register: litecoin_production_restic_password_stat
|
||||
|
||||
- name: Require the operator-provided restic secret with safe permissions
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- litecoin_production_restic_password_stat.stat.exists
|
||||
- litecoin_production_restic_password_stat.stat.mode == "0600"
|
||||
- litecoin_production_restic_password_stat.stat.pw_name == "root"
|
||||
fail_msg: >-
|
||||
/etc/litecoin-backup/restic-password must exist as root:root 0600;
|
||||
the operator installs it once (GNAI-024 Abschnitt 6 Schritt 0).
|
||||
|
||||
- name: Read the enabled backup timers
|
||||
ansible.builtin.command:
|
||||
argv: [/usr/bin/systemctl, list-timers, --no-legend, litecoin-wallet-backup.timer, litecoin-restic-check.timer]
|
||||
check_mode: false
|
||||
changed_when: false
|
||||
register: litecoin_production_timers
|
||||
|
||||
- name: Require both backup timers
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- litecoin_production_timers.stdout is search('litecoin-wallet-backup.timer')
|
||||
- litecoin_production_timers.stdout is search('litecoin-restic-check.timer')
|
||||
|
||||
- name: Report the verified CT 114 production state
|
||||
ansible.builtin.debug:
|
||||
msg:
|
||||
ctid: "{{ litecoin_ctid }}"
|
||||
ipv4: "{{ ansible_facts['default_ipv4']['address'] }}"
|
||||
litecoind: "{{ litecoin_production_version.stdout.splitlines()[0] }}"
|
||||
listeners: "{{ litecoin_production_listeners.stdout_lines }}"
|
||||
services: "{{ litecoin_production_services.stdout_lines }}"
|
||||
ssh_fingerprint: "{{ litecoin_expected_ssh_host_key_fingerprint }}"
|
||||
@@ -0,0 +1,18 @@
|
||||
# litecoin_access
|
||||
|
||||
Access model for CT 114, mirroring `keycloak_access` / GNAI-011:
|
||||
|
||||
- `ghost-agent` (1000, locked, no groups): `restrict,from="10.0.0.0/24,10.8.0.0/24"`
|
||||
key plus a NOPASSWD sudo rule limited to `/usr/local/bin/ltc-readonly`, a
|
||||
wrapper that whitelists read-only `litecoin-cli` calls and runs them as the
|
||||
`litecoin` user (cookie auth, no stored RPC credentials).
|
||||
- `ghost` (1001, password-gated sudo): personal admin key with forwarding
|
||||
restrictions.
|
||||
- `ansible-deploy` (1002, locked, `NOPASSWD: ALL`): `restrict,from=...` key.
|
||||
- Root SSH emptied, `PermitRootLogin no`, password auth off, socket activation
|
||||
off, and `DisableForwarding yes` — therefore no SSH port forwarding; the
|
||||
Litecoin RPC (127.0.0.1:9332) is only used via SSH exec, never via tunnel.
|
||||
|
||||
All public keys come from `ansible/files/ssh/`; the role fails closed when a
|
||||
key file is missing (the `ghost` key is generated interactively by the
|
||||
operator before the first converge — GNAI-024 Abschnitt 6 Schritt 0).
|
||||
@@ -0,0 +1,37 @@
|
||||
---
|
||||
litecoin_access_source_networks: 10.0.0.0/24,10.8.0.0/24
|
||||
litecoin_access_public_key_root: "{{ playbook_dir }}/../files/ssh"
|
||||
|
||||
litecoin_access_agent_user: ghost-agent
|
||||
litecoin_access_agent_uid: 1000
|
||||
litecoin_access_agent_public_key_file: >-
|
||||
{{ litecoin_access_public_key_root }}/litecoin-ghost-agent.pub
|
||||
|
||||
litecoin_access_admin_user: ghost
|
||||
litecoin_access_admin_uid: 1001
|
||||
litecoin_access_admin_public_key_file: >-
|
||||
{{ litecoin_access_public_key_root }}/litecoin-ghost.pub
|
||||
|
||||
litecoin_access_deploy_user: ansible-deploy
|
||||
litecoin_access_deploy_uid: 1002
|
||||
litecoin_access_deploy_public_key_file: >-
|
||||
{{ litecoin_access_public_key_root }}/litecoin-ansible-deploy.pub
|
||||
|
||||
litecoin_access_ssh_dropin: /etc/ssh/sshd_config.d/99-ghostnet-litecoin.conf
|
||||
litecoin_access_sudoers_file: /etc/sudoers.d/90-ghostnet-ansible-deploy
|
||||
litecoin_access_readonly_sudoers_file: /etc/sudoers.d/91-ghostnet-litecoin-readonly
|
||||
litecoin_access_readonly_wrapper: /usr/local/bin/ltc-readonly
|
||||
|
||||
# Read-only litecoin-cli calls the agent account may run via the wrapper.
|
||||
# Sending coins is deliberately not in this list; it stays an interactive
|
||||
# `sudo -u litecoin litecoin-cli ...` action by ghost/ansible-deploy after an
|
||||
# explicit walletpassphrase unlock (GNAI-024 Abschnitt 8).
|
||||
litecoin_access_readonly_commands:
|
||||
- getbalance
|
||||
- getblockchaininfo
|
||||
- getblockcount
|
||||
- getmempoolinfo
|
||||
- getnetworkinfo
|
||||
- getpeerinfo
|
||||
- getwalletinfo
|
||||
- listtransactions
|
||||
@@ -0,0 +1,5 @@
|
||||
---
|
||||
- name: Restart the classic SSH service
|
||||
ansible.builtin.systemd_service:
|
||||
name: ssh.service
|
||||
state: restarted
|
||||
@@ -0,0 +1,229 @@
|
||||
---
|
||||
- name: Require all three role-specific public keys in files/ssh (control node)
|
||||
ansible.builtin.stat:
|
||||
path: "{{ item }}"
|
||||
delegate_to: localhost
|
||||
become: false
|
||||
loop:
|
||||
- "{{ litecoin_access_agent_public_key_file }}"
|
||||
- "{{ litecoin_access_admin_public_key_file }}"
|
||||
- "{{ litecoin_access_deploy_public_key_file }}"
|
||||
register: litecoin_access_public_keys
|
||||
|
||||
- name: Fail with a clear message when a public key is missing
|
||||
ansible.builtin.fail:
|
||||
msg: >-
|
||||
Missing public key {{ item.item }}. The operator generates the CT 114
|
||||
key pairs (the ghost key interactively with passphrase) and copies the
|
||||
.pub files into ansible/files/ssh/ before converging (GNAI-024
|
||||
Abschnitt 6, Schritt 0).
|
||||
when: not item.stat.exists
|
||||
loop: "{{ litecoin_access_public_keys.results }}"
|
||||
loop_control:
|
||||
label: "{{ item.item }}"
|
||||
|
||||
- name: Validate the public key files are real OpenSSH keys (control node)
|
||||
ansible.builtin.command:
|
||||
argv:
|
||||
- /usr/bin/ssh-keygen
|
||||
- -l
|
||||
- -f
|
||||
- "{{ item }}"
|
||||
delegate_to: localhost
|
||||
become: false
|
||||
check_mode: false
|
||||
changed_when: false
|
||||
loop:
|
||||
- "{{ litecoin_access_agent_public_key_file }}"
|
||||
- "{{ litecoin_access_admin_public_key_file }}"
|
||||
- "{{ litecoin_access_deploy_public_key_file }}"
|
||||
loop_control:
|
||||
label: "{{ item }}"
|
||||
|
||||
- name: Create fixed primary groups for Litecoin access accounts
|
||||
ansible.builtin.group:
|
||||
name: "{{ item.name }}"
|
||||
gid: "{{ item.uid }}"
|
||||
state: present
|
||||
loop:
|
||||
- name: "{{ litecoin_access_agent_user }}"
|
||||
uid: "{{ litecoin_access_agent_uid }}"
|
||||
- name: "{{ litecoin_access_admin_user }}"
|
||||
uid: "{{ litecoin_access_admin_uid }}"
|
||||
- name: "{{ litecoin_access_deploy_user }}"
|
||||
uid: "{{ litecoin_access_deploy_uid }}"
|
||||
loop_control:
|
||||
label: "{{ item.name }}"
|
||||
|
||||
- name: Create fixed Litecoin access accounts
|
||||
ansible.builtin.user:
|
||||
name: "{{ item.name }}"
|
||||
uid: "{{ item.uid }}"
|
||||
group: "{{ item.name }}"
|
||||
home: "/home/{{ item.name }}"
|
||||
shell: /bin/bash
|
||||
create_home: true
|
||||
state: present
|
||||
loop:
|
||||
- name: "{{ litecoin_access_agent_user }}"
|
||||
uid: "{{ litecoin_access_agent_uid }}"
|
||||
- name: "{{ litecoin_access_admin_user }}"
|
||||
uid: "{{ litecoin_access_admin_uid }}"
|
||||
- name: "{{ litecoin_access_deploy_user }}"
|
||||
uid: "{{ litecoin_access_deploy_uid }}"
|
||||
loop_control:
|
||||
label: "{{ item.name }}"
|
||||
|
||||
- name: Keep the read-only agent outside supplementary groups
|
||||
ansible.builtin.user:
|
||||
name: "{{ litecoin_access_agent_user }}"
|
||||
groups: ""
|
||||
append: false
|
||||
password_lock: true
|
||||
|
||||
- name: Keep the deployment account outside supplementary groups
|
||||
ansible.builtin.user:
|
||||
name: "{{ litecoin_access_deploy_user }}"
|
||||
groups: ""
|
||||
append: false
|
||||
password_lock: true
|
||||
|
||||
- name: Grant password-gated sudo membership to the administrator
|
||||
ansible.builtin.user:
|
||||
name: "{{ litecoin_access_admin_user }}"
|
||||
groups:
|
||||
- sudo
|
||||
append: true
|
||||
|
||||
- name: Create protected SSH directories
|
||||
ansible.builtin.file:
|
||||
path: "/home/{{ item }}/.ssh"
|
||||
state: directory
|
||||
owner: "{{ item }}"
|
||||
group: "{{ item }}"
|
||||
mode: "0700"
|
||||
loop:
|
||||
- "{{ litecoin_access_agent_user }}"
|
||||
- "{{ litecoin_access_admin_user }}"
|
||||
- "{{ litecoin_access_deploy_user }}"
|
||||
|
||||
- name: Install the restricted read-only agent key
|
||||
ansible.builtin.copy:
|
||||
content: |
|
||||
restrict,from="{{ litecoin_access_source_networks }}" {{ lookup('ansible.builtin.file', litecoin_access_agent_public_key_file) }}
|
||||
dest: "/home/{{ litecoin_access_agent_user }}/.ssh/authorized_keys"
|
||||
owner: "{{ litecoin_access_agent_user }}"
|
||||
group: "{{ litecoin_access_agent_user }}"
|
||||
mode: "0600"
|
||||
|
||||
- name: Install the restricted personal administrator key
|
||||
ansible.builtin.copy:
|
||||
content: |
|
||||
from="{{ litecoin_access_source_networks }}",no-agent-forwarding,no-port-forwarding,no-X11-forwarding,no-user-rc {{ lookup('ansible.builtin.file', litecoin_access_admin_public_key_file) }}
|
||||
dest: "/home/{{ litecoin_access_admin_user }}/.ssh/authorized_keys"
|
||||
owner: "{{ litecoin_access_admin_user }}"
|
||||
group: "{{ litecoin_access_admin_user }}"
|
||||
mode: "0600"
|
||||
|
||||
- name: Install the restricted deployment key
|
||||
ansible.builtin.copy:
|
||||
content: |
|
||||
restrict,from="{{ litecoin_access_source_networks }}" {{ lookup('ansible.builtin.file', litecoin_access_deploy_public_key_file) }}
|
||||
dest: "/home/{{ litecoin_access_deploy_user }}/.ssh/authorized_keys"
|
||||
owner: "{{ litecoin_access_deploy_user }}"
|
||||
group: "{{ litecoin_access_deploy_user }}"
|
||||
mode: "0600"
|
||||
|
||||
- name: Install validated deployment sudo policy
|
||||
ansible.builtin.copy:
|
||||
content: |
|
||||
{{ litecoin_access_deploy_user }} ALL=(root) NOPASSWD: ALL
|
||||
dest: "{{ litecoin_access_sudoers_file }}"
|
||||
owner: root
|
||||
group: root
|
||||
mode: "0440"
|
||||
validate: /usr/sbin/visudo -cf %s
|
||||
|
||||
- name: Install the read-only wrapper for the agent account
|
||||
ansible.builtin.template:
|
||||
src: ltc-readonly.sh.j2
|
||||
dest: "{{ litecoin_access_readonly_wrapper }}"
|
||||
owner: root
|
||||
group: root
|
||||
mode: "0750"
|
||||
validate: /bin/bash -n %s
|
||||
|
||||
- name: Install validated read-only sudo policy for the agent account
|
||||
ansible.builtin.copy:
|
||||
content: |
|
||||
{{ litecoin_access_agent_user }} ALL=(root) NOPASSWD: {{ litecoin_access_readonly_wrapper }}
|
||||
dest: "{{ litecoin_access_readonly_sudoers_file }}"
|
||||
owner: root
|
||||
group: root
|
||||
mode: "0440"
|
||||
validate: /usr/sbin/visudo -cf %s
|
||||
|
||||
- name: Ensure root has no SSH authorization material
|
||||
ansible.builtin.file:
|
||||
path: /root/.ssh
|
||||
state: directory
|
||||
owner: root
|
||||
group: root
|
||||
mode: "0700"
|
||||
|
||||
- name: Keep the root authorized keys file empty
|
||||
ansible.builtin.copy:
|
||||
content: ""
|
||||
dest: /root/.ssh/authorized_keys
|
||||
owner: root
|
||||
group: root
|
||||
mode: "0600"
|
||||
|
||||
- name: Install the hardened SSH policy
|
||||
ansible.builtin.template:
|
||||
src: sshd.conf.j2
|
||||
dest: "{{ litecoin_access_ssh_dropin }}"
|
||||
owner: root
|
||||
group: root
|
||||
mode: "0600"
|
||||
validate: /usr/sbin/sshd -t -f %s
|
||||
notify: Restart the classic SSH service
|
||||
|
||||
- name: Disable SSH socket activation
|
||||
ansible.builtin.systemd_service:
|
||||
name: ssh.socket
|
||||
enabled: false
|
||||
state: stopped
|
||||
|
||||
- name: Enable the classic SSH service
|
||||
ansible.builtin.systemd_service:
|
||||
name: ssh.service
|
||||
enabled: true
|
||||
state: started
|
||||
|
||||
- name: Read account password states
|
||||
ansible.builtin.command:
|
||||
argv:
|
||||
- /usr/bin/passwd
|
||||
- -S
|
||||
- "{{ item }}"
|
||||
check_mode: false
|
||||
changed_when: false
|
||||
register: litecoin_access_password_states
|
||||
loop:
|
||||
- "{{ litecoin_access_agent_user }}"
|
||||
- "{{ litecoin_access_admin_user }}"
|
||||
- "{{ litecoin_access_deploy_user }}"
|
||||
loop_control:
|
||||
label: "{{ item }}"
|
||||
|
||||
- name: Verify the locked password states
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- item.stdout.split()[1] in ["L", "P"]
|
||||
fail_msg: >-
|
||||
Account {{ item.item }} has unsafe password state
|
||||
{{ item.stdout.split()[1] }}.
|
||||
loop: "{{ litecoin_access_password_states.results }}"
|
||||
loop_control:
|
||||
label: "{{ item.item }}"
|
||||
+32
@@ -0,0 +1,32 @@
|
||||
#!/bin/bash
|
||||
# Managed by Ansible role litecoin_access.
|
||||
# Read-only litecoin-cli wrapper for the ghost-agent account (NOPASSWD sudo).
|
||||
# Whitelists read-only RPC calls and executes them as the litecoin service
|
||||
# user so the node-local cookie auth is used. No sending, no wallet unlock.
|
||||
set -Eeuo pipefail
|
||||
|
||||
readonly ALLOWED=(
|
||||
{% for command in litecoin_access_readonly_commands %} "{{ command }}"
|
||||
{% endfor %})
|
||||
|
||||
if [[ $# -lt 1 ]]; then
|
||||
printf 'usage: ltc-readonly <command> [args...]\nallowed:' >&2
|
||||
printf ' %s' "${ALLOWED[@]}" >&2
|
||||
printf '\n' >&2
|
||||
exit 2
|
||||
fi
|
||||
|
||||
allowed=0
|
||||
for candidate in "${ALLOWED[@]}"; do
|
||||
if [[ "$1" == "$candidate" ]]; then
|
||||
allowed=1
|
||||
break
|
||||
fi
|
||||
done
|
||||
if [[ "$allowed" -ne 1 ]]; then
|
||||
printf 'ltc-readonly: command not allowed: %s\n' "$1" >&2
|
||||
exit 2
|
||||
fi
|
||||
|
||||
exec /usr/sbin/runuser -u litecoin -- \
|
||||
/opt/litecoin/bin/litecoin-cli -conf=/etc/litecoin/litecoin.conf "$@"
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
# Managed by Ansible role litecoin_access.
|
||||
# GNAI-011 SSH baseline. TCP forwarding stays disabled on purpose: the
|
||||
# Litecoin RPC is reached via `ssh ... ltc-readonly` / `sudo -u litecoin
|
||||
# litecoin-cli`, never via an SSH tunnel (GNAI-024 Abschnitt 2, Befund d).
|
||||
PermitRootLogin no
|
||||
PasswordAuthentication no
|
||||
KbdInteractiveAuthentication no
|
||||
PubkeyAuthentication yes
|
||||
AllowUsers {{ litecoin_access_agent_user }} {{ litecoin_access_admin_user }} {{ litecoin_access_deploy_user }}
|
||||
X11Forwarding no
|
||||
AllowAgentForwarding no
|
||||
AllowTcpForwarding no
|
||||
AllowStreamLocalForwarding no
|
||||
DisableForwarding yes
|
||||
PermitTunnel no
|
||||
MaxAuthTries 3
|
||||
LoginGraceTime 30
|
||||
LogLevel VERBOSE
|
||||
@@ -0,0 +1,16 @@
|
||||
# litecoin_backup
|
||||
|
||||
Daily encrypted wallet backup of CT 114 (GNAI-024 Abschnitt 9):
|
||||
|
||||
- `/usr/local/sbin/litecoin-wallet-backup.sh` runs `backupwallet` as the
|
||||
`litecoin` user into `/var/lib/litecoin/backups/`, then a restic backup of
|
||||
`backups/` only (never the chain — a restore re-syncs and then restores
|
||||
`wallet.dat`), then `forget --keep-daily 30 --prune`.
|
||||
- restic repository: `sftp:gn-backup@10.0.0.90:...` (host-independent backup
|
||||
target ghostnet-ki) unless the operator overrides
|
||||
`litecoin_backup_repository` with a separate PBS. Encryption is
|
||||
client-side (restic default); the target only sees ciphertext.
|
||||
- Secrets are never managed here: the restic password file and the dedicated
|
||||
SSH key are placed by the operator into `/etc/litecoin-backup/` (root-only);
|
||||
the role only pins the target host key and asserts file modes. The timers
|
||||
run daily 03:00 (backup) and monthly (restic check).
|
||||
@@ -0,0 +1,26 @@
|
||||
---
|
||||
# restic target on the host-independent backup host ghostnet-ki (10.0.0.90),
|
||||
# account gn-backup; overridden per inventory (a separate PBS in the LAN is
|
||||
# equally possible — GNAI-024 Abschnitt 2 Befund g).
|
||||
litecoin_backup_repository: "sftp:gn-backup@10.0.0.90:/var/lib/ghostnet-ai-backup/ct114/restic"
|
||||
litecoin_backup_keep_daily: 30
|
||||
|
||||
litecoin_backup_env_dir: /etc/litecoin-backup
|
||||
litecoin_backup_password_file: "{{ litecoin_backup_env_dir }}/restic-password"
|
||||
# Default ssh identity name so restic's sftp backend picks it up via HOME.
|
||||
litecoin_backup_ssh_key: "{{ litecoin_backup_env_dir }}/.ssh/id_ed25519"
|
||||
litecoin_backup_known_hosts: "{{ litecoin_backup_env_dir }}/.ssh/known_hosts"
|
||||
litecoin_backup_ssh_config: "{{ litecoin_backup_env_dir }}/ssh_config"
|
||||
# ghostnet-ki host key (ed25519), same pin as pve_lxc_backup_sync.
|
||||
litecoin_backup_target_host: 10.0.0.90
|
||||
litecoin_backup_target_user: gn-backup
|
||||
litecoin_backup_target_host_key_ed25519: >-
|
||||
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAID1UMrhG0WoKlRfadNadWdZogijlhjCz8uXfWbjvxuf8
|
||||
litecoin_backup_script: /usr/local/sbin/litecoin-wallet-backup.sh
|
||||
litecoin_backup_service: litecoin-wallet-backup.service
|
||||
litecoin_backup_timer: litecoin-wallet-backup.timer
|
||||
litecoin_backup_timer_oncalendar: '*-*-* 03:00:00'
|
||||
litecoin_restic_check_timer: litecoin-restic-check.timer
|
||||
litecoin_restic_check_oncalendar: '*-*-01 04:00:00'
|
||||
litecoin_backup_wallet_dir: /var/lib/litecoin/backups
|
||||
litecoin_backup_logrotate: /etc/logrotate.d/litecoin-backup
|
||||
@@ -0,0 +1,4 @@
|
||||
---
|
||||
- name: Reload systemd for litecoin backup
|
||||
ansible.builtin.systemd_service:
|
||||
daemon_reload: true
|
||||
@@ -0,0 +1,124 @@
|
||||
---
|
||||
- name: Create the protected restic environment directory
|
||||
ansible.builtin.file:
|
||||
path: "{{ litecoin_backup_env_dir }}"
|
||||
state: directory
|
||||
owner: root
|
||||
group: root
|
||||
mode: "0700"
|
||||
|
||||
- name: Create the root-only ssh directory for the restic key
|
||||
ansible.builtin.file:
|
||||
path: "{{ litecoin_backup_env_dir }}/.ssh"
|
||||
state: directory
|
||||
owner: root
|
||||
group: root
|
||||
mode: "0700"
|
||||
|
||||
- name: Pin the backup target host key for restic's sftp backend
|
||||
ansible.builtin.lineinfile:
|
||||
path: "{{ litecoin_backup_known_hosts }}"
|
||||
regexp: '^10\.0\.0\.90 ssh-ed25519 '
|
||||
line: "10.0.0.90 {{ litecoin_backup_target_host_key_ed25519 }}"
|
||||
owner: root
|
||||
group: root
|
||||
mode: "0600"
|
||||
create: true
|
||||
|
||||
- name: Install the dedicated ssh client config for the restic sftp backend
|
||||
ansible.builtin.template:
|
||||
src: ssh_config.j2
|
||||
dest: "{{ litecoin_backup_ssh_config }}"
|
||||
owner: root
|
||||
group: root
|
||||
mode: "0600"
|
||||
|
||||
- name: Require the operator-provided restic SSH key
|
||||
ansible.builtin.stat:
|
||||
path: "{{ litecoin_backup_ssh_key }}"
|
||||
register: litecoin_backup_ssh_key_stat
|
||||
|
||||
- name: Fail with a clear message when the restic SSH key is missing
|
||||
ansible.builtin.fail:
|
||||
msg: >-
|
||||
{{ litecoin_backup_ssh_key }} is missing. The operator creates the
|
||||
dedicated CT 114 backup key, authorizes it for gn-backup on
|
||||
ghostnet-ki (source-restricted to 10.0.0.61) and installs the private
|
||||
key here with mode 0600; the public key never enters the repository
|
||||
(GNAI-024 Abschnitt 6 Schritt 0).
|
||||
when: not litecoin_backup_ssh_key_stat.stat.exists
|
||||
|
||||
- name: Verify the restic SSH key permissions
|
||||
ansible.builtin.stat:
|
||||
path: "{{ litecoin_backup_ssh_key }}"
|
||||
register: litecoin_backup_ssh_key_mode
|
||||
|
||||
- name: Assert the restic SSH key is root-only
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- litecoin_backup_ssh_key_mode.stat.mode == "0600"
|
||||
- litecoin_backup_ssh_key_mode.stat.pw_name == "root"
|
||||
fail_msg: "{{ litecoin_backup_ssh_key }} must be root:root 0600."
|
||||
|
||||
- name: Install the daily wallet backup script
|
||||
ansible.builtin.template:
|
||||
src: litecoin-wallet-backup.sh.j2
|
||||
dest: "{{ litecoin_backup_script }}"
|
||||
owner: root
|
||||
group: root
|
||||
mode: "0750"
|
||||
validate: /bin/bash -n %s
|
||||
|
||||
- name: Install the wallet backup systemd service
|
||||
ansible.builtin.template:
|
||||
src: litecoin-wallet-backup.service.j2
|
||||
dest: "/etc/systemd/system/{{ litecoin_backup_service }}"
|
||||
owner: root
|
||||
group: root
|
||||
mode: "0644"
|
||||
notify: Reload systemd for litecoin backup
|
||||
|
||||
- name: Install the daily wallet backup timer
|
||||
ansible.builtin.template:
|
||||
src: litecoin-wallet-backup.timer.j2
|
||||
dest: "/etc/systemd/system/{{ litecoin_backup_timer }}"
|
||||
owner: root
|
||||
group: root
|
||||
mode: "0644"
|
||||
notify: Reload systemd for litecoin backup
|
||||
|
||||
- name: Install the monthly restic check service
|
||||
ansible.builtin.template:
|
||||
src: litecoin-restic-check.service.j2
|
||||
dest: /etc/systemd/system/litecoin-restic-check.service
|
||||
owner: root
|
||||
group: root
|
||||
mode: "0644"
|
||||
notify: Reload systemd for litecoin backup
|
||||
|
||||
- name: Install the monthly restic check timer
|
||||
ansible.builtin.template:
|
||||
src: litecoin-restic-check.timer.j2
|
||||
dest: "/etc/systemd/system/{{ litecoin_restic_check_timer }}"
|
||||
owner: root
|
||||
group: root
|
||||
mode: "0644"
|
||||
notify: Reload systemd for litecoin backup
|
||||
|
||||
- name: Install the backup log logrotate policy
|
||||
ansible.builtin.template:
|
||||
src: litecoin-backup.logrotate.j2
|
||||
dest: "{{ litecoin_backup_logrotate }}"
|
||||
owner: root
|
||||
group: root
|
||||
mode: "0644"
|
||||
|
||||
- name: Enable the backup timers
|
||||
ansible.builtin.systemd_service:
|
||||
name: "{{ item }}"
|
||||
enabled: true
|
||||
state: started
|
||||
daemon_reload: true
|
||||
loop:
|
||||
- "{{ litecoin_backup_timer }}"
|
||||
- "{{ litecoin_restic_check_timer }}"
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
/var/log/litecoin-backup.log {
|
||||
weekly
|
||||
rotate 8
|
||||
compress
|
||||
missingok
|
||||
notifempty
|
||||
copytruncate
|
||||
}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
[Unit]
|
||||
Description=Monthly restic check of the Litecoin wallet backup repository
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
Environment=SSH_AUTH_SOCK=
|
||||
ExecStart=/usr/bin/restic check --read-data-subset=5% -r {{ litecoin_backup_repository }} -o sftp.command="ssh -F {{ litecoin_backup_ssh_config }} {{ litecoin_backup_target_user }}@{{ litecoin_backup_target_host }} -s sftp" --password-file {{ litecoin_backup_password_file }}
|
||||
Nice=10
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
[Unit]
|
||||
Description=Monthly restic repository check for the Litecoin wallet backups
|
||||
|
||||
[Timer]
|
||||
OnCalendar={{ litecoin_restic_check_oncalendar }}
|
||||
Persistent=true
|
||||
|
||||
[Install]
|
||||
WantedBy=timers.target
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
[Unit]
|
||||
Description=Encrypted Litecoin wallet backup to the off-host restic repository
|
||||
After=litecoind.service
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
ExecStart={{ litecoin_backup_script }}
|
||||
# Runs as root; the script passes the restic SSH key and known_hosts
|
||||
# explicitly via restic's sftp.command (ssh ignores $HOME for ~).
|
||||
Environment=SSH_AUTH_SOCK=
|
||||
Nice=10
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
#!/bin/bash
|
||||
# Managed by Ansible role litecoin_backup.
|
||||
# Daily wallet backup: backupwallet as the litecoin user, then a
|
||||
# client-side encrypted restic backup of backups/ only (never the chain —
|
||||
# a restore re-syncs the chain and then restores wallet.dat). Secrets stay
|
||||
# in {{ litecoin_backup_password_file }} (root-only) and the dedicated SSH key;
|
||||
# nothing is written to logs or the repository.
|
||||
set -Eeuo pipefail
|
||||
|
||||
export RESTIC_REPOSITORY="{{ litecoin_backup_repository }}"
|
||||
export RESTIC_PASSWORD_FILE="{{ litecoin_backup_password_file }}"
|
||||
|
||||
# ssh resolves ~ from the passwd entry, not from $HOME, so the restic sftp
|
||||
# backend gets a dedicated client config via sftp.command.
|
||||
# restic 0.18: sftp.command is the COMPLETE ssh invocation (host and
|
||||
# -s sftp included); restic does not append them when the option is set.
|
||||
SFTP_COMMAND="ssh -F {{ litecoin_backup_ssh_config }} {{ litecoin_backup_target_user }}@{{ litecoin_backup_target_host }} -s sftp"
|
||||
|
||||
backup_dir="{{ litecoin_backup_wallet_dir }}"
|
||||
today="$(date +%F)"
|
||||
|
||||
/usr/sbin/runuser -u litecoin -- \
|
||||
/opt/litecoin/bin/litecoin-cli -conf=/etc/litecoin/litecoin.conf \
|
||||
backupwallet "${backup_dir}/wallet-${today}"
|
||||
|
||||
/usr/bin/restic backup "$backup_dir" \
|
||||
-r "$RESTIC_REPOSITORY" \
|
||||
-o "sftp.command=$SFTP_COMMAND" \
|
||||
--password-file "$RESTIC_PASSWORD_FILE"
|
||||
|
||||
/usr/bin/restic forget --keep-daily {{ litecoin_backup_keep_daily }} --prune \
|
||||
-r "$RESTIC_REPOSITORY" \
|
||||
-o "sftp.command=$SFTP_COMMAND" \
|
||||
--password-file "$RESTIC_PASSWORD_FILE"
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
[Unit]
|
||||
Description=Daily encrypted Litecoin wallet backup (03:00)
|
||||
|
||||
[Timer]
|
||||
OnCalendar={{ litecoin_backup_timer_oncalendar }}
|
||||
Persistent=true
|
||||
|
||||
[Install]
|
||||
WantedBy=timers.target
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
# Managed by Ansible role litecoin_backup.
|
||||
# Dedicated ssh client config for the restic sftp backend (restic runs
|
||||
# `ssh -F <this file> gn-backup@10.0.0.90 -s sftp`); ssh resolves ~ from
|
||||
# the passwd entry, so all paths are absolute.
|
||||
Host {{ litecoin_backup_target_host }}
|
||||
HostName {{ litecoin_backup_target_host }}
|
||||
User {{ litecoin_backup_target_user }}
|
||||
IdentityFile {{ litecoin_backup_ssh_key }}
|
||||
IdentitiesOnly yes
|
||||
BatchMode yes
|
||||
StrictHostKeyChecking yes
|
||||
UserKnownHostsFile {{ litecoin_backup_known_hosts }}
|
||||
@@ -0,0 +1,16 @@
|
||||
# litecoin_core
|
||||
|
||||
Installs the pinned Litecoin Core release into `/opt/litecoin-<version>` with
|
||||
a stable `/opt/litecoin` symlink. The tarball is fetched over HTTPS from
|
||||
`download.litecoin.org` and verified fail-closed against the pinned SHA-256
|
||||
from the signed `SHA256SUMS.asc` (v0.21.5.8, see GNAI-024 Abschnitt 2 Befund
|
||||
a); the role then asserts `litecoind --version`.
|
||||
|
||||
`litecoin.conf` is Tor-only (`proxy=127.0.0.1:9050`, `onlynet=onion`,
|
||||
`listen=0`, no seeds/UPNP/NAT-PMP), RPC on `127.0.0.1:9332` with cookie auth
|
||||
(no `rpcpassword`, no `rpcauth` material in any file — the node is only ever
|
||||
administered as the `litecoin` user over SSH exec, GNAI-024 Befund d/e).
|
||||
`litecoind.service` runs as `litecoin` with systemd hardening; the service is
|
||||
enabled and started only when the inventory sets
|
||||
`litecoin_service_start_allowed: true` (production). debug.log is rotated
|
||||
weekly (copytruncate).
|
||||
@@ -0,0 +1,27 @@
|
||||
---
|
||||
litecoin_core_version: 0.21.5.8
|
||||
litecoin_core_tarball_name: "litecoin-{{ litecoin_core_version }}-x86_64-linux-gnu.tar.gz"
|
||||
litecoin_core_base_url: "https://download.litecoin.org/litecoin-{{ litecoin_core_version }}/linux"
|
||||
# SHA-256 from the signed SHA256SUMS.asc (GNAI-024 Abschnitt 2 Befund a).
|
||||
litecoin_core_tarball_sha256: >-
|
||||
43200c9f9d65ebc126ea5833ca9429e144c4b3273da6bb9f4e89fd7450ab1be9
|
||||
|
||||
litecoin_core_install_root: /opt
|
||||
litecoin_core_versioned_dir: "{{ litecoin_core_install_root }}/litecoin-{{ litecoin_core_version }}"
|
||||
litecoin_core_symlink: "{{ litecoin_core_install_root }}/litecoin"
|
||||
litecoin_core_download_dir: /usr/local/src/litecoin
|
||||
|
||||
litecoin_core_user: litecoin
|
||||
litecoin_core_group: litecoin
|
||||
litecoin_core_datadir: /var/lib/litecoin
|
||||
litecoin_core_config_dir: /etc/litecoin
|
||||
litecoin_core_config: "{{ litecoin_core_config_dir }}/litecoin.conf"
|
||||
|
||||
# Litecoin mainnet: P2P 9333, RPC 9332 (GNAI-024 Befund c: 8332 ist Bitcoin).
|
||||
litecoin_core_rpc_port: 9332
|
||||
litecoin_core_tor_socks: 127.0.0.1:9050
|
||||
litecoin_core_dbcache_mb: 2048
|
||||
litecoin_core_fallbackfee: 0.0001
|
||||
|
||||
litecoin_core_service_name: litecoind.service
|
||||
litecoin_core_logrotate: /etc/logrotate.d/litecoin
|
||||
@@ -0,0 +1,9 @@
|
||||
---
|
||||
- name: Reload systemd for litecoind
|
||||
ansible.builtin.systemd_service:
|
||||
daemon_reload: true
|
||||
|
||||
- name: Restart litecoind
|
||||
ansible.builtin.systemd_service:
|
||||
name: litecoind.service
|
||||
state: restarted
|
||||
@@ -0,0 +1,91 @@
|
||||
---
|
||||
- name: Require the pinned Litecoin Core tarball checksum
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- litecoin_core_tarball_sha256 is match('^[0-9a-f]{64}$')
|
||||
- litecoin_core_version is match('^0\\.21\\.5\\.[0-9]+$')
|
||||
fail_msg: >-
|
||||
litecoin_core_tarball_sha256 must be a pinned 64-hex SHA-256 from the
|
||||
signed SHA256SUMS.asc and the version must be in the audited 0.21.5.x
|
||||
series (GNAI-024 Abschnitt 2 Befund a).
|
||||
|
||||
- name: Download the pinned Litecoin Core release tarball
|
||||
ansible.builtin.get_url:
|
||||
url: "{{ litecoin_core_base_url }}/{{ litecoin_core_tarball_name }}"
|
||||
dest: "{{ litecoin_core_download_dir }}/{{ litecoin_core_tarball_name }}"
|
||||
checksum: "sha256:{{ litecoin_core_tarball_sha256 }}"
|
||||
mode: "0644"
|
||||
owner: root
|
||||
group: root
|
||||
timeout: 300
|
||||
|
||||
- name: Extract the verified Litecoin Core release
|
||||
ansible.builtin.unarchive:
|
||||
src: "{{ litecoin_core_download_dir }}/{{ litecoin_core_tarball_name }}"
|
||||
dest: "{{ litecoin_core_install_root }}"
|
||||
remote_src: true
|
||||
creates: "{{ litecoin_core_versioned_dir }}/bin/litecoind"
|
||||
|
||||
- name: Point the stable symlink at the verified version
|
||||
ansible.builtin.file:
|
||||
src: "{{ litecoin_core_versioned_dir }}"
|
||||
dest: "{{ litecoin_core_symlink }}"
|
||||
state: link
|
||||
owner: root
|
||||
group: root
|
||||
|
||||
- name: Verify the installed litecoind binary
|
||||
ansible.builtin.command:
|
||||
argv:
|
||||
- "{{ litecoin_core_symlink }}/bin/litecoind"
|
||||
- --version
|
||||
check_mode: false
|
||||
changed_when: false
|
||||
register: litecoin_core_version_output
|
||||
|
||||
- name: Assert the expected Litecoin Core version
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- "('Litecoin Core version v' ~ litecoin_core_version) in litecoin_core_version_output.stdout"
|
||||
fail_msg: "Unexpected litecoind version: {{ litecoin_core_version_output.stdout }}"
|
||||
|
||||
- name: Install the managed litecoin.conf
|
||||
ansible.builtin.template:
|
||||
src: litecoin.conf.j2
|
||||
dest: "{{ litecoin_core_config }}"
|
||||
owner: root
|
||||
group: "{{ litecoin_core_group }}"
|
||||
mode: "0640"
|
||||
notify: Restart litecoind
|
||||
|
||||
- name: Install the hardened litecoind systemd unit
|
||||
ansible.builtin.template:
|
||||
src: litecoind.service.j2
|
||||
dest: "/etc/systemd/system/{{ litecoin_core_service_name }}"
|
||||
owner: root
|
||||
group: root
|
||||
mode: "0644"
|
||||
notify:
|
||||
- Reload systemd for litecoind
|
||||
- Restart litecoind
|
||||
|
||||
- name: Install the litecoin debug.log logrotate policy
|
||||
ansible.builtin.template:
|
||||
src: litecoin.logrotate.j2
|
||||
dest: "{{ litecoin_core_logrotate }}"
|
||||
owner: root
|
||||
group: root
|
||||
mode: "0644"
|
||||
|
||||
- name: Enable litecoind without starting it yet
|
||||
ansible.builtin.systemd_service:
|
||||
name: "{{ litecoin_core_service_name }}"
|
||||
enabled: true
|
||||
state: "{{ 'started' if litecoin_service_start_allowed | bool else 'stopped' }}"
|
||||
daemon_reload: true
|
||||
|
||||
- name: Start litecoind when the inventory allows it
|
||||
ansible.builtin.systemd_service:
|
||||
name: "{{ litecoin_core_service_name }}"
|
||||
state: started
|
||||
when: litecoin_service_start_allowed | bool
|
||||
+32
@@ -0,0 +1,32 @@
|
||||
# Managed by Ansible role litecoin_core. No credentials in this file:
|
||||
# RPC is cookie-authenticated and bound to loopback only (GNAI-024 Befund d/e).
|
||||
|
||||
# --- Network: ALL traffic via Tor (SOCKS5), no inbound, our IP never exposed ---
|
||||
# GNAI-024 Befund k (2026-11-27): the compiled-in onion seeds of v0.21.5.8 are
|
||||
# unreachable ("host unreachable" via Tor while clearnet-via-Tor works), so
|
||||
# onlynet=onion would leave the node peerless forever. With proxy set, DNS
|
||||
# seeds and clearnet peers are reached through Tor exit relays; listen=0 and
|
||||
# discover=0 keep the node dial-out only.
|
||||
proxy={{ litecoin_core_tor_socks }}
|
||||
listen=0
|
||||
discover=0
|
||||
upnp=0
|
||||
natpmp=0
|
||||
|
||||
# --- RPC: loopback only, cookie auth, no stored credentials ---
|
||||
server=1
|
||||
rpcbind=127.0.0.1
|
||||
rpcallowip=127.0.0.1
|
||||
rpcport={{ litecoin_core_rpc_port }}
|
||||
rpcthreads=4
|
||||
|
||||
# --- Chain / wallet ---
|
||||
datadir={{ litecoin_core_datadir }}
|
||||
dbcache={{ litecoin_core_dbcache_mb }}
|
||||
txindex=0
|
||||
wallet=cold
|
||||
fallbackfee={{ litecoin_core_fallbackfee }}
|
||||
# MWEB stays usable locally, but addresses handed to exchanges or services
|
||||
# (Bitpanda, Rapidgator) must always be legacy/bech32, never ltcmweb1...
|
||||
# (GNAI-024 Abschnitt 2 Befund f).
|
||||
prune=0
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
{{ litecoin_core_datadir }}/debug.log {
|
||||
weekly
|
||||
rotate 4
|
||||
compress
|
||||
missingok
|
||||
notifempty
|
||||
copytruncate
|
||||
}
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
[Unit]
|
||||
Description=Litecoin Core full node (Tor-only cold wallet)
|
||||
After=network-online.target tor.service
|
||||
Wants=network-online.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
User={{ litecoin_core_user }}
|
||||
Group={{ litecoin_core_group }}
|
||||
ExecStart={{ litecoin_core_symlink }}/bin/litecoind -conf={{ litecoin_core_config }} -datadir={{ litecoin_core_datadir }}
|
||||
Restart=on-failure
|
||||
RestartSec=30
|
||||
TimeoutStopSec=120
|
||||
KillSignal=SIGINT
|
||||
|
||||
# Hardening
|
||||
NoNewPrivileges=true
|
||||
ProtectSystem=strict
|
||||
ProtectHome=true
|
||||
PrivateTmp=true
|
||||
PrivateDevices=true
|
||||
ProtectKernelTunables=true
|
||||
ProtectKernelModules=true
|
||||
ProtectControlGroups=true
|
||||
RestrictAddressFamilies=AF_INET AF_INET6 AF_UNIX
|
||||
RestrictNamespaces=true
|
||||
LockPersonality=true
|
||||
MemoryDenyWriteExecute=true
|
||||
CapabilityBoundingSet=
|
||||
AmbientCapabilities=
|
||||
ReadWritePaths={{ litecoin_core_datadir }}
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
@@ -0,0 +1,7 @@
|
||||
# litecoin_fail2ban
|
||||
|
||||
Native fail2ban (apt, no Podman on CT 114) with the sshd jail on the systemd
|
||||
backend (Debian 13 LXC has no rsyslog), banning via `nftables-multiport`.
|
||||
Management networks (LAN, WireGuard) are on `ignoreip`; the jail is verified
|
||||
with `fail2ban-client status sshd`. Mirrors the CT 103 fail2ban abnahme
|
||||
without the NPM-specific jails.
|
||||
@@ -0,0 +1,7 @@
|
||||
---
|
||||
litecoin_fail2ban_jail_dropin: /etc/fail2ban/jail.d/00-ghostnet-litecoin.conf
|
||||
litecoin_fail2ban_bantime: 1h
|
||||
litecoin_fail2ban_findtime: 10m
|
||||
litecoin_fail2ban_maxretry: 3
|
||||
# Management networks are trusted; only brute force from elsewhere is banned.
|
||||
litecoin_fail2ban_ignoreip: 127.0.0.1/8 10.0.0.0/24 10.8.0.0/24
|
||||
@@ -0,0 +1,5 @@
|
||||
---
|
||||
- name: Restart fail2ban
|
||||
ansible.builtin.systemd_service:
|
||||
name: fail2ban.service
|
||||
state: restarted
|
||||
@@ -0,0 +1,33 @@
|
||||
---
|
||||
- name: Install the Ghostnet fail2ban jail drop-in
|
||||
ansible.builtin.template:
|
||||
src: jail.local.j2
|
||||
dest: "{{ litecoin_fail2ban_jail_dropin }}"
|
||||
owner: root
|
||||
group: root
|
||||
mode: "0644"
|
||||
notify: Restart fail2ban
|
||||
|
||||
- name: Enable and start fail2ban
|
||||
ansible.builtin.systemd_service:
|
||||
name: fail2ban.service
|
||||
enabled: true
|
||||
state: started
|
||||
|
||||
- name: Read the fail2ban sshd jail status
|
||||
ansible.builtin.command:
|
||||
argv:
|
||||
- /usr/bin/fail2ban-client
|
||||
- status
|
||||
- sshd
|
||||
check_mode: false
|
||||
changed_when: false
|
||||
register: litecoin_fail2ban_sshd_status
|
||||
when: not ansible_check_mode
|
||||
|
||||
- name: Verify the sshd jail is active
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- "litecoin_fail2ban_sshd_status.stdout is search('Status for the jail: sshd')"
|
||||
- "litecoin_fail2ban_sshd_status.stdout is search('Journal matches')"
|
||||
when: not ansible_check_mode
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
# Managed by Ansible role litecoin_fail2ban.
|
||||
# Debian 13 has no rsyslog in the LXC; the sshd jail reads the journal.
|
||||
[DEFAULT]
|
||||
backend = systemd
|
||||
bantime = {{ litecoin_fail2ban_bantime }}
|
||||
findtime = {{ litecoin_fail2ban_findtime }}
|
||||
maxretry = {{ litecoin_fail2ban_maxretry }}
|
||||
ignoreip = {{ litecoin_fail2ban_ignoreip }}
|
||||
action = nftables-multiport[port="ssh", protocol=tcp]
|
||||
|
||||
[sshd]
|
||||
enabled = true
|
||||
port = ssh
|
||||
logpath = %(sshd_log)s
|
||||
backend = systemd
|
||||
@@ -0,0 +1,9 @@
|
||||
# litecoin_firewall
|
||||
|
||||
Native nftables policy for CT 114 (repo convention: nftables, not ufw —
|
||||
GNAI-024 Abschnitt 2 Befund b): `inet ghostnet_filter` with default-deny
|
||||
input, loopback and established traffic accepted, ICMP diagnostics, SSH (TCP
|
||||
22) only from the management networks (`10.0.0.0/24`, `10.8.0.0/24`), output
|
||||
accepted (the Tor client needs outbound), forward dropped. No port of
|
||||
litecoind (P2P 9333, RPC 9332) is ever opened; the service override destroys
|
||||
only the Ghostnet-owned table on service stop.
|
||||
@@ -0,0 +1,5 @@
|
||||
---
|
||||
litecoin_firewall_management_ipv4:
|
||||
- 10.0.0.0/24
|
||||
- 10.8.0.0/24
|
||||
litecoin_firewall_ssh_port: 22
|
||||
@@ -0,0 +1,9 @@
|
||||
---
|
||||
- name: Reload systemd for the Litecoin firewall
|
||||
ansible.builtin.systemd_service:
|
||||
daemon_reload: true
|
||||
|
||||
- name: Restart the Litecoin firewall
|
||||
ansible.builtin.systemd_service:
|
||||
name: nftables.service
|
||||
state: restarted
|
||||
@@ -0,0 +1,93 @@
|
||||
---
|
||||
- name: Require a non-empty management allowlist
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- litecoin_firewall_management_ipv4 | length > 0
|
||||
fail_msg: The firewall management allowlist must be explicit and non-empty.
|
||||
|
||||
- name: Read the active Ansible SSH transport endpoints
|
||||
become: false
|
||||
ansible.builtin.command:
|
||||
argv:
|
||||
- /usr/bin/printenv
|
||||
- SSH_CONNECTION
|
||||
check_mode: false
|
||||
changed_when: false
|
||||
register: litecoin_firewall_ssh_connection
|
||||
|
||||
- name: Require the active Ansible SSH source in the management allowlist
|
||||
ansible.builtin.command:
|
||||
argv: >-
|
||||
{{
|
||||
[
|
||||
'/usr/bin/python3',
|
||||
'-c',
|
||||
'import ipaddress,sys; address=ipaddress.ip_address(sys.argv[1]); raise SystemExit(0 if any(address in ipaddress.ip_network(network) for network in sys.argv[2:]) else 1)',
|
||||
litecoin_firewall_ssh_connection.stdout.split()[0]
|
||||
] + litecoin_firewall_management_ipv4
|
||||
}}
|
||||
check_mode: false
|
||||
changed_when: false
|
||||
vars:
|
||||
ansible_command_timeout: 5
|
||||
|
||||
- name: Create the nftables service override directory
|
||||
ansible.builtin.file:
|
||||
path: /etc/systemd/system/nftables.service.d
|
||||
state: directory
|
||||
owner: root
|
||||
group: root
|
||||
mode: "0755"
|
||||
|
||||
- name: Install the scoped nftables stop override
|
||||
ansible.builtin.template:
|
||||
src: nftables.service-override.conf.j2
|
||||
dest: /etc/systemd/system/nftables.service.d/10-ghostnet-preserve.conf
|
||||
owner: root
|
||||
group: root
|
||||
mode: "0644"
|
||||
notify:
|
||||
- Reload systemd for the Litecoin firewall
|
||||
- Restart the Litecoin firewall
|
||||
|
||||
- name: Install and validate the Litecoin nftables policy
|
||||
ansible.builtin.template:
|
||||
src: nftables.conf.j2
|
||||
dest: /etc/nftables.conf
|
||||
owner: root
|
||||
group: root
|
||||
mode: "0750"
|
||||
validate: /usr/sbin/nft --check --file %s
|
||||
notify: Restart the Litecoin firewall
|
||||
|
||||
- name: Flush firewall handlers before verification
|
||||
ansible.builtin.meta: flush_handlers
|
||||
|
||||
- name: Enable and start the nftables service
|
||||
ansible.builtin.systemd_service:
|
||||
name: nftables.service
|
||||
enabled: true
|
||||
state: started
|
||||
daemon_reload: true
|
||||
|
||||
- name: Read the active Ghostnet nftables table
|
||||
ansible.builtin.command:
|
||||
argv:
|
||||
- /usr/sbin/nft
|
||||
- list
|
||||
- table
|
||||
- inet
|
||||
- ghostnet_filter
|
||||
check_mode: false
|
||||
changed_when: false
|
||||
register: litecoin_firewall_active_table
|
||||
when: not ansible_check_mode
|
||||
|
||||
- name: Verify the active firewall policy
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- litecoin_firewall_active_table.stdout is search('policy drop')
|
||||
- litecoin_firewall_active_table.stdout is search('SSH management')
|
||||
- litecoin_firewall_active_table.stdout is search('default input deny')
|
||||
- litecoin_firewall_active_table.stdout is search('CT 114 forwards nothing')
|
||||
when: not ansible_check_mode
|
||||
+43
@@ -0,0 +1,43 @@
|
||||
#!/usr/sbin/nft -f
|
||||
|
||||
# Managed by Ansible role litecoin_firewall.
|
||||
# CT 114 runs no public service: default-deny input, SSH from the management
|
||||
# networks only, no P2P (9333) and no RPC (9332) listener exposed. The node
|
||||
# reaches the Litecoin network exclusively as a Tor client (outbound only).
|
||||
destroy table inet ghostnet_filter
|
||||
|
||||
table inet ghostnet_filter {
|
||||
set management_ipv4 {
|
||||
type ipv4_addr
|
||||
flags interval
|
||||
elements = { {{ litecoin_firewall_management_ipv4 | join(', ') }} }
|
||||
}
|
||||
|
||||
chain input {
|
||||
type filter hook input priority 10; policy drop;
|
||||
|
||||
iifname "lo" counter accept comment "local loopback"
|
||||
ct state established,related counter accept
|
||||
ct state invalid counter drop
|
||||
|
||||
meta l4proto icmp counter accept comment "IPv4 diagnostics"
|
||||
meta l4proto ipv6-icmp counter accept comment "IPv6 neighbor discovery"
|
||||
|
||||
ip saddr @management_ipv4 tcp dport {{ litecoin_firewall_ssh_port }} ct state new counter accept comment "SSH management"
|
||||
|
||||
counter drop comment "default input deny"
|
||||
}
|
||||
|
||||
chain forward {
|
||||
type filter hook forward priority 10; policy drop;
|
||||
|
||||
ct state invalid counter drop
|
||||
counter drop comment "CT 114 forwards nothing"
|
||||
}
|
||||
|
||||
chain output {
|
||||
type filter hook output priority 10; policy accept;
|
||||
}
|
||||
}
|
||||
|
||||
{{ '' }}
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
[Service]
|
||||
# Keep the Ghostnet table across service stops; only the owned table is
|
||||
# destroyed so a restart does not leave the host unfiltered.
|
||||
ExecStop=
|
||||
ExecStop=/usr/sbin/nft destroy table inet ghostnet_filter
|
||||
{{ '\n' }}
|
||||
@@ -0,0 +1,11 @@
|
||||
# litecoin_lxc_baseline
|
||||
|
||||
Baseline role for CT 114 (`ltc-node`, 10.0.0.61): identity assertion against
|
||||
the inventory safeguards, base packages (incl. `tor`, `fail2ban`, `restic`,
|
||||
`unattended-upgrades`), the locked `litecoin` service account (UID/GID 1100,
|
||||
`nologin`, no supplementary groups), timezone `Europe/Berlin`, protected
|
||||
directories and security-only unattended-upgrades. Mirrors
|
||||
`keycloak_lxc_baseline` / `dns_lxc_baseline`.
|
||||
|
||||
The role never installs keys, secrets or application state; that belongs to
|
||||
`litecoin_access`, `litecoin_core` and `litecoin_backup`.
|
||||
+43
@@ -0,0 +1,43 @@
|
||||
---
|
||||
litecoin_lxc_baseline_timezone: Europe/Berlin
|
||||
|
||||
litecoin_lxc_baseline_packages:
|
||||
- ca-certificates
|
||||
- curl
|
||||
- fail2ban
|
||||
- gnupg
|
||||
- logrotate
|
||||
- nftables
|
||||
- openssh-server
|
||||
- python3
|
||||
- restic
|
||||
- sudo
|
||||
- tor
|
||||
- unattended-upgrades
|
||||
|
||||
litecoin_lxc_baseline_directories:
|
||||
- path: /etc/litecoin
|
||||
owner: root
|
||||
group: litecoin
|
||||
mode: "0750"
|
||||
- path: /etc/litecoin-backup
|
||||
owner: root
|
||||
group: root
|
||||
mode: "0700"
|
||||
# /opt/litecoin is the versioned symlink managed by litecoin_core, not a
|
||||
# directory created here.
|
||||
- path: /usr/local/src/litecoin
|
||||
owner: root
|
||||
group: root
|
||||
mode: "0700"
|
||||
- path: /var/lib/litecoin
|
||||
owner: litecoin
|
||||
group: litecoin
|
||||
mode: "0700"
|
||||
- path: /var/lib/litecoin/backups
|
||||
owner: litecoin
|
||||
group: litecoin
|
||||
mode: "0700"
|
||||
|
||||
litecoin_lxc_baseline_unattended_upgrades_allowed_origins: >-
|
||||
Debian:${distro_codename} ${distro_codename}-security
|
||||
+1
@@ -0,0 +1 @@
|
||||
---
|
||||
+106
@@ -0,0 +1,106 @@
|
||||
---
|
||||
- name: Verify the Litecoin LXC identity before changing baseline state
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- ansible_facts["hostname"] == litecoin_lxc_baseline_expected_hostname
|
||||
- >-
|
||||
ansible_facts["distribution"] ==
|
||||
litecoin_lxc_baseline_expected_distribution
|
||||
- >-
|
||||
ansible_facts["distribution_major_version"] ==
|
||||
litecoin_lxc_baseline_expected_distribution_major_version
|
||||
- >-
|
||||
ansible_facts["default_ipv4"]["address"] ==
|
||||
litecoin_lxc_baseline_expected_ipv4
|
||||
- >-
|
||||
ansible_facts["virtualization_type"] ==
|
||||
litecoin_lxc_baseline_expected_virtualization_type
|
||||
- ansible_facts["virtualization_role"] == "guest"
|
||||
- ansible_facts["service_mgr"] == "systemd"
|
||||
fail_msg: >-
|
||||
The connected system is not the declared CT 114 Litecoin LXC. No
|
||||
baseline changes may be applied.
|
||||
|
||||
- name: Install baseline administration packages
|
||||
ansible.builtin.apt:
|
||||
name: "{{ litecoin_lxc_baseline_packages }}"
|
||||
state: present
|
||||
update_cache: true
|
||||
cache_valid_time: 3600
|
||||
install_recommends: false
|
||||
|
||||
- name: Create the fixed primary group for the Litecoin service account
|
||||
ansible.builtin.group:
|
||||
name: litecoin
|
||||
gid: 1100
|
||||
state: present
|
||||
system: true
|
||||
|
||||
- name: Create the locked Litecoin service account without login shell
|
||||
ansible.builtin.user:
|
||||
name: litecoin
|
||||
uid: 1100
|
||||
group: litecoin
|
||||
home: /var/lib/litecoin
|
||||
shell: /usr/sbin/nologin
|
||||
create_home: false
|
||||
state: present
|
||||
system: true
|
||||
password_lock: true
|
||||
|
||||
- name: Set the local timezone database link
|
||||
ansible.builtin.file:
|
||||
src: "/usr/share/zoneinfo/{{ litecoin_lxc_baseline_timezone }}"
|
||||
dest: /etc/localtime
|
||||
state: link
|
||||
owner: root
|
||||
group: root
|
||||
force: true
|
||||
|
||||
- name: Record the configured timezone
|
||||
ansible.builtin.copy:
|
||||
content: "{{ litecoin_lxc_baseline_timezone }}\n"
|
||||
dest: /etc/timezone
|
||||
owner: root
|
||||
group: root
|
||||
mode: "0644"
|
||||
|
||||
- name: Create protected Litecoin configuration and data paths
|
||||
ansible.builtin.file:
|
||||
path: "{{ item.path }}"
|
||||
state: directory
|
||||
owner: "{{ item.owner }}"
|
||||
group: "{{ item.group }}"
|
||||
mode: "{{ item.mode }}"
|
||||
loop: "{{ litecoin_lxc_baseline_directories }}"
|
||||
loop_control:
|
||||
label: "{{ item.path }}"
|
||||
|
||||
- name: Mask LXC-incompatible mount units (CT 114 runs without nesting)
|
||||
ansible.builtin.systemd_service:
|
||||
name: "{{ item }}"
|
||||
masked: true
|
||||
state: stopped
|
||||
loop:
|
||||
- dev-mqueue.mount
|
||||
- run-lock.mount
|
||||
- tmp.mount
|
||||
|
||||
- name: Enable and start the unattended-upgrades service (CT 100/102 convention)
|
||||
ansible.builtin.systemd_service:
|
||||
name: unattended-upgrades.service
|
||||
enabled: true
|
||||
state: started
|
||||
|
||||
- name: Restrict unattended-upgrades to Debian security origins
|
||||
ansible.builtin.copy:
|
||||
content: |-
|
||||
Unattended-Upgrade::Origins-Pattern {
|
||||
"origin=Debian,codename=${distro_codename},label=Debian-Security";
|
||||
};
|
||||
Unattended-Upgrade::AutoFixInterruptedDpkg "true";
|
||||
Unattended-Upgrade::Remove-Unused-Dependencies "true";
|
||||
dest: /etc/apt/apt.conf.d/52ghostnet-unattended-upgrades
|
||||
owner: root
|
||||
group: root
|
||||
mode: "0644"
|
||||
@@ -0,0 +1,8 @@
|
||||
# litecoin_tor
|
||||
|
||||
Local-only Tor client in CT 114. `tor` runs as `debian-tor`, client-only
|
||||
(`ClientOnly 1`, no OR/Dir/Exit), SOCKS on `127.0.0.1:9050` and ControlPort
|
||||
on `127.0.0.1:9051`, both loopback-only. `litecoind` is configured with
|
||||
`proxy=127.0.0.1:9050` and `onlynet=onion`, so all P2P traffic leaves via
|
||||
Tor and the node accepts no inbound connections (`listen=0`). The role
|
||||
waits for the SOCKS port and reports the bootstrap phase.
|
||||
@@ -0,0 +1,6 @@
|
||||
---
|
||||
litecoin_tor_socks_port: 127.0.0.1:9050
|
||||
litecoin_tor_control_port: 127.0.0.1:9051
|
||||
litecoin_tor_data_directory: /var/lib/tor
|
||||
litecoin_tor_config: /etc/tor/torrc
|
||||
litecoin_tor_log: /var/log/tor/notices.log
|
||||
@@ -0,0 +1,5 @@
|
||||
---
|
||||
- name: Restart tor
|
||||
ansible.builtin.systemd_service:
|
||||
name: tor.service
|
||||
state: restarted
|
||||
@@ -0,0 +1,56 @@
|
||||
---
|
||||
- name: Create the tor runtime directory
|
||||
ansible.builtin.file:
|
||||
path: /run/tor
|
||||
state: directory
|
||||
owner: debian-tor
|
||||
group: debian-tor
|
||||
mode: "0750"
|
||||
|
||||
- name: Install the managed Tor client configuration
|
||||
ansible.builtin.template:
|
||||
src: torrc.j2
|
||||
dest: "{{ litecoin_tor_config }}"
|
||||
owner: debian-tor
|
||||
group: debian-tor
|
||||
mode: "0640"
|
||||
validate: /usr/bin/tor --verify-config -f %s
|
||||
notify: Restart tor
|
||||
|
||||
- name: Create the tor log directory
|
||||
ansible.builtin.file:
|
||||
path: /var/log/tor
|
||||
state: directory
|
||||
owner: debian-tor
|
||||
group: debian-tor
|
||||
mode: "0750"
|
||||
|
||||
- name: Enable and start the Tor client service
|
||||
ansible.builtin.systemd_service:
|
||||
name: tor.service
|
||||
enabled: true
|
||||
state: started
|
||||
|
||||
- name: Wait for the Tor SOCKS port on loopback
|
||||
ansible.builtin.wait_for:
|
||||
host: 127.0.0.1
|
||||
port: 9050
|
||||
timeout: 120
|
||||
when: not ansible_check_mode
|
||||
|
||||
- name: Read the Tor bootstrap status from the journal (tor@default)
|
||||
ansible.builtin.shell: |
|
||||
/usr/bin/journalctl -u tor@default.service --no-pager --output=cat \
|
||||
| /usr/bin/grep -E 'Bootstrapped [0-9]+%' | tail -n 1
|
||||
args:
|
||||
executable: /bin/bash
|
||||
check_mode: false
|
||||
changed_when: false
|
||||
failed_when: false
|
||||
register: litecoin_tor_bootstrap
|
||||
when: not ansible_check_mode
|
||||
|
||||
- name: Report the Tor bootstrap phase
|
||||
ansible.builtin.debug:
|
||||
msg: "{{ litecoin_tor_bootstrap.stdout_lines | default(['check mode: skipped']) | last | default('no bootstrap line in journal', true) }}"
|
||||
when: not ansible_check_mode
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user