M1-Sicherheitsabschluss 10.11.2026: Fail2Ban-Abnahme, hostunabhängige LXC-Backups, Keycloak-Stabi + NPM-Rückfalltest, CT 104 entfernt

- Fail2Ban CT 103 funktional abgenommen (Image/Digest, Jails, Filter-Dry-Run,
  kontrollierter Ban/Unban 203.0.113.66 mit nftables-Nachweis, Dienstneustart,
  pct-Reboot); Befund proxy-host-14 im Jail-Glob nach Restart + SOP; frischer
  Rollback-vzdump d4478c85...
- Hostunabhängige LXC-Backups: frische Stop-Mode-vzdumps CT 100/102/103/105,
  Archiv auf ghostnet-ki (gn-backup, quellbeschränkter PVE-Key) mit SHA-256-
  Verifikation, Restore-Test CT 100 -> CT 150 bestanden; deklarative Rollen
  gn_backup_receiver (KI) + pve_lxc_backup_sync (PVE, nächtlicher Timer,
  Prune 4/CT), beide konvergent changed=0
- Keycloak CT 102: 26 Tage stabil (NRestarts=0), Ansible-Drift changed=0,
  praktischer NPM-Rückfalltest auf CT 104 bestanden (Hosts 7/13 -> .16 -> .4);
  danach CT 104 nach Betreiberfreigabe archiviert + entfernt, historische
  CT-102-Altbackups gelöscht (SHA-256 dokumentiert), 10.0.0.16 aus WG-Set
  server_admin_targets entfernt
- WAN/IPv6-Exposure erfasst: WAN nur TCP 80/443 offen, keine AAAA-Records
- Doku: GNAI-000/001/013, GNAI-006/007/012/016, pve-host README, ct-104 README

Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
This commit is contained in:
2026-11-10 19:42:06 +01:00
parent b96be7ae1c
commit 2fe80bc015
23 changed files with 481 additions and 38 deletions
+10 -1
View File
@@ -1,4 +1,13 @@
# CT 104 – Keycloak Podman target
# CT 104 – Keycloak Podman target (historical reference only)
**CT 104 was decommissioned on 2026-11-10** after the stabilization phase and
the practical NPM fallback test passed and the operator gave explicit release
(GNAI-016 Phase F): final archive `vzdump-lxc-104-2026_11_10-19_25_37.tar.zst`
(SHA-256 `985af29b…`, archived on `ghostnet-ki` under
`/var/lib/ghostnet-ai-backup/lxc/`), then `pct destroy 104 --purge`. This
directory remains only as the migration reference for the CT 102 rebuild; the
LXC no longer exists and `10.0.0.16` was removed from the WG gateway target
set on CT 105.
This directory contains reviewed host-level configuration artifacts for CT 104
at `10.0.0.16`. The LXC hostname intentionally remains `keycloak`, so CT ID and
+13
View File
@@ -25,6 +25,19 @@ Aktuell verwaltete Host-State:
- **LXC-Configs**: Entfernen der Ganesha-Ära-`lxc.seccomp.profile:`-Leerzeile
aus `/etc/pve/lxc/101.conf` — Rolle `pve_lxc_conf` (wirksam beim nächsten
CT-Start/Reboot).
- **Hostunabhängige LXC-Backups**: Rolle `pve_lxc_backup_sync` — Skript
`/usr/local/sbin/ghostnet-lxc-backup-sync.sh` plus Timer
`ghostnet-lxc-backup-sync.timer` (täglich 03:30) kopieren alle
`vzdump-lxc-*`-Archive aus `/var/lib/vz/dump` per `tar | ssh` zum
`gn-backup`-Account auf `ghostnet-ki` (`10.0.0.90`, eigene Hardware),
verifizieren jede Archiv-Prüfsumme (SHA-256) auf der Empfängerseite und
prunen auf die 4 neuesten Archive pro CT. Schlüssel:
`/root/.ssh/id_ed25519_ghostnet_backup` (öffentlich in
`ansible/roles/pve_lxc_backup_sync/files/ssh/pve-backup.pub`, auf
ghostnet-ki quellbeschränkt via Rolle `gn_backup_receiver`); KI-Hostkey in
`/root/.ssh/known_hosts` gepinnt. Log:
`/var/log/ghostnet-lxc-backup-sync.log`. Eingerichtet am 10.11.2026
(GNAI-000 Abschnitt 4 Punkt 4; erster Lauf und Restore-Test bestanden).
Die CT-Lebenszyklus-Skripte (`proxmox/lxc/<ct>/scripts/`: `pct create`,
Dist-Upgrade) bleiben Bootstrap-Skripte und laufen einmalig manuell als
@@ -8,3 +8,4 @@
- role: pve_lxc_conf
- role: pve_media_cron
- role: pve_nfs_export
- role: pve_lxc_backup_sync
@@ -0,0 +1,26 @@
# pve_lxc_backup_sync
Nightly host-independent copy of all LXC vzdump archives from
`/var/lib/vz/dump` to the `gn-backup` account on `ghostnet-ki`
(`10.0.0.90:/var/lib/ghostnet-ai-backup/lxc`) — a separate physical host, so
the LXC backups survive a total loss of the PVE host (GNAI-000 section 4,
blocker 4).
- Script `{{ pve_backup_sync_script }}` (systemd oneshot) transfers all
`vzdump-lxc-*` archives and logs via `tar | ssh`, verifies every archive
by SHA-256 on the receiver and prunes the receiver to the newest
`pve_backup_sync_keep_per_ct` (4) archives per CT. Log:
`/var/log/ghostnet-lxc-backup-sync.log`.
- Timer `ghostnet-lxc-backup-sync.timer`, daily 03:30, persistent.
- Auth: dedicated key `/root/.ssh/id_ed25519_ghostnet_backup`
(fingerprint `SHA256:tabCXnfrKhWI2+0F8vZgLqg7JtWn1Xt4ifo8o2KuPNc`), created
once as root@pve; the public key lives in `files/ssh/pve-backup.pub` and
is installed on ghostnet-ki by the `gn_backup_receiver` role there
(source-restricted to `10.0.0.2`). The KI host key is pinned in
`/root/.ssh/known_hosts` by this role (verified 2026-11-10 against the
workstation known_hosts).
First run 2026-11-10 (manual): archives for CT 100/102/103/105 transferred,
SHA-256 match confirmed on the receiver; practical restore test of the
CT 100 archive to scratch CT 150 passed (Pi-hole answered on its test IP,
split-DNS intact, CT 150 destroyed afterwards).
@@ -0,0 +1,22 @@
---
# Host-independent LXC backup copies (GNAI-000 section 4, blocker 4).
# Nightly, the vzdump archives in /var/lib/vz/dump are pushed to the
# dedicated gn-backup account on ghostnet-ki (10.0.0.90, separate physical
# host), verified by SHA-256 and pruned to the newest archives per CT.
pve_backup_sync_source_dir: /var/lib/vz/dump
pve_backup_sync_archive_glob: 'vzdump-lxc-*.tar.zst'
pve_backup_sync_log_glob: 'vzdump-lxc-*.log'
pve_backup_sync_target_host: 10.0.0.90
pve_backup_sync_target_user: gn-backup
pve_backup_sync_target_dir: /var/lib/ghostnet-ai-backup/lxc
pve_backup_sync_ssh_key: /root/.ssh/id_ed25519_ghostnet_backup
pve_backup_sync_known_hosts: /root/.ssh/known_hosts
pve_backup_sync_script: /usr/local/sbin/ghostnet-lxc-backup-sync.sh
pve_backup_sync_log: /var/log/ghostnet-lxc-backup-sync.log
pve_backup_sync_keep_per_ct: 4
pve_backup_sync_timer_oncalendar: '*-*-* 03:30:00'
# ghostnet-ki host key (ed25519), verified 2026-11-10 against the
# workstation known_hosts entry for 10.0.0.90 before first use.
pve_backup_sync_ki_host_key_ed25519: >-
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAID1UMrhG0WoKlRfadNadWdZogijlhjCz8uXfWbjvxuf8
@@ -0,0 +1 @@
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIqx/qtzU4KXBGL0MOTNZoJ6AglcmxClIA/mrOv/mung ghostnet-backup@pve
@@ -0,0 +1,4 @@
---
- name: Reload systemd daemon
ansible.builtin.systemd_service:
daemon_reload: true
@@ -0,0 +1,66 @@
---
- name: Require the PVE backup key to exist (created once as root, see README)
ansible.builtin.stat:
path: "{{ pve_backup_sync_ssh_key }}"
register: pve_backup_sync_key
- name: Fail when the PVE backup key is missing
ansible.builtin.fail:
msg: >-
{{ pve_backup_sync_ssh_key }} is missing. Create it once as root@pve:
ssh-keygen -t ed25519 -N '' -C ghostnet-backup@pve -f {{ pve_backup_sync_ssh_key }}
and authorize the public key for gn-backup on ghostnet-ki.
when: not pve_backup_sync_key.stat.exists
- name: Pin the ghostnet-ki host key for the backup sync
ansible.builtin.lineinfile:
path: "{{ pve_backup_sync_known_hosts }}"
regexp: '^10\.0\.0\.90 ssh-ed25519 '
line: "10.0.0.90 {{ pve_backup_sync_ki_host_key_ed25519 }}"
owner: root
group: root
mode: "0600"
create: true
- name: Install the backup sync script
ansible.builtin.template:
src: ghostnet-lxc-backup-sync.sh.j2
dest: "{{ pve_backup_sync_script }}"
owner: root
group: root
mode: "0750"
- name: Install the backup sync systemd service
ansible.builtin.template:
src: ghostnet-lxc-backup-sync.service.j2
dest: /etc/systemd/system/ghostnet-lxc-backup-sync.service
owner: root
group: root
mode: "0644"
notify: Reload systemd daemon
- name: Install the backup sync systemd timer
ansible.builtin.template:
src: ghostnet-lxc-backup-sync.timer.j2
dest: /etc/systemd/system/ghostnet-lxc-backup-sync.timer
owner: root
group: root
mode: "0644"
notify: Reload systemd daemon
- name: Create the backup sync log file
ansible.builtin.file:
path: "{{ pve_backup_sync_log }}"
state: touch
owner: root
group: root
mode: "0640"
modification_time: preserve
access_time: preserve
- name: Enable and start the backup sync timer
ansible.builtin.systemd_service:
name: ghostnet-lxc-backup-sync.timer
enabled: true
state: started
daemon_reload: true
@@ -0,0 +1,9 @@
[Unit]
Description=Ghostnet host-independent LXC backup sync to ghostnet-ki
After=network-online.target
Wants=network-online.target
[Service]
Type=oneshot
ExecStart={{ pve_backup_sync_script }}
# Runs as root: reads /var/lib/vz/dump and the root backup key.
@@ -0,0 +1,56 @@
#!/bin/bash
# {{ ansible_managed }}
# Host-independent copy of LXC vzdump archives to ghostnet-ki (gn-backup).
# GNAI-000 section 4 blocker 4; installed by role pve_lxc_backup_sync.
set -euo pipefail
SRC="{{ pve_backup_sync_source_dir }}"
TARGET="{{ pve_backup_sync_target_user }}@{{ pve_backup_sync_target_host }}"
TARGET_DIR="{{ pve_backup_sync_target_dir }}"
KEY="{{ pve_backup_sync_ssh_key }}"
KNOWN_HOSTS="{{ pve_backup_sync_known_hosts }}"
LOG="{{ pve_backup_sync_log }}"
KEEP={{ pve_backup_sync_keep_per_ct }}
SSH=(ssh -i "$KEY" -o BatchMode=yes -o StrictHostKeyChecking=yes -o UserKnownHostsFile="$KNOWN_HOSTS")
log() { echo "$(date -u +%FT%TZ) $*" >> "$LOG"; }
cd "$SRC"
FILES=$(ls {{ pve_backup_sync_archive_glob }} {{ pve_backup_sync_log_glob }} 2>/dev/null | sort || true)
if [ -z "$FILES" ]; then
log "INFO no archives found in $SRC, nothing to do"
exit 0
fi
log "START transfer of $(echo "$FILES" | wc -l) files to $TARGET:$TARGET_DIR"
tar -C "$SRC" -cf - $FILES | "${SSH[@]}" "$TARGET" "tar -C '$TARGET_DIR' -xf -"
fail=0
for f in $(ls {{ pve_backup_sync_archive_glob }} 2>/dev/null); do
local_sum=$(sha256sum "$SRC/$f" | awk '{print $1}')
remote_sum=$("${SSH[@]}" "$TARGET" "sha256sum '$TARGET_DIR/$f'" | awk '{print $1}')
if [ "$local_sum" = "$remote_sum" ]; then
log "OK sha256 $f $local_sum"
else
log "FAIL sha256 mismatch $f local=$local_sum remote=$remote_sum"
fail=1
fi
done
# Prune on the receiver: keep the newest KEEP archives and logs per CT.
"${SSH[@]}" "$TARGET" bash -c "
set -euo pipefail
cd '$TARGET_DIR'
for ct in \$(ls {{ pve_backup_sync_archive_glob }} | sed -E 's/vzdump-lxc-([0-9]+)-.*/\1/' | sort -u); do
ls -1t vzdump-lxc-\$ct-*.tar.zst 2>/dev/null | tail -n +$((KEEP + 1)) | xargs -r rm -f
ls -1t vzdump-lxc-\$ct-*.log 2>/dev/null | tail -n +$((KEEP + 1)) | xargs -r rm -f
done
"
if [ "$fail" -eq 0 ]; then
log "DONE all archives verified on receiver"
else
log "DONE with checksum mismatches (see FAIL lines)"
fi
exit "$fail"
@@ -0,0 +1,9 @@
[Unit]
Description=Nightly host-independent LXC backup sync to ghostnet-ki
[Timer]
OnCalendar={{ pve_backup_sync_timer_oncalendar }}
Persistent=true
[Install]
WantedBy=timers.target