Files
infrastructure/llm-server/monitoring/ansible/roles/gnmon_firewall/tasks/main.yml
T
spektr fd8e1a5559 GNMON-001 M6 abgenommen: Dashboard oeffentlich via mon.ghostnet.selfhost.eu (Keycloak-OIDC)
Kette: Browser -> https://mon.ghostnet.selfhost.eu (NPM CT-103 ID 14, LE-TLS,
Force SSL, WS-Support, X-Forwarded-Proto/Host + 32k-Puffer) -> 10.0.0.90:8080
(nftables gnmon_firewall: nur von 10.0.0.10) -> Blazor v0.3.2 -> Keycloak
Realm Ghost.net, Client gnai-dashboard, Rollen gnai-dashboard-user/-admin.

Neu/geaendert:
- Rolle gnmon_firewall (nftables auf ghostnet-ki, Policy ACCEPT, 8080 nur
  von NPM, Monitoring-Ports non-loopback-drop), Tag firewall in monitor.yml
- Dashboard-Bind 10.0.0.90:8080 (Assertion: LAN-Bind nur mit Firewall-Tag);
  Image v0.3.2; Playbook-Verifikation akzeptiert 200/302 mit Forwarded-Headern
- App: ClientId gnai-dashboard, Auth:AllowedRoles konfigurierbar,
  KnownNetworks/KnownProxies per .Clear() (leere Initializer = Loopback-Default),
  GetClaimsFromUserInfoEndpoint=true (realm-roles-Mapper-Flags im Realm unset),
  SaveTokens=true (Logout: id_token_hint), Cookie AccessDeniedPath
  /access-denied + Page (sonst Redirect-Loop), csproj PrunePackageData=false +
  Containerfile ohne --no-restore (sonst fehlt blazor.web.js im Image ->
  Blazor-Circuit startet nicht)
- KeycloakRealmRolesClaimTransformation auf ClaimTypes.Role + [gnmon-auth]-Log
- CT-100: Adoption 09.11. (pct exec), Split-DNS mon -> 10.0.0.10 live;
  Befunde gefixt: dns_pihole_hosts_records in allen 3 Inventaren gespiegelt,
  FTLCONF_dns_hosts als eine ';'-gejointe Environment-Zeile (systemd: letzter
  Key gewinnt); gnmon_alloy doppelte Key korrigiert
- Doku: GNMON-000 M6 abgenommen (alle Befunde), GNMON-001 v2.2, GNAI-000
  Monitoring/DNS-Zeilen, GNAI-006 v3.1 (Proxy-Host 14), GNAI-012 Stand

E2E 09.11.2026: unauth -> 302 mit PAR request_uri; Direktzugriff 10.0.0.90:8080
gedroppt; blazor.web.js 200 text/javascript; Login ghost -> Dashboard 200 mit
Live-Daten, Unterseiten + WebSocket ok; testuser ohne Rollen -> saubere 403;
/logout ok; monitor.yml gesamt ok=84 changed=0. Server-Image-Store aufgeraeumt
(v0.3.2 + Rollback v0.2.0/v0.1.0).

Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
2026-11-09 19:34:50 +01:00

69 lines
2.1 KiB
YAML

---
# GNMON-001 section 7: host nftables on ghostnet-ki. System scope only;
# the role is a no-op for the workstation (user scope) inventory.
- name: Validate firewall declarations
ansible.builtin.assert:
that:
- gnmon_firewall_scope in ['user', 'system']
- gnmon_firewall_config_path is match('^/etc/')
- gnmon_firewall_dashboard_port | int >= 1024
- gnmon_firewall_dashboard_allowed_ip is match('^[0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+$')
- gnmon_firewall_loopback_only_ports | length > 0
fail_msg: >-
gnmon_firewall requires scope user|system, an /etc config path, a
dashboard port >= 1024 and a valid NPM ingress IPv4.
when: gnmon_firewall_scope == 'system'
- name: Install nftables (system scope only)
ansible.builtin.apt:
name: nftables
state: present
when: gnmon_firewall_scope == 'system'
- name: Install the managed nftables configuration
ansible.builtin.template:
src: nftables.conf.j2
dest: "{{ gnmon_firewall_config_path }}"
owner: root
group: root
mode: "0644"
validate: "/usr/sbin/nft --check --file %s"
notify: Restart nftables
when: gnmon_firewall_scope == 'system'
- name: Enable and start the nftables service
ansible.builtin.systemd_service:
name: "{{ gnmon_firewall_service_name }}"
enabled: true
state: started
daemon_reload: true
when:
- gnmon_firewall_scope == 'system'
- not ansible_check_mode
- name: Verify the GNMON ruleset is loaded
ansible.builtin.command:
argv:
- /usr/sbin/nft
- list
- ruleset
register: gnmon_firewall_ruleset
changed_when: false
check_mode: false
when:
- gnmon_firewall_scope == 'system'
- not ansible_check_mode
- name: Require the dashboard ingress restriction
ansible.builtin.assert:
that:
- "'gnmon_filter' in gnmon_firewall_ruleset.stdout"
- "('tcp dport ' ~ (gnmon_firewall_dashboard_port | string)) in gnmon_firewall_ruleset.stdout"
fail_msg: >-
The gnmon_filter table or the dashboard port restriction is missing
from the live ruleset.
when:
- gnmon_firewall_scope == 'system'
- not ansible_check_mode