- CT 101 kennt NFS nicht mehr: samba_nfs-Rolle und Ganesha-Artefakte entfernt, kein Podman, keine 2049-Firewall-Regel, kein seccomp-Sondereintrag; live restlos bereinigt und deckungsgleich mit dem Playbook (verify ok=47, Idempotenz changed=0). Dafür neue SMB-Freigabe [Encoding] (Export-Root) für die Kontrolle von anderen Geräten als ghostnet-ki. - Grund: Weder kernel-nfsd noch Ganesha (VFS-FSAL) laufen in einem unprivileged LXC — open_by_handle_at braucht CAP_DAC_READ_SEARCH in der init-userns und liefert dort immer EPERM (verifiziert auf Kernel 7.0.14-14-pve; Web-Recherche: NFS direkt auf dem PVE-Host ist gängige Praxis und anerkannte Ausnahme vom Host-Grundsatz). - Neuer Account ansible-deploy (UID 1001) auf dem PVE-Host 10.0.0.2 nach LXC-Muster: gelocktes Passwort, source-restrictierter passphrase-loser Key (nur pub im Repo), NOPASSWD-Sudoers; Host-Key-Fingerprint verifiziert. - Neues Host-Projekt proxmox/pve-host/ansible (Schema wie die CT-Projekte): preflight/site.yml/verify-production + Rollen pve_nfs_export (Kernel-NFS, /etc/exports nur 10.0.0.90/32, NFSv4-only, Export-Root 100000:970 2775, nft 2049 nur von 10.0.0.90) und pve_lxc_conf (seccomp-Leerzeile aus 101.conf entfernt). Auf dem Host grün: check changed=0, verify ok=15, Idempotenz changed=0. - Abnahme bestanden: NFSv4.2-Mount von ghostnet-ki gegen 10.0.0.2:/media/datenhdd3/Encoding (Export-Root 100000:970 2775 sichtbar), sauberer Unmount. CT 101 nach Reboot: Seccomp 2, keine failed units, 17 Shares, 10 CIFS-Mounts der Workstation hängen. - Doku aktualisiert: GNAI-017 §4.1 und GNAI-019 E2/E3/§15 revidiert, Bereichsindex ergänzt, READMEs angepasst; PVE-Lifecycle-Skripte ohne seccomp-Ausnahme (Hashes aktualisiert). Generated by Mistral Vibe. Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
148 lines
7.1 KiB
Markdown
148 lines
7.1 KiB
Markdown
# Proxmox automation (CT 101 Samba)
|
||
|
||
Two PVE-side scripts for CT 101 (`10.0.0.9`, Samba file server,
|
||
GNAI-017/GNAI-018): the in-place dist-upgrade of the productive, adopted LXC to
|
||
Debian 13 (adoption, step 1) and the provisioning of a fresh CT 101 for the
|
||
documented fresh-state rebuild. Both scripts run as root on the Proxmox host,
|
||
contain no password, no private key and no SMB secret, and never destroy or
|
||
replace an existing CT 101.
|
||
|
||
## `upgrade-ct101-to-debian13.sh` (adoption, step 1)
|
||
|
||
Upgrades the productive CT 101 from Debian 12 (bookworm) to Debian 13
|
||
(trixie) in place. The existing LXC is preserved; the Samba passdb and the
|
||
productive `smb.conf` survive the upgrade (`--force-confold` keeps the
|
||
productive `smb.conf`). Sequence:
|
||
|
||
1. Preflight: CT 101 is running, is unprivileged (GNAI-015), all six media
|
||
mounts carry `backup=no` (otherwise `vzdump` would archive the media
|
||
library), and in the guest Debian 12, `ssh`/`smbd`/`nmbd` are active and the
|
||
IPv4 matches.
|
||
2. `vzdump 101 --mode stop` as a safety net (storage and dump directory are
|
||
configurable).
|
||
3. No `lxc.seccomp.profile` change is needed anymore: that exception existed
|
||
only for the Ganesha NFS container inside CT 101. Since 2026-10-30 the NFS
|
||
export runs on the PVE host (see `proxmox/pve-host/ansible/` (Rolle `pve_nfs_export`)); if the
|
||
empty line is still present from the earlier Ganesha setup, the script
|
||
removes it again (the NFS export can no longer run in an unprivileged LXC:
|
||
`open_by_handle_at` needs CAP_DAC_READ_SEARCH in the init user namespace).
|
||
4. In the guest: `bookworm` → `trixie` in the apt sources (deb822 and
|
||
one-line style), `apt-get update`, `dist-upgrade` with
|
||
`Dpkg::Options::=--force-confold`, `autoremove`, then the known dangling
|
||
`wtmpdb-rotate.timer` cleanup rule from `ghostnet-lxc-baseline.sh`.
|
||
5. Reboot and post-verify: Debian 13, `ssh`/`smbd`/`nmbd` active, no failed
|
||
units, listeners 22/139/445, anonymous `smbclient -L` query successful,
|
||
unprivileged uid_map intact, all six media mounts mounted.
|
||
|
||
Before the run, all media mounts in the productive `pct config 101` must carry
|
||
the `backup=no` option. Installation and invocation:
|
||
|
||
```bash
|
||
install -o root -g root -m 0700 \
|
||
upgrade-ct101-to-debian13.sh \
|
||
/usr/local/sbin/upgrade-ct101-to-debian13.sh
|
||
|
||
GHOSTNET_CT101_UPGRADE_CONFIRMATION=DIST-UPGRADE_CT101_TO_DEBIAN_13 \
|
||
/usr/local/sbin/upgrade-ct101-to-debian13.sh
|
||
```
|
||
|
||
Environment variables: `GHOSTNET_BACKUP_STORAGE` (default `local`),
|
||
`GHOSTNET_BACKUP_DUMP_DIR` (default `/var/lib/vz/dump`, only needed for
|
||
non-local backup storage). The confirmed downtime affects only the
|
||
file-server service; the host key is unchanged, so the workstation does not
|
||
have to replace a known host key.
|
||
|
||
The reviewed repository copy has SHA-256
|
||
`7671722cbd5107b0453ec5d016d8ffed82f36ec34d959f50507c21dc953c00a4`.
|
||
|
||
## `provision-ct101-samba.sh` (fresh-state rebuild)
|
||
|
||
Creates a fresh CT 101 from a Debian 13 template with the recorded profile,
|
||
attaches the six media mounts and then runs the reviewed baseline hook with
|
||
the recorded account UIDs (no seccomp change — see above). After the hook it
|
||
masks `sys-kernel-config.mount` (configfs is unavailable in unprivileged LXC;
|
||
CT 100/102/103 convention) and clears a stale failed state, so the fresh CT
|
||
passes the no-failed-units gate of `playbooks/preflight.yml`. The script
|
||
refuses to run when CT 101 already exists, and it names every material
|
||
setting explicitly.
|
||
|
||
| Setting | Value |
|
||
| --- | --- |
|
||
| CT ID / hostname | `101` / `Samba` (overridable via `GHOSTNET_CT101_HOSTNAME`) |
|
||
| OS | Debian 13, amd64 (newest `debian-13-*amd64*` template in the local cache, otherwise `GHOSTNET_OS_TEMPLATE`) |
|
||
| Container type | unprivileged LXC with `nesting=1,keyctl=1` |
|
||
| CPU / RAM / swap | 1 core / 2048 MiB / 2048 MiB (recorded profile, adjustable via env) |
|
||
| Rootfs | 4 GiB on `local-lvm` (recorded profile, adjustable via env) |
|
||
| Network | `vmbr0`, `10.0.0.9/24`, gateway `10.0.0.1`, DNS `10.0.0.14`, no IPv6 |
|
||
| Boot / timezone | `onboot: 1`, `Europe/Berlin` |
|
||
| Media mounts | `mp0`–`mp5` → `/media/daten1`, `/media/daten2`, `/media/daten3`, `/media/datenhdd1`, `/media/datenhdd2/extern`, `/media/datenhdd3`, each with `backup=no` |
|
||
| Baseline hook | `/usr/local/sbin/ghostnet-lxc-baseline.sh` (SHA-256 pinned) |
|
||
|
||
The resource defaults are the recorded productive profile (captured 2026-10-27
|
||
inside the guest via lxcfs/cgroup and `findmnt`); override them via the env
|
||
variables only deliberately.
|
||
|
||
Mandatory environment variables (the recorded values from the Ansible inventory
|
||
or the productive `pct config 101`):
|
||
|
||
| Variable | Meaning |
|
||
| --- | --- |
|
||
| `GHOSTNET_AGENT_UID` | UID of `ghost-agent` (must match `samba_access_agent_uid`) |
|
||
| `GHOSTNET_ADMIN_UID` | UID of `ghost` (must match `samba_access_admin_uid`) |
|
||
| `GHOSTNET_MP0_HOST` … `GHOSTNET_MP5_HOST` | Host paths of the six media mounts (must exist) |
|
||
|
||
Optional variables: `GHOSTNET_CT101_HOSTNAME`, `GHOSTNET_CT101_CORES`,
|
||
`GHOSTNET_CT101_MEMORY_MB`, `GHOSTNET_CT101_ROOTFS_GB`, `GHOSTNET_CT101_SWAP_MB`,
|
||
`GHOSTNET_OS_TEMPLATE`, `GHOSTNET_BASELINE_HOOK`.
|
||
|
||
Installation and invocation:
|
||
|
||
```bash
|
||
install -o root -g root -m 0700 \
|
||
provision-ct101-samba.sh \
|
||
/usr/local/sbin/provision-ct101-samba.sh
|
||
|
||
GHOSTNET_AGENT_UID=<uid> GHOSTNET_ADMIN_UID=<uid> \
|
||
GHOSTNET_MP0_HOST=/path/daten1 GHOSTNET_MP1_HOST=/path/daten2 \
|
||
GHOSTNET_MP2_HOST=/path/daten3 GHOSTNET_MP3_HOST=/path/datenhdd1 \
|
||
GHOSTNET_MP4_HOST=/path/datenhdd2-extern GHOSTNET_MP5_HOST=/path/datenhdd3 \
|
||
/usr/local/sbin/provision-ct101-samba.sh
|
||
```
|
||
|
||
The script sets neither passwords nor keys and configures neither Samba nor
|
||
the firewall — the Ansible roles do that. The final output lists the operator
|
||
steps (set the ghost password, install the public keys from
|
||
`ansible/files/ssh/`, configure the workstation SSH, fill the inventory
|
||
placeholders, rebuild sequence from `ansible/README.md`).
|
||
|
||
The reviewed repository copy has SHA-256
|
||
`74447ae18ab294fae08845490a214959e8e2a629c6aaf798351b0669e2f91823`.
|
||
|
||
## NFS-Export auf dem PVE-Host
|
||
|
||
Der Kernel-NFS-Export von `/media/datenhdd3/Encoding` läuft nicht mehr als
|
||
manuelles Script, sondern deklarativ über das Host-Projekt
|
||
[`proxmox/pve-host/ansible/`](../../../pve-host/README.md) (Rolle `pve_nfs_export`,
|
||
Playbook `site.yml` auf dem PVE-Host via `ansible-deploy`). Siehe dort für
|
||
Account-Prep und Runbook.
|
||
## `ghostnet-lxc-baseline.sh`
|
||
|
||
The versioned source lives under
|
||
`../../../shared/scripts/ghostnet-lxc-baseline.sh`. Both CT 101 scripts call
|
||
this reviewed baseline (adoption: manually after the upgrade; fresh rebuild:
|
||
automatically via `provision-ct101-samba.sh`). Installation on the Proxmox
|
||
host:
|
||
|
||
```bash
|
||
install -o root -g root -m 0750 \
|
||
ghostnet-lxc-baseline.sh \
|
||
/usr/local/sbin/ghostnet-lxc-baseline.sh
|
||
```
|
||
|
||
The pinned SHA-256 of the repository copy is
|
||
`111f1b70e47e3a2f6a1bcce22cb0ec50aacd8fbcff37d87fbcf853a318381b10`;
|
||
the scripts verify the host copy before executing it. The baseline creates
|
||
`ghost-agent` and `ghost` with the passed UIDs (or validates existing
|
||
accounts), prepares the `.ssh` directories, adds `ghost` to `sudo` and ensures
|
||
classic `ssh.service` operation. It installs no keys and sets no passwords.
|