GNAI-025: Befund f revidiert — Upstream-Caddy als interner Edge (:8082), App vollständig bedienbar
ci-static / secret-scan (push) Successful in 21s
ci-static / yamllint (push) Successful in 31s
ci-static / ansible-syntax (push) Successful in 29s
ci-static / markdown-links (push) Successful in 21s

Das app-proxy-only-Routing war unvollständig: der app-proxy ist ein reiner
SPA-Catch-all — /api, /gateway, /media, /admin und Static-Assets fielen auf
ihn zurück, die App konnte keine API-Aufrufe machen.

- fluxer_stack: Caddy-Edge aktiviert (intern, HTTP :8082 via
  FLUXER_CADDY_SITE_ADDRESS=:{{ edge_port }}, kein ACME); gepinnte Caddyfile
  routes alle Pfade zu den Compose-Services; app-proxy 8080 und LiveKit-
  Signaling 7880 nicht mehr gepublisht; caddy-Dep-Kante (Adaption 3) revertiert
- fluxer_firewall: NPM → 8082 (input + DNAT-forward); Verify-Assertionen auf
  den Caddy-Edge umgezogen
- reverse_proxy_fluxer_vhost: NPM → 10.0.0.62:8082 (alles; WS-Upgrade,
  86400 s Timeouts), /livekit/-Location entfernt (caddy routes /livekit)
- Doku: Änderungsverlauf 1.14, Befund f + Zielarchitektur + Abschnitt 5
  und 5a auf den Caddy-Edge-Stand

Verifiziert: /api/auth/sso/status öffentlich HTTP 200 (echte API-Antwort,
SSO enabled=false — Phase 8 steht aus), /admin/login 200, /.well-known/fluxer
200; CT-117- und CT-103-Zweitläufe changed=0.

Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
This commit is contained in:
2026-11-30 05:02:09 +01:00
parent cb42ad363c
commit 51ce267563
9 changed files with 52 additions and 54 deletions
@@ -21,6 +21,7 @@
| 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.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.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` | | 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` |
| 2026-11-30 | 1.14 | Mistral Vibe | **Befund f revidiert — Caddy-Edge als interner Edge aktiviert:** das app-proxy-only-Routing war unvollständig (die SPA lud, aber /api, /gateway, /media, /admin, Static-Assets fielen auf den SPA-Fallback des app-proxy — die App war faktisch nicht bedienbar). NPM bleibt TLS-Edge; der gepinnte Upstream-Caddy läuft auf CT 117 als interner HTTP-Edge auf :8082 (`FLUXER_CADDY_SITE_ADDRESS=:8082`, kein ACME) und routed laut gepinnter Caddyfile alle Pfade zu den Compose-Services. NPM-Vhost: alles → 10.0.0.62:8082 (WS-Upgrade, lange Timeouts), /livekit/-Location entfernt (caddy routed). App-proxy-Port 8080 und LiveKit-Signaling 7880 nicht mehr gepublisht; Firewall: NPM → 8082 (input + DNAT-forward). Verifiziert: `/api/auth/sso/status` öffentlich 200 (echte API-Antwort), `/admin/login` 200, `/.well-known/fluxer` 200; CT-117- und CT-103-Zweitläufe `changed=0` |
## 1. Zweck und Leitentscheidung ## 1. Zweck und Leitentscheidung
@@ -50,21 +51,21 @@ fluxerapp/fluxer, fossengineer.com, selfhostedworld.com):
| 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). | ✅ | | 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 | | 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 | | 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). | ✅ | | f) **Edge/TLS** | **Machbar — Revision 30.11. (1.14): der Upstream-Caddy läuft als interner Edge.** NPM (CT 103) terminiert TLS (Wildcard `*.ghostnet.selfhost.eu`); der gepinnte Upstream-Caddy horcht auf CT 117 als interner HTTP-Edge auf :8082 (kein ACME, keine public 80/443) und routed laut gepinnter Caddyfile `/api`, `/gateway`, `/media`, `/admin`, `/livekit`, Static-Assets und SPA zu den Compose-Services. Erste Annahme „ohne upstream Caddy" (nur app-proxy 8080) war unvollständig: der app-proxy ist ein reiner SPA-Catch-all, API-Pfade fielen auf ihn zurück. Firewall lässt 8082 nur von 10.0.0.10/32 (CT 103) zu. | ✅ |
## 3. Zielarchitektur ## 3. Zielarchitektur
``` ```
Internet ──TLS──> FRITZ!Box (80/443 → CT 103 NPM; optional 7881/tcp, 3478/udp, Internet ──TLS──> FRITZ!Box (80/443 → CT 103 NPM; optional 7881/tcp, 3478/udp,
50000-50100/udp → CT 117 bei Voice) 50000-50100/udp → CT 117 bei Voice)
CT 103 NPM: fluxer.ghostnet.selfhost.eu → 10.0.0.62:8080 (+ /livekit/ → :7880) CT 103 NPM: fluxer.ghostnet.selfhost.eu → 10.0.0.62:8082 (alles)
CT 117 fluxer (10.0.0.62, Debian 13, unprivileged, nesting=1): 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, 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) 8082 (caddy edge) nur von 10.0.0.10, Voice-Ports WAN bei D2=ja)
fluxer-stack.service → podman compose (pinned, pull_policy=never): fluxer-stack.service → podman compose (pinned, pull_policy=never):
app-proxy:8080, livekit:7880(+media), api, gateway, worker, caddy edge :8082 (intern, HTTP) → app-proxy, livekit:7880(+media),
media-proxy, static, admin, shards, postgres, valkey, nats, api, gateway, worker, media-proxy, static, admin, shards,
meilisearch, seaweedfs (caddy edge disabled) postgres, valkey, nats, meilisearch, seaweedfs
Keycloak CT 102: Realm Ghost.net, Client `fluxer` (OIDC-SSO) Keycloak CT 102: Realm Ghost.net, Client `fluxer` (OIDC-SSO)
Pi-hole CT 100: Split-DNS fluxer.ghostnet.selfhost.eu → 10.0.0.10 Pi-hole CT 100: Split-DNS fluxer.ghostnet.selfhost.eu → 10.0.0.10
``` ```
@@ -98,7 +99,7 @@ ist als Ausbaustufe offen (Abschnitt 11).
| Provisioning | `proxmox/lxc/ct-117-fluxer/scripts/provision-ct117-fluxer.sh` | pct create + baseline hook (SHA-256-gepinnt) + configfs-Mask; nie destruktiv | | 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` | | 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 | | 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 | | NPM | `proxmox/lxc/ct-103-reverse-proxy/ansible/roles/reverse_proxy_fluxer_vhost/` | Vhost `fluxer.ghostnet.selfhost.eu` → 10.0.0.62:8082 (interner Caddy-Edge, alles; WS-Upgrade, 86400 s Timeouts), LE-Cert, Fail2Ban-Restart; in CT-103-`site.yml` eingehängt |
| Keycloak | `proxmox/lxc/ct-102-keycloak/.../keycloak_realm_config` | Client `fluxer` (Abschnitt 4) | | Keycloak | `proxmox/lxc/ct-102-keycloak/.../keycloak_realm_config` | Client `fluxer` (Abschnitt 4) |
**Begründete Abweichung vom Quadlet-Schema:** Upstream liefert eine einzige **Begründete Abweichung vom Quadlet-Schema:** Upstream liefert eine einzige
@@ -131,10 +132,11 @@ Loop-Args unzuverlässig):
FLUXER_VAPID_EMAIL, FLUXER_PASSKEY_RP_ID, FLUXER_PASSKEY_ADDITIONAL_ALLOWED_ORIGINS) FLUXER_VAPID_EMAIL, FLUXER_PASSKEY_RP_ID, FLUXER_PASSKEY_ADDITIONAL_ALLOWED_ORIGINS)
— podman-compose zerpflückt nested defaults und lässt Literale wie `}:` — podman-compose zerpflückt nested defaults und lässt Literale wie `}:`
im Container-Env stehen. im Container-Env stehen.
3. **`depends_on: caddy` (app-proxy) entfernt** — mit dem per Override-Profil 3. ~~`depends_on: caddy` (app-proxy) entfernt~~ — **mit 1.14 revertiert:** der
deaktivierten Caddy-Edge crasht podman-compose mit `KeyError: 'caddy'` Caddy-Edge läuft wieder (intern, :8082), die Upstream-Dep-Kante bleibt
in `check_dep_conditions`; die Override zeigt DISCOVERY_UPSTREAM_URL direkt unverändert. (Historisch: mit per Override-Profil deaktiviertem Edge
auf die api. crashte podman-compose mit `KeyError: 'caddy'` in `check_dep_conditions`;
die Override zeigt DISCOVERY_UPSTREAM_URL weiterhin direkt auf die api.)
Zusätzlich gilt für die `.env`: **jede** in der Compose referenzierte Variable 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, muss explizit stehen — auch die mit leerem Upstream-Default (CSP_*, SMTP-Felder,
@@ -13,9 +13,12 @@ reverse_proxy_fluxer_api_env_file: /etc/nginx-proxy-manager/api.env
reverse_proxy_fluxer_domain: fluxer.ghostnet.selfhost.eu reverse_proxy_fluxer_domain: fluxer.ghostnet.selfhost.eu
reverse_proxy_fluxer_upstream_host: 10.0.0.62 reverse_proxy_fluxer_upstream_host: 10.0.0.62
reverse_proxy_fluxer_upstream_port: 8080 # Internal caddy edge on CT 117 (site32-Befund): the pinned upstream Caddyfile
# routes /api, /gateway, /media, /admin, /livekit, static assets and the SPA
# to the compose services — the app-proxy alone returns SPA HTML for API
# paths. NPM terminates TLS and proxies EVERYTHING to caddy on 8082.
reverse_proxy_fluxer_upstream_port: 8082
reverse_proxy_fluxer_upstream_scheme: http reverse_proxy_fluxer_upstream_scheme: http
reverse_proxy_fluxer_livekit_upstream_port: 7880
reverse_proxy_fluxer_letsencrypt_email: ma-koenig@gmx.net reverse_proxy_fluxer_letsencrypt_email: ma-koenig@gmx.net
# No oauth2-proxy IAP in front of Fluxer: the instance is public like any chat # No oauth2-proxy IAP in front of Fluxer: the instance is public like any chat
@@ -28,18 +31,6 @@ reverse_proxy_fluxer_letsencrypt_email: ma-koenig@gmx.net
# generation). WebSocket upgrade headers for the gateway and LiveKit # generation). WebSocket upgrade headers for the gateway and LiveKit
# signaling; long timeouts for long-lived WS connections. # signaling; long timeouts for long-lived WS connections.
reverse_proxy_fluxer_advanced_config: | 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 / { location / {
proxy_pass http://{{ reverse_proxy_fluxer_upstream_host }}:{{ reverse_proxy_fluxer_upstream_port }}; proxy_pass http://{{ reverse_proxy_fluxer_upstream_host }}:{{ reverse_proxy_fluxer_upstream_port }};
proxy_set_header Host $host; proxy_set_header Host $host;
@@ -10,8 +10,10 @@ fluxer_firewall_reverse_proxy_ipv4: 10.0.0.10/32
# 10.89.0.1:53 + inter-container traffic must pass the CT firewall) # 10.89.0.1:53 + inter-container traffic must pass the CT firewall)
fluxer_firewall_podman_subnet: 10.89.0.0/16 fluxer_firewall_podman_subnet: 10.89.0.0/16
fluxer_firewall_podman_dns_ip: 10.89.0.1 fluxer_firewall_podman_dns_ip: 10.89.0.1
fluxer_firewall_app_proxy_port: 8080 # Internal caddy edge (site32-Befund): the ONLY HTTP port published for NPM;
fluxer_firewall_livekit_signaling_port: 7880 # the pinned Caddyfile routes /api, /gateway, /media, /admin, /livekit and
# the SPA from there.
fluxer_firewall_edge_port: 8082
# Voice/video media (LiveKit) is published on the CT IP and must be reachable # Voice/video media (LiveKit) is published on the CT IP and must be reachable
# from the internet; the FRITZ!Box forwards these ports to 10.0.0.62 # from the internet; the FRITZ!Box forwards these ports to 10.0.0.62
@@ -88,10 +88,10 @@
that: that:
- fluxer_firewall_active_table.stdout is search('policy drop') - fluxer_firewall_active_table.stdout is search('policy drop')
- fluxer_firewall_active_table.stdout is search('SSH management') - fluxer_firewall_active_table.stdout is search('SSH management')
- fluxer_firewall_active_table.stdout is search('Fluxer app-proxy via NPM') - fluxer_firewall_active_table.stdout is search('Fluxer caddy edge via NPM')
- fluxer_firewall_active_table.stdout is search('default input deny') - fluxer_firewall_active_table.stdout is search('default input deny')
- fluxer_firewall_active_table.stdout is search('CT 117 forwards nothing else') - fluxer_firewall_active_table.stdout is search('CT 117 forwards nothing else')
- fluxer_firewall_active_table.stdout is search('podman bridge intra-network') - fluxer_firewall_active_table.stdout is search('podman bridge intra-network')
- fluxer_firewall_active_table.stdout is search('NPM to published Fluxer ports') - fluxer_firewall_active_table.stdout is search('NPM to the published caddy edge')
fail_msg: The active nftables policy does not match the declared CT 117 policy. fail_msg: The active nftables policy does not match the declared CT 117 policy.
when: not ansible_check_mode when: not ansible_check_mode
@@ -2,8 +2,9 @@
# Managed by Ansible role fluxer_firewall. # Managed by Ansible role fluxer_firewall.
# CT 117 runs the Fluxer stack behind NPM (CT 103): default-deny input, SSH # CT 117 runs the Fluxer stack behind NPM (CT 103): default-deny input, SSH
# from the management networks only, HTTP/WebSocket from the reverse proxy # from the management networks only, the internal caddy edge (8082) from the
# only, LiveKit media ports open to the internet iff voice is enabled. # reverse proxy only, LiveKit media ports open to the internet iff voice is
# enabled.
destroy table inet ghostnet_filter destroy table inet ghostnet_filter
table inet ghostnet_filter { table inet ghostnet_filter {
@@ -31,8 +32,7 @@ table inet ghostnet_filter {
ip saddr @management_ipv4 tcp dport {{ fluxer_firewall_ssh_port }} ct state new counter accept comment "SSH management" ip saddr @management_ipv4 tcp dport {{ fluxer_firewall_ssh_port }} ct state new counter accept comment "SSH management"
ip saddr @reverse_proxy_ipv4 tcp dport {{ fluxer_firewall_app_proxy_port }} ct state new counter accept comment "Fluxer app-proxy via NPM" ip saddr @reverse_proxy_ipv4 tcp dport {{ fluxer_firewall_edge_port }} ct state new counter accept comment "Fluxer caddy edge via NPM"
ip saddr @reverse_proxy_ipv4 tcp dport {{ fluxer_firewall_livekit_signaling_port }} ct state new counter accept comment "LiveKit signaling via NPM"
{% if fluxer_stack_voice_enabled %} {% if fluxer_stack_voice_enabled %}
tcp dport {{ fluxer_firewall_livekit_tcp_port }} ct state new counter accept comment "LiveKit ICE TCP (voice)" tcp dport {{ fluxer_firewall_livekit_tcp_port }} ct state new counter accept comment "LiveKit ICE TCP (voice)"
udp dport {{ fluxer_firewall_livekit_udp_port }} counter accept comment "LiveKit UDP (voice)" udp dport {{ fluxer_firewall_livekit_udp_port }} counter accept comment "LiveKit UDP (voice)"
@@ -64,7 +64,7 @@ table inet ghostnet_filter {
# CONTAINER IP inside the podman subnet (site30-Befund) — the input # CONTAINER IP inside the podman subnet (site30-Befund) — the input
# rules above never see it. Allow NPM and (voice) WAN traffic to the # rules above never see it. Allow NPM and (voice) WAN traffic to the
# DNAT'd container destinations here. # DNAT'd container destinations here.
ip saddr @reverse_proxy_ipv4 ip daddr {{ fluxer_firewall_podman_subnet }} tcp dport { {{ fluxer_firewall_app_proxy_port }}, {{ fluxer_firewall_livekit_signaling_port }} } ct state new counter accept comment "NPM to published Fluxer ports (app-proxy, livekit signaling)" ip saddr @reverse_proxy_ipv4 ip daddr {{ fluxer_firewall_podman_subnet }} tcp dport {{ fluxer_firewall_edge_port }} ct state new counter accept comment "NPM to the published caddy edge"
{% if fluxer_stack_voice_enabled %} {% if fluxer_stack_voice_enabled %}
ip daddr {{ fluxer_firewall_podman_subnet }} tcp dport {{ fluxer_firewall_livekit_tcp_port }} ct state new counter accept comment "LiveKit ICE TCP via DNAT (voice)" ip daddr {{ fluxer_firewall_podman_subnet }} tcp dport {{ fluxer_firewall_livekit_tcp_port }} ct state new counter accept comment "LiveKit ICE TCP via DNAT (voice)"
ip daddr {{ fluxer_firewall_podman_subnet }} udp dport { {{ fluxer_firewall_livekit_udp_port }}, {{ fluxer_firewall_livekit_turn_udp_port }} } counter accept comment "LiveKit UDP via DNAT (voice)" ip daddr {{ fluxer_firewall_podman_subnet }} udp dport { {{ fluxer_firewall_livekit_udp_port }}, {{ fluxer_firewall_livekit_turn_udp_port }} } counter accept comment "LiveKit UDP via DNAT (voice)"
@@ -40,10 +40,16 @@ fluxer_stack_images: []
fluxer_stack_public_domain: fluxer.ghostnet.selfhost.eu fluxer_stack_public_domain: fluxer.ghostnet.selfhost.eu
fluxer_stack_public_scheme: https fluxer_stack_public_scheme: https
fluxer_stack_public_port: 443 fluxer_stack_public_port: 443
fluxer_stack_app_proxy_port: 8080 # The upstream Caddy edge runs as the INTERNAL edge on CT 117: NPM (CT 103)
fluxer_stack_livekit_signaling_port: 7880 # terminates TLS and proxies everything to caddy on this port; the pinned
# Caddyfile routes /api, /gateway, /media, /admin, static assets, /livekit
# and the SPA to the compose services. The app-proxy alone cannot serve the
# app: its catch-all returns SPA HTML for API paths (site32-Befund, revised
# Befund f).
fluxer_stack_edge_port: 8082
fluxer_stack_voice_enabled: true fluxer_stack_voice_enabled: true
fluxer_stack_livekit_tcp_port: 7881 fluxer_stack_livekit_tcp_port: 7881
fluxer_stack_livekit_udp_port: 7882
fluxer_stack_livekit_turn_udp_port: 3478 fluxer_stack_livekit_turn_udp_port: 3478
fluxer_stack_livekit_rtp_port_range: 50000-50100 fluxer_stack_livekit_rtp_port_range: 50000-50100
@@ -108,12 +108,6 @@
replace: '${FLUXER_PASSKEY_RP_ID}' replace: '${FLUXER_PASSKEY_RP_ID}'
- regexp: '\$\{FLUXER_PASSKEY_ADDITIONAL_ALLOWED_ORIGINS:-\$\{FLUXER_PUBLIC_SCHEME:-https\}://\$\{FLUXER_DOMAIN\}\}' - regexp: '\$\{FLUXER_PASSKEY_ADDITIONAL_ALLOWED_ORIGINS:-\$\{FLUXER_PUBLIC_SCHEME:-https\}://\$\{FLUXER_DOMAIN\}\}'
replace: '${FLUXER_PASSKEY_ADDITIONAL_ALLOWED_ORIGINS}' replace: '${FLUXER_PASSKEY_ADDITIONAL_ALLOWED_ORIGINS}'
# 3. app-proxy depends_on caddy; with caddy disabled via the override
# profile, podman-compose 1.3.0 crashes with KeyError: 'caddy' in
# check_dep_conditions (site17-Befund). The override points
# DISCOVERY_UPSTREAM_URL directly at the api, so the edge is dead.
- regexp: '^ caddy: .*condition: service_started.*$'
replace: ''
when: not ansible_check_mode when: not ansible_check_mode
notify: notify:
- Restart the Fluxer stack - Restart the Fluxer stack
@@ -3,10 +3,16 @@
# - EVERY service gets its digest-pinned image + pull_policy: never + # - EVERY service gets its digest-pinned image + pull_policy: never +
# journald logging (CT 102/103 pinning convention; images are pre-pulled # journald logging (CT 102/103 pinning convention; images are pre-pulled
# by the role from fluxer_stack_images); # by the role from fluxer_stack_images);
# - the upstream Caddy edge is disabled (NPM on CT 103 is the TLS edge); # - the upstream Caddy edge is ENABLED as the internal edge (HTTP :8082):
# - only app-proxy (8080) and LiveKit (7880 signaling + media ports) are # NPM on CT 103 is the TLS edge and proxies everything to caddy, which
# published on the CT IP; the firewall allows 8080/7880 only from CT 103; # routes /api, /gateway, /media, /admin, static assets, /livekit and the
# - app-proxy discovery points at the api (caddy edge is disabled). # SPA to the compose services per the pinned Caddyfile (the app-proxy
# alone returns SPA HTML for API paths, site32-Befund);
# - only the caddy edge (8082) and the LiveKit media ports are published on
# the CT IP; the firewall allows 8082 only from CT 103 (voice media ports
# are WAN-open per GNAI-025 Befund e);
# - app-proxy discovery points at the api (upstream 8088 route is for the
# public-edge Caddy setup).
# Service names are asserted against the pinned compose by the role. # Service names are asserted against the pinned compose by the role.
x-ghostnet-defaults: &ghostnet-defaults x-ghostnet-defaults: &ghostnet-defaults
pull_policy: never pull_policy: never
@@ -28,17 +34,13 @@ services:
FLUXER_ERLANG_COOKIE: ${FLUXER_ERLANG_COOKIE:?set in .env} FLUXER_ERLANG_COOKIE: ${FLUXER_ERLANG_COOKIE:?set in .env}
{% endif %} {% endif %}
{% if svc == fluxer_stack_service_edge %} {% if svc == fluxer_stack_service_edge %}
profiles: ports:
- ghostnet-disabled-edge - "{{ fluxer_stack_edge_port }}:{{ fluxer_stack_edge_port }}"
ports: []
{% elif svc == fluxer_stack_service_app_proxy %} {% elif svc == fluxer_stack_service_app_proxy %}
environment: environment:
DISCOVERY_UPSTREAM_URL: http://api:8080/api/.well-known/fluxer DISCOVERY_UPSTREAM_URL: http://api:8080/api/.well-known/fluxer
ports:
- "{{ fluxer_stack_app_proxy_port }}:{{ fluxer_stack_app_proxy_port }}"
{% elif svc == fluxer_stack_service_livekit %} {% elif svc == fluxer_stack_service_livekit %}
ports: ports:
- "{{ fluxer_stack_livekit_signaling_port }}:7880"
- "{{ fluxer_stack_livekit_tcp_port }}:{{ fluxer_stack_livekit_tcp_port }}/tcp" - "{{ fluxer_stack_livekit_tcp_port }}:{{ fluxer_stack_livekit_tcp_port }}/tcp"
- "{{ fluxer_stack_livekit_udp_port }}:{{ fluxer_stack_livekit_udp_port }}/udp" - "{{ fluxer_stack_livekit_udp_port }}:{{ fluxer_stack_livekit_udp_port }}/udp"
{% if fluxer_stack_voice_enabled %} {% if fluxer_stack_voice_enabled %}
@@ -4,8 +4,9 @@
# once on this guest, never in git). Verify the variable names against the # once on this guest, never in git). Verify the variable names against the
# pinned upstream .env.example when bumping fluxer_stack_upstream_commit. # pinned upstream .env.example when bumping fluxer_stack_upstream_commit.
FLUXER_DOMAIN={{ fluxer_stack_public_domain }} FLUXER_DOMAIN={{ fluxer_stack_public_domain }}
# required by the compose even with the caddy edge disabled (GNAI-025): # internal caddy edge listener (site32-Befund): NPM is the TLS edge, caddy
FLUXER_CADDY_SITE_ADDRESS={{ fluxer_stack_public_scheme }}://{{ fluxer_stack_public_domain }} # serves plain HTTP on this port only — no ACME, no public 80/443 from here:
FLUXER_CADDY_SITE_ADDRESS=:{{ fluxer_stack_edge_port }}
FLUXER_LIVEKIT_ENABLED={{ 'true' if fluxer_stack_voice_enabled else 'false' }} FLUXER_LIVEKIT_ENABLED={{ 'true' if fluxer_stack_voice_enabled else 'false' }}
# podman-compose 1.3.0 liefert bei manchen ${VAR:-default}-Refs einen Leerstring # podman-compose 1.3.0 liefert bei manchen ${VAR:-default}-Refs einen Leerstring
# durch (hier beobachtet: SSO_ALLOW_PRIVATE_ADDRESSES) — daher explizit gesetzt: # durch (hier beobachtet: SSO_ALLOW_PRIVATE_ADDRESSES) — daher explizit gesetzt: