diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md new file mode 100644 index 0000000..5adcf03 --- /dev/null +++ b/.github/copilot-instructions.md @@ -0,0 +1 @@ +Read [AGENTS.md](../AGENTS.md). It is the canonical instruction entry point. diff --git a/.github/workflows/check.yaml b/.github/workflows/check.yaml new file mode 100644 index 0000000..1c1e251 --- /dev/null +++ b/.github/workflows/check.yaml @@ -0,0 +1,24 @@ +name: Ubuntu checks +on: + pull_request: + push: + branches: [main] +permissions: + contents: read +jobs: + check: + runs-on: ubuntu-24.04 + timeout-minutes: 15 + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + persist-credentials: false + - uses: hashicorp/setup-packer@1aa358be5cf73883762b302a3a03abd66e75b232 # v3.1.0 + with: + version: 1.16.2 + - name: Install check dependencies + run: sudo apt-get update && sudo apt-get install -y shellcheck jq qemu-utils python3 zsh + - run: make init + env: + PACKER_GITHUB_API_TOKEN: ${{ github.token }} + - run: make check diff --git a/AGENTS.md b/AGENTS.md new file mode 100644 index 0000000..a85f24a --- /dev/null +++ b/AGENTS.md @@ -0,0 +1,37 @@ +# Repository instructions + +Read the personal conventions at +https://github.com/vhco-pro/docs/blob/0e52f51f01b84eda75a976763c42d8ec0a07b544/AGENTS.md +and follow the task routes there before implementation. + +For all code, read conventions/coding.md at that revision. For feature work, read +conventions/feature-documents.md and conventions/delivery.md. For documentation, +read conventions/documentation.md and guides/humanize-prose.md. Load only the +relevant pages. If a required source is unavailable, report it and stop. +When onboarding or bootstrapping, read the matching guides/ page. +Preserve local instructions; report a conflict instead of silently overriding either source. + +Feature documents: docs/specs/ + +## Local commands and constraints + +- `make init` installs the Packer plugins declared by the Ubuntu template. +- `make check` runs formatting, Packer validation, ShellCheck and local regression tests. + It needs Packer, ShellCheck, Python 3, Zsh, jq and qemu-img. Packer validation fetches public + checksum metadata but does not require Proxmox credentials. +- Feature documents use the pinned vh-adlc format. Use the shared lifecycle and + independent reviewer from the vh-adlc plugin; do not maintain a second local agent workflow. +- Keep PDS standalone. Builders selects shared PDS functions when that package integration + is implemented. Keep image provisioning separate from Proxmox bootstrap and image sealing. +- Run `seal-image.sh --image-build` only inside a fresh disposable build guest. It removes + access keys and resets machine identity. It is not an existing-machine setup command. +- Real Proxmox integration tests need task authorization, unused test IDs and recorded + ownership. Never delete, stop or reconfigure pre-existing guests as test cleanup. + The normal local checks must not perform remote VM mutations. +- Prepare base images off-node. The node import uses native Proxmox commands over SSH; + do not install Packer or libguestfs on the hypervisor. Keep replacement-machine recovery + in `docs/ubuntu/recovery.md` aligned with the tested scripts. +- Preserve unrelated work, staged changes and existing worktrees. No reset, stash or cleanup + to make a review target clean. A dirty-tree diagnostic review is not release acceptance. +- Commits, pushes, PR writes, merges and releases need explicit owner approval. Permission to + commit or update a PR does not authorize merging, releasing or publishing the homelab guides. diff --git a/CLAUDE.md b/CLAUDE.md new file mode 100644 index 0000000..43c994c --- /dev/null +++ b/CLAUDE.md @@ -0,0 +1 @@ +@AGENTS.md diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..6c4cb6d --- /dev/null +++ b/Makefile @@ -0,0 +1,26 @@ +PACKER ?= packer + +RECIPE ?= default + +.PHONY: init check check-config check-shell check-tests check-image check-instance +init: + cd packer/ubuntu && $(PACKER) init . + +check: check-config check-shell check-tests + @echo 'SKIP: real image builds, artifact inspection and fresh-instance checks require explicit disposable resources.' + +check-config: + $(PACKER) fmt -check -recursive packer/ubuntu + cd packer/ubuntu && PKR_VAR_proxmox_api_token=validation-only-placeholder $(PACKER) validate . +check-shell: + shellcheck -S warning packer/ubuntu/scripts/*.sh packer/ubuntu/tests/*.sh packer/ubuntu/recipes/*.sh + zsh -dfn packer/ubuntu/scripts/check-user-shell.zsh + +check-tests: + PACKER="$(PACKER)" python3 -B -m unittest discover -s packer/ubuntu/tests -v + +check-image: + bash packer/ubuntu/scripts/check-image.sh "$(IMAGE)" "$(RECIPE)" "$(PDS_VERSION)" "$(PDS_SOURCE)" + +check-instance: + bash packer/ubuntu/scripts/check-instance.sh "$(RECIPE)" diff --git a/docs/development.md b/docs/development.md new file mode 100644 index 0000000..65c4382 --- /dev/null +++ b/docs/development.md @@ -0,0 +1,83 @@ +# Develop and verify builders + +Read [the repository instructions](../AGENTS.md) before changing code. Feature scope and review +records live in [the feature documents](specs/README.md). PDS remains a standalone function library; +builders owns the selected [Ubuntu recipe](ubuntu/provisioning.md). + +## Local checks + +From the repository root, run `make init` once and `make check` with Packer, ShellCheck, Python 3, Zsh, jq and +`qemu-img` installed. Checks validate both builders and exercise refusal of occupied IDs and real +raw conversion using disposable files. They also check first-boot result handling, explicit config +inputs and refusal of accidental sealing. Packer validation fetches upstream checksum metadata and +needs network access. These checks also exercise package identity/trust refusals, default/custom +recipe selection, selected-call failures, SSH service observation and negative artifact fixtures. +They do not contact Proxmox or replace live image/clone tests. The read-only PR workflow runs the +same `make check` target and reports the real-build checks as skipped. The real recipe-readability +regression needs an unprivileged caller: root can read its mode-000 fixture, so a root container +explicitly skips that case. Run it separately as the build user with Packer available: + +```bash +PACKER=packer python3 -B -m unittest discover -s packer/ubuntu/tests -p test_image_steps.py -k unreadable -v +``` + +After a real build, inspect its unbooted disk with libguestfs installed: + +```bash +make check-image IMAGE=/path/to/image.qcow2 RECIPE=default PDS_VERSION=0.20.0 PDS_SOURCE=signed-repository +``` + +Use the exact `pds_version` supplied to the build, `PDS_SOURCE=candidate` for an explicit candidate, +and `RECIPE=custom` for the committed custom example. The expected route must match the image's +provenance. This reads the disk without modifying it and checks identity/access cleanup, both build homes against an +explicit allowlist, package provenance and the selected policy's presence or absence. +It does not establish successful boot or authentication behavior. The original shipped image +must be inspected before creating writable instance disks from it. + +Inside each owned fresh instance, logged in as the supplied Zsh user with its own key and sudo policy, +copy `check-instance.sh` and `check-user-shell.zsh` from `packer/ubuntu/scripts/` into the same +directory and run `bash check-instance.sh default` (or `custom`). It verifies both shell +startups and the selected tools/policy. First Zi startup needs network access. Retain full build and +service evidence, including actual plugin revisions; the bounded validation also requires distinct +machine IDs/host keys, real cron execution and positive/negative SSH authentication probes. + +PDS has its own package check: `bash tests/check-package.sh` in the dependency checkout. That +builds a candidate with verified nFPM and runs real helper/service checks in disposable Ubuntu. +Neither local candidate tests nor a passing PR check proves installation from the signed repository. +Validate that route against the published package and inspect the resulting image's provenance. + +The destructive sealing integration test needs a fresh disposable Ubuntu container with cloud-init +and OpenSSH server installed. It applies the real build seed, checks that password SSH was enabled, +runs the sealer, and verifies that build access and identity were removed. It refuses to run outside +Docker. From the repository root: + +```bash +docker run --rm -v "$PWD:/work:ro" ubuntu:24.04 bash -c \ + 'apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y cloud-init openssh-server && bash /work/packer/ubuntu/tests/test_sealing.sh' +``` + +On Linux, repeat the sealing test with a public test ID bind-mounted read-only to reproduce an +uncommitted transient ID. Prepare the same disposable image with cloud-init and OpenSSH first, +then run the test with networking disabled. Use a tmpfs fixture such as `/dev/shm`: + +```bash +fixture=$(mktemp /dev/shm/builders-machine-id.XXXXXX) +printf '0123456789abcdef0123456789abcdef\n' > "$fixture" +docker run --rm --network none --cap-add SYS_ADMIN \ + -v "$PWD:/work:ro" -v "$fixture:/etc/machine-id:ro" \ + YOUR_PREPARED_UBUNTU_TEST_IMAGE bash /work/packer/ubuntu/tests/test_sealing.sh +rm -- "$fixture" +``` + +`SYS_ADMIN` permits the systemd command to unmount that fixture inside the container. Mount only +the public fixture and repository as shown; no host devices or host machine ID are needed. + +## Live checks + +Local checks do not establish that an image boots or that a Proxmox clone has a new identity. +Use disposable artifacts and recorded unused VM IDs for live tests; preserve existing guests. Follow +the [bounded live-validation procedure](ubuntu/live-validation.md) for resource baselines, both +deployment paths, exact update/authentication probes, reboot persistence and ownership-limited cleanup. +The [PDS integration validation](validation/0001-2026-11-05.md) records candidate attempts, the +published-release build and eight-instance matrix, and the independent review boundary. The +[earlier bootstrap/CPU validation](validation/0001-2026-11-04.md) records the preceding iteration. diff --git a/docs/legacy/armbian-qemu.md b/docs/legacy/armbian-qemu.md new file mode 100644 index 0000000..76ec5ec --- /dev/null +++ b/docs/legacy/armbian-qemu.md @@ -0,0 +1,52 @@ +# Legacy Armbian QEMU recipes + +These ARM commands were kept from the original Packer README. They are manual recipes for separately +prepared Armbian images. They are outside the validated Ubuntu amd64 image matrix. + +## Boot an ARM64 raw image + +```bash +sudo qemu-system-aarch64 -m 2048 -cpu cortex-a72 \ + -M virt \ + -drive file=/path/to/armbian-image.img,format=raw \ + -serial mon:stdio \ + -netdev user,id=user.0 \ + -device virtio-net,netdev=user.0,romfile= +``` + +This retains the historical command. The image must provide a boot chain compatible with QEMU's +`virt` machine; CPU architecture alone is not enough. It is not a tested boot command for the current +Ubuntu output. A separately prepared UEFI or kernel boot flow may be needed for a different image. + +## Extract a board image's U-Boot + +The historical image used a partition offset of 16777216 bytes. Confirm the partition layout with +`fdisk -l` before selecting an offset for another image: + +```bash +sudo mkdir -p /mnt/armbian +sudo mount -o loop,ro,offset=16777216 /path/to/armbian-image.img /mnt/armbian +sudo cp /mnt/armbian/boot/u-boot.bin ./ +sudo umount /mnt/armbian +``` + +The old example invoked that extracted firmware as follows: + +```bash +qemu-system-aarch64 \ + -machine virt -cpu cortex-a72 -m 2048 \ + -serial stdio \ + -bios ./u-boot.bin \ + -drive if=none,file=/path/to/armbian-image.qcow2,id=mydisk \ + -device ich9-ahci,id=ahci \ + -device ide-hd,drive=mydisk,bus=ahci.0 +``` + +The firmware, storage controller and image need to agree. This historical combination has not been +revalidated here. Keep the original disk unchanged and use a copy while investigating it. + +## References + +- [Original Armbian QEMU discussion](https://forum.armbian.com/topic/38258-running-self-build-image-on-qemu-arm64/) +- [Original ARM64 examples](https://gist.github.com/wuhanstudio/e9b37b07312a52ceb5973aacf580c453) +- [QEMU ARM virt machine](https://www.qemu.org/docs/master/system/arm/virt.html) diff --git a/docs/specs/0001-packer-proxmox-native-output.md b/docs/specs/0001-packer-proxmox-native-output.md index 239a8b1..8dd5bf2 100644 --- a/docs/specs/0001-packer-proxmox-native-output.md +++ b/docs/specs/0001-packer-proxmox-native-output.md @@ -1,20 +1,77 @@ -# 0001 — Packer: Proxmox-native builder with selectable output formats +--- +status: complete +status_description: "All 15 criteria are met with clean independent Opus R-29 acceptance; controlled builds, eight deployments and cleanup pass. Owner merge review remains pending." +issue: https://github.com/vhco-pro/builders/issues/1 +goal: "Build customizable Ubuntu images with PDS bootstrap and opinionated update/SSH defaults, as optional Proxmox templates or standalone qcow2/raw disks." +covers: + - packer/ubuntu/ + - Makefile + - readme.md + - packer/readme.md + - docs/ubuntu/ + - docs/development.md + - .github/workflows/ + - renovate.json5 +branch: feat/0001-packer-proxmox-native +--- -- **Status:** draft -- **Scope:** `packer/ubuntu/` only. Getting a generic template onto the Proxmox host correctly. - **Out of scope:** any Terraform / clone-time logic, and the full PDS provisioning migration - (tracked separately — this spec only stops *baking identity* into the image). +# Plan: Ubuntu baseline images with PDS, updates and restricted SSH + +Build reusable Ubuntu images with a builders default recipe calling PDS for nightly updates and restricted SSH; +operators may select a custom recipe with different choices. +Select a standalone disk or optional native Proxmox template; supply deployment identity through +cloud-init. ## Context -Today `packer/ubuntu/ubuntu.pkr.hcl` uses the `hashicorp/qemu` builder to produce a local qcow2/raw +### Owner summary + +Build Ubuntu images once, then supply the real users, keys and hostname when deploying them. +Choose a portable qcow2/raw disk or an optional native Proxmox template; both use the same PDS package, +recipe and image cleanup. + +The default recipe installs the shared shell and admin tools, VHCO MOTD, midnight package updates +and key-only SSH with root login disabled. A custom Bash recipe can select different PDS functions +and omit those policy calls. PDS remains usable for ordinary installations. + +Base preparation runs on a build machine, with a documented replacement-machine recovery path. +Proxmox needs no Packer or libguestfs installation. Native guests default to the host CPU model, +which is configurable. This suits the current single-node lab; migration to a different CPU needs +an explicit compatibility choice. + +The controlled matrix at `9f4db43` passed four builds, eight fresh deployments and two reboot checks +total. All six pre-existing guests were preserved and all disposable resources removed. Later +image-input changes are comments with identical parsed YAML. Linked guides cover host setup, manual +QEMU boots, SSH/VNC, raw mounts, chroot and the historical ARM commands. Merge requires current review +and CI. + +This feature is the image foundation. RKE2, an edgectl redesign and the cross-repository Homelab +coordinator each need their own design. The homelab articles remain draft. + +R-28 returns all 15 criteria met and no findings, but its AC-14 evidence says "2 reboots per default +instance". The retained records show **two reboot operations total**, one on native default 990342 +and one on portable default 990349. Each JSON records one before/after boot-ID pair. R-28 is preserved +verbatim; R-29 independently checks the raw records and corrects that wording, with no implementation +change or additional VM run. + +The owner explicitly accepted the default-recipe/customization contract and requested continuation +on 2026-11-05 after the owner-facing explanation. That approval covers implementing and testing this +scope, including the PDS dependency; it does not authorize merging or publishing the homelab guides. +R-17 retains two non-blocking notes for the implementation: observe selected SSH-policy application +inside custom recipes, and distinguish the builders recipe from the PDS function library. No new +product policy was inferred from that review. + + +Migration: this file now uses the pinned vh-adlc format in its existing location. Earlier checklist ticks are historical and are not imported as current acceptance. No review or owner-acceptance record has been invented. + +At the start of this feature, `packer/ubuntu/ubuntu.pkr.hcl` used the `hashicorp/qemu` builder to produce a local qcow2/raw artifact. Getting that onto Proxmox is a manual, out-of-band step (`qm importdisk` / upload, then `qm template`) that lives outside Packer. That flow has three problems: 1. **Manual import.** The build stops at a local file; a human turns it into a Proxmox template. 2. **Baked-in identity.** `scripts/install.sh` sets the hostname, writes a static `netplan` config, creates the `sysadmin` user with a hardcoded SSH key, and hardens SSHD *at build time*. That makes - the image machine-specific — the opposite of a golden image — and every clone inherits the same + the image machine-specific; the opposite of a golden image; and every clone inherits the same `machine-id` and host keys unless we're careful. 3. **One output shape.** The template only knows how to emit a local qcow2/raw. @@ -23,11 +80,11 @@ We want to build **directly against the Proxmox API** using the native land the result as a template with a cloud-init drive attached, and keep it fully generic so `bpg/proxmox` can clone it with per-VM init. -We also want to keep the local qcow2/raw path available — some workflows (ARM, offline, inspection, +We also want to keep the local qcow2/raw path available; some workflows (ARM, offline, inspection, non-Proxmox targets) still want a portable file. So the template must be able to emit **either** format, **chosen at invocation**, from a single template. -## Primer — Proxmox concepts (new to this) +### Primer; Proxmox concepts (new to this) Short glossary so the rest of this spec reads cleanly: @@ -35,14 +92,14 @@ Short glossary so the rest of this spec reads cleanly: - **Packer builds *against* that API:** it's a program that logs into Proxmox, creates a VM, installs the OS, then converts the VM into a **template**. Authentication is via an **API token** (created in the PVE UI: a user like `packer@pve` + token id `packer` → a one-time secret). Tokens are revocable - and need no interactive login. (This is separate from — but the same *kind* of thing as — the creds + and need no interactive login. (This is separate from; but the same *kind* of thing as; the creds the `bpg/proxmox` **Terraform** provider will need later at clone time; that's out of scope here.) - **Template:** a VM flagged read-only that you **clone** to make real VMs. `proxmox-clone` sets this flag automatically as its last step (it clones a base, customizes, then re-templates). - **Cloud image, not an ISO install.** We start from Ubuntu's **prebuilt cloud image** (OS already - installed) and *customize* it with Packer — no fresh install, no autoinstall/preseed. This is the + installed) and *customize* it with Packer; no fresh install, no autoinstall/preseed. This is the modern, preferred approach and matches the current qemu flow's base. -- **Two different "cloud-inits" — do not conflate them:** +- **Two different "cloud-inits"; do not conflate them:** - **Build-time (throwaway):** how Packer gets into the VM to *customize* it during the build. The `proxmox-clone` builder auto-generates a temporary SSH key and injects it via cloud-init so it can connect and run provisioners. Discarded when the template is sealed. @@ -53,23 +110,203 @@ Short glossary so the rest of this spec reads cleanly: So Packer *prebuilds* the customized image from the cloud image; the clone-time drive is a separate, empty slot for consumers to populate. -## Goals +### Live validation before the structure refactor (2026-11-03) + +This section records an earlier candidate, not verification of the current source. The migrated +feature status remains `draft`; commit `deae257` contains the implementation, and `0b33ecf` incorporates +the latest main-branch specification changes. No completion is claimed. + +- Packer 1.16.2, Proxmox plugin 1.2.4 and QEMU plugin 1.1.8; `make check` passed formatting, + validation, ShellCheck and the eight tests available then. The refactor added further local regression cases. + Portable-only validation also passed without + Proxmox credentials. +- The full bootstrap created a new Ubuntu noble/amd64 base on Proxmox 9.1.7 with a checksum-verified + image, installed guest agent, DHCP, `virtio-scsi-pci`, a 12 GiB test disk and `template: 1`. Offline + image tools ran in a disposable container; guarded SSH transport ran `qm`/`pvesh` on the node. + No packages were installed on the Proxmox host. The script's normal disk default remains 32G. +- A VM-scoped token built a native golden template with a fresh cloud-init volume and no retained + build cloud-init credentials. Two full clones accepted distinct injected users/SSH keys, received + their own hostnames, and had different machine IDs and SSH host keys. Baseline packages, locale, + keyboard, timezone and the locked Ubuntu password were checked inside both clones. +- A complete portable KVM build ran in a separate temporary Proxmox guest. Its qcow2 and raw disks + both have a 10 GiB virtual size and compare identically. Read-only inspection confirmed an empty + machine-id, the D-Bus link, generic hostname, no build/host keys, no seed/instance cache, no static + cloud-init netplan file, a locked Ubuntu password and the expected packages and OS settings. +- Live tests exposed duplicate machine IDs in the initial bootstrap, which made concurrent base + clones share a DHCP client ID/IP. The corrected bootstrap clears machine-id after customization. + Tests also caught Proxmox's deprecated cloud-init `user` string and a missing executable bit on + the raw exporter. Both fixes have regression coverage. Only deprecation-only completed cloud-init + results are accepted; other reported errors still fail provisioning. +- Early local TCG attempts hit a container memory cap and termination during conversion. The final + portable result is from KVM. ARM/HVF, UEFI, other releases/storage backends and Terraform deployment + remain unverified. PDS and the full automated image-test harness remain separate specs. + +The test range was 990100–990105. All seven pre-existing guests' configuration hashes and runtime +statuses were checked throughout. Temporary API identities were removed after each native attempt. +The task retained raw logs, cleanup evidence and runtime file hashes privately. These early troubleshooting details remain history recorded only in private artifacts. The committed +[validation summary](../validation/0001-2026-11-04.md) covers the later off-node preparation, +portable build and host-CPU run; it does not reproduce every earlier experiment. +These earlier-run results do not establish current independent acceptance. No credentials are committed. + +### Structure refactor for owner review + +The previously recorded live runs used the earlier two-script provisioner. The implementation makes +first-boot readiness, image configuration and sealing separate ordered Packer steps. The standalone +`wait-cloud-init.sh` parses cloud-init JSON with jq, `install.sh` accepts its cloud-config path as an +argument, and `seal-image.sh` requires `--image-build` before it changes the guest. Both builders use +the same steps. The Proxmox bootstrap and raw exporter retain their separate responsibilities. + +PDS remains standalone and unchanged. Its pinned-package integration belongs in spec 0003; the +current `install.sh` applies the native Ubuntu settings and does not claim to install PDS yet. + +Full image-build criteria are unchecked again pending validation of this updated Packer wiring. +The earlier live evidence remains useful history, not an exact-source acceptance of this refactor. + +Current source: `packer/ubuntu/ubuntu.pkr.hcl:19` and `:49` define the two outputs; +`Makefile:3` defines the available local commands. The feature links were confirmed by reading +GitHub issues #1, #2 and #3 during this migration. + +R-1 is an independent Opus 5.5 diagnostic of the uncommitted candidate. It established no criterion +as met and flagged a possible retained SSH password-authentication setting (F-01). That setting must +be checked in a newly built artifact before acceptance. Subsequent documentation corrections do not +clear R-1 or turn it into a current implementation review. + +### Off-node candidate checks (2026-11-04) + +The owner selected off-node preparation and initially withheld commits pending inspection. The owner +subsequently authorized the commits and PR update; the source is committed at `deae257`. These +observations do not change the draft status or tick any criterion. Current local checks pass Packer +formatting and validation, ShellCheck and 26 regression tests. A clean plugin directory installed +Proxmox 1.2.4 and QEMU 1.1.8 with Packer 1.16.2. + +Base preparation passed in a fresh Ubuntu 24.04 amd64 environment, running as root with the documented +direct libguestfs backend and DHCP client. A separate non-root SSH-only client imported the retained +bundle, refused an occupied ID and preserved the seven original guests. No build packages were +installed on Proxmox. This is replacement-client evidence, not a completed Fedora system restore or +an already-configured off-host backup. + +The earlier portable KVM build produced matching qcow2 and raw disks. Read-only inspection found no build +credentials or generated SSH override, and two fresh boots accepted their own keys with different +machine IDs and host keys. That earlier native run used `kvm64`. Its template build passed after increasing the API task timeout +from the plugin's one-minute default to the configurable ten-minute default. Both native fresh clones +then accepted distinct consumer users and keys, with different machine IDs and SSH host keys and +password authentication disabled. Read-only inspection of the stopped native template also passed +the sealing checks. The final audit confirms removal of all five owned test resources and temporary +API identities, with the seven original guest configurations and power states unchanged. +The native timeout addition does not change the portable source or shared provisioner scripts. + +The retained test evidence is under `/tmp/builders-offnode/`, including `make-check-final2.log`, +`prepare-clean.log`, `import-final-results.json`, `portable-final-build.log`, `inspection-results.json`, +`portable-clone-results.json` and `native-results.json`. These local paths are review artifacts, not +durable public links. The committed [validation summary](../validation/0001-2026-11-04.md) +covers the later host-CPU run and the portable checks. The earlier `kvm64` timeout/retry and +five-resource cleanup details above remain history in private artifacts. + +### Native host CPU follow-up (2026-11-04) + +The owner selected configurable `host` after the earlier `kvm64` run. The follow-up native build +completed in 2 minutes 56 seconds. Its golden template and both fresh clones report `cpu: host`; +the clones expose the node's Xeon E5-2620 model, AES and AVX, accept separate consumer SSH keys and +have distinct machine IDs and host keys. Password authentication is disabled and the build password +is discarded. Read-only inspection of the stopped native disk passed the sealing checks. + +The input guard was tightened after that build to reject surrounding whitespace. Only its condition +and error message changed; the selected valid `host` value, native CPU wiring, QEMU source and guest +scripts are unchanged. The guard-only diff and manifests record this boundary. Final Packer +validation, ShellCheck and all 26 regression tests passed again; exact-command records show a named +CPU override accepted locally and empty or padded names rejected. Alternate CPU model support on +the node is not established by local validation. + +Evidence is under `/tmp/builders-hostcpu-20261104/`: `native-results.json`, `inspection-results.json`, +`cpu-validation-results.json`, `validation-guard-followup.patch`, `make-check-final.log` and +`final-audit.json`. All four owned test resources and temporary API identities were removed. The +seven original guests' configuration hashes and power states match the fresh preflight baseline. +The committed [validation summary](../validation/0001-2026-11-04.md) records these checks. +R-5 independently reran the local regression tests and read retained integration results. Its two +documentation nits were corrected here; it remains a dirty diagnostic, not current acceptance. + +### Settled decisions and earlier review notes + +Automatic updates and restricted SSH are core baked-image requirements, confirmed by the owner on +2026-11-04. Keep the earlier nightly midnight update policy and require public-key SSH with password +and root logins disabled. Deployment supplies machine identity and authorized users/keys; it does +not have to recreate this baseline policy. -- One Packer template for Ubuntu that can produce **either**: - - a **Proxmox template** built natively via the Proxmox API (default, preferred), or - - a **local qcow2/raw** artifact (the legacy portable path). -- The output format is **selected at build invocation**, not by editing the template. -- The Proxmox path lands a **template** (not just a VM) on the PVE host, with a **cloud-init drive** - attached, ready for `bpg/proxmox` to clone. -- The image is **generic/unidentified**: no baked hostname, no static IP, no baked SSH host keys, - fresh `machine-id` on every clone. -## Non-goals +The owner selected Zi's existing per-user first-login plugin downloads on 2026-11-04, preserving +the current configuration instead of introducing image-specific prefetching and cache maintenance. +The bootstrap guide must state the first-login network requirement and plugin-version variability. -- Terraform / `bpg/proxmox` clone blocks and per-VM init (hostname, IP, SSH keys, `edgectl` user-data). - That's the consumer of this template and is deliberately untouched here. -- Completing the "move all provisioning to PDS" migration. This spec removes *identity baking* and - leaves the remaining provisioning as-is (or minimally adjusted); the PDS cutover is its own spec. + +Off-node bootstrap is the owner's decision of 2026-11-04. +The Bash/jq adapter follows the request to avoid unnecessary Python and continue after that +recommendation. These implementation choices do not establish formal spec or feature acceptance. + +The earlier R-1 F-02 assumed jq would need an extra installation. The retained `/tmp/builders-offnode/portable-final-build.log` shows `wait-cloud-init.sh` +using jq to parse real cloud-init status in the tested noble/amd64 build. The historic review is retained unchanged below. This draft also makes AC-06's +build-access exception explicit, so the current criterion requires a new review. + +### Combined PR preparation (2026-11-04) + +The owner selected one builders PR for the native/portable outputs, the PDS provisioning replacement, +its required image checks and the README restructure. The dependent shared-library work stays in +`michielvha/PDS`. PR #4 remains open; merging either repository requires the owner's final review. +The wider multi-OS/macOS harness stays in feature 0002. + +At preparation time, `scripts/install.sh:11-13` only invokes four native cloud-init modules and +`ubuntu.pkr.hcl:88-109` does not install PDS. The earlier +`origin/main:packer/ubuntu/scripts/install.sh` supplied MOTD at lines 65-115, Zi/shell setup at 133-137, SSH restrictions at 151, user/sudo setup at 153-169, nightly updates at 183 and +kubectl at 190, while also editing bootloaders. GitHub CLI was in +`origin/main:packer/ubuntu/cloud-init/user-data:42`. This revised scope replaces the useful shared +bootstrap without restoring baked users, keys or network identity. Earlier statements that PDS was a separate delivery describe the prior scope. + +The existing candidate at `/home/m/code/PDS-image-provisioning`, based on PDS `04c8dee` with +uncommitted changes, supplies packaged shell assets, unattended loading and MOTD. Its package +`pds_1.0.0_all.deb` has SHA-256 +`378a2ef2d1277c54fd4524abfe160d0648cd501e98d7cd26b716de240a495991`. +The existing package suite passed nine tests against a read-only source snapshot in a disposable +network-isolated container. Those tests use a Zi stub and do not establish real plugin installation, +GitHub CLI/kubectl installation or a bootable PDS image. Preparation evidence is retained privately +under `/tmp/builders-pds-prep-20261104/`. + +`gh api repos/michielvha/PDS/releases/latest` reported release `0.19.0` and asset +`pds_0.19.0_all.deb`; `gh api repos/michielvha/PDS/commits/main` returned `04c8dee`. +The local `1.0.0` label is a placeholder, identified here by the package checksum; it is not a +published replacement version or a prediction of the CI-assigned release number. The PDS pull-request +list contained only unrelated Cloudflare-host PR #34, which remains outside this work. + +Two inspected library gaps affect image use. `bash/debian/software/install_kubectl.sh:21-57` writes +completion into the invoking user's home; lines 59-104 install user-local Krew/plugins and tolerate +failures. `bash/common/shell/zsh.sh:16` clones Zi without a revision pin, while the packaged zshrc +selects plugins that may download on first shell startup. A passing package loader test does not +prove that a newly deployed user receives functional, self-contained tooling. + +This is a normative scope revision. All criteria remain unchecked; earlier reviews below are history +for their recorded targets and do not accept the combined scope. No implementation or final image +validation is claimed by this preparation. + +## Scope + +- One Ubuntu Packer template with shared provisioning for a standalone qcow2/raw disk and an optional + native Proxmox template. Both outputs are selected explicitly with `-only`. +- Off-node base preparation and retained-bundle recovery. Packer and libguestfs stay off Proxmox. +- Native Ubuntu packages/settings through cloud-init, plus an exact PDS package and a readable + select-and-apply bootstrap for Zi/Powerlevel10k, MOTD, GitHub CLI and kubectl. +- The default recipe applies nightly package updates and restricted SSH through PDS to both outputs. + Custom recipes may deliberately change or omit those policy selections. +- Shared configuration available to users created after sealing. No fixed admin user or key is baked in. +- Package verification, static/local regression checks, real amd64 builds, offline inspection and two + independently initialized boots for each output. Test resources have recorded ownership. +- Short READMEs linking build, bootstrap, SSH/debugging, recovery and validation procedures under docs/. + +Out of scope: + +- Deploying Stackweaver, production workloads or consumer Terraform configurations. +- Merging, releasing PDS, publishing homelab articles or modifying pre-existing Proxmox guests. +- The wider feature 0002 matrix: Apple Silicon/HVF acceptance, another OS/template and a permanent + self-hosted runner. Its absence cannot excuse missing checks for this Ubuntu amd64 delivery. +- Changes to the unrelated PDS Cloudflare-host feature or other installers beyond shared bootstrap + dependencies needed here. PDS remains independently usable for ordinary host setup. ## Design @@ -82,16 +319,16 @@ at the command line: ```bash packer init . -# Proxmox-native template (default / preferred) +# Optional Proxmox-native template packer build -only='proxmox-clone.ubuntu' -var-file=variables.pkrvars.hcl . # Portable local qcow2/raw artifact packer build -only='qemu.ubuntu' -var-file=variables.pkrvars.hcl . ``` -`-only` is the selection mechanism — no template edits, no separate files. Both builders run the same +`-only` is the selection mechanism; no template edits, no separate files. Both builders run the same provisioners, so the *provisioning applied* is identical regardless of output shape (their base OS -differs — see the qemu note below). +differs; see the qemu note below). > **Decided:** use `-only` (explicit, idiomatic, zero magic). No `build_target` variable. @@ -101,45 +338,56 @@ differs — see the qemu note below). packer { required_plugins { proxmox = { - version = ">= 1.2.2" + version = "= 1.2.4" source = "github.com/hashicorp/proxmox" } qemu = { - version = "~> 1" + version = "= 1.1.8" source = "github.com/hashicorp/qemu" } } } ``` -### Stage 0 — base cloud-init template (bootstrap, once per Ubuntu release) +### Stage 0; base cloud-init template (bootstrap, once per Ubuntu release) `proxmox-clone` clones an **existing** Proxmox template; it cannot download a cloud image itself. So we first turn the official Ubuntu **cloud image** into a base cloud-init template on the PVE host. This is -**not** the per-build manual import we're eliminating — it runs *once per Ubuntu release*, and we commit +**not** the per-build manual import we're eliminating; it runs *once per Ubuntu release*, and we commit it as a repeatable script (`packer/ubuntu/scripts/create-base-template.sh`) rather than hand-clicking. -Sketch of what the bootstrap does (over SSH to the PVE host, using `qm`): +The owner selected off-node preparation on 2026-11-04. The independent Fedora bare-metal +workstation is the normal build host; a replacement Linux machine must be able to run the same +procedure without Stackweaver. Packer and image-preparation packages are not installed on Proxmox. + +`packer/ubuntu/scripts/prepare-base-image.sh:1` creates a reusable bundle with a prepared disk, +its checksum, upstream checksum records and source/tool information. It installs the guest agent +and resets machine identity locally. `scripts/create-base-template.sh:1` checks an explicit unused +VM ID over SSH, verifies the local bundle and transfers it to a temporary node directory. +`scripts/import-base-template.sh:1` checks availability again and verifies the uploaded disk before +creating and configuring the new template with native Proxmox commands. Failed partial VMs remain +for inspection; these scripts contain no VM deletion path. ```bash -# download the official cloud image, embed qemu-guest-agent (needed so Packer/Proxmox -# can see the VM's IP after clone), then create + template it. -virt-customize -a ubuntu-24.04-cloudimg-amd64.img --install qemu-guest-agent -qm create $BASE_VMID --name ubuntu-2404-cloudimg --memory 2048 --net0 virtio,bridge=vmbr0 --scsihw virtio-scsi-pci -qm importdisk $BASE_VMID ubuntu-24.04-cloudimg-amd64.img $STORAGE -qm set $BASE_VMID --scsi0 $STORAGE:vm-$BASE_VMID-disk-0 --ide2 $STORAGE:cloudinit -qm set $BASE_VMID --boot c --bootdisk scsi0 --serial0 socket --vga serial0 --ipconfig0 ip=dhcp -qm template $BASE_VMID +sudo bash scripts/prepare-base-image.sh /path/to/new/base-bundle +PVE_HOST=root@pve BASE_VMID=9000 BASE_IMAGE_DIR=/path/to/new/base-bundle \ + STORAGE=local-lvm BRIDGE=vmbr0 bash scripts/create-base-template.sh ``` -Single source of truth = the upstream Ubuntu cloud image; the base is a thin, generic wrapper of it. +The retained-bundle recovery path needs only Bash, OpenSSH and sha256sum on a replacement machine. +The from-source path also needs the documented libguestfs environment and upstream access. +`packer/ubuntu/recovery.md:1` describes both paths. Source downloads default to Ubuntu's moving +`current` directory and apt packages can change, so exact base reuse comes from the retained bundle, +not a promise that a later fresh build will be byte-identical. -### Stage 1 — `source "proxmox-clone" "ubuntu"` (native Proxmox build, every build) +### Stage 1; `source "proxmox-clone" "ubuntu"` (native Proxmox build, every build) -**Decided: `proxmox-clone` from the cloud-image base** — Packer clones the Stage-0 base, boots it, +**Decided: `proxmox-clone` from the cloud-image base**; Packer clones the Stage-0 base, boots it, customizes it with our provisioners, resets cloud-init state, and seals it as the golden template with a fresh **empty** cloud-init drive. No per-build `qm importdisk`, no ISO install. +The following excerpt is abridged; `packer/ubuntu/ubuntu.pkr.hcl` is the executable configuration. + ```hcl source "proxmox-clone" "ubuntu" { # --- Proxmox API connection (Packer builds against this) --- @@ -147,11 +395,13 @@ source "proxmox-clone" "ubuntu" { username = var.proxmox_api_token_id # e.g. "packer@pve!packer" (token id, not a login) token = var.proxmox_api_token # API token secret (never committed) node = var.proxmox_node - insecure_skip_tls_verify = var.proxmox_insecure # true for self-signed homelab certs + insecure_skip_tls_verify = var.proxmox_insecure # false by default; explicit test-only opt-out + task_timeout = var.proxmox_task_timeout # 10m API task wait; configurable for slower storage # --- base to clone (Stage 0) --- - clone_vm = var.base_template_name # e.g. "ubuntu-2404-cloudimg" + clone_vm = var.base_template_name # e.g. "ubuntu-noble-cloudimg" full_clone = true + cpu_type = var.proxmox_cpu_type # host by default; configurable for migration requirements scsi_controller = "virtio-scsi-pci" qemu_agent = true # base image has qemu-guest-agent embedded @@ -172,48 +422,66 @@ Key points required by this spec: - **`cloud_init = true`** and **`cloud_init_storage_pool = `** → the finished template carries an **empty** cloud-init drive for consumers to fill at clone time. -- **No** hostname, static network config, or baked SSH host keys set here — the image stays generic. +- **No** hostname, static network config, or baked SSH host keys set here; the image stays generic. **Networking = DHCP** (decided); per-VM addressing is a clone-time concern. -- **Build-time SSH:** with no explicit communicator config, `proxmox-clone` generates an SSH key and - injects it via cloud-init; `qemu_agent = true` lets Proxmox report the VM's IP back to Packer. +- **Build-time SSH:** `proxmox-clone` generates a temporary SSH key and injects it via cloud-init. + The username `ubuntu` and 20-minute SSH timeout are set explicitly; `qemu_agent = true` lets Proxmox report the VM's IP back to Packer. - The builder finishes by **converting the VM back into a template**, so the output lands as a template, - not a VM — no manual template step. + not a VM; no manual template step. + +### Native CPU model + +The owner resolved R-3 F-02 on 2026-11-04: use `host` as the native default and make it configurable. +`proxmox_cpu_type` feeds the native builder's `cpu_type`; it does not alter the portable QEMU source. +The single-node lab does not require live migration between different processors. A future cluster +needs a model supported by every target node. The follow-up native build and two fresh-clone checks +verified `cpu: host`, inherited configuration, guest AES/AVX features and the existing sealing checks, +as recorded in Context. +CPU model validation rejects blank and whitespace-padded values; +the target node remains responsible for rejecting unsupported model names. ### `source "qemu" "ubuntu"` (portable local artifact) Retained (current builder, Ubuntu **cloud image** + `cidata` seed) for the portable qcow2/raw path and fast local iteration. Same generic-image provisioners, so it no longer bakes identity either. -> Both builders share the **same base** (the upstream Ubuntu cloud image) *and* the same provisioners, -> so the qemu path is a faithful fast check of what the Proxmox template will contain. That equivalence -> is what spec 0002's local/CI qemu loop leans on. +Both builders start from the same upstream Ubuntu release and share provisioners. Their starting +disks differ: the Proxmox bootstrap preinstalls the guest agent, clears machine-id and defaults to +32G, while QEMU boots the upstream image with a 10G disk. Local QEMU checks exercise shared image +provisioning; they do not establish native-builder correctness. This feature tests both Ubuntu amd64 paths; spec 0002 covers the wider OS/macOS matrix. ### Provisioning changes (identity removal) +The QEMU seed grants temporary password SSH access for the build. Sealing replaces that password +hash with `*` and removes cloud-init's generated SSH policy override. The native builder instead +injects a temporary SSH key; both paths discard their build access before export. + Both builders share the `build` block. Strip everything that makes the image machine-specific; that work moves to cloud-init at clone time: - **Remove** hostname assignment (`hostnamectl` / `/etc/hosts` / `hostname_vars.sh` reads). -- **Remove** the baked static `netplan` — clone-time cloud-init owns addressing. (A generic DHCP-on-`en*` - fallback may stay, TBD in review.) -- **Remove** build-time creation of the `sysadmin` user + hardcoded `SSH_PUBLIC_KEY` and SSHD hardening. - Users and keys are injected by cloud-init at clone time. +- **Remove** the generated cloud-init `netplan`; clone-time cloud-init owns addressing. The selected + design uses DHCP and leaves no builder-written fallback network file. +- **Remove** build-time creation of the fixed `sysadmin` user and hardcoded `SSH_PUBLIC_KEY`. + Users and keys are injected by cloud-init at clone time. When selected by the recipe, generic SSH restrictions are supplied by + PDS at build time and retained in the finished image. - **Reset cloud-init state before sealing** so every clone re-runs cloud-init as if first-booted - (the classic template gotcha — otherwise clones skip clone-time init): + (the classic template gotcha; otherwise clones skip clone-time init): ```bash - cloud-init clean --logs --seed + cloud-init clean --logs --seed --configs ssh_config network ``` - **Regenerate machine-id on shutdown** so clones never collide: ```bash truncate -s 0 /etc/machine-id # ensure /var/lib/dbus/machine-id is a symlink to /etc/machine-id (or also truncated) ``` - (`cleanup.sh` already truncates `/etc/machine-id`; make it authoritative and cover the dbus symlink.) + `seal-image.sh` truncates `/etc/machine-id` and relinks the D-Bus machine-id to it. - **Remove** any baked SSH host keys so each clone regenerates its own on first boot, and remove the temporary build SSH key Packer injected. -Generic, non-identity provisioning (packages, shell/MOTD, kubectl, etc.) stays for now and is the subject -of the follow-up PDS-migration spec. +Native Ubuntu packages, locale, timezone and keyboard configuration are shared by both builders via +`cloud-init/build-config.yaml`. Shell customisations, MOTD and selected third-party tools are supplied by the package-backed PDS +step described below. The current executable baseline does not implement that step yet. ### Output @@ -224,36 +492,20 @@ initialization (hostname, IP, SSH keys, `edgectl` bootstrap user-data). ### Variables & secrets New variables: `proxmox_url`, `proxmox_api_token_id`, `proxmox_api_token`, `proxmox_node`, -`proxmox_storage_pool`, `base_template_name`, `proxmox_insecure`, `template_name`, `template_vmid`. +`proxmox_storage_pool`, `proxmox_cpu_type`, `proxmox_task_timeout`, `base_template_name`, +`proxmox_insecure`, `template_name`, `template_vmid`. **Auth = API token** (decided). Create it once in the Proxmox UI (Datacenter → Permissions → API Tokens): a user such as `packer@pve` with token id `packer` yields `proxmox_api_token_id = -"packer@pve!packer"` and a secret → `proxmox_api_token`. The secret must **not** be committed — supply -via `PKR_VAR_proxmox_api_token` env var (preferred, works cleanly in CI) or an untracked -`*.auto.pkrvars.hcl`; confirm `.gitignore` excludes `*.pkrvars.hcl`. The token needs privileges to -create VMs, use the target storage, and template VMs (a `PVEVMAdmin`-style role on `/`). - -> Caveat to verify at implementation: some older `proxmox-clone` versions only supported -> `username`/`password` (not token) for the *clone* builder specifically. On plugin `>= 1.2.2` token -> auth should work; if not, fall back to a `packer@pve` password supplied the same secret-free way. - -## Acceptance criteria - -- [ ] A committed `create-base-template.sh` turns the official Ubuntu cloud image into a base cloud-init - template on the PVE host (qemu-guest-agent embedded), repeatably — no hand-clicking. -- [ ] `packer init .` installs both `hashicorp/proxmox` (`>= 1.2.2`) and `hashicorp/qemu` plugins. -- [ ] `packer build -only='proxmox-clone.ubuntu' …` clones the base and produces a **template** on the - PVE node (verified via `qm config ` showing `template: 1`) with an **empty cloud-init drive** - attached — no per-build `qm importdisk`/upload anywhere in the flow. -- [ ] `packer build -only='qemu.ubuntu' …` still produces the local qcow2/raw artifact. -- [ ] The resulting image contains **no** baked hostname, static IP/netplan identity, or SSH host keys, - and boots with a **fresh `machine-id`** (two clones get distinct ids). -- [ ] No hostname/user/SSH-key/SSHD-hardening provisioning runs at build time; those responsibilities are - documented as belonging to clone-time cloud-init. -- [ ] `packer/ubuntu/readme.md` documents the `-only` invocation for both formats and the required - Proxmox variables/secrets. - -## Decisions (resolved) +"packer@pve!packer"` and a secret → `proxmox_api_token`. The secret must **not** be committed; supply +via `PKR_VAR_proxmox_api_token` (preferred) or an ignored `*.auto.pkrvars.hcl` file. The committed +`variables.pkrvars.hcl` contains non-secret values and requires an explicit `-var-file` argument. +Token authentication was verified with plugin 1.2.4. Use read permissions for discovery and scope +VM writes to the base and reserved output IDs, storage allocation to the target pool, and network +access to the selected bridge. A root API token is unnecessary. `template_vmid = 0` requests automatic +allocation; reserve an unused explicit ID when restricting the token to particular VM IDs. + +### Earlier recorded decisions - **Selection mechanism:** `-only` (explicit, idiomatic). No `build_target` variable. - **Base:** the official Ubuntu **cloud image** (prebuilt OS + cloud-init), *not* an ISO install. No @@ -261,21 +513,2111 @@ create VMs, use the target storage, and template VMs (a `PVEVMAdmin`-style role - **Builder:** `proxmox-clone` from a cloud-image base template. The one-time base is created by a committed `create-base-template.sh` (Stage 0); Packer clones + customizes it every build (Stage 1). - **Networking:** DHCP everywhere in the image; no static addressing baked in. -- **Auth:** Proxmox **API token** (for the Proxmox API that Packer builds against — a token created in +- **Auth:** Proxmox **API token** (for the Proxmox API that Packer builds against; a token created in the PVE UI, not the Terraform provider's creds). -## Open questions +### Current orchestration draft + +`packer/ubuntu/ubuntu.pkr.hcl` uploads the image configuration, runs `scripts/wait-cloud-init.sh`, passes the config path to `scripts/install.sh`, and calls `scripts/seal-image.sh --image-build` last. The readiness provisioner has a 20-minute deadline. Both builders share that ordering. The disabled Ubuntu account and its standard sudo rule remain so the existing authenticated session can request shutdown. Clone-time inputs supply usable deployed access. The expanded design adds the package-backed PDS step between native Ubuntu configuration and sealing. PDS remains standalone. + +### Default recipe and explicit customization + +The owner approved this contract on 2026-11-05: builders is a readable image recipe using shared PDS +functions. The supplied default selects Zi/Powerlevel10k, the chosen MOTD, tooling, nightly updates +and restricted SSH. Those selected defaults must be applied reliably and tested. They are not a +mandatory policy for every custom image built with this repository. + +Keep the default function sequence in `packer/ubuntu/recipes/default.sh`. Packer's +`provisioning_recipe` input defaults to that file. An operator can select another readable Bash recipe +at build time, without changing the default recipe or PDS. Builders uploads the selected recipe, +loads the installed PDS library, and runs that recipe as trusted image-build code; it never evaluates +a string of function names. Missing recipe files and failed selected calls stop the build. +The committed `recipes/custom.example.sh` selects Zi/configuration and a MOTD while omitting the +update and SSH-policy calls. No profile +framework or duplicated policy implementation is needed. + +Builders exports `BUILD_MOTD_PRESET` and `BUILD_KUBECTL_CHANNEL` to the selected recipe. The default +recipe consumes them; a custom recipe explicitly controls whether to use or ignore those inputs. + +Skipping a policy call means builders does not apply that PDS policy. It does not reverse policy +inherited from the Ubuntu source or a customized parent image, and does not itself enable password +login. A custom recipe must explicitly configure any different behavior it wants. Tests check the +default recipe's strong settings and a custom recipe's actual selections separately. + +Native Ubuntu configuration, PDS package identity checks and image sealing remain builder steps. +Custom recipes do not disable removal of temporary build credentials or reset of machine identity. +The default and custom paths both leave real users, public keys, hostname and addressing to deployment. +A PDS helper can still configure a normal host's user/key; cloud-init is the default VM-deployment +entry point and does not become a dependency of standalone PDS. + +### PDS provisioning and package identity + +Builders installs an exact PDS version, sources `/usr/share/pds/init.sh` explicitly in non-interactive +Bash and calls named shared functions. Native Ubuntu apt packages remain in +`cloud-init/build-config.yaml`; reusable software installers and configuration stay in PDS. +`install.sh` keeps its explicit cloud-config input and short orchestration role. Sealing and base +preparation remain separate scripts; PDS does not acquire Proxmox or sealing responsibilities. + +Normal builds obtain the selected version from the signed PDS APT repository. Version and trust +inputs are explicit, updater-discoverable build configuration. Missing versions, trust failures, +missing functions and failed selected installers stop the build. No fallback to `latest`, the default +branch, a local source directory or a different installed version is allowed. + +Before PDS is merged/released, an explicit candidate-package input may upload a locally built `.deb` +for integration tests. It requires the expected package name, version and SHA-256; the installed +package must match them. The build records candidate provenance and must not label this route as +published-release validation. The normal signed-repository route must also pass before final delivery. +No PDS release or merge is triggered by preparing this builders PR. + +The owner first reviews the dependent PDS PR. Only after separate owner authorization may that PR +be merged and its existing release pipeline run. Record the actual CI-assigned version and published +package identity in builders, replacing the candidate test input, then repeat signed-repository +builds and fresh-user checks for both outputs. Until then the builders PR is a candidate integration; +it cannot receive final implementation acceptance from local-package tests alone. The agent does not merge or +trigger a release through this handoff. + +Only the needed PDS libraries and packaging receive dependent repairs. Both installed-package and +standalone checkout/raw-bootstrap usage are checked; loading the library defines functions without +running installers, changing shell options or downloading anything. No Proxmox dependency is added. + +The exact PDS version identifies the built image at seal time. Keep the signed PDS source/trust key +and selected third-party APT repositories in the sealed image. With the default recipe, the nightly all-package update policy +therefore upgrades PDS and GitHub CLI as new versions appear, and kubectl within its configured APT +channel. Record the installed versions and retained repositories in build evidence. There is no +package hold or promise that a running instance remains at the build-time versions; copied shell +configuration is not automatically regenerated merely because the PDS library package upgrades. + +### Bootstrap preservation map + +| Earlier capability | Planned home and observable result | +| --- | --- | +| Ubuntu packages, locale, keyboard and timezone | Native cloud-init settings shared by both outputs. | +| Zi and Powerlevel10k | PDS `install_zi` and `configure_zsh`, preserving the existing preset, plugin set and Zi workflow. The owner selected the existing Zi per-user first-login downloads, keeping the current preset and plugin configuration. First shell startup needs internet access. | +| MOTD | PDS supplies file-based VHCO, Stackweaver and legacy EdgeForge presets. Builders defaults to VHCO; a shared helper selects a preset or accepts an operator banner file, preserving other MOTD scripts. | +| GitHub CLI | PDS `install_gh`; verify the binary in a built image without configuring an account or token. | +| kubectl, alias and completion | PDS supplies system tooling and shared shell configuration, usable by a new deployment user rather than only the build account. The version/channel input is explicit. | +| Krew, stern, view-secret and neat | Preserve Krew and all three plugins for a fresh deployment user through supported PDS image/user setup. Failed downloads cannot be logged as successful provisioning; no empty plugin selection satisfies this scope. | +| Hostname, users, SSH keys, login shell, sudo and network identity | Clone-time cloud-init inputs. A documented example selects Zsh and sudo for the deployed user; no hardcoded `sysadmin` or personal key is retained. | +| Automatic updates and restrictive SSH policy | PDS configures the nightly midnight update job and a retained public-key SSH baseline with password and root logins disabled. The default recipe bakes both into each output; custom recipes may omit those calls. | +| Manual GRUB rewrites | The official cloud image provides its boot chain. Retain the boot test, not an unverified architecture-specific reinstall command. Firmware modes beyond the tested configuration remain unclaimed. | + +The PDS candidate's user-local kubectl/Krew setup must be corrected upstream, keeping its ordinary +workstation entry point compatible. Builders selects the image behavior; it does not copy the +installer. The owner selected the existing Zi first-login workflow on 2026-11-04. PDS supplies +Zi, the shared zshrc and the existing Powerlevel10k preset; Zi downloads the selected plugins and +snippets into each user's home when first needed. Powerlevel10k may also fetch its supporting +binary. First shell startup therefore needs internet access, and upstream plugin revisions can +change between users or deployments. + +Keep the current Zi configuration and standalone installation behavior. For Zi shell plugins, this scope adds no +image-specific cache, shared prefetched asset tree or plugin lockfile. Pinning the PDS +package fixes its functions and configuration; it does not freeze first-login plugin contents. +Record that reproducibility limit in the bootstrap guide and validation results. + +Krew and its required neat/view-secret/stern plugins are system tooling installed during the image +build, independently of Zi's shell-plugin downloads. PDS supplies an explicit system-install mode +that preserves its ordinary per-user workstation behavior. Image mode installs a root-owned Krew +tree under `/usr/local/share/pds/krew`, exposes its `bin` directory and `KREW_ROOT` to deployed Bash +and Zsh users, and requires each selected plugin installation to succeed. Deployed users can execute +these tools without referring to `/root/.krew`; updating that shared tree is an administrator task. +A user can explicitly select a private Krew root for their own plugin changes. Test both fresh-user +execution and the retained standalone per-user installer. No build-user credentials or home state +are copied to make this work. + +The package's interactive auto-loader and login message remain PDS behavior during this preparation. +AC-11's strict error-reporting contract applies to explicit non-interactive loading; it makes no +claim that the existing interactive loader stops suppressing errors. Inspect both `/root` and +`/home/ubuntu` for build residue, regardless of which HOME `sudo` supplies. Shared assets belong in +system/skel locations; build-user homes must not become deployment-user paths. + +Native validation supplies a complete deployment cloud-config through a `cicustom` user snippet; +this makes the chosen user's shell and sudo policy explicit. It needs snippet-capable storage, +access to the owned snippet and permission to reference it from the owned clone. Preflight checks +these prerequisites; it does not silently change storage settings. The same config is delivered by +NoCloud seed for the portable path. Assert the user's actual login shell and sudo policy, not merely +that a manual Zsh command runs. Proxmox's source generator and custom-snippet reader establish this +mechanism; the installed node's behavior still requires the planned live test. + +The PDS dependency includes package-test CI and trigger coverage for packaged `bash/config/` assets +and tests. Relevant ShellCheck failures must not be swallowed by the existing broad lint recipe. +The PDS default checkout contains an earlier APT-workflow edit; preserve it and assess any needed +transfer independently, without overwriting it. Do not pull the unrelated Cloudflare feature in. + +### Baked update and SSH policy + +With the default recipe, both outputs receive the same automatic-update and SSH baseline through +named PDS functions. Selecting a different recipe is the explicit build-time opt-out; builders does +not reapply omitted policy outside that recipe. +`update_system_cron_entry` selects the existing nightly `00:00` update policy, using the image's +configured timezone. Its exact managed command uses `apt-get` with +`DEBIAN_FRONTEND=noninteractive` and explicit dpkg `--force-confdef`/`--force-confold` handling, so +modified configuration files cannot leave the job waiting for input. It updates APT metadata and +upgrades available packages, not only security packages. Native Ubuntu package configuration provides the scheduler, and its enabled state must +survive into each fresh instance. Repeated provisioning creates one managed job. The managed command waits or retries for APT lists and dpkg locks within a bounded five-minute +budget, then returns a visible failure if contention persists. Keep Ubuntu's existing apt-daily and +unattended-upgrades timers; coexistence must be tested rather than assuming midnight is idle. +This scope adds no automatic reboot policy. + +`restricted_ssh_security_profile` supplies a retained managed OpenSSH configuration: password and +keyboard-interactive login disabled, public-key authentication enabled, and root SSH login disabled. +Store the baseline in `/etc/ssh/sshd_config.d/00-pds-security.conf`, ordered before generated +`50-cloud-init.conf` and distribution `60-cloudimg-settings.conf`. It enforces key-only, non-root +SSH even when a deployment input requests `ssh_pwauth: true`; changing that baseline is an explicit +operator configuration change. Verify the actual include precedence with `sshd -T`, including any +existing main-file settings, rather than relying only on the filename. +The current PDS function only rewrites a few default lines with sed; the dependent PDS repair must +make the intended effective settings reliable and repeatable without duplicating the logic in builders. +The helper writes and validates the configuration with `sshd -t` but does not reload the daemon. +Ordinary-host documentation provides an explicit distribution-appropriate reload step after the +operator verifies key access; the image build never invokes that step. Check both the no-reload +helper contract and the ordinary-host validation/reload procedure. +Verify configuration syntax and effective settings, including after clone-time cloud-init runs. + +Keep temporary Packer access usable until provisioning and sealing finish. The QEMU path initially +uses password access, while the native path uses a temporary key. Finish package operations capable of restarting services before installing the final policy. +Record ssh.service's MainPID and activation timestamp immediately before policy installation and +again before sealing; require them to match, and inspect the guest journal for intervening restarts. +Apply the policy without sshd reload/restart during that interval, then remove the temporary build password/key and generated policy during +sealing. The retained PDS policy must survive cleanup and fresh cloud-init initialization. A finished +instance accepts its injected non-root user's key, rejects password login and rejects root SSH. +Any recipe selecting `restricted_ssh_security_profile` must call it last, after installers capable +of restarting services. The guest PID/activation check applies whenever that policy is selected, +including in a custom recipe. This is separate from resetting SSH host keys and machine identity. + +### File-based MOTD presets + +The owner uses VHCO for current branding and wants EdgeForge retained for possible future use. +Provide three bundled text banners under PDS `bash/config/motd/`: `vhco.txt`, `stackweaver.txt` and +`edgeforge.txt`. The existing nFPM `bash/config` mapping packages them under +`/usr/share/pds/config/motd/`. Preserve the legacy EdgeForge banner from +`origin/main:packer/ubuntu/scripts/install.sh` rather than replacing it with the new brand. +The original MOTD block and draft banner text were retained privately for comparison; the new VHCO +and Stackweaver assets are plain title drafts pending their visual treatment. The EdgeForge +comparison target is the rendered text of the original plain echo lines, ignoring trailing whitespace. +Keep one plain banner, with the optional information-tool argument controlling system information; +the duplicated coloured output and unconditional neofetch invocation are historical behavior. + +Keep `setup_motd [none|fastfetch|neofetch]` compatible with the existing candidate. +Add `setup_motd_preset [none|fastfetch|neofetch]` as a small selector +that resolves a bundled file and delegates to that helper. Resolve assets from the installed package +or a complete standalone checkout. Reject unknown preset names and missing assets before changing +the active MOTD. Text files are read as data, never sourced or evaluated as shell code. + +Builders selects `vhco` by default through an explicit configurable MOTD-preset input. Other images +can select `stackweaver` or `edgeforge`; operators can continue supplying a custom file to the base +helper. A selection installs one active banner, not all presets at login. The helper manages only its +own `/etc/update-motd.d/90-pds` entry and copied banner under `/etc/pds`, leaving distribution and +operator scripts intact. Dynamic system information remains optional and separate from branding. +Changing a preset requires no duplicated shell function. These are image/host banners, with no +claim about where Stackweaver or any workload is deployed. + +### Bounded image checks and delivery order + +Keep `make check` available without Proxmox credentials or KVM. Add bounded host-side checks for the +PDS version/origin and required functions, provisioning failure propagation, packaged assets, offline +identity invariants and first-boot behavior. New behavioral tests run failing before their repairs. +Do not substitute a mocked function-call test for real package or image validation. + +The standalone amd64 path builds qcow2 plus raw, compares their contents, inspects the sealed disk +read-only and boots two instances with different NoCloud users/keys. Each must finish cloud-init, +accept SSH with its supplied key and expose the selected tooling to that new user. Compare machine +IDs and host keys, and check removal of build credentials. The native path repeats those assertions +on the resulting Proxmox template and two owned clones, with the selected `host` CPU default. + +PR checks run static/regression and package checks without homelab credentials. Image build/boot jobs +check KVM availability and report missing acceleration explicitly; a skipped job is not image proof. +Native validation stays an explicit owned-resource operation. Final acceptance requires observed +image results for both outputs even if a hosted runner cannot perform them. + +Preparation proceeds through the PDS package/standalone contract, shared installer repairs, builders +package selection, bounded image checks, documentation and final source review. Publication describes +one builders PR and its separate PDS dependency. The issue links remain open until their implemented +scope is verified and merged by the owner. Feature 0002 remains open for its wider matrix. + +## Acceptance Criteria + +- [x] AC-01: A committed `create-base-template.sh` turns the official Ubuntu cloud image into a base cloud-init template on the PVE host (qemu-guest-agent embedded), repeatably; no hand-clicking. + Evidence: R-29 returned met at 86f740b666b8fc1d96e417ad57cc4625bda9f02d using its observed 9f4db43 matrix and verified comment-only source equivalence; returned records and measurement limits are preserved below. +- [x] AC-02: `packer init .` installs both `hashicorp/proxmox` (`1.2.4`) and `hashicorp/qemu` plugins. + Evidence: R-29 returned met at 86f740b666b8fc1d96e417ad57cc4625bda9f02d using its observed 9f4db43 matrix and verified comment-only source equivalence; returned records and measurement limits are preserved below. +- [x] AC-03: `packer build -only='proxmox-clone.ubuntu' …` clones the base and produces a **template** on the PVE node (verified via `qm config ` showing `template: 1`) with an **empty cloud-init drive** attached; no per-build `qm importdisk`/upload anywhere in the flow. The native CPU model defaults to `host` and is configurable; the template and two fresh clones use the selected default, and blank or whitespace-padded model names fail local validation. + Evidence: R-29 returned met at 86f740b666b8fc1d96e417ad57cc4625bda9f02d using its observed 9f4db43 matrix and verified comment-only source equivalence; returned records and measurement limits are preserved below. +- [x] AC-04: `packer build -only='qemu.ubuntu' …` still produces the local qcow2/raw artifact. + Evidence: R-29 returned met at 86f740b666b8fc1d96e417ad57cc4625bda9f02d using its observed 9f4db43 matrix and verified comment-only source equivalence; returned records and measurement limits are preserved below. +- [x] AC-05: Both native and portable sealed outputs contain no site-specific hostname, static IP/netplan identity or SSH host keys; two independently initialized instances of each output receive distinct machine IDs and host keys and apply their supplied identities. + Evidence: R-29 returned met at 86f740b666b8fc1d96e417ad57cc4625bda9f02d using its observed 9f4db43 matrix and verified comment-only source equivalence; returned records and measurement limits are preserved below. +- [x] AC-06: The sealed image retains no build password, authorized keys or generated SSH policy override. The default Ubuntu account may remain only locked and keyless, with its standard sudo policy. Usable deployed users, keys and site-specific identity are supplied at clone time; the default recipe's PDS SSH baseline remains effective after fresh cloud-init initialization. + Evidence: R-29 returned met at 86f740b666b8fc1d96e417ad57cc4625bda9f02d using its observed 9f4db43 matrix and verified comment-only source equivalence; returned records and measurement limits are preserved below. +- [x] AC-07: Short root and Ubuntu READMEs link canonical procedures for both output selections, PDS bootstrap, SSH/debugging and recovery; small flow diagrams use Mermaid and Proxmox is explicitly optional. + Evidence: R-29 returned met at 86f740b666b8fc1d96e417ad57cc4625bda9f02d using its observed 9f4db43 matrix and verified comment-only source equivalence; returned records and measurement limits are preserved below. +- [x] AC-08: Both builders install the exact selected PDS package, verify its identity and provenance, and fail on missing, mismatched or untrusted inputs; candidate-package testing is distinguished from a verified signed-repository release build. + Evidence: R-29 returned met at 86f740b666b8fc1d96e417ad57cc4625bda9f02d using its observed 9f4db43 matrix and verified comment-only source equivalence; returned records and measurement limits are preserved below. +- [x] AC-09: The shared provisioner applies native Ubuntu settings and the default recipe's explicit PDS function selection for Zi/Powerlevel10k, MOTD, GitHub CLI, kubectl, Krew, neat/view-secret/stern, nightly package updates and restricted SSH; reusable implementations live in the standalone PDS package, and selected-function failures stop provisioning. + Evidence: R-29 returned met at 86f740b666b8fc1d96e417ad57cc4625bda9f02d using its observed 9f4db43 matrix and verified comment-only source equivalence; returned records and measurement limits are preserved below. +- [x] AC-10: A new deployment user of a default-recipe image receives working Zsh/Powerlevel10k, the kubectl alias/completion, Krew and the neat, view-secret and stern plugins from either output, with its configured Zsh login shell and sudo policy and without inheriting build credentials or build-home paths. Zi populates the existing plugin set on first shell startup with network access; no image-prefetched plugin cache is required. + Evidence: R-29 returned met at 86f740b666b8fc1d96e417ad57cc4625bda9f02d using its observed 9f4db43 matrix and verified comment-only source equivalence; returned records and measurement limits are preserved below. +- [x] AC-11: The PDS package loads non-interactively without installer/network side effects, preserves the caller's shell state and reports library failures; its supported standalone setup preserves Zi, the preset and the existing plugin set. Error-reporting assertions cover explicit non-interactive loading; interactive auto-loading is documented separately. + Evidence: R-29 returned met at 86f740b666b8fc1d96e417ad57cc4625bda9f02d using its observed 9f4db43 matrix and verified comment-only source equivalence; returned records and measurement limits are preserved below. +- [x] AC-12: Repository checks exercise package-backed provisioning, failure paths, sealed-artifact assertions and two fresh boots of each Ubuntu amd64 output; CI reports executed versus skipped checks, and native checks preserve all pre-existing guests. + Evidence: R-29 returned met at 86f740b666b8fc1d96e417ad57cc4625bda9f02d using its observed 9f4db43 matrix and verified comment-only source equivalence; returned records and measurement limits are preserved below. + +- [x] AC-13: PDS bundles selectable VHCO, Stackweaver and preserved EdgeForge MOTD text presets; builders defaults to configurable VHCO, custom-file usage remains supported, and invalid selections leave the active MOTD and other MOTD scripts unchanged. + Evidence: R-29 returned met at 86f740b666b8fc1d96e417ad57cc4625bda9f02d using its observed 9f4db43 matrix and verified comment-only source equivalence; returned records and measurement limits are preserved below. + +- [x] AC-14: Both image outputs built with the default recipe retain one configured nightly midnight package-update job that runs non-interactively with an enabled scheduler and effective SSH settings that allow injected non-root public-key login while disabling password, keyboard-interactive and root login; repeated provisioning is safe and temporary Packer access is removed only after it is no longer needed. + Evidence: R-29 returned met at 86f740b666b8fc1d96e417ad57cc4625bda9f02d using its observed 9f4db43 matrix and verified comment-only source equivalence; returned records and measurement limits are preserved below. + +- [x] AC-15: An operator can select a readable custom Bash recipe at invocation for either output without editing the default recipe or PDS; omitted PDS update/SSH policies are not applied elsewhere, missing recipes and failed calls stop the build, and generic-image cleanup still runs. + Evidence: R-29 returned met at 86f740b666b8fc1d96e417ad57cc4625bda9f02d using its observed 9f4db43 matrix and verified comment-only source equivalence; returned records and measurement limits are preserved below. + +## Test Plan + +| Criterion | Proof | +| --- | --- | +| AC-01 | Run the off-node bootstrap from a clean supported environment on unused IDs; verify template, guest agent and reset identity. Import the saved bundle from a second minimal environment without Packer/libguestfs. Repeat import of the same verified bundle on another unused ID must produce the requested fixed configuration; generated IDs/MACs may differ. The same occupied ID must be refused, and corrupt-bundle attempts must leave existing guests unchanged. Moving upstream downloads are not a byte-identical rebuild guarantee. | +| AC-02 | Run `make init`, then validate that both required plugin versions load. | +| AC-03 | Run the native Packer build with a scoped test token; inspect the output template flag, cloud-init volume and absence of temporary cloud-init credentials. Inspect the native source and build log to confirm there is no disk-import or disk-upload step after Stage 0. Verify the native default and both fresh clones report `cpu: host` and expose node AES/AVX features; validate a CPU override and reject both an empty model and a whitespace-padded value such as `" host "`. | +| AC-04 | Run the QEMU builder with raw export enabled; inspect both formats and compare their disk contents. | +| AC-05 | Inspect each native and portable sealed artifact read-only, then boot two fresh instances of each with separate cloud-init inputs; compare machine IDs, host keys and applied identity. The qcow2/raw disks must compare identically. | +| AC-06 | Run the manual disposable-container `tests/test_sealing.sh` check with real cloud-init; verify sealing removes the temporary SSH password override and discards the build-password hash. `make check` lint-checks this script but does not execute its destructive guest changes. Inspect both default-recipe sealed outputs and boot fresh instances with consumer-supplied users/keys; effective SSH policy must retain the selected baked restrictions while accepting the supplied non-root user's key. | +| AC-07 | Follow linked task guides for both outputs and a temporary SSH/VNC session; check local links, examples and variables against source. Render both Mermaid diagrams and verify the standalone quick start needs no Proxmox credentials. | +| AC-08 | Exercise exact-version repository installation and explicit candidate upload; reject wrong version, package name, checksum, trust and missing-function inputs. Inspect dpkg metadata, provenance, APT source files and keyrings in each built output; record exact build-time versions and the retained signed repositories. Final validation includes the signed-repository route; the baked updater is expected to advance running-package versions later. | +| AC-09 | Inspect the selected PDS functions and their installed-package origins; execute real provisioning and verify tools/settings in the image. Inject a failing selected function and require the provisioner to fail before sealing. | +| AC-10 | Log into each fresh instance as its supplied new user; check the actual Zsh login shell and documented sudo policy, preset, kubectl alias/completion, Krew and neat/view-secret/stern commands. Exercise actual Zi first-login downloads with network access, then verify the preset/plugins work on a subsequent shell startup; record the downloaded revisions and network requirement. Verify Krew and neat/view-secret/stern execute from the shared system tree as the new user without a Krew download, and retain standalone per-user coverage. Inspect /root and /home/ubuntu in each sealed filesystem for build-user paths, keys, tokens and history; use a complete native cicustom snippet and equivalent portable NoCloud seed. | +| AC-11 | Install the built PDS package in disposable Ubuntu and run its strict-load, missing-library, Zi/preset, MOTD, sudoers and standalone-path tests. Add real selected-installer/new-user coverage; existing Zi stubs do not prove actual downloads or plugin startup. | +| AC-12 | Execute documented Make targets and PR checks, including negative artifact fixtures; retain per-output build/offline/boot results and explicit skips. For Proxmox, snapshot original guest configurations/power states, reserve unused owned IDs, and audit ownership-limited cleanup afterward. | +| AC-13 | Inspect the built package for all three banner files and compare EdgeForge with the preserved legacy banner. Exercise each preset and custom-file usage in disposable Ubuntu, including standalone-checkout resolution, repeated application, preset switching, unknown names and missing files; verify unchanged operator scripts and no changes after invalid selection. Check the configured banner in both image outputs. | +| AC-14 | Apply the PDS helpers twice in disposable Ubuntu; require one midnight job, scheduler enablement, sshd syntax/effective settings and successful non-interactive updates, including an upgrade of a deliberately modified conffile. Exercise held APT-list and dpkg locks, requiring bounded recovery and visible timeout failure. In a fresh instance of each output, execute the installed job's exact command under cron PATH with stdin /dev/null and require exit 0. Guest-side ssh.service PID/activation timestamp and journal evidence must establish no reload/restart between policy installation and sealing; a quiet Packer log is insufficient. For one owned instance per output, supply ssh_pwauth: true, disable_root: false, a temporary known non-root password and a temporary root key. Add a lower-precedence 10-test-permissive.conf enabling password, keyboard-interactive and root login; require the baked 00-pds-security.conf settings to win. Use a permissive control in the owned fixture to establish the credentials and authentication methods work without the PDS restriction, then restore the baseline and require non-root key success, password/keyboard-interactive/root-key refusal at authentication, only publickey offered, and matching sshd -T values. Root refusal must be authentication denial, not a cloud-init forced-command banner. Redact/discard test credentials and retain per-output results. Inspect the retained policy offline and check the scheduler/baseline in both fresh instances of each output. | +| AC-15 | Validate inputs for both builders and reject an unreadable/missing recipe before building. Exercise the shared provisioner with the default and committed recipes/custom.example.sh; check exported inputs, selected call order and propagated failure. Build that custom example for both native and portable outputs from clean bases. Inspect each sealed disk for absent 00-pds-security.conf and PDS-managed update job, present example selections, and AC-06 credential/identity cleanup. Boot two fresh instances of each custom output with independent identities and verify AC-05 separation and the selected tools/MOTD. No custom-image assertion requires enabling password login or undoing vendor/inherited policy. | + +## Tasks + +T1-T7 were the earlier unchecked worklist; their source, reviews and delivery history remain in Git. +This unchecked tail is replanned for the accepted combined scope without inventing completion ticks. +PDS paths below refer to the existing `michielvha/PDS` dependency branch +`feat/image-provisioning-pds`; builders stays on its existing owning feature branch. Each task is one +local commit. No branch push, merge or release is implied by a task tick. + +- [x] T8 `PDS/AGENTS.md`, `PDS/CLAUDE.md`, `PDS/.github/copilot-instructions.md` adopt the pinned shared conventions while preserving existing code and independent standalone use; instruction links and local command references check cleanly (AC-11). + Evidence: PDS commits 12acd56 and b198f47 adopt the pin and retain all prior Copilot instruction bytes in AGENTS.md; the initial accidental replacement was corrected locally without rewriting history. The existing code was untouched. +- [x] T9 `PDS/packaging/`, `PDS/bash/common/`, `PDS/bash/debian/`, `PDS/bash/config/zshrc`, `PDS/tests/image_provisioning_test.py` retain and commit the inherited image-provisioning candidate after its nine package tests, changed-shell lint and source/package comparison pass; record that these tests predate this continuation rather than inventing a failing-first history (AC-11). + Evidence: PDS commit 08ce2d7; re-ran the existing package in a disposable network-isolated container against matching source: nine tests passed. Earlier source/package comparison covered 79 files and changed-shell lint passed. This inherited implementation predates this continuation, so no new failing-first history is claimed. +- [x] T10 `PDS/tests/test_motd_presets.py` adds packaged-preset, switching, invalid-input and standalone/custom-file checks; observe missing helper/assets fail against T9 (AC-13). + Evidence: PDS commit 96e34cd; docker test run in /tmp/builders-recipe-20261105/motd-red.log failed with missing preset files and setup_motd_preset exit 127 before implementation. +- [x] T11 `PDS/bash/debian/admin/setup_motd.sh`, `PDS/bash/config/motd/`, `PDS/packaging/README.md` implement the file selector, three banners and documented compatibility; T10 and existing package tests pass (AC-13). + Evidence: PDS commit 416550f; rebuilt package SHA256 48d43f7f5bac39e9e59d235b7d30a7fc3c68464f19aaf0b8400e56894bb24e7c. ShellCheck and all 13 package tests passed in disposable network-isolated Ubuntu; motd-final.log retains the results. Builders preset wiring and complete AC-13 image proof remain pending. +- [x] T12 `PDS/tests/test_image_baseline.py` adds real OpenSSH configuration/authentication and noninteractive updater/lock/conffile checks in disposable Ubuntu; observe the current helpers fail these checks (AC-14). + Evidence: PDS commit a59d81a; baseline-red.log records the four real-service checks failing against the old helpers after permissive SSH positive controls succeeded. Configuration errors, policy/drop-in behavior and managed updater execution were the observed gaps. +- [x] T13 `PDS/bash/common/admin/sysadmin.sh`, `PDS/bash/debian/admin/`, `PDS/bash/config/`, `PDS/packaging/README.md` implement the repeatable updater and validated no-reload SSH policy, with observer support for selected image policy; T12 and standalone helper checks pass (AC-11, AC-14). + Evidence: PDS commit fb8be74; digest-pinned disposable Ubuntu, network disabled, installed candidate SHA256 f5a8d8600dd43b47d489c24454e9e5eb754219ade18093187557bdaa72c909a7. ShellCheck and all 18 package tests passed (baseline-checked.log). An added rollback test first exposed lost file permissions; the repair preserves the previous policy metadata. Complete image/boot proof remains pending. +- [x] T14 `PDS/tests/test_kubectl_image.py` exercises strict noninteractive execution, system-wide tool availability and propagated plugin failures; observe current user-local/warning behavior fail (AC-09, AC-10). + Evidence: PDS commit cd02d6a; kubectl-red-final.log records four failures against the unchanged installer: invalid inputs performed downloads, strict loading hit an unset ZSH_VERSION, image mode was absent, and failed bootstrap still returned success. The controlled Krew fixture was subsequently corrected to supply Krew's ordinary HOME default. +- [x] T15 `PDS/bash/debian/software/install_kubectl.sh`, `PDS/bash/config/`, `PDS/packaging/` add explicit system-image mode and verified Krew inputs while preserving ordinary per-user installation; T14 and package regression tests pass (AC-09, AC-10, AC-11). + Evidence: ShellCheck and 24 tests passed using candidate SHA256 adbfc7345d4f0feb217cb14648c54cc974b9b83d6b99ffd1d85ee71e434b24b7 in disposable network-isolated Ubuntu (kubectl-raw-compatible.log). A separate real-download run (kubectl-live.log) installed kubectl 1.37.2, verified Krew 0.5.0 and all three plugins; a fresh unprivileged user executed them from the shared root-owned tree. This container proof does not establish either image output's boot behavior. +- [x] T16 `packer/ubuntu/tests/test_pds_provisioning.py` adds package-identity, default/custom recipe, selected-call failure and SSH-order observation checks; observe the missing integration fail (AC-08, AC-09, AC-15). + Evidence: commit ccb34d5; builders-pds-red.log records the missing installation/recipe entry points failing the positive-path checks. The tests intercept package/system commands and perform no host or Proxmox mutations. +- [x] T17 `packer/ubuntu/scripts/`, `packer/ubuntu/recipes/`, `packer/ubuntu/ubuntu.pkr.hcl`, `packer/ubuntu/variables.pkr.hcl`, `packer/ubuntu/pds/` implement the thin package bootstrap and recipe selection, move package operations ahead of final policy, and retain sealing outside recipes; T16, Packer validation and existing local checks pass (AC-06, AC-08, AC-09, AC-15). + Evidence: all 33 local tests and ShellCheck passed (builders-checks.log); Packer 1.16.2 with exact qemu 1.1.8/proxmox 1.2.4 plugins reports valid configuration, and formatting passes. Default/custom selection, explicit candidate identity/trust failures and SSH restart/reload observation pass controlled checks. Native/portable builds and the pending signed PDS release remain unverified for this change. +- [x] T18 `packer/ubuntu/tests/`, `Makefile` add failing negative artifact and fresh-user checks for the bounded Ubuntu image validation, including real cron environment and preserved journal evidence (AC-05, AC-06, AC-10, AC-12, AC-14). + Evidence: commit d762cc3; artifact-red.log records missing check entry points failing the positive artifact and invalid-mode checks. Controlled residue cases cover baked identity/access, incorrect package metadata and a custom recipe leaking default policy. Real cron-environment/lock/conffile checks are retained in PDS T12-T13; live scheduler/authentication checks remain T20. +- [x] T19 `packer/ubuntu/tests/`, `Makefile`, `.github/workflows/`, `renovate.json5` implement the bounded shared check targets and secret-free PR checks, report skips explicitly, and expose pinned inputs to the updater; T18 and local CI-equivalent checks pass (AC-08, AC-12). + Evidence: make-check.log records the exact CI entry point passing Packer formatting/validation, ShellCheck and all 37 local tests, followed by an explicit live-test skip. Actionlint passes the new read-only PR workflow. Renovate 44.216.2 validates both configs; its actual regex manager extracts PDS, both plugins, the Packer tool and both Krew checksums (renovate-extraction-final.log). PDS commit 1dd0ac8 supplies its dependency config. Hosted updater access and GitHub CI execution are not established by local checks. + Follow-up: PDS commit 0985e50 adds a separate candidate-package PR check, relevant fail-on-warning lint, and bash/config/test trigger coverage in the existing publisher. The exact CI package script passed all 24 tests in a disposable source snapshot (pds-ci-equivalent.log); Actionlint and actual Renovate extraction include its verified nFPM pin. The unrelated default-checkout APT architecture patch remains untouched; an actual signed-repository install of existing PDS 0.19.0 succeeded without transferring that patch. +- [x] T20 `docs/validation/` records executed default/custom native and portable builds, sealed inspection, two fresh boots per recipe/output, scheduler/authentication/tool checks and ownership-limited cleanup; all pre-existing guests remain unchanged. Candidate-package proof is labelled separately from the later signed-release route (AC-01, AC-02, AC-03, AC-04, AC-05, AC-06, AC-08, AC-10, AC-12, AC-13, AC-14, AC-15). + Evidence: builders guest provisioners at e5cf7b3 and explicit PDS candidate 1.0.0, SHA256 744343e157c8d0b297daf8633fb9623839bbd4734c89f384f7c0208cc141d3ba. Both native and both portable recipes built successfully; all four passed read-only inspection and both portable qcow2/raw pairs compare equal. Eight final fresh instances passed selected shell/tooling, distinct identities, isolated keys and MOTD checks. Both default outputs passed real authentication controls and cron-environment execution. The final audit removed all owned instances/build resources, volumes, seeds/snippets, temporary storage and API identities; all seven originals and original storage settings were preserved. Storage content-list ordering was normalized only after exact original-hash reconstruction proved no setting changed. Failed attempts and signed-release limitations remain in docs/validation/0001-2026-11-05.md; the future signed PDS route is not claimed as verified. +- [x] T21 `readme.md`, `packer/ubuntu/readme.md`, `docs/ubuntu/`, `docs/development.md` align the short entry points and task guides with observed commands, recipes, branded MOTDs and validation limits; links/examples check cleanly and independent final implementation review targets the committed source (AC-07, AC-13, AC-15). + Evidence: all 44 builders checks, the real disposable sealing regression and all 27 PDS package/build-target checks pass. Both Mermaid diagrams render in Chromium and Firefox, and the linked procedures resolve. R-21 targets committed builders d9282b4 and PDS 92cd558; its returned records are retained exactly. The current test count/source description and Review Log/Sources placement repair its two documentation nits. + Review limits: R-18's fail-fast shell, build-home cleanup and expected-package-source repairs are independently reviewed. R-19's workflow-only PR trigger nit is repaired; the older helper remains documented outside this integration. R-20 returned no source findings but its Docker execution was denied, so it is not independent runtime proof. Feature status remains in-progress for owner review, the future signed-release route and independent runtime acceptance. No merge, release or homelab publication is authorized. R-23 verifies the final README/CI-evidence repairs at fcd9b0c with no findings; its records remain verbatim. Hosted builders checks pass after the step-scoped read-only plugin authentication repair. + + +- [x] T22 `packer/ubuntu/variables.pkr.hcl`, `packer/ubuntu/pds/readme.md`, `docs/ubuntu/provisioning.md` select the published PDS 0.20.0 after actual signed-repository installation verifies package identity, signing key, provenance and required helpers; wrong-version/missing-helper controls remain failing and local checks pass (AC-08, AC-09, AC-10, AC-11, AC-13, AC-14, AC-15). + Evidence: published PDS 0.20.0, release asset SHA256 d73c3c946e1cb9316341e806c747431e4e8811679fcd07f2aa4d73e262ef6abc; the real installer reports source signed-repository and fingerprint 37C7D029C0FE4DB0E66E5F72AFA1101D94CBF301, with all selected helpers available. The input-only version pin uses the existing negative identity/trust/missing-function regressions rather than a test mirroring the literal version. All 44 checks pass in the existing disposable tools container. The first host attempt lacked ShellCheck and is retained as a harness failure. Full image acceptance remains T23. +- [x] T25 `packer/ubuntu/tests/test_sealing.sh`, `packer/ubuntu/scripts/seal-image.sh` reproduce a transient read-only machine-id mount failing sealing, commit/unmount that transient ID through systemd before clearing it, and pass ordinary/transient disposable sealing checks; fresh image validation remains T23 (AC-05, AC-06, AC-14). + Evidence: the first signed-release custom native build failed at truncate because systemd-machine-id-commit.service timed out and left /etc/machine-id on read-only tmpfs while / was writable. The disposable transient mount reproduces that exact failure before the fix; both transient and ordinary real sealing regressions pass after systemd-machine-id-setup --commit. All 44 checks pass. The fixture uses a public test ID mounted read-only and SYS_ADMIN only in its network-disabled container; no host devices or existing guests are used. Fresh image builds remain unchecked under T23. +- [x] T23 `docs/validation/0001-2026-11-05.md` records fresh signed-release default/custom native and portable builds, sealed-disk inspection and two independent boots per output/recipe; verify tools, selected policies, updater execution, identity/key separation, no SSH restart, complete owned-resource cleanup and unchanged pre-existing guests/storage (AC-01, AC-02, AC-03, AC-04, AC-05, AC-06, AC-08, AC-09, AC-10, AC-11, AC-12, AC-13, AC-14, AC-15). + Evidence: source c3c1421 and published PDS 0.20.0 via the signed repository; all four rebuilt default/custom native/portable images pass offline inspection, both qcow2/raw pairs compare equal, and eight fresh deployments pass globally distinct identities/keys, selected tooling/policies, real SSH controls and cron execution. Real standalone per-user Krew from Zsh preserves the shared tree. All four dpkg/APT-source/key checks and both archive-transfer digest comparisons pass. Final cleanup removes all owned resources, storage and API identities with zero volumes left; the six pre-existing guest configurations/power states and original storage settings remain unchanged. The dated validation record separates the genuine transient-machine-id defect and harness failures from the final passing matrix; independent acceptance remains pending. +- [x] T24 `docs/specs/README.md`, `docs/ubuntu/`, `docs/development.md`, `readme.md`, `packer/ubuntu/readme.md` align release references and validation limits with T23, preserve short entry points and draft homelab publication boundaries, and pass local link/example checks plus the full check target (AC-07, AC-12). + Evidence: all 44 checks pass in the existing disposable tools container, including both Packer configurations, ShellCheck and failure-path regressions. All 45 relative links in the changed pages resolve; the previously rendered Mermaid diagrams are unchanged. The guides select the published signed release, preserve separate candidate testing and optional Proxmox, and document the transient-ID regression. Feature index and dated validation distinguish completed author tests from independent acceptance; homelab publication remains outside this PR. + +- [x] T26 `packer/ubuntu/scripts/run-recipe.sh`, `ssh-policy-observer.sh`, `check-image.sh` and regression tests reproduce and repair R-24 F-01/F-05: retain the builders hook after library loading, refuse changed SSH policy without captured evidence, and reject netplan/cloud-instance residue (AC-05, AC-06, AC-09, AC-12, AC-14, AC-15). + Evidence: both observer regressions fail before the fix (library hook replacement and unobserved policy change), and the three netplan/instance residue subcases fail against the old checker. All 47 checks pass after the fixes, including both Packer configurations and ShellCheck. The observer is defined after library loading; a before/after policy digest makes missing observation fail when the recipe creates or changes the policy. Custom recipes with no policy change still pass. Fresh source-equivalent image validation remains T28. +- [x] T27 `docs/development.md`, `docs/ubuntu/` and the dated validation record document reproducible bounded live checks and command-level outcomes, reconcile the historical guest baselines using available task records, and state machine-ID stall/reboot and repository-retention limits without inventing a cause or actor (AC-01, AC-05, AC-07, AC-08, AC-12, AC-14). + Evidence: the bounded live guide specifies both deployment paths, exact cron command/exit recording, positive/negative authentication controls, reboot comparisons and ownership-limited cleanup. Seventeen relative links resolve and Bash examples pass syntax checks. Read-only node history records guest 104 deletion under root@pam at 06:51 UTC, between the earlier seven-guest audit and current six-guest preflight; the human/process is unknown. The single commit stall remains unexplained. The current APT index serves only 0.20.0, so saved-package recovery and pin-availability limits are explicit. Fresh checks and review remain T28/T29. +- [x] T28 `docs/validation/0001-2026-11-05.md` records fresh native/portable default/custom validation after the source repair, adds owned-instance identity persistence across reboot, retains explicit command exit/refusal traces and audits complete cleanup against a fresh protected baseline (AC-01, AC-03, AC-04, AC-05, AC-06, AC-08, AC-09, AC-10, AC-12, AC-13, AC-14, AC-15). + Evidence: source f78ac9a, all four new builds and stronger offline inspections pass; both portable format pairs compare equal. Eight new users pass shell/tool/MOTD checks, isolated keys and globally distinct identities. Four cron logs retain exact commands and exit 0; 34 authentication events retain 18 successes and 16 expected refusals. Native and portable default reboots preserve machine/DHCP/host-key identities with different boot IDs. All four actual dpkg/APT/key checks and archive transfers match. Final ownership-limited cleanup removes all resources/storage/API users and leaves the fresh six-guest baseline and original storage unchanged. The dated report explicitly retains after-boot credential-fixture and unknown-stall limits; independent acceptance remains T29. +- [x] T30 `packer/ubuntu/variables.pkr.hcl`, live-validation guidance and the dated record address R-25: verify and reject unreadable recipes before building; retain observed post-cleanup hashes/states with a derived comparison; disclose the shared root principal and measured host-key/service/SSH-observation limits (AC-05, AC-07, AC-12, AC-14, AC-15). + Evidence: real unprivileged Packer accepted a mode-000 recipe before the guard repair; the new regression fails against the old condition and passes with can(file(...)). The 48-case tools-container run has 47 passes and one explicit root-permission skip; that permission case passes separately as the unprivileged host user. Read-only observations at 11:12:59 UTC retain six actual guest hash/state rows and two original storage hashes; the comparison derived from those values matches and finds no owned resources. Documentation discloses the shared root principal, limits earlier preservation claims to their own snapshots, and distinguishes ed25519 persistence, no recorded service failure and the missing two-file sshd dump. Fourteen changed-page links and Bash examples pass. The local guard changes no guest payload; the f78ac9a matrix remains labelled separately. +- [x] T29 retain a fresh independent Opus review at the committed repaired source, keep unverified criteria unticked, and update PR #4 with exact-head CI; preserve owner-only merge and draft-guide boundaries (AC-07, AC-12). + Evidence: actual Copilot claude-opus-5.5 R-26 at eca9c59 independently executes local/package/sealing/artifact/hash/comparison/readability checks; returned records are retained verbatim and review check passes. AC-02/07/13 are met in that review; unverified composite criteria remain unticked and the feature remains in progress. PR #4 source and description are updated at f2ffe59; hosted run 42020493879 passes all 48 tests with the unprivileged permission case executed, while live checks explicitly skip in CI. The raw-versus-normalized wording nit is corrected without relabelling R-26. No merge or auto-merge is enabled, linked issues remain open, and homelab guides remain drafts. + +- [x] T31 `packer/ubuntu/cloud-init/build-config.yaml` and `docs/validation/0001-2026-11-05.md` replace the stale issue reference with the active PDS recipe, prove unchanged parsed cloud-init data, and record the current-head controlled matrix and cleanup (AC-07, AC-12). + Evidence: the full 9f4db43 matrix, R-27 and raw post-cleanup comparison pass; PyYAML parsing of the old/new build-config produces identical values. The only image-input change is a comment; the dated validation record preserves that boundary. +- [x] T32 `docs/specs/0001-packer-proxmox-native-output.md` retain the independent follow-up at the comment-corrected commit, check the completion gate, and update PR #4 with CI for its pushed commit; preserve owner-only merge and draft-guide boundaries (AC-07, AC-12). + Evidence: R-29 at 86f740b returns all 15 criteria met and no findings; verbatim review check, lint and freshness pass. PR #4 is updated at 58595e1 and hosted CI 42121748326 succeeds. The completion commit receives normal CI before handoff; merge and homelab publication remain withheld. + +## Open Questions + +None. + +## Review Log + +| Date | Review | Kind | Commit | Model | Isolation | Outcome | +| --- | --- | --- | --- | --- | --- | --- | +| 2026-11-03 | R-1 | implementation | `dd92fec037e2338000f62471d1353e2d96cd5520+dirty` | claude-opus-5-5 | procedural | Diagnostic: one blocking finding; no criterion established as met. | +| 2026-11-04 | R-2 | implementation | `dd92fec037e2338000f62471d1353e2d96cd5520+dirty` | claude-opus-5-5 | procedural | Diagnostic: seven findings; integration verification was still running. | +| 2026-11-04 | R-3 | implementation | `dd92fec037e2338000f62471d1353e2d96cd5520+dirty` | claude-opus-5-5 | procedural | Diagnostic: five findings; 26 tests passed independently; live checks were still finishing. | +| 2026-11-04 | R-4 | implementation | `dd92fec037e2338000f62471d1353e2d96cd5520+dirty` | claude-opus-5-5 | procedural | Diagnostic of configurable host CPU; records retained below, live clone checks still running. | +| 2026-11-04 | R-5 | implementation | `dd92fec037e2338000f62471d1353e2d96cd5520+dirty` | claude-opus-5-5 | procedural | Final CPU diagnostic after R-4 repairs; no completion acceptance. | +| 2026-11-04 | R-6 | spec | `0b33ecf5dbcade3bb3042b1b0dc60d5cbad1e8d9` | claude-opus-5-5 | procedural | Six findings; factual corrections and one scope clarification. | +| 2026-11-04 | R-7 | implementation | `0b33ecf5dbcade3bb3042b1b0dc60d5cbad1e8d9` | claude-opus-5-5 | procedural | AC-02 and AC-07 met; remaining live criteria not independently verified. | +| 2026-11-04 | R-8 | spec | `edcdb0a169316f22d98854d9f44f8fab18459edf` | claude-opus-5-5 | procedural | Five non-blocking findings; Q1 remains pending. | +| 2026-11-04 | R-9 | implementation | `edcdb0a169316f22d98854d9f44f8fab18459edf` | claude-opus-5-5 | procedural | AC-02 and AC-07 met; live execution remains not independently verified. | +| 2026-11-04 | R-10 | spec | `1dcd2c59a5a01cc2301f63e41ab1516cbe6d88f1` | claude-opus-5-5 | procedural | One delivery-note nit; Q1 remains pending. | +| 2026-11-04 | R-11 | implementation | `1dcd2c59a5a01cc2301f63e41ab1516cbe6d88f1` | claude-opus-5-5 | procedural | No implementation findings; AC-02 and AC-07 met, remaining criteria not independently verified. | +| 2026-11-04 | R-12 | spec | `4bf428f9cb2e4e4ce20eb8e6c5619af23d0a3209+dirty` | claude-opus-5-5 | procedural | Diagnostic of expanded PDS scope; six findings, no acceptance. | +| 2026-11-04 | R-13 | spec | `7b818c9e3e98d402d3b72710c6542bdb5315de9d` | claude-opus-5-5 | procedural | Six non-blocking findings about update execution, SSH proof, shared Krew and package lifecycle. | +| 2026-11-04 | R-14 | spec | `fa4b1b5d446447ac37c4990ad81a9b08f9865446` | claude-opus-5-5 | procedural | Five non-blocking findings about control probes, reload evidence, APT locks and a stale harness reference. | +| 2026-11-04 | R-15 | spec | `eb38755c4218f7d315a32951f53cf589115630e0` | claude-opus-5-5 | procedural | Two implementation/testing nits; no blocking findings. | +| 2026-11-05 | R-16 | spec | `59928bc110dedec4c6f91cbbd7c18c384cee2f65` | claude-opus-5-5 | procedural | Four non-blocking consistency/proof findings for custom recipe behavior. | +| 2026-11-05 | R-17 | spec | `08f056d8dea3b5cba1702cc03242a9ea43650be6` | claude-opus-5-5 | procedural | Two non-blocking implementation/wording nits; no blocking findings. | +| 2026-11-05 | R-17 | spec | `08f056d8dea3b5cba1702cc03242a9ea43650be6` | n/a | n/a | accepted by owner | +| 2026-11-05 | R-18 | implementation | `e05ed58d79d4d456f783b786b543b24e1f57d96f` | claude-opus-5-5 | procedural | One blocking fresh-user check defect and three further findings; runtime/release proof remains incomplete. | +| 2026-11-05 | R-19 | implementation | `e5cf7b370078437d3fef3a65d659a3cf44081bc0` | claude-opus-5-5 | procedural | R-18 repairs verified; two nits, with runtime/release proof still incomplete. | +| 2026-11-05 | R-20 | implementation | `8b56679c7f424332e7c908c4c1262738ea33743f` | claude-opus-5-5 | procedural | No source findings; Docker execution denied, live/release criteria remain unverified by reviewer. | +| 2026-11-05 | R-21 | implementation | `d9282b4051a9613bd2569d4c38859073865321a8` | claude-opus-5-5 | procedural | No CI-repair code defect; two documentation nits, with live/release proof still incomplete. | +| 2026-11-05 | R-22 | implementation | `0437db7561f74c41d797201f9a7d05a42be0e742` | claude-opus-5-5 | procedural | No CI-authentication code defect; two documentation nits, with runtime/release acceptance still open. | +| 2026-11-05 | R-23 | implementation | `fcd9b0c00ea2cb3ecb76ae890e79ded24b1fa837` | claude-opus-5-5 | procedural | R-22 documentation repairs verified; no findings, with independent runtime/release acceptance still open. | +| 2026-11-05 | R-24 | implementation | `51872a307fe0a3a7bcfa3cbc075915a7cfc8a81e` | claude-opus-5.5 | procedural | Five should-fix findings and one nit; source review completed, container execution denied and runtime acceptance remains open. | +| 2026-11-05 | R-25 | implementation | `a55568b669e9411185c6520377ee2e8ae1fa35ea` | claude-opus-5.5 | procedural | All local/package/sealing/disk checks pass independently; two evidence should-fixes and two nits, with live criteria still unverified by reviewer. | +| 2026-11-05 | R-26 | implementation | `eca9c5918ed1d2d199b24febcaf82f83707e2b7b` | claude-opus-5.5 | procedural | Independent local/package/sealing/disk/hash/comparison checks pass; one documentation nit, with live criteria still unverified by reviewer. | +| 2026-11-05 | R-27 | implementation | `9f4db433675beb03eb86a9312e83292647a57655` | claude-opus-5.5 | procedural | All 15 criteria met after independent controlled-run verification; one stale-comment nit. | +| 2026-11-05 | R-28 | implementation | `b6975ef8142c6d3e011cbffd85a923029f3681b7` | claude-opus-5.5 | procedural | All 15 criteria met, no findings; raw evidence clarifies a reboot-count wording error. | +| 2026-11-05 | R-29 | implementation | `86f740b666b8fc1d96e417ad57cc4625bda9f02d` | claude-opus-5.5 | procedural | All 15 criteria met, no findings; raw reboot counts and command attribution verified. | +| 2026-11-06 | R-30 | implementation | `2d0c61061caeb88d88fd0b4a8aa9ce5f80b07dc1` | claude-opus-5.5 | procedural | All 15 criteria met; one prose nit about historical framing in current guides. | +| 2026-11-06 | R-31 | implementation | `24c12d3dbc0dad1cfa33f854cf34a0a5fe6495ec` | claude-opus-5.5 | procedural | All 15 criteria met; no findings after prose correction. | + +### R-1 + +```text +CRITERION: AC-01 A committed `create-base-template.sh` turns the official Ubuntu cloud image into a base cloud-init template on the PVE host (qemu-guest-agent embedded), repeatably; no hand-clicking. +VERDICT: not met +EVIDENCE: `git status --porcelain=v1` and `python3 -B -m unittest discover -s packer/ubuntu/tests -v`, dd92fec+dirty, the reviewed script shows as ` M packer/ubuntu/scripts/create-base-template.sh`, so the version under review is not committed; the 3 BaseTemplateSafety stub tests passed (missing ID, invalid IDs, occupied ID refused before any download or qm call), limitations: this review ran no bootstrap against Proxmox, the historical live run used an off-host container plus an SSH transport that is not in the repository (spec lines 77 to 78), and the committed HEAD version differs from the reviewed one. + +CRITERION: AC-02 `packer init .` installs both `hashicorp/proxmox` (`1.2.4`) and `hashicorp/qemu` plugins. +VERDICT: not verified +EVIDENCE: `which packer` plus inspection of packer/ubuntu/ubuntu.pkr.hcl:1-12, dd92fec+dirty, packer is not installed on this host; the template pins proxmox `= 1.2.4` and qemu `= 1.1.8`, limitations: `make init` and `packer validate` were not executed in this review, and the historical Packer 1.16.2 run predates the three-stage refactor. + +CRITERION: AC-03 `packer build -only='proxmox-clone.ubuntu' …` clones the base and produces a **template** on the PVE node (verified via `qm config ` showing `template: 1`) with an **empty cloud-init drive** attached; no per-build `qm importdisk`/upload anywhere in the flow. +VERDICT: not verified +EVIDENCE: inspection of packer/ubuntu/ubuntu.pkr.hcl:49-106, dd92fec+dirty, the proxmox-clone source sets full_clone, cloud_init = true and cloud_init_storage_pool, and the Packer flow has no importdisk or upload step (the single qm importdisk is in the once-per-release Stage 0 script), limitations: no native build ran in this review; the recorded live run predates the move of package installation from first-boot user-data to `cloud-init single` in install.sh. + +CRITERION: AC-04 `packer build -only='qemu.ubuntu' …` still produces the local qcow2/raw artifact. +VERDICT: not verified +EVIDENCE: `python3 -B -m unittest discover -s packer/ubuntu/tests -v` (test_raw_export) plus inspection of ubuntu.pkr.hcl:19-40,108-115, dd92fec+dirty, export-raw.sh converted a disposable 2M qcow2 to raw, skipped conversion when disabled and refused to overwrite an existing raw, limitations: this is a subset; no QEMU Packer build ran, so the qcow2 artifact and the post-processor wiring were not observed. + +CRITERION: AC-05 The resulting image contains **no** baked hostname, static IP/netplan identity, or SSH host keys, and boots with a **fresh `machine-id`** (two clones get distinct ids). +VERDICT: not verified +EVIDENCE: inspection of packer/ubuntu/scripts/seal-image.sh:10-21, dd92fec+dirty, sealing removes host keys, runs `cloud-init clean --logs --seed`, removes 50-cloud-init.yaml netplan, empties /etc/machine-id, relinks the D-Bus id and resets /etc/hostname to localhost; the only automated test of the sealer checks its argument guard, limitations: no artifact was inspected and no clones were booted in this review; the historical two-clone evidence predates the refactor. + +CRITERION: AC-06 No hostname/user/SSH-key/SSHD-hardening provisioning runs at build time; those responsibilities are documented as belonging to clone-time cloud-init. +VERDICT: not verified +EVIDENCE: inspection of ubuntu.pkr.hcl:88-106, scripts/install.sh, cloud-init/build-config.yaml, cloud-init/user-data and packer/ubuntu/readme.md:13, dd92fec+dirty, the provisioners set no hostname, create no user and add no key or sshd hardening, and the readme assigns users, SSH access, hostname and networking to clone time; however the QEMU seed sets `ssh_pwauth: true` at build time, which changes sshd policy (see F-01), limitations: the Test Plan's boot of fresh instances with consumer-supplied users and keys was not executed. + +CRITERION: AC-07 `packer/ubuntu/readme.md` documents the `-only` invocation for both formats and the required Proxmox variables/secrets. +VERDICT: not verified +EVIDENCE: inspection of packer/ubuntu/readme.md:81-130 against variables.pkr.hcl and proxmox.auto.pkrvars.hcl.example, dd92fec+dirty, the readme shows `-only='proxmox-clone.ubuntu'` and `-only='qemu.ubuntu'`, describes the token ID and secret, PKR_VAR_proxmox_api_token, proxmox_insecure, template_vmid and proxmox_storage_pool, and points to the example file for the remaining variables, limitations: the Test Plan proof is to follow the guide for both builds, which was not executed. + +FINDING: F-01 +KIND: factual +SEVERITY: blocking +WHERE: packer/ubuntu/cloud-init/user-data, packer/ubuntu/scripts/seal-image.sh +EVIDENCE: user-data:4 sets `ssh_pwauth: true`. On Ubuntu, cloud-init's set_passwords module then writes `PasswordAuthentication yes` to /etc/ssh/sshd_config.d/50-cloud-init.conf. That file sorts before the cloud image's 60-cloudimg-settings.conf, so its value wins. `cloud-init clean` does not remove it, and seal-image.sh:10-29 does not either. The portable artifact would therefore ship with password SSH enabled. This is inferred from cloud-init behaviour and was not observed in a built image here. The historical portable inspection (spec lines 83 to 86) did not check sshd drop-ins. +PROPOSAL: Remove the cloud-init sshd drop-in during sealing, or give the QEMU build key-based access, and add a sealed-artifact check that password authentication is disabled. Check whether Proxmox's generated build user-data has the same effect. + +FINDING: F-02 +KIND: judgement +SEVERITY: should-fix +WHERE: packer/ubuntu/scripts/wait-cloud-init.py, Open Questions Q1 +EVIDENCE: Dependency comparison. Python costs no extra guest dependency, because cloud-init is itself a Python program and every guest that has `cloud-init status` also has python3. Bash with jq adds a package that is not guaranteed in the Ubuntu cloud image. It would have to be present before the readiness parse on both paths: baked by virt-customize for the Proxmox base, and installed through the QEMU seed's first-boot apt run, which is the step this check waits on. That makes jq the costliest option. The refactor also changed what the check guards. Packages now install through `cloud-init single` in install.sh:11-13, which fails the build directly. First boot now only applies build access, and Packer's SSH connection already fails if that breaks. The JSON filter that rejects non-deprecation warnings was written for the earlier user-data package install. A short Bash step that runs `cloud-init status --wait` and accepts exit codes 0 and 2 needs no parser and no new dependency. Q1 offers only A and B and recommends jq. +PROPOSAL: Add a Bash-only option (accept 0 and 2, log `cloud-init status --long`) to Q1 and recommend it. If the owner wants to keep deprecation-only filtering, keeping Python is technically justified over jq. Either way, record the decision in Design and drop the jq recommendation. + +FINDING: F-03 +KIND: judgement +SEVERITY: nit +WHERE: packer/ubuntu/tests/, Makefile:11, AGENTS.md:18 +EVIDENCE: All four test modules are Python, and they test Bash scripts through Python-written stubs. So `make check` requires Python 3 on the build host even if wait-cloud-init.py is removed. The test stubs for cloud-init are also Python scripts (test_cloud_init_status.py:18-25, test_image_steps.py:20-24). +PROPOSAL: If the owner wants a Python-free repository, plan a Bash test runner for the same refusal and conversion cases as a separate task. Otherwise state in AGENTS.md that Python is accepted for tests. + +FINDING: F-04 +KIND: factual +SEVERITY: should-fix +WHERE: Context +EVIDENCE: Line 69 says "Status remains `in-progress`", but the frontmatter says `status: draft`. Line 70 refers to a "bootstrap criterion above", but no criterion appears above it. Line 72 claims eight local tests; this review observed "Ran 10 tests". Lines 96 to 99 rest on "the task's retained validation report", which is not in the repository. Line 115 cites files without file:line, contrary to the standard's citation rule. +PROPOSAL: Make the status statements match the frontmatter, correct the test count, and either cite repository evidence or label the live run as uncited history. + +FINDING: F-05 +KIND: factual +SEVERITY: should-fix +WHERE: Design, Test Plan +EVIDENCE: Line 255 leaves a DHCP fallback "TBD in review", while lines 233 and 304 record DHCP as decided and seal-image.sh:15 removes the netplan file. Line 268 says "seal-image.sh already truncates ... make it authoritative", which describes the pre-change state. Lines 244 to 246 say both builders share the same base. In fact the Proxmox base has the guest agent preinstalled, machine-id cleared and a 32G disk (create-base-template.sh:17,41-49), while QEMU uses the raw image at 10G (ubuntu.pkr.hcl:25). Line 274 refers to "PR #4". The AC-01 Test Plan cell starts with a commit instruction rather than a proof. +PROPOSAL: Resolve or move the TBD into Open Questions, rewrite the stale sealing and same-base text to describe the current behaviour, and make the AC-01 proof a pass condition only. + +FINDING: F-06 +KIND: judgement +SEVERITY: should-fix +WHERE: packer/ubuntu/scripts/create-base-template.sh, packer/ubuntu/readme.md:61-65 +EVIDENCE: The script requires qm, pvesh, curl, sha256sum and virt-customize on one host (lines 19 to 21), and `qm importdisk` reads a local path (line 55). The readme tells the user to install libguestfs-tools on the Proxmox node. The recorded validation instead ran the image tools in a disposable container and qm/pvesh over SSH, with "No packages were installed on the Proxmox host" (spec lines 77 to 78). That transport is not committed. The validated procedure therefore cannot be reproduced from the repository, and the documented one was not validated. +PROPOSAL: Choose the supported bootstrap shape (image preparation on the node, or off-node preparation followed by upload and qm on the node), commit it, and validate that exact path for AC-01. + +FINDING: F-07 +KIND: factual +SEVERITY: should-fix +WHERE: docs/specs/_template.md +EVIDENCE: `vh-adlc lint docs/specs/_template.md` returned `"result":"malformed"` with 11 findings. The file sits in the declared feature root and copies the central guides/feature-document-template.md. The onboarding guide says "Do not copy the central pages into every consumer." +PROPOSAL: Delete the local template and link the pinned central template from docs/specs/README.md. + +FINDING: F-08 +KIND: factual +SEVERITY: nit +WHERE: docs/specs/README.md:18 +EVIDENCE: The README says "Start with `vh-adlc find`". Running `vh-adlc find --repo . --plugin-pin ` returned "find takes exactly one of --issue and --slug". +PROPOSAL: Show the command with `--issue ` or `--slug `. + +FINDING: F-09 +KIND: judgement +SEVERITY: nit +WHERE: AGENTS.md, CLAUDE.md, .github/copilot-instructions.md +EVIDENCE: The pin is one full SHA and both bridges match the onboarding guide. AGENTS.md drops two lines from the guide's template: the route to guides/ pages for onboarding or bootstrapping, and "report a conflict instead of silently overriding either source". The onboarding files and the docs/specs migration fall outside the 0001 `covers` list but sit on the feature branch. +PROPOSAL: Restore the two lines, and commit the workflow migration separately from the feature 0001 implementation so the feature history and review target stay focused. + +FINDING: F-10 +KIND: judgement +SEVERITY: nit +WHERE: packer/ubuntu/scripts/seal-image.sh:11 +EVIDENCE: `passwd -l ubuntu` keeps the hash of the known build password `ubuntu` (user-data:3) behind a reversible lock prefix in the shipped image. +PROPOSAL: Replace the hash as well, for example `usermod -p '*' ubuntu`, before or instead of locking. + +FINDING: F-11 +KIND: factual +SEVERITY: nit +WHERE: packer/ubuntu/ubuntu.pkr.hcl:16-17 +EVIDENCE: The comment presents `-var 'arch=arm64' -var 'qemu_accelerator=hvf'` as the fast local path. The qemu source sets no qemu_binary, machine type or UEFI firmware for aarch64, and readme.md:137-138 says the configuration is unvalidated. +PROPOSAL: Mark the comment as unvalidated or remove it until arm64 is supported. + +FINDING: F-12 +KIND: factual +SEVERITY: nit +WHERE: packer/ubuntu/cloud-init/build-config.yaml:9, packer/ubuntu/ubuntu.pkr.hcl:21 +EVIDENCE: `preserve_hostname: false` has no effect because install.sh:11 runs only package_update_upgrade_install, locale, timezone and keyboard. `cd_files = ["./cloud-init/*"]` also places build-config.yaml in the QEMU cidata seed, where NoCloud ignores it. +PROPOSAL: Drop the unused key and restrict cd_files to user-data and meta-data. + +FINDING: F-13 +KIND: factual +SEVERITY: nit +WHERE: readme.md:15 +EVIDENCE: The covered root readme says "The native-builder draft is under review for PR #4." That text goes stale as soon as the PR closes. +PROPOSAL: Remove the transient PR status from the readme. + +FINDING: F-14 +KIND: judgement +SEVERITY: nit +WHERE: packer/ubuntu/scripts/create-base-template.sh:33-37, packer/ubuntu/ubuntu.pkr.hcl:27 +EVIDENCE: Both paths fetch SHA256SUMS from the same HTTPS origin as the image and do not verify SHA256SUMS.gpg. This detects corruption but does not establish authenticity beyond TLS. +PROPOSAL: Decide whether TLS is enough. If not, verify the signed checksum file in the bootstrap. +``` +### R-2 + +CRITERION: AC-01 A committed `create-base-template.sh` turns the official Ubuntu cloud image into a base cloud-init template on the PVE host (qemu-guest-agent embedded), repeatably; no hand-clicking. +VERDICT: not met +EVIDENCE: `git status --porcelain=v1`, `python3 -B -m unittest discover -s packer/ubuntu/tests -v` and inspection of scripts/prepare-base-image.sh, create-base-template.sh and import-base-template.sh, dd92fec037e2338000f62471d1353e2d96cd5520+dirty. The criterion asks for a committed script, but the tree shows ` M packer/ubuntu/scripts/create-base-template.sh` and `?? prepare-base-image.sh` and `?? import-base-template.sh`. That is the intended draft state, since the owner forbids commits. All 19 tests ran OK. They cover: missing ID, invalid IDs, missing host, an occupied ID refused before download or upload, a corrupt local bundle refused before upload, reuse of a verified bundle without preparation, a remote recheck and checksum refusal before any qm call, and an import sequence that ends with `qm template` and has no destroy. The tree was unchanged afterwards. Hashes in /tmp/builders-offnode/runtime-manifest.json match the current tree for all 20 listed files. Limitations: I did not run a preparation, upload or import against Proxmox. The retained /tmp/builders-offnode/prepare-base.log shows the first preparation failing apt with "Temporary failure resolving" and leaving a partial bundle with no base-image.sha256. prepare-clean.log has reached "Finishing off", but at 03:43 its bundle still held the unrenamed .img and no checksum record, so that run had not finished. No import-results.json exists, and the minimal-environment import and the occupied-ID and corrupt-bundle checks against live guests were not observed. + +CRITERION: AC-02 `packer init .` installs both `hashicorp/proxmox` (`1.2.4`) and `hashicorp/qemu` plugins. +VERDICT: not verified +EVIDENCE: `/tmp/builders-pr4-tools/packer fmt -check -recursive .` and `PACKER_PLUGIN_PATH=/tmp/builders-offnode/fresh-plugins PKR_VAR_proxmox_api_token=validation-only-placeholder packer validate .` in packer/ubuntu, dd92fec+dirty, Packer v1.16.2. fmt exited 0 and validate printed "The configuration is valid.". fresh-plugins holds packer-plugin-proxmox_v1.2.4 and packer-plugin-qemu_v1.1.8. ubuntu.pkr.hcl:1-12 pins `= 1.2.4` and `= 1.1.8`. Limitations: I did not run `packer init` or `make init` myself. The only init evidence is the retained /tmp/builders-offnode/init-clean.log, which reports both plugins installed into an empty directory. + +CRITERION: AC-03 `packer build -only='proxmox-clone.ubuntu' …` clones the base and produces a **template** on the PVE node (verified via `qm config ` showing `template: 1`) with an **empty cloud-init drive** attached; no per-build `qm importdisk`/upload anywhere in the flow. +VERDICT: not verified +EVIDENCE: inspection of packer/ubuntu/ubuntu.pkr.hcl:49-106 and a successful validate, dd92fec+dirty. The proxmox-clone source sets full_clone, cloud_init = true and cloud_init_storage_pool. The build has no import or upload step; the only `qm importdisk` is in the once-per-base import-base-template.sh:43. Limitations: no native build was run or observed and /tmp/builders-offnode/native-results.json does not exist. The output template flag, the cloud-init volume and removal of the build ciuser/sshkeys from the template configuration remain unobserved, and the repository has no code that clears them. + +CRITERION: AC-04 `packer build -only='qemu.ubuntu' …` still produces the local qcow2/raw artifact. +VERDICT: not verified +EVIDENCE: unittest test_raw_export (ok) plus inspection of ubuntu.pkr.hcl:19-40,108-115 and scripts/export-raw.sh, dd92fec+dirty. The exporter converts only when enabled and refuses to overwrite. The retained /tmp/builders-offnode/portable-build.log (200 lines, RUNNING) shows the boot, a real cloud-init 26.1 status JSON accepted by wait-cloud-init.sh, and install.sh partway through apt upgrades. Limitations: the build had not finished. No qcow2 or raw artifact, no post-processor run and no format comparison was observed. The log is retained evidence I did not execute. + +CRITERION: AC-05 The resulting image contains **no** baked hostname, static IP/netplan identity, or SSH host keys, and boots with a **fresh `machine-id`** (two clones get distinct ids). +VERDICT: not verified +EVIDENCE: inspection of scripts/seal-image.sh:13-22 and prepare-base-image.sh:33-42, dd92fec+dirty. Sealing removes host keys, runs `cloud-init clean --logs --seed --configs ssh_config network`, empties /etc/machine-id, relinks the D-Bus id, writes localhost to /etc/hostname and drops the 127.0.1.1 line. Preparation clears machine-id and host keys in the base. The retained /tmp/builders-sealing-tools/retained-regression.log reports the container sealing test passing. Limitations: that test ran in Docker with a test-only sed adapter for the bind-mounted /etc/hosts. No sealed artifact was inspected and no two-clone boot was observed. inspection-results.json does not exist. + +CRITERION: AC-06 Only temporary build access is configured during image creation; the sealed image retains no build credentials or generated SSH policy override. Hostname, users, access keys and SSH policy for deployed machines are supplied at clone time. +VERDICT: not verified +EVIDENCE: inspection of cloud-init/user-data, scripts/seal-image.sh:10-16, ubuntu.pkr.hcl:75-77, and the retained /tmp/builders-sealing-tools/before.log, after.log and retained-regression.log, dd92fec+dirty. The current sealer replaces the ubuntu hash with `*`, removes authorized_keys and cleans the ssh_config and network configs. The retained logs show real cloud-init 26.2 reproducing `passwordauthentication yes` from the build seed, and then `passwordauthentication no` after the current sealer. Limitations: those logs are a container subset I did not execute. The build-created ubuntu account and its cloud-init sudoers drop-in survive sealing (F-01). Removal of the Proxmox-side build ciuser/sshkeys, inspection of both sealed outputs, and fresh clones with consumer-supplied users and keys were not observed. + +CRITERION: AC-07 `packer/ubuntu/readme.md` documents the `-only` invocation for both formats and the required Proxmox variables/secrets. +VERDICT: not verified +EVIDENCE: inspection of packer/ubuntu/readme.md:160-269 against variables.pkr.hcl and proxmox.auto.pkrvars.hcl.example, dd92fec+dirty. The guide shows `-only='proxmox-clone.ubuntu'` and `-only='qemu.ubuntu'`, including the raw and tcg variants. It describes the token ID and secret, PKR_VAR_proxmox_api_token, proxmox_insecure, template_vmid and proxmox_storage_pool, and points to the example file for endpoint, node and base template name. The recovery.md anchor to Stage 1 resolves. Limitations: the Test Plan proof is to follow the guide for both outputs, and neither documented build was followed to completion. + +FINDING: F-01 +KIND: judgement +SEVERITY: should-fix +WHERE: packer/ubuntu/scripts/seal-image.sh:10-16, AC-06 +EVIDENCE: On both builders the `ubuntu` account comes from build-time cloud-init. In the QEMU build the seed sets its password (user-data:3). In the Proxmox build, ubuntu.pkr.hcl:76 makes it the build user. Ubuntu's default_user also writes /etc/sudoers.d/90-cloud-init-users with NOPASSWD sudo. seal-image.sh locks the hash and deletes authorized_keys. It does not remove the account, its home directory or that sudoers file, and `cloud-init clean` does not remove them either. A clone whose clone-time config lists only its own users still gets a build-created `ubuntu` sudoer. AC-06 says users are supplied at clone time. This is inferred from cloud-init defaults. Neither test_sealing.sh nor any artifact check looked for it. +PROPOSAL: Either remove the build user and its cloud-init sudoers drop-in during sealing, or state in Design and AC-06 that a locked, keyless default account is an accepted residue. Add a sealed-artifact check for whichever is chosen. + +FINDING: F-02 +KIND: judgement +SEVERITY: should-fix +WHERE: packer/ubuntu/recovery.md:56-83 +EVIDENCE: The only measured from-source runs used the clean-tools Docker image as root (base-bundle files are owned by root). The first run failed DNS in the appliance (prepare-base.log). The clean run had not produced a final base-image.sha256 when last read. The recipe tells a user on a fresh Ubuntu 24.04 machine to install the packages with sudo and then run prepare-base-image.sh, with no statement about privileges. On Ubuntu hosts /boot/vmlinuz-* is mode 0600, and a non-root supermin appliance build usually cannot read it. This is inferred from known Ubuntu libguestfs behaviour and was not observed here. +PROPOSAL: State the privilege or kernel-readability requirement the measured run relied on. Keep the recipe labelled as a candidate until a completed run, outside any test-only network adaptation, produces an importable bundle. + +FINDING: F-03 +KIND: factual +SEVERITY: nit +WHERE: Context +EVIDENCE: Spec line 73 says "The refactored suite now has ten tests." This review observed "Ran 19 tests", and the retained make-check.log shows the same count. +PROPOSAL: Correct the count or drop it. + +FINDING: F-04 +KIND: judgement +SEVERITY: nit +WHERE: packer/ubuntu/scripts/create-base-template.sh:51-56, 30-37 +EVIDENCE: `remote_dir` is the variable the EXIT trap passes to the remote `rm -rf -- '$remote_dir'`, and it is assigned from the ssh output before the regex check. If the remote command exits non-zero after printing (for example, rc-file output followed by a mktemp failure), set -e exits with an unvalidated string, and the trap interpolates it into a remote rm -rf. If the output fails validation, the variable is cleared and any directory that was created is left on the node without the "remove manually" message. +PROPOSAL: Capture into a local variable, validate it, and only then assign `remote_dir`. Report any unvalidated output instead of deleting it. + +FINDING: F-05 +KIND: judgement +SEVERITY: nit +WHERE: packer/ubuntu/tests/test_base_template.py, scripts/prepare-base-image.sh +EVIDENCE: There are no automated cases for prepare-base-image.sh refusing an existing output directory or an upstream checksum mismatch. Refusal of a partial bundle with no base-image.sha256 is not tested either; only inspection shows that `cat` fails under set -e at create-base-template.sh:47. The upload-failure and remote-cleanup paths are also untested, because the ssh stub never consumes stdin or fails. DISK_SIZE accepts values smaller than the prepared image, such as 1G, which pass validation and fail only at `qm resize` after `qm create`, leaving a partial VM (import-base-template.sh:41-49). +PROPOSAL: Add stubbed cases for these refusals and for cleanup after a failed upload. Consider rejecting DISK_SIZE values below the image's virtual size before creating the VM. + +FINDING: F-06 +KIND: judgement +SEVERITY: nit +WHERE: packer/ubuntu/scripts/wait-cloud-init.sh:8, ubuntu.pkr.hcl:93-96 +EVIDENCE: `cloud-init status --wait` blocks until cloud-init finishes, and the shell provisioner sets no `timeout`, so a hung first-boot module stalls the build indefinitely rather than failing. The parsing itself fails closed: exit codes other than 0 and 2, non-JSON, multiple documents, a non-done status, non-array errors, non-object recoverable_errors and any category other than DEPRECATED are all rejected. The tests cover each of these, and the real cloud-init 26.1 JSON in portable-build.log matches the expected shape. +PROPOSAL: Set a provisioner timeout, or wrap the wait in `timeout`, so a stalled first boot fails the build. + +FINDING: F-07 +KIND: factual +SEVERITY: nit +WHERE: packer/ubuntu/readme.md:227 +EVIDENCE: "Packer full-clones the base, applies provisioning, removes its temporary cloud-init credentials and converts the result to a template." No repository code clears the build ciuser/sshkeys from the Proxmox VM configuration, so the claim rests on Proxmox plugin behaviour, which only the pre-refactor live run observed (spec lines 80 to 81). +PROPOSAL: Mark the claim as plugin behaviour that the AC-03 template inspection must confirm, or cite the plugin documentation for it. + +### R-3 + + +CRITERION: AC-01 A committed `create-base-template.sh` turns the official Ubuntu cloud image into a base cloud-init template on the PVE host (qemu-guest-agent embedded), repeatably; no hand-clicking. +VERDICT: not met +EVIDENCE: `git status --porcelain=v1` before and after `python3 -B -m unittest discover -s packer/ubuntu/tests -v`, plus inspection of scripts/prepare-base-image.sh, create-base-template.sh and import-base-template.sh, at dd92fec037e2338000f62471d1353e2d96cd5520+dirty. create-base-template.sh is still ` M` and prepare-base-image.sh and import-base-template.sh are still `??`, so the criterion's committed script does not exist yet. The owner has deliberately forbidden commits, so this is expected. All 26 tests ran OK and the tree did not change. The stubs cover a missing or invalid ID, a missing host, an occupied ID refused before download, corrupt and partial bundles refused before upload, a refused remote allocation path that is never cleaned, cleanup of only the staging directory after a failed upload, reporting of a failed cleanup, a remote ID recheck, refusal of a shrink or upload corruption before `qm create`, and an import that ends in `qm template` with no destroy. On inspection, the remote command arguments are either validated against regexes or are the validated staging path. The upload directory is validated before it becomes the cleanup target. `qm create` refuses an ID taken after the check, and failures keep the partial VM. The current prepare-base-image.sh hash matches runtime-manifest.json, which was recorded before prepare-clean.log ran. The create and import hashes match runtime-manifest-final.json. Retained evidence I did not execute: prepare-clean.log ends with "Prepared base-image bundle", and base-bundle-clean holds base-image.sha256. import-final.log and import-final-results.json show non-root client "ubuntu" without Packer or libguestfs creating 990100 with `template: 1`, `agent: enabled=1`, scsi0, an ide2 cloud-init drive and `ipconfig0: ip=dhcp`, with occupied_id_refused true and protected_guests_unchanged true. refused-repeat-final.log shows "VM 990100 already exists". Limitations: I ran nothing against Proxmox. The Test Plan's corrupt-bundle attempt against live guests is not recorded; only stubbed corrupt-bundle cases exist. The guest agent inside the base was not inspected directly. + +CRITERION: AC-02 `packer init .` installs both `hashicorp/proxmox` (`1.2.4`) and `hashicorp/qemu` plugins. +VERDICT: not verified +EVIDENCE: inspection of packer/ubuntu/ubuntu.pkr.hcl:1-12 and Makefile:4-5, dd92fec+dirty. The template pins proxmox `= 1.2.4` and qemu `= 1.1.8`, and `make init` runs `packer init .`. Retained /tmp/builders-offnode/init-clean.log reports both plugins installed into an empty plugin directory, and make-check-final2.log reports "The configuration is valid." Limitations: I did not run `packer init`, `make init` or `packer validate` in this review. The init log is retained evidence only. + +CRITERION: AC-03 `packer build -only='proxmox-clone.ubuntu' …` clones the base and produces a **template** on the PVE node (verified via `qm config ` showing `template: 1`) with an **empty cloud-init drive** attached; no per-build `qm importdisk`/upload anywhere in the flow. +VERDICT: not verified +EVIDENCE: inspection of ubuntu.pkr.hcl:49-79 and 81-108, plus a hash comparison of the current tree against /tmp/builders-offnode/runtime-manifest-native-final.json, dd92fec+dirty. All 20 listed files match. The build has no import or upload step, and the only `qm importdisk` is in the once-per-base import-base-template.sh:46. Retained native-build.log ends with "A template was created: 990101" after 3 minutes 3 seconds. native-resume-snapshot.json shows 990101 with `template: 1`, `ide0: local-lvm:vm-990101-cloudinit` and no ciuser, sshkeys or cipassword. failed-native-task.json records the earlier one-minute timeout while the server-side clone finished. Limitations: no native build ran in this review. The template configuration comes from a retained snapshot I did not execute. native-results.json does not exist. + +CRITERION: AC-04 `packer build -only='qemu.ubuntu' …` still produces the local qcow2/raw artifact. +VERDICT: not verified +EVIDENCE: unittest test_export_is_optional_and_does_not_overwrite (ok), inspection of ubuntu.pkr.hcl:19-40 and 110-117 and scripts/export-raw.sh, and a hash comparison against runtime-manifest-final.json, dd92fec+dirty. Only ubuntu.pkr.hcl, variables.pkr.hcl and proxmox.auto.pkrvars.hcl.example differ. portable-final-config-diff.patch limits the two .hcl changes to the native task_timeout and variable metadata. Retained inspect-portable-final.log and inspection-results.json report "Images are identical.", qcow2 format, a 10 GiB virtual size and qcow2_and_raw_identical true. Limitations: I did not run the QEMU build or inspect the artifacts. These are retained observations only. + +CRITERION: AC-05 The resulting image contains **no** baked hostname, static IP/netplan identity, or SSH host keys, and boots with a **fresh `machine-id`** (two clones get distinct ids). +VERDICT: not verified +EVIDENCE: inspection of scripts/seal-image.sh:13-22 and prepare-base-image.sh:33-42, plus retained /tmp/builders-sealing-tools/retained-regression.log, inspection-results.json, portable-clone-results.json and native-resume logs, dd92fec+dirty. The sealer removes host keys, cleans cloud-init logs, seed, ssh_config and network, empties machine-id, relinks the D-Bus ID, sets localhost and drops the 127.0.1.1 line. On the portable side, the retained inspection reports generic_hostname, machine_id_empty, ssh_keys_absent and netplan_absent all true. Two portable boots report different machine IDs and host keys. On the native side, only clone 990102 exists in native-resume-snapshot.json. native-resume-before-ssh-order.log ends in a traceback ("Missing privilege separation directory: /run/sshd"), and native-resume.log records only VM states. No native offline inspection or second native clone is recorded. Limitations: I executed none of these checks. The native path, which starts from a different base, is not covered. + +CRITERION: AC-06 The sealed image retains no build password, authorized keys or generated SSH policy override. The default Ubuntu account may remain only locked and keyless, with its standard sudo policy. Any usable deployed login and site-specific identity or SSH policy are supplied at clone time. +VERDICT: not verified +EVIDENCE: inspection of seal-image.sh:10-16, cloud-init/user-data, ubuntu.pkr.hcl:30-31 and 76-78, and tests/test_sealing.sh, plus retained before.log, after.log and retained-regression.log, dd92fec+dirty. The sealer sets the ubuntu hash to `*`, removes the ubuntu and root authorized_keys and runs `cloud-init clean --configs ssh_config network`. It leaves the account and its cloud-init sudoers drop-in, which the current wording permits. The retained container test with real cloud-init 26.2 shows `passwordauthentication yes` before sealing and `no` after it, with the hash `*` and 50-cloud-init.conf gone. The portable inspection reports build_keys_absent, build_ssh_override_absent and build_password_discarded true. Both portable boots show password_auth "no" and consumer_key_login true. The native template snapshot has no build ciuser or sshkeys, and clone 990102 carries consumer ciuser "probe1". Limitations: I executed none of these checks. The native clone's effective SSH policy check failed in the retained harness (empty `ssh_password_auth=`). Inspection of the native sealed disk is not recorded. + +CRITERION: AC-07 `packer/ubuntu/readme.md` documents the `-only` invocation for both formats and the required Proxmox variables/secrets. +VERDICT: not verified +EVIDENCE: inspection of packer/ubuntu/readme.md:117-172 against variables.pkr.hcl and proxmox.auto.pkrvars.hcl.example, dd92fec+dirty. The guide shows `-only='proxmox-clone.ubuntu'` and `-only='qemu.ubuntu'`, including the raw and tcg variants. It covers the token ID and secret, PKR_VAR_proxmox_api_token, proxmox_insecure, template_vmid, proxmox_storage_pool and proxmox_task_timeout, and points to the example file for the endpoint, node and base name. The Stage 0 text at lines 100-112 matches the import code: the ID check runs before preparation, an ID repeat is refused, the uploaded copy is grown and shrinking is refused, and the inline bundle is removed. Limitations: the Test Plan proof is to follow the guide for both outputs. I did not follow it, and the retained build logs do not record which command line was used. + +FINDING: F-01 +KIND: factual +SEVERITY: should-fix +WHERE: Context, Uncommitted off-node candidate checks +EVIDENCE: Spec lines 142-143 say "Native clone checks, offline inspection and final resource cleanup are recorded separately in the owner review evidence." At 04:51 /tmp/builders-offnode had no native-results.json, no final-audit.json and no native entry in inspection-results.json. native-resume-before-ssh-order.log ends in a RuntimeError ("Missing privilege separation directory: /run/sshd", `ssh_password_auth=` empty). native-resume.log lists only states, with 990100, 990101, 990105 stopped and 990102 running. Only one of the intended clones (990102 and 990103 in native-attempt-intent.json) exists, and the test resources still exist. +PROPOSAL: Remove the claim, or replace it with the recorded native results once the second clone, the native disk inspection, the SSH policy check and cleanup have actually completed. + +FINDING: F-02 +KIND: judgement +SEVERITY: should-fix +WHERE: packer/ubuntu/ubuntu.pkr.hcl:49-79 +EVIDENCE: The retained native-resume-snapshot.json shows golden template 990101, and clone 990102 derived from it, with `cpu: kvm64`. The base template 990100 has no cpu key, so it uses the Proxmox default. The proxmox-clone source sets no cpu_type, so the plugin default kvm64 is written into the golden template and inherited by every clone. kvm64 does not expose AES-NI or x86-64-v2 features. +PROPOSAL: Set `cpu_type` explicitly, for example through a variable that defaults to `x86-64-v2-AES` or `host`. Add the CPU type to the native template inspection. + +FINDING: F-03 +KIND: judgement +SEVERITY: nit +WHERE: packer/ubuntu/readme.md:142-144 +EVIDENCE: failed-native-task.json shows that after Packer's one-minute wait expired, the qmclone task finished with "OK" and left a full VM at the requested output ID (vm-990101-disk-0, 32G). The build log says "skipping cleanup". The readme explains the timeout but does not warn that an aborted build can leave that VM and block a retry with the same `template_vmid`. +PROPOSAL: State that a timed-out or aborted native build can leave a VM at the output ID, and that it must be inspected and removed, or a new ID chosen, before retrying. + +FINDING: F-04 +KIND: judgement +SEVERITY: nit +WHERE: packer/ubuntu/scripts/create-base-template.sh:43-46, readme.md:110-112 +EVIDENCE: Without BASE_IMAGE_DIR, the script runs prepare-base-image.sh as the invoking user inside a mktemp work directory and deletes the bundle on exit. readme.md:74-75 and recovery.md:81-83 say preparation needs root, or a readable host kernel, on Ubuntu. Running the whole command under sudo switches the SSH identity and known_hosts to root's. The resulting base also cannot be reused for recovery. Neither of these combined paths appears in the retained live evidence. +PROPOSAL: Require BASE_IMAGE_DIR and keep preparation as a separate step, or state the privilege and SSH identity implications of the inline path. + +FINDING: F-05 +KIND: factual +SEVERITY: nit +WHERE: packer/ubuntu/recovery.md:91-93, scripts/prepare-base-image.sh:26-31 +EVIDENCE: The retained base-bundle-clean/build-info.txt records `source_url=https://cloud-images.ubuntu.com/noble/current/...`, the architecture, the backend and the virt-customize version, but no dated image serial or preparation time. recovery.md says "the recorded upstream checksum and source URL explain the input used". After `current` moves, the checksum identifies the bytes but the URL no longer locates them. +PROPOSAL: Record the resolved dated serial and the preparation timestamp in build-info.txt, or reword the recovery text so it claims only checksum identification. + +### R-4 + + +```text +CRITERION: AC-01 A committed `create-base-template.sh` turns the official Ubuntu cloud image into a base cloud-init template on the PVE host (qemu-guest-agent embedded), repeatably; no hand-clicking. +VERDICT: not met +EVIDENCE: `git status --porcelain=v1` before and after `python3 -B -m unittest discover -s packer/ubuntu/tests -v`, plus a sha256 comparison of the tree against /tmp/builders-hostcpu-20261104/runtime-manifest.json, at dd92fec037e2338000f62471d1353e2d96cd5520+dirty. create-base-template.sh shows as ` M`, and prepare-base-image.sh and import-base-template.sh show as `??`. The criterion requires a committed script, and the owner's no-commit restriction means it cannot be met yet. All 26 tests ran OK. The status digest was identical before and after the run (1d65079f...). All 20 manifest entries match the current tree. Retained evidence I did not execute: base-import.log for the current run ends with "Base template created: test-builders-pr4-base-recovered (VM ID 990100)". base-ownership.json shows `template: 1`, `agent: enabled=1`, an ide2 cloud-init drive and `ipconfig0: ip=dhcp`. /tmp/builders-offnode/import-final-results.json records a non-root client without Packer or libguestfs, with occupied_id_refused true and protected_guests_unchanged true. Limitations: I ran nothing against Proxmox. A corrupt-bundle attempt against live guests is covered only by stubbed tests. The guest agent inside the base disk was not inspected directly. + +CRITERION: AC-02 `packer init .` installs both `hashicorp/proxmox` (`1.2.4`) and `hashicorp/qemu` plugins. +VERDICT: not verified +EVIDENCE: inspection of packer/ubuntu/ubuntu.pkr.hcl:1-12, plus a listing of /tmp/builders-offnode/fresh-plugins and the retained init-clean.log, at dd92fec+dirty. The template pins proxmox `= 1.2.4` and qemu `= 1.1.8`. The plugin directory holds packer-plugin-proxmox_v1.2.4 and packer-plugin-qemu_v1.1.8 with their SHA256SUM files. init-clean.log reports both plugins installed by `packer init .`. The retained make-check.log reports "The configuration is valid." Limitations: I did not run `packer init`, `make init` or `packer validate`. All of this evidence is retained, not observed by me. + +CRITERION: AC-03 `packer build -only='proxmox-clone.ubuntu' …` clones the base and produces a **template** on the PVE node (verified via `qm config ` showing `template: 1`) with an **empty cloud-init drive** attached; no per-build `qm importdisk`/upload anywhere in the flow. +VERDICT: not verified +EVIDENCE: inspection of ubuntu.pkr.hcl:49-80 and variables.pkr.hcl:67-76, plus a read (no execution) of /tmp/builders-hostcpu-20261104/run-native.py and the retained logs, at dd92fec+dirty. The native source sets `cpu_type = var.proxmox_cpu_type`. The variable defaults to `host` and rejects blank values. The qemu source has no reference to it. The build has no import or upload step. The current native-build.log reached "A template was created: 990101" after 2 minutes 56 seconds. controller.log then recorded "Native golden template and empty cloud-init configuration verified: 990101". template-ownership.json shows `cpu: host`, `template: 1`, `ide0: local-lvm:vm-990101-cloudinit,media=cdrom` and no ciuser, sshkeys or cipassword. Packer used the default because the controller sets no PKR_VAR_proxmox_cpu_type and refuses to run when an automatic vars file is present. validate-cpu-override.log shows "The configuration is valid." validate-empty-cpu.log shows the empty model refused by variables.pkr.hcl:72. Limitations: I executed none of this. When I last read the evidence, the controller had not started the clones. No clone ownership file existed, and no native-results.json, inspection-results.json or final-audit.json existed. The Test Plan's checks for inherited `cpu: host` in both clones and guest AES/AVX were therefore not yet recorded. The override log does not name the value tested. + +CRITERION: AC-04 `packer build -only='qemu.ubuntu' …` still produces the local qcow2/raw artifact. +VERDICT: not verified +EVIDENCE: `diff -u` and `cmp` of the current packer/ubuntu sources against the portable-build snapshot /home/m/code/.cache/builders-offnode-20261104/portable-final/ubuntu, plus unittest test_export_is_optional_and_does_not_overwrite (ok), at dd92fec+dirty. All seven scripts and all three cloud-init files are byte-identical. ubuntu.pkr.hcl differs only by the native `task_timeout` and `cpu_type` lines. variables.pkr.hcl differs only by the arch description and the two native variables. The qemu source and the build block are unchanged. The new validation is evaluated in a qemu-only build as well, and the default value passes it. Retained /tmp/builders-offnode/inspection-results.json reports portable qcow2 with a 10 GiB virtual size and qcow2_and_raw_identical true. Limitations: I did not run the QEMU build or inspect its artifacts. This is retained evidence from that unchanged portable source. + +CRITERION: AC-05 The resulting image contains **no** baked hostname, static IP/netplan identity, or SSH host keys, and boots with a **fresh `machine-id`** (two clones get distinct ids). +VERDICT: not verified +EVIDENCE: inspection of scripts/seal-image.sh:11-22, which matches the earlier tested snapshot byte for byte, plus the retained results in /tmp/builders-offnode and /tmp/builders-hostcpu-20261104, at dd92fec+dirty. The sealer removes host keys, cleans cloud-init logs, seed, ssh_config and network, empties machine-id, relinks the D-Bus id, writes localhost and drops the 127.0.1.1 line. The earlier inspection-results.json reports generic_hostname, machine_id_empty, ssh_keys_absent and netplan_absent true for both the portable and the earlier native disk. portable-clone-results.json and the earlier native-results.json each show two different machine IDs and host keys. Limitations: I executed none of these. That earlier native build used `cpu: kvm64` (final-audit.json, 990101). For the current host-CPU template, the two-clone boot and the offline disk inspection had not produced results when last read. + +CRITERION: AC-06 The sealed image retains no build password, authorized keys or generated SSH policy override. The default Ubuntu account may remain only locked and keyless, with its standard sudo policy. Any usable deployed login and site-specific identity or SSH policy are supplied at clone time. +VERDICT: not verified +EVIDENCE: inspection of seal-image.sh:10-16, cloud-init/user-data and ubuntu.pkr.hcl:30-32 and 77-79 (all unchanged from the tested snapshot), plus run-native.py:155-191 read without execution and the retained results, at dd92fec+dirty. The sealer sets the ubuntu hash to `*`, removes the ubuntu and root authorized_keys and cleans the cloud-init ssh_config. The current native-build.log shows the plugin's own ephemeral-key removal reporting that those files are already absent. The earlier inspection-results.json reports build_keys_absent, build_ssh_override_absent and build_password_discarded true for both outputs. The earlier portable and kvm64 native clones report password authentication "no" and a locked ubuntu account, and the portable clones confirm consumer key login. The current template has no ciuser, sshkeys or cipassword. Limitations: I executed none of these. The current host-CPU clones' consumer SSH login, effective `passwordauthentication no` and locked-account checks, and the offline inspection of the current native disk, had not produced results when last read. + +CRITERION: AC-07 `packer/ubuntu/readme.md` documents the `-only` invocation for both formats and the required Proxmox variables/secrets. +VERDICT: not verified +EVIDENCE: inspection of packer/ubuntu/readme.md:121-170 against variables.pkr.hcl and proxmox.auto.pkrvars.hcl.example, at dd92fec+dirty. The guide shows `-only='proxmox-clone.ubuntu'` and has a portable section for `-only='qemu.ubuntu'`. It covers the token ID and secret, PKR_VAR_proxmox_api_token, proxmox_insecure, template_vmid, proxmox_storage_pool and proxmox_task_timeout. Lines 154-160 state that proxmox_cpu_type defaults to `host`, that it refers to the hypervisor and not the Packer machine, that it must be overridden with a model shared by all nodes for cross-CPU migration, and how to override it, and that the portable builder is unaffected. The example file sets `proxmox_cpu_type = "host"` with the migration caveat. host-cpu.json (E5-2620, aes, avx, sse4_2, popcnt, no avx2) supports the README's statement that the x86-64-v2-AES example needs compatible hardware. Limitations: the Test Plan proof is to follow the guide for both outputs, and I did not follow it. + +FINDING: F-01 +KIND: factual +SEVERITY: should-fix +WHERE: Tasks (closing paragraph), Context "Uncommitted off-node candidate checks" +EVIDENCE: Spec lines 420-421 say "R-3 F-02 remains an owner question." That contradicts Design line 293 ("The owner resolved R-3 F-02 on 2026-11-04") and Open Questions line 425. Lines 141-146 report that the native template build and both native clones passed, but they do not say that this build predates `cpu_type`. The retained /tmp/builders-offnode/final-audit.json shows template 990101 and clone 990102 with `cpu: kvm64`. +PROPOSAL: Replace the "remains an owner question" sentence with a pointer to the Native CPU model decision. Label the 2026-11-04 native results as the earlier kvm64 build and keep them separate from the current host-CPU run. + +FINDING: F-02 +KIND: judgement +SEVERITY: nit +WHERE: Acceptance Criteria AC-03, Test Plan AC-03 +EVIDENCE: The owner's CPU decision is checked only in the AC-03 Test Plan row ("report `cpu: host` and expose node AES/AVX features; validate a CPU override and reject an empty model"). The text of AC-03 and of every other criterion is silent on the CPU model, so a criterion record can be `met` without any CPU proof. +PROPOSAL: Add the native default CPU model and override behaviour to AC-03's text or a new criterion. That is a normative change and needs a new spec review. + +FINDING: F-03 +KIND: factual +SEVERITY: nit +WHERE: packer/ubuntu/variables.pkr.hcl:72-75, ubuntu.pkr.hcl:61 +EVIDENCE: The validation checks `length(trimspace(var.proxmox_cpu_type)) > 0`, but the builder receives the untrimmed value. A value such as " host" or "host " passes validation and reaches the Proxmox API unchanged. +PROPOSAL: Also require `trimspace(var.proxmox_cpu_type) == var.proxmox_cpu_type`, or pass `trimspace(var.proxmox_cpu_type)` to `cpu_type`. + +FINDING: F-04 +KIND: factual +SEVERITY: nit +WHERE: /tmp/builders-hostcpu-20261104/validate-cpu-override.log +EVIDENCE: The log contains only "The configuration is valid." and records neither the command nor the override value. `packer validate` also does not ask the node whether the model is supported, so the log shows only that a non-empty override is accepted locally. +PROPOSAL: Record the exact command and value with the result. Describe the override proof as local validation, not as node support. +``` + +### R-5 + + +CRITERION: AC-01 A committed `create-base-template.sh` turns the official Ubuntu cloud image into a base cloud-init template on the PVE host (qemu-guest-agent embedded), repeatably; no hand-clicking. +VERDICT: not met +EVIDENCE: I ran `git rev-parse HEAD` and took the sha256 of `git status --porcelain=v1` before and after `python3 -B -m unittest discover -s packer/ubuntu/tests -v`, at dd92fec037e2338000f62471d1353e2d96cd5520+dirty. HEAD is dd92fec. create-base-template.sh shows as ` M`. prepare-base-image.sh and import-base-template.sh show as `??`. The criterion requires a committed script, and the owner's no-commit restriction means this cannot be met at this target. The unittest run printed "Ran 26 tests" and "OK", and that includes the BaseTemplateSafety and RemoteImportSafety refusal, corrupt-bundle and reuse cases. The status digest was the same before and after (16a9e237...). Retained evidence I did not execute: /tmp/builders-hostcpu-20261104/controller.log reports "Disposable base imported from retained bundle." for this run, and /tmp/builders-offnode/import-final-results.json covers the earlier non-root recovery. Limitations: I ran nothing against Proxmox. I did not inspect the guest agent inside the base disk. Corrupt-bundle and occupied-ID refusal against a live node are retained or stubbed evidence only. + +CRITERION: AC-02 `packer init .` installs both `hashicorp/proxmox` (`1.2.4`) and `hashicorp/qemu` plugins. +VERDICT: not verified +EVIDENCE: I inspected packer/ubuntu/ubuntu.pkr.hcl:1-12 and read the retained /tmp/builders-hostcpu-20261104/make-check-final.log, at dd92fec+dirty. The template pins proxmox `= 1.2.4` and qemu `= 1.1.8`. make-check-final.log shows `packer fmt -check`, `packer validate .` with "The configuration is valid.", ShellCheck and "Ran 26 tests ... OK", all run against the guarded source. The fresh-plugins link points to /tmp/builders-offnode/fresh-plugins, which R-4 listed as holding both pinned plugin binaries. Limitations: I did not run `packer init`, `make init` or `packer validate`. All of this evidence is retained, not executed by me. + +CRITERION: AC-03 `packer build -only='proxmox-clone.ubuntu' …` clones the base and produces a **template** on the PVE node (verified via `qm config ` showing `template: 1`) with an **empty cloud-init drive** attached; no per-build `qm importdisk`/upload anywhere in the flow. The native CPU model defaults to `host` and is configurable; the template and two fresh clones use the selected default, and blank or whitespace-padded model names fail local validation. +VERDICT: not verified +EVIDENCE: Source inspection at dd92fec+dirty. ubuntu.pkr.hcl:61 sets `cpu_type = var.proxmox_cpu_type` in the proxmox-clone source only, and the qemu source has no CPU reference. variables.pkr.hcl:67-76 defaults to "host" and requires `length(trimspace(v)) > 0 && trimspace(v) == v`. Searching the repository finds `qm importdisk` only in the Stage 0 import-base-template.sh:46, and the build block has no import or upload step. I compared the current tree with runtime-manifest.json, and only packer/ubuntu/variables.pkr.hcl differs. I reversed the two lines of validation-guard-followup.patch in memory, and that reproduced the manifest hash da40255d... exactly. The build therefore used the same default, the same `cpu_type` wiring and the same provisioners as the current source. Read without execution: run-native.py sets no PKR_VAR_proxmox_cpu_type and refuses to run when an automatic vars file exists. Retained results I did not execute: native-build.log ends "A template was created: 990101" after "2 minutes 56 seconds". template-ownership.json and native-results.json show `template: 1`, `cpu: host` and `ide0: local-lvm:vm-990101-cloudinit,media=cdrom`, with no ciuser, sshkeys, cipassword or ipconfig. clone-990102-ownership.json and clone-990103-ownership.json both show `cpu: host`. native-results.json shows both clones with cpu_model "Intel(R) Xeon(R) CPU E5-2620 0 @ 2.00GHz" and aes_exposed and avx_exposed true. cpu-validation-results.json and the validate-*-cpu.log files record `packer validate -var proxmox_cpu_type=x86-64-v2-AES .` exiting 0, and `proxmox_cpu_type=` and `proxmox_cpu_type= host ` each exiting 1 with the variables.pkr.hcl validation message. Limitations: I executed no build, validate or clone step. The accepted override is local validation only, and its scope field says target-node support is not asserted. A whitespace-only value is rejected by inspection but was not executed. + +CRITERION: AC-04 `packer build -only='qemu.ubuntu' …` still produces the local qcow2/raw artifact. +VERDICT: not verified +EVIDENCE: I ran `diff -u` and `cmp` of the current packer/ubuntu sources against the portable-build snapshot at /home/m/code/.cache/builders-offnode-20261104/portable-final/ubuntu, and ran unittest test_export_is_optional_and_does_not_overwrite (ok), at dd92fec+dirty. All seven scripts and all three cloud-init files are byte-identical. ubuntu.pkr.hcl differs only by the native `task_timeout` and `cpu_type` lines. variables.pkr.hcl differs only by the arch description and the two native-only variables, and the "host" default passes the new validation in a qemu-only run. The qemu source, the build block and the shell-local post-processor are unchanged. Retained /tmp/builders-offnode/inspection-results.json from that unchanged portable source reports qcow2_and_raw_identical true. Limitations: I did not run the QEMU build or inspect its artifacts. + +CRITERION: AC-05 The resulting image contains **no** baked hostname, static IP/netplan identity, or SSH host keys, and boots with a **fresh `machine-id`** (two clones get distinct ids). +VERDICT: not verified +EVIDENCE: I ran `cmp` of scripts/seal-image.sh against the earlier tested snapshot (identical), read run-native.py:128-198 without executing it, and read the retained results, at dd92fec+dirty. In the current host-CPU native-results.json, clone 990102 has hostname test-builders-pr4-clone-1, machine_id 95a7e1d2... and host key SHA256:PbiVeJ..., and clone 990103 has test-builders-pr4-clone-2, 32b56175... and SHA256:fAmr6g.... Each hostname comes from its clone input. The controller checks that the SSH login host key matches the guest-agent fingerprint and that the two clones differ. The earlier /tmp/builders-offnode/inspection-results.json reports generic hostname, empty machine-id, absent host keys and absent netplan for the portable disk and the earlier kvm64 native disk. Limitations: I executed none of this. For the current host-CPU template, native-template.qcow2 exists under /home/m/code/.cache/builders-hostcpu-20261104, but no offline inspection result for it existed when I last read. No final-audit.json exists for this run, and the test resources 990100 to 990103 had not been audited as removed. + +CRITERION: AC-06 The sealed image retains no build password, authorized keys or generated SSH policy override. The default Ubuntu account may remain only locked and keyless, with its standard sudo policy. Any usable deployed login and site-specific identity or SSH policy are supplied at clone time. +VERDICT: not verified +EVIDENCE: I inspected seal-image.sh, cloud-init/user-data and the shared provisioners (byte-identical to the earlier tested snapshot) and read run-native.py:158-192 without executing it, at dd92fec+dirty. Retained current results: both host-CPU clones report ubuntu_password "L" (the controller also asserts the shadow hash is `*`), ssh_password_auth "no" from `sshd -T`, and ssh_login_verified true. Each clone was logged into as its own clone-time user (probe1 or probe2) with a freshly generated key. The template config has no ciuser, sshkeys or cipassword. Earlier /tmp/builders-offnode/inspection-results.json reports build keys absent, SSH override absent and build password discarded for both earlier outputs. Limitations: I executed none of this. The current native sealed disk was exported but has no offline inspection result yet, so absence of authorized_keys and of the generated sshd drop-in in the current template disk is not shown directly. + +CRITERION: AC-07 `packer/ubuntu/readme.md` documents the `-only` invocation for both formats and the required Proxmox variables/secrets. +VERDICT: not verified +EVIDENCE: I inspected packer/ubuntu/readme.md:121-176 against variables.pkr.hcl and proxmox.auto.pkrvars.hcl.example, at dd92fec+dirty. The guide shows `packer build -only='proxmox-clone.ubuntu' .` and a portable section for `-only='qemu.ubuntu'`. It covers the token ID and secret, PKR_VAR_proxmox_api_token, proxmox_insecure, template_vmid, proxmox_storage_pool and proxmox_task_timeout. Lines 154-160 explain the `host` default, that it means the hypervisor CPU and not the Packer machine, the shared-model guidance for migration, the override syntax, that the QEMU builder is unaffected, and the template and clone `cpu: host` check. The example sets `proxmox_cpu_type = "host"` with the migration caveat. The retained controller ran the same native `-only` command shape with environment variables. Limitations: the Test Plan proof is to follow the guide for both outputs, and I followed neither. + +FINDING: F-01 +KIND: factual +SEVERITY: nit +WHERE: Design, Variables & secrets +EVIDENCE: Spec lines 348-349 list "New variables: `proxmox_url`, `proxmox_api_token_id`, `proxmox_api_token`, `proxmox_node`, `proxmox_storage_pool`, `base_template_name`, `proxmox_insecure`, `template_name`, `template_vmid`." The current source adds `proxmox_cpu_type` (variables.pkr.hcl:67) and `proxmox_task_timeout` (variables.pkr.hcl:78), and both are used by the native source (ubuntu.pkr.hcl:56 and :61) and documented in the README and the example. +PROPOSAL: Add the two native variables to that list. + +FINDING: F-02 +KIND: factual +SEVERITY: nit +WHERE: Context, Native CPU model +EVIDENCE: Spec lines 296-297 still say another native build and two fresh-clone checks "must verify" `cpu: host`. The document names only /tmp/builders-offnode (lines 149-151) as the evidence location. /tmp/builders-hostcpu-20261104/native-results.json now records the host-CPU template and both clones passing. That same directory has no offline inspection result for native-template.qcow2 and no final-audit.json for removal of 990100 to 990103. +PROPOSAL: Record the host-CPU run's location and what it established. State that the current native disk inspection and the owned-resource cleanup audit are still pending until their outputs exist. + +### R-6 + + +FINDING: F-01 +KIND: factual +SEVERITY: should-fix +WHERE: Context, Test Plan AC-01 +EVIDENCE: The target is the committed 0b33ecf, and `git status --porcelain=v1` is empty. deae257 committed the scripts and docs/validation/0001-2026-11-04.md. Several current-tense statements in the document still describe an uncommitted candidate with no durable evidence. Line 70 says "the current changes are uncommitted". Lines 99 to 101 say "That report is not in this repository, so the live results above are uncited history". Lines 105 and 126 use the labels "The current draft" and "Uncommitted off-node candidate checks". Lines 149 to 152 and 169 name only /tmp paths as "review artifacts, not durable public links". Searching the document finds no reference to docs/validation/0001-2026-11-04.md, even though packer/ubuntu/recovery.md:4 links to it. The AC-01 Test Plan cell still ends "Commit only after owner review." That is a process instruction, not a proof, and the commit it waits for has now happened. R-1 F-05 already flagged it. +PROPOSAL: Keep the dated 2026-11-03 and 2026-11-04 notes as history, but correct the present-tense commit-state statements and cite docs/validation/0001-2026-11-04.md as the committed evidence summary next to the /tmp paths. Remove the commit instruction from the AC-01 proof so the cell holds only a pass condition. + +FINDING: F-02 +KIND: factual +SEVERITY: should-fix +WHERE: Acceptance Criteria +EVIDENCE: Every criterion is unticked, yet each has an `Evidence:` line beneath it. The standard says a criterion is "ticked only with evidence beneath it, or left unticked with a residual". These lines also restate a diagnostic that is now stale. AC-01's line 403 says "R-5 returned `not met`: the owner prohibits committing this candidate before review". The owner has since authorized the commit, and create-base-template.sh, prepare-base-image.sh and import-base-template.sh are tracked at 0b33ecf. The other six lines cite R-5, a `dd92fec+dirty` diagnostic that `vh-adlc fresh` reports as stale with reason `dirty-target`. +PROPOSAL: Remove the Evidence lines from the unticked criteria and leave R-5's verdicts in the Review Log, where they already sit as history. Add evidence only when a current implementation review establishes a criterion. + +FINDING: F-03 +KIND: judgement +SEVERITY: should-fix +WHERE: Acceptance Criteria AC-05, Test Plan AC-05 +EVIDENCE: Design lines 330 to 333 say the two builders start from different disks. The Proxmox base has the guest agent preinstalled, machine-id cleared and a 32G disk, while QEMU uses the upstream image at 10G. The same lines add that "Local QEMU checks ... do not establish native-builder correctness". AC-05 nonetheless speaks of "The resulting image" and "two clones", and its proof is "Inspect a powered-off artifact, then boot two fresh instances". One output alone can satisfy that proof. By contrast, the AC-06 proof says "Inspect both sealed outputs". +PROPOSAL: State in AC-05 and its Test Plan row that both the native template and the portable artifact are inspected offline, and that two fresh instances of each show distinct machine IDs and host keys. This is a normative revision. + +FINDING: F-04 +KIND: factual +SEVERITY: nit +WHERE: Test Plan AC-03 +EVIDENCE: AC-03 requires that "blank or whitespace-padded model names fail local validation", and variables.pkr.hcl:192 enforces both cases. The AC-03 proof says only "validate a CPU override and reject an empty model". It sets no pass condition for a padded value. +PROPOSAL: Add rejection of a whitespace-padded `proxmox_cpu_type` (for example `" host "`) to the AC-03 proof. + +FINDING: F-05 +KIND: factual +SEVERITY: nit +WHERE: Design, Stage 1 and Native CPU model +EVIDENCE: Line 308 says "with no explicit communicator config, `proxmox-clone` generates an SSH key". However, ubuntu.pkr.hcl:78-79 sets `ssh_username = "ubuntu"` and `ssh_timeout = "20m"`. The HCL excerpt at lines 273 to 299 also omits `os`, `memory`, `cores` and `ssh_username` (ubuntu.pkr.hcl:64-66 and :78), and gives "ubuntu-2404-k3s-base" as the example template name, while variables.pkr.hcl:212 defaults to "ubuntu-2404-base". Lines 321 to 322 put delivery status ("authorized commits and the PR update ... Merging remains unauthorized") inside the normative Design section, so any later status update there counts as a revision. +PROPOSAL: Say that only the SSH key is generated, because the username and timeout are set explicitly. Either align the excerpt with the source or label it abridged. Move the delivery-authorization sentences to Context or Tasks. + +FINDING: F-06 +KIND: factual +SEVERITY: nit +WHERE: Sources +EVIDENCE: Line 859 lists "Legacy flow being replaced: `packer/ubuntu/ubuntu.pkr.hcl`, `scripts/install.sh`, `scripts/seal-image.sh`". deae257 deleted the legacy `scripts/cleanup.sh` and added seal-image.sh as a new file (`git show --stat HEAD~1`), so seal-image.sh is part of the replacement, not the legacy flow. +PROPOSAL: Replace `scripts/seal-image.sh` with the removed `scripts/cleanup.sh` in the legacy list, or point to deae257's parent for the legacy files. + +### R-7 + + +CRITERION: AC-01 A committed `create-base-template.sh` turns the official Ubuntu cloud image into a base cloud-init template on the PVE host (qemu-guest-agent embedded), repeatably; no hand-clicking. +VERDICT: not verified +EVIDENCE: `git ls-files`, `git status --short` and `python3 -B -m unittest discover -s packer/ubuntu/tests -v` at 0b33ecf5dbcade3bb3042b1b0dc60d5cbad1e8d9. The working tree is clean. create-base-template.sh, prepare-base-image.sh and import-base-template.sh are committed. The 16 base template tests passed. They cover a required remote host and explicit ID, refusal of a used ID, corrupt and partial bundles, upload corruption, the ID recheck, disk shrink refusal, reuse of a verified bundle and the qm sequence that creates a cloud-init template. In source, prepare-base-image.sh:34 installs qemu-guest-agent and clears machine-id and host keys, and import-base-template.sh:44-52 creates the VM, adds the cloud-init drive and runs qm template. I also read retained results in /tmp/builders-offnode/. import-final-results.json reports template 1, ide2 cloudinit, agent enabled=1 and a non-root client without Packer or libguestfs. refused-repeat-final.log shows the repeat refused. Limitations: I did not run the live preparation or import against Proxmox, so those results are the implementer's and I did not observe them. The local tests use stubs. + +CRITERION: AC-02 `packer init .` installs both `hashicorp/proxmox` (`1.2.4`) and `hashicorp/qemu` plugins. +VERDICT: met +EVIDENCE: I ran `packer init .` in packer/ubuntu at 0b33ecf with Packer v1.16.2 (/tmp/builders-pr4-tools/packer), using an empty scratch PACKER_PLUGIN_PATH and config dir outside the repo. The output was "Installed plugin github.com/hashicorp/proxmox v1.2.4" and "Installed plugin github.com/hashicorp/qemu v1.1.8", with exit 0. A follow-up `packer validate .` with a placeholder token against those freshly installed plugins printed "The configuration is valid." Limitations: I ran the command directly rather than through `make init`, which runs the same command (Makefile:5). The run was on linux_amd64 only. + +CRITERION: AC-03 `packer build -only='proxmox-clone.ubuntu' …` clones the base and produces a **template** on the PVE node (verified via `qm config ` showing `template: 1`) with an **empty cloud-init drive** attached; no per-build `qm importdisk`/upload anywhere in the flow. The native CPU model defaults to `host` and is configurable; the template and two fresh clones use the selected default, and blank or whitespace-padded model names fail local validation. +VERDICT: not verified +EVIDENCE: I ran `packer fmt -check -recursive .`, `packer validate .`, `packer validate -var 'proxmox_cpu_type=x86-64-v2-AES' .`, `packer validate -var 'proxmox_cpu_type=' .`, `packer validate -var 'proxmox_cpu_type= host' .` and `packer inspect .` in packer/ubuntu at 0b33ecf. fmt passed, the default and the override validated, empty and padded values exited 1 with the variables.pkr.hcl:72 rule message, and inspect shows proxmox_cpu_type "host". In source, ubuntu.pkr.hcl:49-79 sets full_clone, cpu_type = var.proxmox_cpu_type, cloud_init = true and cloud_init_storage_pool, and the Packer flow has no importdisk or upload. I also read retained results. /tmp/builders-hostcpu-20261104/native-results.json reports template 1, ide0 cloudinit and cpu host, and two clones with cpu host, the E5-2620 model, AES and AVX. I recomputed the hash after reversing validation-guard-followup.patch and it matches runtime-manifest.json (da40255d...). Of the 20 runtime files, only variables.pkr.hcl differs from the commit. Limitations: I did not observe the native build, the qm config check or the clones. Only the local validation part of this composite criterion ran in this review. + +CRITERION: AC-04 `packer build -only='qemu.ubuntu' …` still produces the local qcow2/raw artifact. +VERDICT: not verified +EVIDENCE: `python3 -B -m unittest discover -s packer/ubuntu/tests -v` (test_raw_export) and `packer validate .` at 0b33ecf. The raw export test passed: export is optional, a real qemu-img conversion runs and an existing raw file is never overwritten. The qemu source and its export-raw.sh post-processor validate. I also read retained results. /tmp/builders-offnode/portable-final-build.log ends with qemu.ubuntu artifacts in output-noble-amd64, and inspection-results.json reports qcow2_and_raw_identical true at 10 GiB. Limitations: I ran no QEMU Packer build. The retained build predates the native CPU and timeout settings, which the manifests show leave the QEMU source unchanged. + +CRITERION: AC-05 The resulting image contains **no** baked hostname, static IP/netplan identity, or SSH host keys, and boots with a **fresh `machine-id`** (two clones get distinct ids). +VERDICT: not verified +EVIDENCE: Inspection of seal-image.sh:13-22 at 0b33ecf. It removes ssh_host_*, runs `cloud-init clean --logs --seed --configs ssh_config network`, truncates /etc/machine-id, relinks the D-Bus id, sets /etc/hostname to localhost and drops the 127.0.1.1 hosts entry. I also read retained results. /tmp/builders-hostcpu-20261104/inspection-results.json reports native generic_hostname, machine_id_empty, ssh_keys_absent and netplan_absent all true. native-results.json shows two clones with distinct machine IDs and host keys. /tmp/builders-offnode/portable-clone-results.json shows the same for two portable boots. Limitations: I inspected no artifact and booted no instance. test_sealing.sh needs Docker, which this review may not run. + +CRITERION: AC-06 The sealed image retains no build password, authorized keys or generated SSH policy override. The default Ubuntu account may remain only locked and keyless, with its standard sudo policy. Any usable deployed login and site-specific identity or SSH policy are supplied at clone time. +VERDICT: not verified +EVIDENCE: Inspection of seal-image.sh:11-16, cloud-init/user-data and ubuntu.pkr.hcl:30-31 and 76-78 at 0b33ecf. The sealer sets the ubuntu hash to `*`, removes the ubuntu and root authorized_keys and cleans the cloud-init ssh_config, which drops 50-cloud-init.conf. The account and its sudo drop-in remain, as the criterion allows. I also read retained results. The native and portable inspection-results.json files report build_keys_absent, build_ssh_override_absent and build_password_discarded true. Both native clones show ubuntu_password "L", ssh_password_auth "no" and ssh_login_verified true. final-audit.json shows clone 990102 configured with consumer ciuser probe1, and the template config in native-results.json has no ciuser or sshkeys. Limitations: I did not run test_sealing.sh (Docker is prohibited here, and make check does not run it). I observed no sealed disk and no fresh boot. + +CRITERION: AC-07 `packer/ubuntu/readme.md` documents the `-only` invocation for both formats and the required Proxmox variables/secrets. +VERDICT: met +EVIDENCE: Read packer/ubuntu/readme.md and cross-checked every variable declared in variables.pkr.hcl against the readme and proxmox.auto.pkrvars.hcl.example at 0b33ecf. readme.md:130 gives `packer build -only='proxmox-clone.ubuntu' .`. readme.md:177-183 give the qemu forms, including output_raw=true. readme.md:123-145 tells the reader to copy the example file, which sets proxmox_url, proxmox_api_token_id, proxmox_node, proxmox_insecure, proxmox_storage_pool, proxmox_cpu_type, proxmox_task_timeout, base_template_name, template_name and template_vmid. The secret is supplied via a hidden-prompt PKR_VAR_proxmox_api_token, with a never-commit warning. Every Proxmox and template variable in the template appears in the readme or the example it references. Limitations: I did not follow the guide through either build. Several variable names appear only in the referenced example file, not in the readme prose. + +FINDING: F-01 +KIND: factual +SEVERITY: should-fix +WHERE: Context (Live validation before the structure refactor) and Acceptance Criteria AC-01 Evidence +EVIDENCE: docs/specs/0001-packer-proxmox-native-output.md:69-70 says "the current changes are uncommitted. AC-01 remains unchecked", and :403 says "R-5 returned `not met`: the owner prohibits committing this candidate before review." `git status --short` at 0b33ecf is clean, and all AC-01 scripts are tracked. +PROPOSAL: Update both passages to state that the candidate is committed at deae257 and merged in 0b33ecf, and that R-5 is a historical dirty diagnostic. Leave AC-01 unticked until a current review establishes it. + +FINDING: F-02 +KIND: judgement +SEVERITY: nit +WHERE: Delivery boundary (owner-approved candidate versus committed tree) +EVIDENCE: Comparing /tmp/builders-pr4-delivery-20261104/approved-manifest.json with `git show` blobs gives 50 paths checked. Four differ at deae257: AGENTS.md, the 0001 spec, packer/ubuntu/recovery.md and readme.md. 0b33ecf additionally differs in the 0003 spec from the merge. All runtime and test files match. recovery.md is within `covers`. +PROPOSAL: Record that the post-approval changes are documentation only, or regenerate the approval manifest from deae257, so the claim "committing the reviewed candidate" is exact. + +FINDING: F-03 +KIND: judgement +SEVERITY: nit +WHERE: Test Plan AC-06 and Makefile check target +EVIDENCE: Makefile:8-11 only runs ShellCheck on tests/test_sealing.sh. The unittest discovery runs 26 Python tests and none runs the sealer against real cloud-init. readme.md:207-215 documents a manual Docker run. The sealing behaviour behind AC-05 and AC-06 therefore has no automated local regression in `make check`. +PROPOSAL: Note in the Test Plan that test_sealing.sh is a manual container check, and have spec 0002 run it in CI. + +### R-8 + + +FINDING: F-01 +KIND: factual +SEVERITY: nit +WHERE: Context, Live validation before the structure refactor and Off-node candidate checks +EVIDENCE: Spec line 101 says the committed validation summary "records the observed results and their limits". That sentence follows the 2026-11-03 section, which reports the 12 GiB test disk, the duplicate machine ID and shared DHCP client ID defect, the deprecated cloud-init `user` string, the missing executable bit on the raw exporter, the early TCG memory-cap failures and the 990100 to 990105 test range (lines 77 to 98). docs/validation/0001-2026-11-04.md mentions none of these. Lines 154 to 155 say the summary "provides the portable record of these observations". Those observations include the earlier `kvm64` native template build, the build failure that led to raising the task timeout, the `kvm64` native fresh clones and the audit of five removed resources (lines 143 to 148). The summary describes only the later `host` CPU native run and its four removed resources (summary lines 33 to 42). It mentions the timeout only as a setting that leaves the QEMU source unchanged (line 56). +PROPOSAL: Narrow both citations to what the summary contains. Either label the 2026-11-03 notes and the earlier `kvm64` native run as history recorded only in private artifacts, or add those observations to the validation summary. + +FINDING: F-02 +KIND: judgement +SEVERITY: nit +WHERE: Design, Provisioning changes, and Context, Primer +EVIDENCE: The Design describes build access only for the native builder: "`proxmox-clone` generates a temporary SSH key" (line 314) and "remove the temporary build SSH key Packer injected" (line 362). The Primer gives the same native-only description (lines 57 to 59). The portable builder actually logs in with a password. ubuntu.pkr.hcl:31 sets `ssh_password = "ubuntu"`, and cloud-init/user-data:3-4 sets `password: ubuntu` and `ssh_pwauth: true`. The AC-06 Test Plan row checks that sealing "removes the temporary SSH password override and discards the build-password hash". seal-image.sh:11 and :16 do this with `usermod --password '*'` and `--configs ssh_config`. The Design never introduces this password access or the step that removes it, so the AC-06 proof relies on behaviour the Design does not describe. +PROPOSAL: Add one Design sentence: the QEMU seed grants temporary password SSH access, and sealing replaces the password hash with `*` and removes cloud-init's SSH policy drop-in. + +FINDING: F-03 +KIND: judgement +SEVERITY: nit +WHERE: Acceptance Criteria AC-01, Test Plan AC-01 +EVIDENCE: AC-01 requires the base template to be created "repeatably". Design lines 266 to 268 say source downloads track Ubuntu's moving `current` directory, so a later fresh build will not be byte-identical, and that exact reuse comes from the retained bundle. The AC-01 proof runs one bootstrap and one bundle import. It never defines what a repeat run must show, so a reviewer cannot tell which reading of "repeatably" passes. +PROPOSAL: Define "repeatably" in AC-01 or its proof. One option: rerunning the committed script on a new unused ID produces an equivalent base, and importing the retained bundle reproduces the same verified disk. + +FINDING: F-04 +KIND: judgement +SEVERITY: nit +WHERE: Test Plan AC-03 +EVIDENCE: AC-03 requires "no per-build `qm importdisk`/upload anywhere in the flow". The AC-03 proof checks the template flag, the cloud-init volume, leftover credentials, the CPU model and CPU validation. It sets no pass condition for the absence of an import or upload step. In source, the only `qm importdisk` is in the once-per-base import-base-template.sh:46, and the build block at ubuntu.pkr.hcl:82-119 has no import or upload step. +PROPOSAL: Add a pass condition to the AC-03 proof. For example, inspecting ubuntu.pkr.hcl and the native build log shows no import or upload step after Stage 0. + +FINDING: F-05 +KIND: factual +SEVERITY: nit +WHERE: Open Questions +EVIDENCE: Lines 470 to 476 come after the Q1 option table and its "Why this is yours" line, still under the `### Q1:` heading. They record settled decisions (off-node bootstrap, the Bash/jq adapter) and history about R-1 F-02, so they read as part of the pending Q1. Line 474 also states "The actual noble/amd64 manifest includes jq" with no citation. The standard requires Context and Design claims to be cited. +PROPOSAL: Move these decision notes to Design or Context. Cite the jq claim with the retained portable build log showing wait-cloud-init.sh parsing real cloud-init JSON, or with the upstream manifest. Leave only Q1 under Open Questions. + +### R-9 + + +CRITERION: AC-01 A committed `create-base-template.sh` turns the official Ubuntu cloud image into a base cloud-init template on the PVE host (qemu-guest-agent embedded), repeatably; no hand-clicking. +VERDICT: not verified +EVIDENCE: I ran `git rev-parse HEAD`, `git status --short`, `git ls-files` and `python3 -B -m unittest discover -s packer/ubuntu/tests -v` at edcdb0a169316f22d98854d9f44f8fab18459edf. HEAD matches the target and the tree is clean. create-base-template.sh, prepare-base-image.sh and import-base-template.sh are tracked. All 26 tests passed, 16 of them in test_base_template. These cover the required remote host and explicit ID, refusal of a used ID with no download or delete, corrupt and partial bundles, upload corruption, the ID recheck on the node, disk shrink refusal, reuse of a verified bundle and the qm sequence that imports a cloud-init template. `git diff --stat 0b33ecf edcdb0a` shows only the 0001 spec changed. I read the source. prepare-base-image.sh:34-42 installs qemu-guest-agent and clears machine-id and host keys. import-base-template.sh:44-52 creates the VM, imports the disk, attaches ide2 cloudinit, enables the agent and runs qm template. I also read retained results that I did not observe being produced. /tmp/builders-offnode/import-final-results.json reports template 1, ide2 cloudinit, agent enabled=1, a non-root client without Packer or libguestfs, an occupied ID refused and protected guests unchanged. Limitations: I ran no live preparation or import against Proxmox. The local tests use stubs for ssh, qm and pvesh. A full Fedora restoration and an off-host backup are not established. The prior dirty-target reason no longer applies. + +CRITERION: AC-02 `packer init .` installs both `hashicorp/proxmox` (`1.2.4`) and `hashicorp/qemu` plugins. +VERDICT: met +EVIDENCE: I ran `packer init .` in packer/ubuntu at edcdb0a with Packer v1.16.2 (/tmp/builders-pr4-tools/packer). I set PACKER_PLUGIN_PATH, PACKER_CONFIG_DIR and PACKER_CACHE_DIR to an empty scratch directory, /tmp/r8-review.EVAPGo. Output: "Installed plugin github.com/hashicorp/proxmox v1.2.4" and "Installed plugin github.com/hashicorp/qemu v1.1.8", exit 0. A following `packer validate .` with a placeholder token against those plugins printed "The configuration is valid." ubuntu.pkr.hcl:1-12 pins proxmox = 1.2.4 and qemu = 1.1.8. Limitations: I ran the command directly, not through `make init` (Makefile:5 runs the same command). The run was on linux_amd64 only. The binary's zip hash matches the linux_amd64 entry of a SHA256SUMS file in the implementer's tool directory, and I did not verify that file's signature. + +CRITERION: AC-03 `packer build -only='proxmox-clone.ubuntu' …` clones the base and produces a **template** on the PVE node (verified via `qm config ` showing `template: 1`) with an **empty cloud-init drive** attached; no per-build `qm importdisk`/upload anywhere in the flow. The native CPU model defaults to `host` and is configurable; the template and two fresh clones use the selected default, and blank or whitespace-padded model names fail local validation. +VERDICT: not verified +EVIDENCE: I ran these at edcdb0a: `packer fmt -check -recursive .`, `packer validate .`, `packer validate -var 'proxmox_cpu_type=x86-64-v2-AES' .`, `packer validate -var 'proxmox_cpu_type=' .`, `packer validate -var 'proxmox_cpu_type= host ' .`, a validate with a whitespace-only value, and `packer inspect .`. fmt passed (exit 0). The default and the override printed "The configuration is valid." The empty, padded and whitespace-only values exited 1 with the variables.pkr.hcl:193 message. inspect shows var.proxmox_cpu_type "host" and both sources. In source, ubuntu.pkr.hcl:49-80 sets full_clone, cpu_type = var.proxmox_cpu_type, cloud_init = true and cloud_init_storage_pool, with ssh_username "ubuntu" and ssh_timeout "20m". The Packer flow has no importdisk or disk upload. I also read retained results that I did not observe being produced. /tmp/builders-hostcpu-20261104/native-results.json reports template 1, ide0 cloudinit and cpu host, and two clones with cpu host, the Xeon E5-2620 model, AES and AVX. I recomputed hashes for the 20 runtime files in runtime-manifest.json against edcdb0a blobs. Nineteen match. variables.pkr.hcl differs, and reversing the two lines in validation-guard-followup.patch gives da40255d2fcada1b48f87aae26e4f4c62130fff7af2ff5dd4de1ee3e91b3218b, which matches the manifest. Limitations: I observed no native build, no qm config and no clones. Only the local validation part of this composite criterion ran in this review. + +CRITERION: AC-04 `packer build -only='qemu.ubuntu' …` still produces the local qcow2/raw artifact. +VERDICT: not verified +EVIDENCE: I ran the unittest discovery (test_raw_export) and `packer validate .` at edcdb0a. The raw export test passed: export is optional, a real qemu-img conversion runs and an existing raw file is never overwritten. The qemu source and its export-raw.sh post-processor validate. I also read retained results that I did not observe being produced. /tmp/builders-offnode/portable-final-build.log ends with qemu.ubuntu artifacts in output-noble-amd64, and inspection-results.json reports qcow2_and_raw_identical true at 10 GiB virtual size. Limitations: I ran no QEMU Packer build. The retained build predates the native CPU, timeout and guard changes. The manifest comparison above shows ubuntu.pkr.hcl, the shared scripts and export-raw.sh are identical to the tested files. + +CRITERION: AC-05 The resulting image contains **no** baked hostname, static IP/netplan identity, or SSH host keys, and boots with a **fresh `machine-id`** (two clones get distinct ids). +VERDICT: not verified +EVIDENCE: I inspected seal-image.sh:13-22 at edcdb0a. It removes ssh_host_*, runs `cloud-init clean --logs --seed --configs ssh_config network`, truncates /etc/machine-id, relinks the D-Bus id, writes localhost to /etc/hostname and drops the 127.0.1.1 hosts entry. tests/test_sealing.sh:44-55 asserts these outcomes. I read the script but did not run it. I also read retained results that I did not observe being produced. /tmp/builders-hostcpu-20261104/inspection-results.json reports native generic_hostname, machine_id_empty, ssh_keys_absent and netplan_absent all true. native-results.json shows two native clones with distinct machine IDs and host keys. /tmp/builders-offnode/inspection-results.json and portable-clone-results.json show the same for the portable artifact and two portable boots. Limitations: I inspected no artifact and booted no instance. test_sealing.sh needs Docker, which this review may not run. Whether AC-05 must cover both outputs is still owner question Q1, so I applied no particular reading. + +CRITERION: AC-06 The sealed image retains no build password, authorized keys or generated SSH policy override. The default Ubuntu account may remain only locked and keyless, with its standard sudo policy. Any usable deployed login and site-specific identity or SSH policy are supplied at clone time. +VERDICT: not verified +EVIDENCE: I inspected seal-image.sh:11-16, cloud-init/user-data, ubuntu.pkr.hcl:30-33 and 77-79, tests/test_sealing.sh and the Makefile at edcdb0a. The sealer sets the ubuntu hash to `*`, removes the ubuntu and root authorized_keys and cleans the cloud-init ssh_config, which removes 50-cloud-init.conf. test_sealing.sh:16-19 reproduces `passwordauthentication yes` from the real seed, and :44-50 asserts `no`, hash `*` and that the override is absent. Makefile:10 only runs ShellCheck on it, which matches the manual boundary stated in the AC-06 Test Plan row. The native SSH settings match the Design text: only the key is generated, and the username and timeout are set explicitly. I also read retained results that I did not observe being produced. The native and portable inspection-results.json files report build_keys_absent, build_ssh_override_absent and build_password_discarded true. Both native clones show ubuntu_password "L", ssh_password_auth "no" and ssh_login_verified true. Both portable boots show password_auth "no" and consumer_key_login true. final-audit.json shows clone 990102 with consumer ciuser probe1, and the template config has no ciuser or sshkeys. Limitations: I did not run test_sealing.sh, since Docker is prohibited here. I observed no sealed disk and no fresh boot. + +CRITERION: AC-07 `packer/ubuntu/readme.md` documents the `-only` invocation for both formats and the required Proxmox variables/secrets. +VERDICT: met +EVIDENCE: I read packer/ubuntu/readme.md at edcdb0a and checked every variable in variables.pkr.hcl against the readme and proxmox.auto.pkrvars.hcl.example. readme.md:130 gives `packer build -only='proxmox-clone.ubuntu' .`, and readme.md:177-183 give the qemu forms, including output_raw=true. readme.md:123-132 tells the reader to copy the example file, which sets proxmox_url, proxmox_api_token_id, proxmox_node, proxmox_insecure, proxmox_storage_pool, proxmox_cpu_type, proxmox_task_timeout, base_template_name, template_name and template_vmid. The secret comes from a hidden-prompt PKR_VAR_proxmox_api_token with a never-commit warning (readme.md:128-135). The prose also explains proxmox_insecure, template_vmid, proxmox_storage_pool, proxmox_task_timeout and proxmox_cpu_type (readme.md:136-160). The `packer init .` and validate commands I ran follow the guide's preparation step. Limitations: I did not follow the guide through either build. proxmox_url, proxmox_node, base_template_name and template_name appear in the readme only through the referenced example file and the line 123 summary. + +FINDING: F-01 +KIND: factual +SEVERITY: should-fix +WHERE: Test Plan, Tasks delivery note, Review Log +EVIDENCE: `vh-adlc fresh docs/specs/0001-packer-proxmox-native-output.md --repo . --plugin-pin 0e52f51f01b84eda75a976763c42d8ec0a07b544` at edcdb0a reports both R-6 (spec) and R-7 (implementation) as stale with reason `baseline-changed`. `git diff 0b33ecf edcdb0a` shows normative edits to the Test Plan rows for AC-01, AC-03 and AC-06, plus the new Q1. So the current normative baseline has no current spec review and no owner acceptance. The Tasks delivery note says "R-7 observed AC-02 and AC-07 as met" and does not say that R-7 is now stale against this baseline. +PROPOSAL: Run a spec review at edcdb0a, or a later commit, before any acceptance row. Say in the delivery note that R-6 and R-7 reviewed the previous baseline. + +FINDING: F-02 +KIND: factual +SEVERITY: nit +WHERE: packer/ubuntu/ubuntu.pkr.hcl:47, Design (Selecting output format at invocation) +EVIDENCE: The comment at ubuntu.pkr.hcl:47 gives `packer build -only='proxmox-clone.ubuntu' -var-file=proxmox.auto.pkrvars.hcl .`. readme.md:130 and :186 say `*.auto.pkrvars.hcl` loads automatically and use no -var-file, while the Design example uses `-var-file=variables.pkrvars.hcl` for both builders. Passing the auto file explicitly loads it twice. This does no harm, but it is a third invocation form. +PROPOSAL: Align the source comment with readme.md:130, so the native command takes no -var-file and relies on the automatically loaded file. + +### R-10 + + +FINDING: F-01 +KIND: factual +SEVERITY: nit +WHERE: Tasks, delivery note +EVIDENCE: Spec lines 449 to 450 say "R-9 refreshed the implementation review: AC-02 and AC-07 were observed as met; live-build criteria remain not independently verified." At 1dcd2c59a5a01cc2301f63e41ab1516cbe6d88f1, running `vh-adlc fresh docs/specs/0001-packer-proxmox-native-output.md --repo . --plugin-pin 0e52f51f01b84eda75a976763c42d8ec0a07b544` reports R-8 as stale with reason `baseline-changed`. It reports R-9 as stale with reasons `baseline-changed` and `covered-changed`, because covered path packer/ubuntu/ubuntu.pkr.hcl changed. `git diff edcdb0a HEAD -- packer` shows that change is the ubuntu.pkr.hcl:47 build comment only, which no longer passes `-var-file=proxmox.auto.pkrvars.hcl`. Lines 445 to 447 say the runtime and test files match the owner-reviewed manifest and that no runtime feature changed. That was true for deae257, but the note never mentions that 1dcd2c5 later edited this comment in a covered runtime file. R-9 F-01 raised the same problem about R-7, and the note now repeats it one review later. +PROPOSAL: State that R-8 and R-9 reviewed edcdb0a and are now stale against the current baseline. Also record that the only covered-path change since then is the comment at ubuntu.pkr.hcl:47, and that it changes no executable setting. + +### R-11 + + +CRITERION: AC-01 A committed `create-base-template.sh` turns the official Ubuntu cloud image into a base cloud-init template on the PVE host (qemu-guest-agent embedded), repeatably; no hand-clicking. +VERDICT: not verified +EVIDENCE: Executed `python3 -B -m unittest discover -s packer/ubuntu/tests -v` at 1dcd2c59a5a01cc2301f63e41ab1516cbe6d88f1 with a clean tree: 26 tests ran OK, including 16 base-template fixtures. The fixtures cover a missing host or ID, refusal of an occupied ID without download or delete, rejection of a corrupt or partial bundle before upload, rejection of upload corruption, a shrink refusal and an ID recheck before `qm create`, cleanup limited to the staging directory, and the stubbed import sequence. Read the committed prepare-base-image.sh, create-base-template.sh and import-base-template.sh: they verify the upstream checksum, install qemu-guest-agent through virt-customize, clear machine-id and host keys, check the bundle checksum locally and on the node, then run `qm create`, `importdisk`, set a cloud-init ide2 drive and finish with `qm template`. The live off-node preparation, the SSH-only bundle import on Proxmox 9.1.7, the occupied-ID refusal and the guest-preservation audit were read only as retained implementer evidence (docs/validation/0001-2026-11-04.md, /tmp/builders-offnode/). I did not execute them. The Test Plan's repeat import of the same bundle on a second unused ID was not found as an executed result in the committed summary. The live criterion is composite, and local fixtures with stubbed qm and pvesh do not establish it. + +CRITERION: AC-02 `packer init .` installs both `hashicorp/proxmox` (`1.2.4`) and `hashicorp/qemu` plugins. +VERDICT: met +EVIDENCE: Executed `packer init .` in packer/ubuntu using Packer v1.16.2 (the retained /tmp/builders-pr4-tools/packer ELF binary), with PACKER_PLUGIN_PATH, PACKER_CONFIG_DIR and PACKER_CACHE_DIR in an empty scratch directory outside the repository. Exit 0. Output: "Installed plugin github.com/hashicorp/qemu v1.1.8" and "Installed plugin github.com/hashicorp/proxmox v1.2.4". `packer plugins installed` listed both binaries. With those plugins, `packer validate .`, `packer validate -only=qemu.ubuntu .` and `packer fmt -check -recursive packer/ubuntu` all succeeded. The repository tree and index were unchanged afterwards. Limitation: Packer is not installed on this host, so the implementer's retained binary was used. ShellCheck is absent here, so the shellcheck step of `make check` was not observed. + +CRITERION: AC-03 `packer build -only='proxmox-clone.ubuntu' …` clones the base and produces a **template** on the PVE node (verified via `qm config ` showing `template: 1`) with an **empty cloud-init drive** attached; no per-build `qm importdisk`/upload anywhere in the flow. The native CPU model defaults to `host` and is configurable; the template and two fresh clones use the selected default, and blank or whitespace-padded model names fail local validation. +VERDICT: not verified +EVIDENCE: Executed locally with the scratch plugins: `packer validate .` passed with the `host` default. `-var 'proxmox_cpu_type=x86-64-v2-AES'` validated. `-var 'proxmox_cpu_type='` and `-var 'proxmox_cpu_type= host '` each exited 1 with the variable's "non-empty model name" error. `packer inspect` reports var.proxmox_cpu_type "host". Static read of ubuntu.pkr.hcl: the proxmox-clone source sets full_clone, cpu_type = var.proxmox_cpu_type, cloud_init = true and cloud_init_storage_pool. The only post-processor (line 111) is shell-local, limited to qemu.ubuntu. The file contains no importdisk or qm call. The only `file` provisioner uploads build-config.yaml into the guest, not a disk. `git diff 0b33ecf 1dcd2c5 -- packer/` shows only the comment edit at line 47. The live native build, the `template: 1` and cloud-init volume inspection, and the two fresh clones reporting `cpu: host` with AES/AVX are retained implementer evidence (/tmp/builders-hostcpu-20261104/, the validation summary) that I did not execute. The composite criterion is not upgraded by the passing local subset. + +CRITERION: AC-04 `packer build -only='qemu.ubuntu' …` still produces the local qcow2/raw artifact. +VERDICT: not verified +EVIDENCE: Executed `packer validate -only=qemu.ubuntu .`: valid. The unittest run includes test_export_is_optional_and_does_not_overwrite, which passed with a real qemu-img conversion of a disposable file. Read the qemu source: output_directory, the qcow2 vm_name and the shell-local export-raw.sh post-processor gated by output_raw. The portable KVM build, which produced matching 10 GiB qcow2 and raw disks, is retained implementer evidence (/tmp/builders-offnode/portable-final-build.log, the validation summary) that I did not execute. The summary states the portable image was not rebuilt after the native-only CPU and guard changes. My diff since 0b33ecf confirms the QEMU source and guest scripts are unchanged. + +CRITERION: AC-05 The resulting image contains **no** baked hostname, static IP/netplan identity, or SSH host keys, and boots with a **fresh `machine-id`** (two clones get distinct ids). +VERDICT: not verified +EVIDENCE: Read seal-image.sh at the target. It removes /etc/ssh/ssh_host_*, runs `cloud-init clean --logs --seed --configs ssh_config network`, truncates /etc/machine-id and relinks the D-Bus id, writes `localhost` to /etc/hostname and deletes the 127.0.1.1 hosts entry. install.sh and build-config.yaml set no hostname or static network. Executed test_sealing_requires_an_explicit_image_build_flag, which passed. The offline disk inspections and the fresh-boot pairs with distinct machine IDs and host keys for both outputs are retained implementer evidence that I did not execute. No guest or disk was inspected in this review. + +CRITERION: AC-06 The sealed image retains no build password, authorized keys or generated SSH policy override. The default Ubuntu account may remain only locked and keyless, with its standard sudo policy. Any usable deployed login and site-specific identity or SSH policy are supplied at clone time. +VERDICT: not verified +EVIDENCE: Read seal-image.sh. It runs `usermod --password '*' ubuntu`, removes the authorized_keys files for ubuntu and root, and removes the cloud-init ssh_config override and seed. It leaves the cloud-init sudoers rule, which the current criterion allows. cloud-init/user-data enables temporary password SSH for the QEMU build only, and the readme and Design describe that temporary access and its removal. The real cloud-init check tests/test_sealing.sh needs Docker and was not executed by me. `make check` only lints it, and ShellCheck is absent on this host. Sealed-artifact inspection and fresh boots with consumer-supplied users and keys are retained implementer evidence only. + +CRITERION: AC-07 `packer/ubuntu/readme.md` documents the `-only` invocation for both formats and the required Proxmox variables/secrets. +VERDICT: met +EVIDENCE: Inspected packer/ubuntu/readme.md at the target. It gives `packer build -only='proxmox-clone.ubuntu' .` and `packer build -only='qemu.ubuntu' .`, plus the raw and tcg variants. It documents the token ID and secret through PKR_VAR_proxmox_api_token, with a prompt that keeps the secret out of shell history, and the copy of proxmox.auto.pkrvars.hcl.example. It explains proxmox_insecure, template_vmid, proxmox_storage_pool, proxmox_task_timeout and proxmox_cpu_type, and how -var-file and auto-loading behave. I executed a scan comparing each declared Proxmox variable in variables.pkr.hcl with the readme and the example. All 11 are named in the example file. proxmox_url, proxmox_api_token_id, proxmox_node and base_template_name appear in the readme as described values ("endpoint, node, storage and base template name", token ID form) rather than by name. Packer validation confirms that the variable names in the example match the template. Limitation: the guide was not followed through a live build. + +NO FINDINGS + +### R-12 + +FINDING: F-01 +KIND: judgement +SEVERITY: should-fix +WHERE: Acceptance Criteria AC-09 and AC-10; Design, Bootstrap preservation map (Krew row) +EVIDENCE: The map row "Krew, stern, view-secret and neat" says "Selected plugins must work for a fresh user ... Any proposed omission needs an owner decision". AC-09 lists only "Zi/Powerlevel10k, MOTD, GitHub CLI and kubectl" and does not mention Krew. AC-10 requires only "the selected kubectl alias/completion and selected Krew plugins", and no section says which plugins are selected. The source behaviour is purely per user. pds-source/bash/debian/software/install_kubectl.sh:60 checks `$HOME/.krew/bin/kubectl-krew`, line 97 installs `("neat" "view-secret" "stern")`, and lines 76 and 102 only print warnings when a download fails. An empty selection would therefore tick AC-09 and AC-10, and the user's earlier stern/view-secret/neat tooling would still be lost. +PROPOSAL: Name neat, view-secret and stern (and Krew itself) in AC-09 and AC-10 as required for a fresh user from both outputs, or record an owner decision that omits them. The AC-10 proof should run each plugin as the new user. + +FINDING: F-02 +KIND: judgement +SEVERITY: should-fix +WHERE: Design, Bootstrap preservation map (Zi and Powerlevel10k row) and following paragraph; AC-10; AC-11 +EVIDENCE: The map promises "preserving the existing preset and Zi workflow" and also "first shell startup does not require an installer download". The paragraph after it adds that Zi/plugin downloads are "selected at exact revisions". The existing workflow is the packaged pds-source/bash/config/zshrc:11-33. It runs unpinned `zi light romkatv/powerlevel10k`, `zsh-users/*`, `agkozak/zsh-z`, `michielvha/zsh-readline` and `zi snippet OMZP::docker|history|git`, which Zi clones into each user's home on first startup. Powerlevel10k's gitstatus also fetches a gitstatusd binary into the user's cache on first prompt. AC-11 requires "existing Zi/preset behavior continue to work", and tests/image_provisioning_test.py:70-71 asserts those exact unpinned `zi light` lines. zsh.sh:16 also clones Zi at the default branch. As written, the design cannot satisfy both "preserve the existing workflow" and "no download, exact revisions". It also names no mechanism, such as a shared Zi home or skel-seeded plugins with version ices, and does not list gitstatusd among the bounded inputs. +PROPOSAL: Say which zshrc and Zi changes PDS will make: pinned revisions for Zi and every plugin and snippet, a prebuilt shared or skel location, and gitstatusd handling. Reword AC-11's "existing Zi/preset behavior" to mean the same preset and plugin set, not unpinned per-user first-start cloning. + +FINDING: F-03 +KIND: judgement +SEVERITY: should-fix +WHERE: Design, PDS provisioning and package identity; Bounded image checks and delivery order; Scope (Out of scope); AC-08 +EVIDENCE: Design says "The normal signed-repository route must also pass before final delivery", and AC-08 requires a "verified signed-repository release build". Scope puts "Merging, releasing PDS" out of scope. pds-source/.github/workflows/build-apt-package.yml:134 and :169 create a release and APT publication only on pushes to main. Lines 68-80 also overwrite the version with GitVersion output. The candidate's `version: 1.0.0` (packaging/nfpm.yaml:2) is a placeholder, so the published version will differ from the candidate (latest release 0.19.0). The delivery order paragraph names "its separate PDS dependency" but no handoff. It does not say the owner merges PDS first, that the assigned release version then replaces the candidate pin in builders, or that builders cannot be accepted until then. +PROPOSAL: Add an explicit handoff: the PDS PR is merged and released by the owner, its CI-assigned version is recorded as the builders pin, and the signed-route builds for both outputs then run before builders acceptance. State that the candidate's 1.0.0 is a local placeholder identified only by its SHA-256. + +FINDING: F-04 +KIND: judgement +SEVERITY: should-fix +WHERE: Design, Bootstrap preservation map (Hostname, users ... login shell, sudo row); AC-10; Test Plan AC-10; Design, Variables & secrets +EVIDENCE: The map says "A documented example selects Zsh and sudo for the deployed user". The Test Plan for AC-10 only says "launch Zsh", so a user whose login shell is still Bash passes. For the native output, the earlier recorded clone checks used Proxmox-supplied users and keys (Context, "Native host CPU follow-up"). Proxmox's generated cloud-init user data does not set a login shell or sudo rule, so choosing Zsh for a native clone needs custom user data (for example a cicustom snippet on snippet-capable storage). The token scope in Variables & secrets covers only VM IDs, the target pool and the bridge. No section names this dependency for the two native clone checks. +PROPOSAL: Make the AC-10 proof require that the new user's login shell is Zsh and that the documented sudo choice applies on both outputs. Name the native clone-time mechanism and any storage or permission it needs. + +FINDING: F-05 +KIND: factual +SEVERITY: nit +WHERE: Context, Combined PR preparation (2026-11-04) +EVIDENCE: Context says the earlier `origin/main:packer/ubuntu/scripts/install.sh` "selected Zi, shell configuration, an update cron entry and kubectl". The preserved history in docs/specs/0003-pds-provisioning-migration.md:45-53 also lists `set_sudo_nopasswd`, `restricted_ssh_security_profile`, GitHub CLI and an inline MOTD/neofetch block. The Bootstrap preservation map relies on the GitHub CLI, MOTD, sudo and SSH-policy rows as earlier capabilities. I could not read the origin blob itself with Read/Grep/Glob. +PROPOSAL: Complete the list of earlier capabilities, citing the origin file and lines, so it matches the preservation map. + +FINDING: F-06 +KIND: judgement +SEVERITY: nit +WHERE: AC-10, AC-11; Test Plan AC-10 +EVIDENCE: Installing the package changes deployed-user shells in two ways that no section mentions. pds-source/packaging/scripts/postinstall.sh:29-38 appends an auto-load block to /etc/bash.bashrc that runs `. /usr/share/pds/init.sh 2>/dev/null || true`. packaging/profile.d/pds.sh:26-29 hides loader stderr and prints "PDS Functions loaded!" on interactive login. So AC-11's "reports library failures" holds for the explicit build-time source but not for every deployed user's shell. Also, the provisioners run under `sudo -n bash` (ubuntu.pkr.hcl:97,102), so `configure_zsh` (zsh.sh:59-60,67) and `install_kubectl` (install_kubectl.sh:25-28,84-85) write to the invoking HOME. That HOME is likely /root rather than the ubuntu account, and the AC-10 inspection of "build-user paths" does not name /root. +PROPOSAL: State whether the image keeps package auto-loading and the login message for deployed users, and narrow AC-11's failure-reporting promise to the paths it covers. Include /root in the AC-10 residue inspection. + +### R-13 + +FINDING: F-01 +KIND: judgement +SEVERITY: should-fix +WHERE: Design, Baked update and SSH policy; AC-14; Test Plan AC-14 +EVIDENCE: The design keeps "the existing nightly `00:00` update policy". The only existing implementation is pds-source/bash/common/admin/sysadmin.sh:8-9, which appends `0 0 * * * root apt update -y && apt upgrade -y` to /etc/crontab. It sets no DEBIAN_FRONTEND and no dpkg conffile options. Under cron, stdin is not a terminal, so a conffile prompt during `apt upgrade` aborts the configure step. The image modifies at least two dpkg conffiles: /etc/crontab (cron package), through this same helper, and /etc/bash.bashrc (bash package), through pds-source/packaging/scripts/postinstall.sh:30-34. The first upstream conffile change in either package can therefore leave dpkg half-configured and stop every later nightly upgrade. The AC-14 proof checks only "exactly one midnight job, scheduler enablement", so a job that fails every night still passes. The owner's request for scheduler proof is not met by a job and timer that exist but never succeed. +PROPOSAL: Require the managed job to run non-interactively, with DEBIAN_FRONTEND=noninteractive and explicit conffile handling such as `--force-confdef --force-confold`. In AC-14's proof, run the installed job's exact command in a fresh instance of each output under cron's environment (cron PATH, stdin /dev/null) and require exit 0. Include a modified-conffile case in the disposable-Ubuntu test. + +FINDING: F-02 +KIND: judgement +SEVERITY: should-fix +WHERE: Design, Baked update and SSH policy; AC-06; AC-14; Test Plan AC-06 and AC-14 +EVIDENCE: On Ubuntu, sshd_config includes `sshd_config.d/*.conf` before its own settings, and OpenSSH keeps the first value it reads. The cloud image ships 60-cloudimg-settings.conf (tests/test_sealing.sh:14 models it). When a cloud-config sets `ssh_pwauth`, cloud-init writes 50-cloud-init.conf, which sorts ahead of both. The build seed itself does this (packer/ubuntu/cloud-init/user-data:4). The current PDS function only edits the main /etc/ssh/sshd_config with sed (sysadmin.sh:140-144), so any drop-in overrides it. The design asks for "a retained managed OpenSSH configuration" that stays effective "after clone-time cloud-init runs" and for keyboard-interactive to be disabled to enforce key-only login. It never says where that file goes or how it is ordered against 50-cloud-init.conf. The Test Plan boots fresh instances only with consumer configs that produce no such drop-in, so it cannot tell whether the baked policy wins or loses when clone-time input sets `ssh_pwauth: true`. A drop-in that sorts before 50 would also apply to the QEMU build's password session after any sshd reload. That is the build-access ordering the design wants to protect. +PROPOSAL: Name the managed drop-in path and its sort order relative to 50-cloud-init.conf and 60-cloudimg-settings.conf, and state the result the owner selected: key-only is enforced even when deployment input requests password auth. Add a fresh instance per output whose cloud-config sets `ssh_pwauth: true` and check `sshd -T`, and confirm in the build log that no sshd reload or restart happens before sealing. + +FINDING: F-03 +KIND: judgement +SEVERITY: should-fix +WHERE: Test Plan AC-06, AC-14 +EVIDENCE: The AC-14 proof asks to "Observe ... failed password/root login". By default, cloud-init creates deployed users with locked passwords, and sealing removes /root/.ssh/authorized_keys (seal-image.sh:12). So both logins fail whatever PasswordAuthentication, KbdInteractiveAuthentication and PermitRootLogin say. These negative probes cannot fail, and they do not show that the policy is in force. +PROPOSAL: Make the negative probes able to fail. Give the test user a known password and inject a root key in one owned instance per output. Then require password, keyboard-interactive and root-key attempts to be refused, with the server offering only `publickey`, alongside the `sshd -T` values. + +FINDING: F-04 +KIND: judgement +SEVERITY: should-fix +WHERE: Design, Bootstrap preservation map (Krew row) and following Zi paragraphs; AC-10 +EVIDENCE: The Krew row requires Krew, neat, view-secret and stern for "a fresh deployment user through supported PDS image/user setup" and says "Failed downloads cannot be logged as successful provisioning". That implies the downloads happen at build time. The candidate installs everything under `$HOME/.krew` of the invoking user (install_kubectl.sh:60,71-73,84-104), and the build runs as root via `sudo -n bash` (ubuntu.pkr.hcl:102). A user created at clone time therefore needs either a shared Krew root that is baked into the image or a per-user download on first login. The design names neither. Lines 534-536 add "This scope adds no image-specific plugin cache, shared prefetched asset tree or plugin lockfile" without limiting that to Zi. Read literally, it rules out the shared Krew tree that the build-time wording implies. If Krew is downloaded at first login instead, that contradicts the provisioning-failure wording, and AC-10's proof gives no network condition for Krew as it does for Zi. +PROPOSAL: State where Krew and its three plugins live for users created after sealing, for example a system KREW_ROOT installed at build time and on every user's PATH, and when they are downloaded. Limit the "no shared prefetched asset tree" sentence to Zi plugins, or explicitly extend first-login behavior to Krew with a matching AC-10 proof condition. + +FINDING: F-05 +KIND: judgement +SEVERITY: should-fix +WHERE: Design, PDS provisioning and package identity; Baked update and SSH policy; AC-08 +EVIDENCE: Normal builds install an exact PDS version "from the signed PDS APT repository", and AC-08 verifies "dpkg package metadata ... in each built output". The baked nightly job runs a plain `apt upgrade -y` on every package. If the signed PDS source stays configured in the sealed image, deployed instances move to whatever PDS release is newest at the next midnight. The same applies to kubectl within the pkgs.k8s.io channel that install_kubectl.sh:16 adds. The design does not say whether the PDS repository and its trust key remain in the image. So the exact-version guarantee and the shell assets of deployed users after first night are undefined, and no Test Plan row checks the retained source. +PROPOSAL: State whether the sealed image keeps the signed PDS source. If it does, say that the exact pin describes the image at seal time and that deployed instances follow PDS releases nightly. If it does not, remove the source during provisioning or sealing. Add an offline inspection of /etc/apt/sources.list.d and keyrings to AC-08's proof. + +FINDING: F-06 +KIND: factual +SEVERITY: nit +WHERE: Design, File-based MOTD presets; Test Plan AC-13 +EVIDENCE: The Test Plan asks to "compare EdgeForge with the preserved legacy banner". The original block (motd-preset-drafts/edgeforge-original-block.txt:21-28 and 39-49) prints a plain banner, then a coloured copy, then runs neofetch, and it replaces other MOTD scripts. The draft edgeforge.txt holds only the plain lines, and its line 8 drops the trailing spaces of the original's last echo. Without a defined comparison target, a byte comparison fails and any looser comparison is undefined. +PROPOSAL: Define the comparison target as the rendered output of the original plain echo lines 21-28, with trailing whitespace ignored. State that the coloured copy and the unconditional neofetch are not kept, since neofetch stays available through the optional information argument. -- **Base-template automation:** keep `create-base-template.sh` as a hand-run bootstrap, or wrap it so - it's idempotent / invoked from the Makefile? (It only reruns per Ubuntu release.) -- **Token vs password for `proxmox-clone`:** confirm token auth works on the pinned plugin version (see - the caveat above); fall back to a secret-free `packer@pve` password if not. -- **Disk/storage details:** base disk size (`qm resize`), controller (`virtio-scsi-pci`), and the exact - `proxmox_storage_pool` / `base_template_name` / vmid values on the homelab PVE (fill into the - untracked vars file). -- **UEFI vs BIOS:** keep whatever the cloud-image base uses; confirm it matches how `bpg/proxmox` clones. +### R-14 -## References +FINDING: F-01 +KIND: judgement +SEVERITY: should-fix +WHERE: Test Plan AC-14; Design, Baked update and SSH policy +EVIDENCE: The repaired AC-14 proof says that with `ssh_pwauth: true`, a temporary known non-root password and a temporary root key, "permissive SSH settings would admit the negative probes". That holds for password login, which the 50-cloud-init.conf drop-in written for `ssh_pwauth: true` would enable without 00-pds-security.conf (test_sealing.sh:14-19 reproduces this). It does not hold for the other two probes. Ubuntu's cloud-init default `disable_root: true` installs root's injected key with a forced command that prints "Please login as the user ..." and exits. A root-key attempt then fails even under the distribution's `PermitRootLogin prohibit-password`, unless the probe tells authentication refusal apart from the forced-command exit. Ubuntu's main sshd_config also already sets `KbdInteractiveAuthentication no`, and no deployment input in the plan enables it. So the keyboard-interactive probe is refused with or without the baked file, and "only publickey offered" cannot show it either. These are inferences from Ubuntu and cloud-init defaults, not observed in this review. The current tree sets no `disable_root` anywhere (Grep for disable_root found no match under packer/). +PROPOSAL: In the owned negative-probe instance, set `disable_root: false` and require root-key refusal at authentication ("Permission denied", no forced-command banner). To prove precedence directly, add a temporary lower-precedence test drop-in, for example `10-test-permissive.conf` setting PasswordAuthentication, KbdInteractiveAuthentication and PermitRootLogin to yes, and require refusal and `sshd -T` values to stay unchanged. + +FINDING: F-02 +KIND: judgement +SEVERITY: nit +WHERE: Design, Baked update and SSH policy; Scope (PDS remains independently usable for ordinary host setup) +EVIDENCE: Design line 600 requires "Apply the final policy without any sshd reload/restart before sealing", and line 594-595 requires the PDS repair to "make the intended effective settings reliable". OpenSSH only applies new configuration when it starts or is reloaded. The current function edits the file and prints "Restricted SSH security profile will be applied on next login." (pds-source/bash/common/admin/sysadmin.sh:140-145), which is wrong for a running daemon. The design does not say whether the repaired `restricted_ssh_security_profile` reloads sshd. If it reloads, it breaks the build-access constraint. If it never reloads, the policy is not in effect on an ordinary host until a reload or restart, and no criterion covers that ordinary-host path. +PROPOSAL: State that the function writes and validates the drop-in (`sshd -t`) without reloading, and that ordinary-host use gets an explicit, documented reload step or opt-in flag that the image build never uses. + +FINDING: F-03 +KIND: judgement +SEVERITY: nit +WHERE: Test Plan AC-14 +EVIDENCE: The proof says "Build logs must show no sshd reload/restart before sealing." The Packer log records provisioner output. It does not reliably record service restarts triggered by package maintainer scripts or restart helpers during the PDS step's APT installs (for example GitHub CLI and kubectl through install_gh.sh:24-25). If no restart line appears in the log, that does not show no restart happened. +PROPOSAL: Use guest-side evidence. Record ssh.service's MainPID and ActiveEnterTimestamp (or its journal entries) right after the policy is written and again just before sealing, and require them to match. + +FINDING: F-04 +KIND: judgement +SEVERITY: nit +WHERE: Design, Baked update and SSH policy; AC-14 +EVIDENCE: The managed job runs `apt-get` at 00:00 with noninteractive conffile handling. The design does not say how it coexists with Ubuntu's own APT timers in the cloud image. `apt-daily.timer` has a 12-hour randomized delay, so it can hold the APT lists or dpkg lock at midnight. By default `apt-get` fails at once on a held lock. The single cron-environment run in the Test Plan would not reveal this intermittent failure. This is inferred from Ubuntu defaults and was not observed here. +PROPOSAL: Make the managed command wait for or retry APT/dpkg locks (for example a bounded `DPkg::Lock::Timeout`). State that Ubuntu's apt-daily/unattended-upgrades timers remain alongside the PDS job, or say how they are handled. + +FINDING: F-05 +KIND: factual +SEVERITY: nit +WHERE: Design, `source "qemu" "ubuntu"` (portable local artifact) +EVIDENCE: Line 411 says "Local QEMU checks exercise shared image provisioning; they do not establish native-builder correctness. Spec 0002 must test both paths." The revised Scope (lines 258-259, 266-267) and Bounded image checks (lines 639-648) require real builds, offline inspection and two fresh boots of both outputs in this feature. They also say feature 0002's absence "cannot excuse missing checks for this Ubuntu amd64 delivery". +PROPOSAL: Reword line 411 so this feature tests both Ubuntu amd64 paths, and feature 0002 covers only the wider matrix. + +### R-15 + +FINDING: F-01 +KIND: judgement +SEVERITY: nit +WHERE: Design, Baked update and SSH policy (build-access paragraph); Test Plan AC-14 +EVIDENCE: Design line 605 says "Finish package operations capable of restarting services before installing the final policy". Lines 606 to 607 limit the restart evidence to the time between "immediately before policy installation" and "again before sealing". The sealing step, which the design keeps as a separate final script (line 481), still runs package operations after that point. packer/ubuntu/scripts/seal-image.sh:24 runs `apt-get -y autoremove`, and its maintainer scripts and APT hooks can restart services. So the spec's own ordering rule is broken by an existing step, and its PID window ends before that step runs. seal-image.sh:28 also truncates every regular file under /var/log, which includes persistent journal files under /var/log/journal. Journal evidence for line 607 must therefore be captured before sealing truncates it, and the spec does not say so. I did not observe a restart. This is inferred from the current sealer source. +PROPOSAL: Either move autoremove ahead of policy installation, or extend the PID/activation comparison to the end of sealing, just before shutdown. Also state that the guest journal evidence is exported before seal-image.sh truncates /var/log. + +FINDING: F-02 +KIND: judgement +SEVERITY: nit +WHERE: Test Plan AC-14 (cron-environment run) +EVIDENCE: The proof runs "the installed job's exact command under cron PATH with stdin /dev/null and require exit 0". The existing job lives in /etc/crontab (pds-source/bash/common/admin/sysadmin.sh:8-9), and cron runs those entries with /bin/sh (dash on Ubuntu) and a minimal environment. The new managed command adds a bounded lock wait/retry (Design lines 584 to 585), so it is no longer the simple `&&` chain that dash runs safely. If the command is run from a root Bash session with the provisioning or login environment still set, Bash-only syntax or inherited variables such as DEBIAN_FRONTEND can make it pass, even though the real 00:00 run would fail. I inferred this from cron's defaults and the current helper. I executed nothing. +PROPOSAL: Require the fresh-instance run to use /bin/sh -c with a cleared environment that matches cron's (for example env -i with cron's PATH, HOME, SHELL and LOGNAME). Alternatively, require evidence that cron itself ran the managed entry and logged exit 0. + +### R-16 + +```text +FINDING: F-01 +KIND: factual +SEVERITY: should-fix +WHERE: Design (Provisioning changes; Bootstrap preservation map) +EVIDENCE: docs/specs/0001-packer-proxmox-native-output.md:558 says the nightly update job and restricted SSH baseline "are baked into each image", and :427-428 says "Generic SSH restrictions are supplied by PDS at build time and retained in the finished image" without qualification. Both are normative Design text and contradict :488-489 ("They are not a mandatory policy for every custom image"), :605-607 and AC-15, which let a custom recipe omit those calls. The summary at :20 also states the policies unconditionally. +PROPOSAL: Qualify :558 and :427-428 as default-recipe behavior, for example "the default recipe bakes both into each output; a custom recipe may omit them", and add the same qualifier to the summary line. + +FINDING: F-02 +KIND: judgement +SEVERITY: should-fix +WHERE: Acceptance Criteria AC-15, Test Plan AC-15 +EVIDENCE: AC-15 (:711) requires custom recipe selection "for either output", but the proof (:731) says only "Build clean default and custom artifacts". It does not say that a custom artifact is built for each output, which custom recipe is used, or which observations show that the PDS policy is absent. The Design at :496 promises a committed example that omits the update and SSH calls, but the proof does not tie the tested custom selection to that example. It is also unclear whether custom artifacts need the fresh boots in AC-05/AC-06 or only offline inspection. +PROPOSAL: Make the proof build the committed example custom recipe on both outputs. Inspect each sealed disk offline and require: no 00-pds-security.conf, no PDS-managed update job, the example's own selections present, and the AC-06 credential and identity checks passing. State whether this needs a fresh boot or offline inspection is enough. + +FINDING: F-03 +KIND: judgement +SEVERITY: nit +WHERE: Design (File-based MOTD presets; Bootstrap preservation map), AC-13 +EVIDENCE: :661 and AC-13 (:707) keep "an explicit configurable MOTD-preset input", and :555 keeps an explicit kubectl version/channel input. Under :491-495, the recipe file is now the selection mechanism. The spec does not say how these Packer inputs reach the recipe, or whether a custom recipe may ignore them. That leaves room for an input that silently has no effect under a custom recipe. +PROPOSAL: State that builders exports these inputs to the selected recipe, that the default recipe consumes them, and that a custom recipe may use or ignore them. Alternatively, state that preset selection lives only in the recipe and reword AC-13 to match. + +FINDING: F-04 +KIND: judgement +SEVERITY: nit +WHERE: Design (Baked update and SSH policy) +EVIDENCE: :633-637 requires package operations that can restart services to finish before the SSH policy is installed, and requires no sshd restart before sealing. Under the recipe model, call order is set in the recipe file. The spec makes default.sh responsible for this, but does not say whether a custom recipe that selects restricted_ssh_security_profile before later installers carries the same ordering duty or gets a builder check. On the QEMU password path, an sshd restart after the policy is applied would cut Packer's build access. +PROPOSAL: Add one sentence saying that any recipe selecting the SSH policy must call it last, after service-restarting installers, and that the PID and activation check applies whenever that call is selected, not only to the default recipe. +``` + +### R-17 + +```text +FINDING: F-01 +KIND: judgement +SEVERITY: nit +WHERE: Design, Baked update and SSH policy (custom-recipe ordering sentence); Test Plan AC-14, AC-15 +EVIDENCE: docs/specs/0001-packer-proxmox-native-output.md:645-647 says "Any recipe selecting `restricted_ssh_security_profile` must call it last" and "The guest PID/activation check applies whenever that policy is selected, including in a custom recipe." Builders runs the selected recipe as one trusted script (:494-496), and :640 places the PID capture "immediately before policy installation", which is inside the recipe. The spec does not say how builders finds that point in a custom recipe, or whether the call-last rule is enforced or only documented. AC-14 and its proof cover only the default recipe (:716, :737). The AC-15 proof (:738) exercises only custom.example.sh, which omits the SSH policy (:497-498). So no criterion or proof row observes the custom-recipe obligation, and a custom recipe that calls the policy before a later installer passes every box. +PROPOSAL: Name the mechanism. For example, builders captures ssh.service MainPID/ActiveEnterTimestamp through a small builder-provided step or wrapper around the selected policy call and compares the values at the end of sealing, and the AC-15 proof shows this check fails for a fixture recipe that restarts sshd after selecting the policy. Otherwise, reword :645-647 as a documented recipe-author rule that builders does not verify. + +FINDING: F-02 +KIND: factual +SEVERITY: nit +WHERE: Summary (line 20); frontmatter goal (line 5) +EVIDENCE: :20 says "a PDS default recipe selecting nightly updates and restricted SSH". :492 puts the default recipe in builders at `packer/ubuntu/recipes/default.sh`, and :493-494 says operators select another recipe "without changing the default recipe or PDS". So the recipe belongs to builders, and PDS only supplies the functions it calls. The frontmatter goal at :5 still says, without qualification, that the images have "automatic updates and restricted SSH". The R-16 F-01 repair qualified :428 and :563 the same way. +PROPOSAL: Change :20 to say "a builders default recipe that calls PDS functions for nightly updates and restricted SSH". In the goal, add "by default" or a similar qualifier. +``` + +### R-18 + +CRITERION: AC-01 A committed `create-base-template.sh` turns the official Ubuntu cloud image into a base cloud-init template on the PVE host (qemu-guest-agent embedded), repeatably; no hand-clicking. +VERDICT: not verified +EVIDENCE: Read packer/ubuntu/scripts/create-base-template.sh, prepare-base-image.sh and import-base-template.sh, and ran `python3 -B -m unittest discover -s packer/ubuntu/tests -v` at e05ed58d79d4d456f783b786b543b24e1f57d96f. All 14 test_base_template safety cases passed (occupied ID refused, corrupt bundle rejected, no delete path). No off-node bootstrap, import or repeat import was run on Proxmox in this review, because Proxmox access was not permitted. Retained logs were not counted as observed execution. + +CRITERION: AC-02 `packer init .` installs both `hashicorp/proxmox` (`1.2.4`) and `hashicorp/qemu` plugins. +VERDICT: not verified +EVIDENCE: Packer 1.16.2 (/tmp/builders-pr4-tools/packer) with PACKER_PLUGIN_PATH pointing at existing proxmox v1.2.4 and qemu v1.1.8 binaries ran `packer validate .` in packer/ubuntu at e05ed58 and reported "The configuration is valid". `packer fmt -check -recursive .` returned 0. Without that plugin path, validate reported both exact versions missing. `packer init .` was not run because it downloads and writes plugins, so installation was not observed. + +CRITERION: AC-03 `packer build -only='proxmox-clone.ubuntu' …` clones the base and produces a **template** on the PVE node (verified via `qm config ` showing `template: 1`) with an **empty cloud-init drive** attached; no per-build `qm importdisk`/upload anywhere in the flow. The native CPU model defaults to `host` and is configurable; the template and two fresh clones use the selected default, and blank or whitespace-padded model names fail local validation. +VERDICT: not verified +EVIDENCE: `packer validate` at e05ed58 rejected `-var proxmox_cpu_type=` and `-var 'proxmox_cpu_type= host '` with the variables.pkr.hcl:153 rule, and accepted `x86-64-v2-AES`. The default is `host` (variables.pkr.hcl), and ubuntu.pkr.hcl sets cloud_init = true and has no import step. No native build, `qm config` check or clone was observed in this review. That makes this composite criterion unverified. + +CRITERION: AC-04 `packer build -only='qemu.ubuntu' …` still produces the local qcow2/raw artifact. +VERDICT: not verified +EVIDENCE: Read the qemu source and the export-raw.sh post-processor at e05ed58. test_raw_export passed in the local suite. No portable build was executed or observed in this review. + +CRITERION: AC-05 Both native and portable sealed outputs contain no site-specific hostname, static IP/netplan identity or SSH host keys; two independently initialized instances of each output receive distinct machine IDs and host keys and apply their supplied identities. +VERDICT: not verified +EVIDENCE: Read seal-image.sh (it truncates machine-id, removes host keys, runs cloud-init clean with network configs and sets hostname localhost) and check-image.sh at e05ed58. test_artifact_checks negative fixtures passed, but those use stubs and no real disk. No sealed artifact was inspected and no instance was booted in this review. + +CRITERION: AC-06 The sealed image retains no build password, authorized keys or generated SSH policy override. The default Ubuntu account may remain only locked and keyless, with its standard sudo policy. Usable deployed users, keys and site-specific identity are supplied at clone time; the default recipe's PDS SSH baseline remains effective after fresh cloud-init initialization. +VERDICT: not verified +EVIDENCE: Read seal-image.sh at e05ed58: usermod sets the password to '*', authorized_keys are removed, and `cloud-init clean --configs ssh_config` runs. check-image.sh requires 50-cloud-init.conf to be absent. tests/test_sealing.sh was not run. No sealed default output was inspected and no fresh instance was observed. + +CRITERION: AC-07 Short root and Ubuntu READMEs link canonical procedures for both output selections, PDS bootstrap, SSH/debugging and recovery; small flow diagrams use Mermaid and Proxmox is explicitly optional. +VERDICT: met +EVIDENCE: At e05ed58 I read readme.md (32 lines) and packer/ubuntu/readme.md (53 lines). Together they link docs/ubuntu/local-build.md, proxmox.md, provisioning.md, ssh-and-debugging.md, recovery.md and image-pipeline.md, plus development.md. A script resolved every relative link in both READMEs, packer/readme.md, docs/ubuntu/*.md, docs/development.md and packer/ubuntu/pds/readme.md, and none was broken. The Ubuntu README and image-pipeline.md each contain a Mermaid flowchart. Both READMEs say Proxmox is optional. Limitations: I did not render the Mermaid diagrams or follow the guides end to end, and T21's final documentation alignment is still open. + +CRITERION: AC-08 Both builders install the exact selected PDS package, verify its identity and provenance, and fail on missing, mismatched or untrusted inputs; candidate-package testing is distinguished from a verified signed-repository release build. +VERDICT: not verified +EVIDENCE: Read install-pds.sh at e05ed58. It checks the candidate's SHA-256, Package, Version and Architecture, checks the primary key fingerprint, refuses a candidate.deb without a hash, pins `pds=$version` for the repository route, checks the installed dpkg identity and records source in /var/lib/builders/pds.json. The 8 test_pds_provisioning tests passed with intercepted commands. `packer validate -var pds_candidate_sha256=ABC` was rejected. The candidate.deb SHA-256 7135550317e295a1f341cb83bccb126dad613fb44d04291e36b1de391e8259f8 matched, and its extracted payload is byte-identical to PDS c0704f4 bash/debian, bash/common, bash/config, init.sh, profile.d/pds.sh and bin/pds. No built output's dpkg metadata or APT sources were inspected. The signed-release route for the new PDS version does not exist yet (separate owner-approved release pending). + +CRITERION: AC-09 The shared provisioner applies native Ubuntu settings and the default recipe's explicit PDS function selection for Zi/Powerlevel10k, MOTD, GitHub CLI, kubectl, Krew, neat/view-secret/stern, nightly package updates and restricted SSH; reusable implementations live in the standalone PDS package, and selected-function failures stop provisioning. +VERDICT: not verified +EVIDENCE: Read recipes/default.sh and run-recipe.sh at e05ed58. The recipe calls install_zi, configure_zsh, setup_motd_preset, install_gh, `install_kubectl … --system`, update_system_cron_entry and restricted_ssh_security_profile, and run-recipe.sh sources it under `set -euo pipefail`. Unit tests passed for default/custom call order and failing-call propagation. The PDS implementations live in the PDS repository at c0704f4. No real provisioning run in an image was observed. + +CRITERION: AC-10 A new deployment user of a default-recipe image receives working Zsh/Powerlevel10k, the kubectl alias/completion, Krew and the neat, view-secret and stern plugins from either output, with its configured Zsh login shell and sudo policy and without inheriting build credentials or build-home paths. Zi populates the existing plugin set on first shell startup with network access; no image-prefetched plugin cache is required. +VERDICT: untested +EVIDENCE: The repository check meant to cover this, packer/ubuntu/scripts/check-instance.sh:17 and :20, cannot detect most failures (see F-01). The ongoing T20 harness (/tmp/builders-recipe-20261105/validate-instances.py:249) relies on that script for these assertions. In PDS, test_system_mode_exposes_tools_to_a_fresh_user passed in the network-disabled container, but that is not an image boot. No fresh instance was observed in this review. + +CRITERION: AC-11 The PDS package loads non-interactively without installer/network side effects, preserves the caller's shell state and reports library failures; its supported standalone setup preserves Zi, the preset and the existing plugin set. Error-reporting assertions cover explicit non-interactive loading; interactive auto-loading is documented separately. +VERDICT: not verified +EVIDENCE: Ran `docker run --rm --network none` on pds-baseline-test:local, with PDS c0704f4 mounted read-only at /work and the candidate mounted read-only. Inside it, `dpkg -i /candidate/candidate.deb` (pds 1.0.0, install ok installed) was followed by `python3 -B -m unittest discover -s tests -p '*test*.py' -v`. All 24 tests passed, including strict load without installers, load failure keeping caller state, standalone asset fetch only on configure, and the Zi/preset checks. A first run with the source mounted at /src gave 4 errors because the tests hard-code /work; that was a harness path problem, not a defect. The Test Plan's real selected-installer and actual Zi download coverage was not executed in this review (network disabled; kubectl-live.log was read, not observed). + +CRITERION: AC-12 Repository checks exercise package-backed provisioning, failure paths, sealed-artifact assertions and two fresh boots of each Ubuntu amd64 output; CI reports executed versus skipped checks, and native checks preserve all pre-existing guests. +VERDICT: not verified +EVIDENCE: At e05ed58 all 38 local unit tests passed, Packer fmt passed, and Packer validate passed using the existing plugin copies. `make check` itself stopped at check-config because packer is not on the host PATH, and ShellCheck is not installed on the host, so check-shell was not run. .github/workflows/check.yaml runs `make check` read-only with persist-credentials false, and the Makefile prints an explicit SKIP line for image checks. No fresh boots, native guest-preservation audit or hosted CI run were observed. + +CRITERION: AC-13 PDS bundles selectable VHCO, Stackweaver and preserved EdgeForge MOTD text presets; builders defaults to configurable VHCO, custom-file usage remains supported, and invalid selections leave the active MOTD and other MOTD scripts unchanged. +VERDICT: not verified +EVIDENCE: The extracted candidate payload contains usr/share/pds/config/motd/vhco.txt, stackweaver.txt and edgeforge.txt. The 4 test_motd_presets tests passed in the isolated container (packaging and switching, legacy EdgeForge banner, custom file and standalone checkout, invalid selection preserving state). variables.pkr.hcl defaults motd_preset to "vhco". The Test Plan's check of the configured banner in both image outputs was not observed. + +CRITERION: AC-14 Both image outputs built with the default recipe retain one configured nightly midnight package-update job that runs non-interactively with an enabled scheduler and effective SSH settings that allow injected non-root public-key login while disabling password, keyboard-interactive and root login; repeated provisioning is safe and temporary Packer access is removed only after it is no longer needed. +VERDICT: not verified +EVIDENCE: PDS test_image_baseline passed 5 tests in the isolated container (SSH policy overriding cloud-init without reload, rollback, invalid-config refusal, repeatable updater with conffile handling, bounded lock contention). I read ssh-policy-observer.sh and seal-image.sh at e05ed58. The observer checks MainPID and activation timestamps and reads journal files from retained paths, and test_missing_journal_evidence_cannot_pass_as_an_empty_interval passed. No image output, scheduler state, cron execution or authentication control was observed in a fresh instance. + +CRITERION: AC-15 An operator can select a readable custom Bash recipe at invocation for either output without editing the default recipe or PDS; omitted PDS update/SSH policies are not applied elsewhere, missing recipes and failed calls stop the build, and generic-image cleanup still runs. +VERDICT: not verified +EVIDENCE: At e05ed58, `packer validate -var provisioning_recipe=recipes/custom.example.sh .` was valid and `-var provisioning_recipe=recipes/missing.sh` was rejected by the variables.pkr.hcl:31 rule. Unit tests passed for different default/custom selections and for failing calls. seal-image.sh runs after the recipe in a separate inline step. Custom builds of either output and fresh custom instances were not observed. + +FINDING: F-01 +KIND: factual +SEVERITY: blocking +WHERE: packer/ubuntu/scripts/check-instance.sh +EVIDENCE: Lines 17 and 20 pass several probes, separated by `;`, to `zsh -lic`. A zsh -c script's exit status is only its last command's status, and `set -e` in the outer Bash does not reach inside the string. On this host, `zsh -fc 'false; (( 0 )); [[ -n x ]]'` returned 0. So line 17 checks only `[[ -s ~/.p10k.zsh ]]` and line 20 checks only `kubectl stern --version`. Missing zi or p10k functions, a wrong KREW_ROOT, no `k` alias, missing completion, a failing `kubectl krew list`, `kubectl neat` or `kubectl view-secret` all still report PASS. The ongoing T20 harness runs this script (validate-instances.py:249), and test_artifact_checks only tests the unknown-mode rejection. +PROPOSAL: Join each probe with `&&`, or start each zsh string with `setopt err_exit`, so any failing probe fails the check. Add a stubbed test where an earlier probe fails and the script must exit non-zero. + +FINDING: F-02 +KIND: factual +SEVERITY: should-fix +WHERE: packer/ubuntu/scripts/check-image.sh +EVIDENCE: Lines 37-41 check only authorized_keys, .bash_history, /var/lib/cloud/seed and 50-cloud-init.conf. The AC-10 Test Plan asks for /root and /home/ubuntu to be inspected for build-user paths, keys, tokens and history. The default recipe runs as root and PDS configure_zsh (bash/common/shell/zsh.sh:59-60) writes .zshrc and .p10k.zsh into the build caller's HOME. Nothing checks for shell histories other than Bash, .krew, .kube, .config/gh, .gitconfig or similar residue in either home. +PROPOSAL: Inspect both home directories against an explicit allowlist and add a negative fixture for unexpected residue in /root. + +FINDING: F-03 +KIND: factual +SEVERITY: should-fix +WHERE: PDS .github/workflows/build-apt-package.yml (dependency at c0704f4) +EVIDENCE: The workflow-level `permissions` grant contents: write, pages: write and id-token: write (lines 2-5), and the workflow triggers on pull_request (line 19). The version, lint, build and test-install jobs set no narrower permissions and use actions/checkout without persist-credentials: false. Pull-request code (build.sh, make test) therefore runs with a write-capable token persisted in the checkout for same-repository branches. The gitversion `dry-run` input (line 47) only suppresses tagging (tag-dry-run-output shows tagged=false). Commit c0704f4 says "keep package PR checks read-only". +PROPOSAL: Set the workflow default to `permissions: contents: read`, grant write scopes only to the jobs that publish (version on push, release, deploy-apt-repo), and disable credential persistence on checkouts that PR jobs use. + +FINDING: F-04 +KIND: judgement +SEVERITY: nit +WHERE: packer/ubuntu/scripts/check-image.sh +EVIDENCE: Line 36 accepts `.source == "candidate" or .source == "signed-repository"` and has no input for the expected route. The image check therefore cannot itself show that a final-validation artifact came from the signed repository, which AC-08 requires to be distinguished from candidate testing. +PROPOSAL: Add an expected-source argument (or a make variable) and require it to match the provenance record, with a fixture where a candidate artifact is presented as a signed release. + +### R-19 + +CRITERION: AC-01 A committed `create-base-template.sh` turns the official Ubuntu cloud image into a base cloud-init template on the PVE host (qemu-guest-agent embedded), repeatably; no hand-clicking. +VERDICT: not verified +EVIDENCE: Confirmed that both worktrees are clean (`git status --porcelain` printed nothing) and that HEAD is e5cf7b370078437d3fef3a65d659a3cf44081bc0 in builders and e756e93f52e4ade5113f2a96e89858d7670a371d in PDS. Ran `python3 -B -m unittest discover -s packer/ubuntu/tests -v` in builders-pr4-review-tools:local with `--network none`, source mounted read-only and Packer plus plugins mounted read-only. All 43 tests passed, including the 15 test_base_template safety cases (occupied ID refused, corrupt or partial bundle rejected, ID rechecked before VM creation). Proxmox access was not permitted, so no bootstrap, import or repeat import was run. Retained logs were not counted. + +CRITERION: AC-02 `packer init .` installs both `hashicorp/proxmox` (`1.2.4`) and `hashicorp/qemu` plugins. +VERDICT: not verified +EVIDENCE: In the same network-disabled container at e5cf7b3, with PACKER_PLUGIN_PATH set to the read-only proxmox v1.2.4 and qemu v1.1.8 binaries, `packer fmt -check -recursive .` returned 0. `packer validate .` failed only because it could not download https://cloud-images.ubuntu.com/noble/current/SHA256SUMS ("network is unreachable"). `packer init .` was not run because it needs network and writes plugins. Plugin installation was not observed. + +CRITERION: AC-03 `packer build -only='proxmox-clone.ubuntu' …` clones the base and produces a **template** on the PVE node (verified via `qm config ` showing `template: 1`) with an **empty cloud-init drive** attached; no per-build `qm importdisk`/upload anywhere in the flow. The native CPU model defaults to `host` and is configurable; the template and two fresh clones use the selected default, and blank or whitespace-padded model names fail local validation. +VERDICT: not verified +EVIDENCE: Nothing under packer/ubuntu/*.pkr.hcl changed since e05ed58 (`git diff e05ed58 e5cf7b3` touches no HCL). Packer validation could not run offline in this review, so the CPU rejection rules were not executed again. No native build, `qm config` check or clone was observed. This is a composite criterion, so it stays unverified. + +CRITERION: AC-04 `packer build -only='qemu.ubuntu' …` still produces the local qcow2/raw artifact. +VERDICT: not verified +EVIDENCE: test_raw_export passed in the 43-test run at e5cf7b3. No portable build was executed or observed. + +CRITERION: AC-05 Both native and portable sealed outputs contain no site-specific hostname, static IP/netplan identity or SSH host keys; two independently initialized instances of each output receive distinct machine IDs and host keys and apply their supplied identities. +VERDICT: not verified +EVIDENCE: Read seal-image.sh and check-image.sh at e5cf7b3. check-image.sh:23-28 now captures machine-id and host-key output before testing it, so an unreadable file fails the check. test_missing_identity_evidence_and_unexpected_home_state_fail passed using stubs. No real sealed disk was inspected and no instance was booted. + +CRITERION: AC-06 The sealed image retains no build password, authorized keys or generated SSH policy override. The default Ubuntu account may remain only locked and keyless, with its standard sudo policy. Usable deployed users, keys and site-specific identity are supplied at clone time; the default recipe's PDS SSH baseline remains effective after fresh cloud-init initialization. +VERDICT: not verified +EVIDENCE: seal-image.sh:35-39 now deletes everything in /root and /home/ubuntu except .bashrc, .profile, .bash_logout, .zshrc and .p10k.zsh. check-image.sh:39-72 checks both homes against an allowlist, and the stubbed negative fixtures (.config, .kube, .krew, .zsh_history, .gitconfig, unexpected .cache entries) failed as intended. tests/test_sealing.sh was not run in this review. No sealed default output and no fresh instance were observed. + +CRITERION: AC-07 Short root and Ubuntu READMEs link canonical procedures for both output selections, PDS bootstrap, SSH/debugging and recovery; small flow diagrams use Mermaid and Proxmox is explicitly optional. +VERDICT: met +EVIDENCE: At e5cf7b3 I grepped every relative link in readme.md and packer/ubuntu/readme.md and checked each target with Glob. All exist: docs/ubuntu/local-build.md, proxmox.md, provisioning.md, ssh-and-debugging.md, recovery.md, image-pipeline.md, docs/development.md, docs/specs/README.md, packer/ubuntu/recipes/default.sh, proxmox.auto.pkrvars.hcl.example, armbian-build-framework/ and LICENSE. packer/ubuntu/readme.md:35 and docs/ubuntu/image-pipeline.md:7 contain Mermaid blocks. Both READMEs say Proxmox is optional (readme.md:3 and :19, packer/ubuntu/readme.md:3 and :8). docs/development.md:31-33 documents copying check-user-shell.zsh next to check-instance.sh, which matches check-instance.sh:14-15. Limitations: the diagrams were not rendered, the guides were not followed end to end, and links in the docs/ubuntu pages themselves were not checked again in this pass. + +CRITERION: AC-08 Both builders install the exact selected PDS package, verify its identity and provenance, and fail on missing, mismatched or untrusted inputs; candidate-package testing is distinguished from a verified signed-repository release build. +VERDICT: not verified +EVIDENCE: All 8 test_pds_provisioning tests passed at e5cf7b3. check-image.sh:4 now requires a fourth argument, `candidate` or `signed-repository`, and :37-38 requires the provenance record to match it. test_candidate_cannot_pass_a_signed_release_check passed, which closes R-18 F-04. The candidate package /tmp/builders-recipe-20261105/pds-completion-green/packaging/dist/pds_1.0.0_all.deb has SHA-256 744343e157c8d0b297daf8633fb9623839bbd4734c89f384f7c0208cc141d3ba and installs as pds 1.0.0. No built output's dpkg metadata or APT sources were inspected. The signed-release route for the new PDS version does not exist yet. + +CRITERION: AC-09 The shared provisioner applies native Ubuntu settings and the default recipe's explicit PDS function selection for Zi/Powerlevel10k, MOTD, GitHub CLI, kubectl, Krew, neat/view-secret/stern, nightly package updates and restricted SSH; reusable implementations live in the standalone PDS package, and selected-function failures stop provisioning. +VERDICT: not verified +EVIDENCE: recipes/default.sh and run-recipe.sh are unchanged since R-18. The unit tests for default/custom call order and failing-call propagation passed. The PDS kubectl Zsh completion repair (bash/config/zshrc:42 and bash/debian/software/install_kubectl.sh:127, both `compdef k=kubectl`) lives in PDS and builders does not copy it. No real provisioning run in an image was observed. + +CRITERION: AC-10 A new deployment user of a default-recipe image receives working Zsh/Powerlevel10k, the kubectl alias/completion, Krew and the neat, view-secret and stern plugins from either output, with its configured Zsh login shell and sudo policy and without inheriting build credentials or build-home paths. Zi populates the existing plugin set on first shell startup with network access; no image-prefetched plugin cache is required. +VERDICT: not verified +EVIDENCE: The R-18 F-01 defect is repaired. check-instance.sh:19 sources check-user-shell.zsh in a login interactive Zsh, and that script runs under ERR_EXIT, NO_UNSET and PIPE_FAIL. It now requires `_comps[k]` to equal the non-empty `_comps[kubectl]` and that function to exist, instead of the old `__start_kubectl` lookup. test_user_shell passed 3 tests in `zsh -dflic`: every probe call ran, and each of 8 removed capabilities and 5 failing tool calls made the check exit non-zero. In PDS, test_zsh_alias_uses_the_generated_completion passed: with a cobra-style `_kubectl` completion stub, both the shipped zshrc and the per-user installer leave `_comps[k] == _kubectl`. A check now exists, but no fresh instance was booted and no real Zi download or real kubectl completion output was observed. + +CRITERION: AC-11 The PDS package loads non-interactively without installer/network side effects, preserves the caller's shell state and reports library failures; its supported standalone setup preserves Zi, the preset and the existing plugin set. Error-reporting assertions cover explicit non-interactive loading; interactive auto-loading is documented separately. +VERDICT: not verified +EVIDENCE: Ran `docker run --rm --network none` on pds-image-provisioning-test:local, with /tmp/builders-recipe-20261105/pds-completion-green mounted read-only at /work. Inside it, sha256sum confirmed 744343e1...d3ba, `dpkg -i` reported pds 1.0.0 "install ok installed", and `python3 -B -m unittest discover -s tests -p '*test*.py' -v` ran 25 tests, all OK. These include strict load without installers, load failure keeping caller state, standalone assets fetched only on configure, and the Zi/preset checks. Grep found the same compdef lines in the test source copy as in PDS e756e93, but the complete copy was not diffed against the commit. The Test Plan's real selected-installer and actual Zi download coverage was not executed (network disabled). + +CRITERION: AC-12 Repository checks exercise package-backed provisioning, failure paths, sealed-artifact assertions and two fresh boots of each Ubuntu amd64 output; CI reports executed versus skipped checks, and native checks preserve all pre-existing guests. +VERDICT: not verified +EVIDENCE: In the isolated container at e5cf7b3: ShellCheck over the same file list as the Makefile returned 0, `zsh -dfn check-user-shell.zsh` returned 0, Packer fmt passed and all 43 unit tests passed. Packer validate could not reach its checksum URL offline, so the whole `make check` was not observed passing. .github/workflows/check.yaml now also installs zsh, which the new test needs, and still runs `make check`. No fresh boots, native guest-preservation audit or hosted CI run were observed. + +CRITERION: AC-13 PDS bundles selectable VHCO, Stackweaver and preserved EdgeForge MOTD text presets; builders defaults to configurable VHCO, custom-file usage remains supported, and invalid selections leave the active MOTD and other MOTD scripts unchanged. +VERDICT: not verified +EVIDENCE: All 4 test_motd_presets tests passed after installing the 744343e1 candidate in the network-disabled container. The builders motd_preset default is unchanged. The configured banner was not checked in either image output. + +CRITERION: AC-14 Both image outputs built with the default recipe retain one configured nightly midnight package-update job that runs non-interactively with an enabled scheduler and effective SSH settings that allow injected non-root public-key login while disabling password, keyboard-interactive and root login; repeated provisioning is safe and temporary Packer access is removed only after it is no longer needed. +VERDICT: not verified +EVIDENCE: PDS test_image_baseline passed 5 tests in the isolated container: policy without reload, rollback, refusal of invalid config, repeatable updater with conffile handling, and bounded lock contention. seal-image.sh still runs builders_check_ssh_policy at :12 and again at :32, before truncating /var/log, and test_missing_journal_evidence_cannot_pass_as_an_empty_interval passed. No image output, scheduler state, cron execution or authentication control was observed in a fresh instance. + +CRITERION: AC-15 An operator can select a readable custom Bash recipe at invocation for either output without editing the default recipe or PDS; omitted PDS update/SSH policies are not applied elsewhere, missing recipes and failed calls stop the build, and generic-image cleanup still runs. +VERDICT: not verified +EVIDENCE: The unit tests passed for different default/custom selections, failing calls and test_custom_recipe_cannot_hide_later_ssh_restart_or_reload. test_custom_recipe_checks_its_selected_shell_only confirms that custom mode runs no kubectl probes. Packer validation of the recipe inputs could not run offline in this review. No custom build or fresh custom instance was observed. + +FINDING: F-01 +KIND: factual +SEVERITY: nit +WHERE: PDS bash/common/software/kubernetes.sh (dependency at e756e93) +EVIDENCE: kubernetes.sh:24 in configure_kubectl_plugins still appends `compdef __start_kubectl k` to a Zsh user's ~/.zshrc. This file is packaged under bash/common, and the same line remains in darwin/functions.sh:62. The commit e756e93 changelog says current kubectl releases register `_kubectl`, not `__start_kubectl`, for Zsh, and it fixed only zshrc and install_kubectl.sh. So ordinary workstation users of this older helper still get the broken alias completion. The default recipe does not call it. +PROPOSAL: Change both lines to `compdef k=kubectl`, or record that the legacy helper is out of scope under the Design's "only the needed PDS libraries" rule. + +FINDING: F-02 +KIND: factual +SEVERITY: nit +WHERE: PDS .github/workflows/build-apt-package.yml (dependency at e756e93) +EVIDENCE: The push trigger lists `.github/workflows/build-apt-package.yml` (line 14), but the pull_request trigger (lines 17-26) does not. The deleted image-provisioning-check.yaml included itself in its PR paths. A PR that changes only this workflow, such as its permissions or checkout settings, therefore runs no package checks before merge, and the first execution happens on the main push that can publish. R-18 F-03 itself is repaired: the default is `contents: read`, write scopes exist only on release (contents: write) and deploy-apt-repo (pages and id-token), every checkout sets persist-credentials: false, and version calculation is always dry-run. +PROPOSAL: Add `.github/workflows/build-apt-package.yml` to the pull_request paths. + +### R-20 + +CRITERION: AC-01 A committed `create-base-template.sh` turns the official Ubuntu cloud image into a base cloud-init template on the PVE host (qemu-guest-agent embedded), repeatably; no hand-clicking. +VERDICT: not verified +EVIDENCE: Confirmed builders HEAD is 8b56679c7f424332e7c908c4c1262738ea33743f and PDS HEAD is ac91a1e8ea1a72dd91a8b375aaca4ce98ad600c5. `git status --porcelain` printed nothing in either tree. `git diff --stat e5cf7b3 HEAD` shows no change to the base-template scripts or their tests since R-19. The host permission mode denied Docker in this review, so the builders unittest suite did not run in builders-pr4-review-tools:local, and the 16 test_base_template cases were not executed. Proxmox access was not permitted, so no bootstrap, import or repeat import ran. Retained logs were read only as claims. + +CRITERION: AC-02 `packer init .` installs both `hashicorp/proxmox` (`1.2.4`) and `hashicorp/qemu` plugins. +VERDICT: not verified +EVIDENCE: No *.pkr.hcl file changed between e5cf7b3 and 8b56679. The review container could not be started because Docker was denied, so neither Packer fmt nor validate ran. `packer init .` was not run because it downloads and writes plugins. Plugin installation was not observed. + +CRITERION: AC-03 `packer build -only='proxmox-clone.ubuntu' …` clones the base and produces a **template** on the PVE node (verified via `qm config ` showing `template: 1`) with an **empty cloud-init drive** attached; no per-build `qm importdisk`/upload anywhere in the flow. The native CPU model defaults to `host` and is configurable; the template and two fresh clones use the selected default, and blank or whitespace-padded model names fail local validation. +VERDICT: not verified +EVIDENCE: The HCL is unchanged since R-18 and R-19. CPU validation was not executed in this review because Docker was denied. No native build, `qm config` check or clone was observed. docs/validation/0001-2026-11-05.md:51-52 reports native builds and inspections passed and the default instance checks "Running", but that is the implementer's claim. This is a composite criterion, so it is not verified. + +CRITERION: AC-04 `packer build -only='qemu.ubuntu' …` still produces the local qcow2/raw artifact. +VERDICT: not verified +EVIDENCE: The qemu source and export-raw.sh are unchanged since R-19. test_raw_export was not executed in this review because Docker was denied. No portable build was observed. The validation summary's row 53, "formats compare equal", is the implementer's claim. + +CRITERION: AC-05 Both native and portable sealed outputs contain no site-specific hostname, static IP/netplan identity or SSH host keys; two independently initialized instances of each output receive distinct machine IDs and host keys and apply their supplied identities. +VERDICT: not verified +EVIDENCE: Read check-image.sh at 8b56679. Line 12 now opens one `guestfish --ro -a -i --listen` session. Lines 13-18 fail if the PID cannot be parsed. Line 19 closes the session with an EXIT trap. Every read at lines 20-87 goes through `--remote`. The assertions are unchanged: empty machine-id at :33-34, hostname `localhost` at :35, no ssh_host_* keys at :37-38. test_one_read_only_session_is_closed_on_success_and_failure (test_artifact_checks.py:116-127) asserts one --ro launch, all later calls remote, `exit` as the last call on both pass and fail, and no remote call when launch fails. I read that test but did not run it. The allowed read-only check of a -final.qcow2 disk was not run because Docker was denied. No instance was booted. + +CRITERION: AC-06 The sealed image retains no build password, authorized keys or generated SSH policy override. The default Ubuntu account may remain only locked and keyless, with its standard sudo policy. Usable deployed users, keys and site-specific identity are supplied at clone time; the default recipe's PDS SSH baseline remains effective after fresh cloud-init initialization. +VERDICT: not verified +EVIDENCE: seal-image.sh is unchanged since R-19. In check-image.sh:36 the ubuntu shadow field must be `*`. Lines 49-82 check /root and /home/ubuntu against an allowlist. Lines 83-87 require authorized_keys, histories, the cloud seed and 50-cloud-init.conf to be absent. Lines 90-98 require the 00-pds-security.conf settings in default mode. tests/test_sealing.sh and the unit fixtures were not run. No sealed disk was inspected and no fresh instance was observed. + +CRITERION: AC-07 Short root and Ubuntu READMEs link canonical procedures for both output selections, PDS bootstrap, SSH/debugging and recovery; small flow diagrams use Mermaid and Proxmox is explicitly optional. +VERDICT: met +EVIDENCE: At 8b56679, Grep extracted every relative link in readme.md and packer/ubuntu/readme.md. Glob and `ls -d` confirmed that every target exists: docs/ubuntu/local-build.md, provisioning.md, proxmox.md, image-pipeline.md, ssh-and-debugging.md and recovery.md, plus docs/development.md, docs/specs/README.md, packer/ubuntu/readme.md, proxmox.auto.pkrvars.hcl.example, recipes/default.sh, armbian-build-framework/ and LICENSE. Mermaid blocks are at packer/ubuntu/readme.md:35 and docs/ubuntu/image-pipeline.md:7. Proxmox is called optional at readme.md:3 and :19 and at packer/ubuntu/readme.md:3 and :8. The links that docs/development.md:56-58 changed point to docs/validation/0001-2026-11-05.md and 0001-2026-11-04.md, and both exist. Limitations: I did not render the diagrams or follow the guides end to end. + +CRITERION: AC-08 Both builders install the exact selected PDS package, verify its identity and provenance, and fail on missing, mismatched or untrusted inputs; candidate-package testing is distinguished from a verified signed-repository release build. +VERDICT: not verified +EVIDENCE: `sha256sum` of /tmp/builders-recipe-20261105/pds-completion-green/packaging/dist/pds_1.0.0_all.deb printed 744343e157c8d0b297daf8633fb9623839bbd4734c89f384f7c0208cc141d3ba, the stated candidate. `diff -rq` of that test source against the PDS ac91a1e checkout found identical bash/ and tests/ trees, apart from an untracked __pycache__. packaging/ differs only in README.md (the ac91a1e documentation addition) and the untracked dist .deb. `git diff e756e93 ac91a1e` touches only the workflow, changelog.md and packaging/README.md. Package extraction and dpkg-deb inspection were denied, so I did not compare the payload bytes myself. check-image.sh:47-48 still requires the expected `candidate` or `signed-repository` source. No built output's dpkg metadata or APT sources were inspected. The signed-release route does not exist yet. + +CRITERION: AC-09 The shared provisioner applies native Ubuntu settings and the default recipe's explicit PDS function selection for Zi/Powerlevel10k, MOTD, GitHub CLI, kubectl, Krew, neat/view-secret/stern, nightly package updates and restricted SSH; reusable implementations live in the standalone PDS package, and selected-function failures stop provisioning. +VERDICT: not verified +EVIDENCE: recipes/default.sh, run-recipe.sh and install-pds.sh are unchanged since R-19. In PDS, the Zsh alias uses `compdef k=kubectl` at bash/config/zshrc:42 and bash/debian/software/install_kubectl.sh:127. That copies the completion kubectl registers rather than naming a fixed function. The Bash path keeps `complete -F __start_kubectl k`, which is correct for Bash completion. The builders unit tests and PDS tests were not executed because Docker was denied. No real provisioning run was observed. + +CRITERION: AC-10 A new deployment user of a default-recipe image receives working Zsh/Powerlevel10k, the kubectl alias/completion, Krew and the neat, view-secret and stern plugins from either output, with its configured Zsh login shell and sudo policy and without inheriting build credentials or build-home paths. Zi populates the existing plugin set on first shell startup with network access; no image-prefetched plugin cache is required. +VERDICT: not verified +EVIDENCE: check-instance.sh and check-user-shell.zsh are unchanged since R-19, which inspected the `_comps[k] == _comps[kubectl]` assertion. The fresh-user check exists, but test_user_shell was not run in this review because Docker was denied. No fresh instance was booted, and no real Zi download or kubectl completion was observed. The validation summary lists the instance phases as running or pending. + +CRITERION: AC-11 The PDS package loads non-interactively without installer/network side effects, preserves the caller's shell state and reports library failures; its supported standalone setup preserves Zi, the preset and the existing plugin set. Error-reporting assertions cover explicit non-interactive loading; interactive auto-loading is documented separately. +VERDICT: not verified +EVIDENCE: The allowed `docker run --network none` on pds-image-provisioning-test:local, which installs /work/packaging/dist/pds_1.0.0_all.deb and runs `python3 -B -m unittest discover -s tests -p '*test*.py' -v`, was denied by the host permission mode, so it did not run. Grep counted 25 test methods in the four PDS test files, which matches the claimed count. The candidate test source's bash/ and tests/ trees match ac91a1e, as shown under AC-08. No load, strict-mode or Zi test was executed in this review. + +CRITERION: AC-12 Repository checks exercise package-backed provisioning, failure paths, sealed-artifact assertions and two fresh boots of each Ubuntu amd64 output; CI reports executed versus skipped checks, and native checks preserve all pre-existing guests. +VERDICT: not verified +EVIDENCE: Grep counted 44 builders test methods: 7 cloud_init_status, 3 user_shell, 7 artifact_checks, 1 raw_export, 16 base_template, 8 pds_provisioning and 2 image_steps. That matches the claimed 44, but the suite was not executed because Docker was denied. In PDS, build-apt-package.yml:25 now adds the workflow file to the pull_request paths, ahead of the `!**/*.md` exclusions, which closes R-19 F-02. The workflow default is `contents: read` at :2-3. Checkouts set persist-credentials: false at :41, :55, :74, :152 and :192. Version calculation is dry-run at :47. release (:145-147) and deploy-apt-repo (:183-187) hold the only write scopes and run only for push or workflow_dispatch on main. No hosted CI run, fresh boots or guest-preservation audit was observed. + +CRITERION: AC-13 PDS bundles selectable VHCO, Stackweaver and preserved EdgeForge MOTD text presets; builders defaults to configurable VHCO, custom-file usage remains supported, and invalid selections leave the active MOTD and other MOTD scripts unchanged. +VERDICT: not verified +EVIDENCE: The PDS bash/ tree, including bash/config/motd/, matches the candidate test source, as shown under AC-08. check-image.sh:39 requires /etc/update-motd.d/90-pds. test_motd_presets was not executed because Docker was denied. The configured banner was not checked in either image output. + +CRITERION: AC-14 Both image outputs built with the default recipe retain one configured nightly midnight package-update job that runs non-interactively with an enabled scheduler and effective SSH settings that allow injected non-root public-key login while disabling password, keyboard-interactive and root login; repeated provisioning is safe and temporary Packer access is removed only after it is no longer needed. +VERDICT: not verified +EVIDENCE: seal-image.sh, ssh-policy-observer.sh and the PDS sysadmin/SSH helpers are unchanged since R-19. In check-image.sh:94-98, default mode requires the four policy lines and the exact `0 0 * * * root /usr/local/sbin/pds-update ...` cron line. PDS test_image_baseline and the builders observer tests were not executed because Docker was denied. No scheduler state, cron execution, journal interval or authentication control was observed in an image or instance. + +CRITERION: AC-15 An operator can select a readable custom Bash recipe at invocation for either output without editing the default recipe or PDS; omitted PDS update/SSH policies are not applied elsewhere, missing recipes and failed calls stop the build, and generic-image cleanup still runs. +VERDICT: not verified +EVIDENCE: Recipe selection and run-recipe.sh are unchanged since R-19. In check-image.sh:99-101, custom mode requires both 00-pds-security.conf and the pds-update job to be absent. The unit tests and Packer recipe validation were not executed because Docker was denied. No custom build or fresh custom instance was observed. The validation summary marks the portable custom build as running and the custom instance checks as pending. + +NO FINDINGS + +### R-21 + +CRITERION: AC-01 A committed `create-base-template.sh` turns the official Ubuntu cloud image into a base cloud-init template on the PVE host (qemu-guest-agent embedded), repeatably; no hand-clicking. +VERDICT: not verified +EVIDENCE: `git rev-parse HEAD` printed d9282b4051a9613bd2569d4c38859073865321a8 in builders and 92cd5581a595d000f2213a63f51df4ee52f086e6 in PDS. `git status --porcelain=v1 --untracked-files=all` printed nothing in either tree, before and after my test run. `git show --stat d9282b4` shows that the only builders change since R-20 (8b56679) is docs/specs/0001-packer-proxmox-native-output.md, so the base-template scripts and tests are unchanged. The R-21 dispatch allowed only the PDS test_package_target suite on the host, so the builders unittest suite did not run. Proxmox access was not permitted, so no bootstrap, import or repeat import ran. + +CRITERION: AC-02 `packer init .` installs both `hashicorp/proxmox` (`1.2.4`) and `hashicorp/qemu` plugins. +VERDICT: not verified +EVIDENCE: No *.pkr.hcl file changed between 8b56679 and d9282b4, because the only change is the feature document. Packer init, fmt and validate were not run in this review because no container or Packer execution was permitted. Plugin installation was not observed. + +CRITERION: AC-03 `packer build -only='proxmox-clone.ubuntu' …` clones the base and produces a **template** on the PVE node (verified via `qm config ` showing `template: 1`) with an **empty cloud-init drive** attached; no per-build `qm importdisk`/upload anywhere in the flow. The native CPU model defaults to `host` and is configurable; the template and two fresh clones use the selected default, and blank or whitespace-padded model names fail local validation. +VERDICT: not verified +EVIDENCE: The native source is unchanged since R-20. No native build, `qm config` check, clone or CPU validation was run or observed. docs/validation/0001-2026-11-05.md reports that the native builds and inspections passed and that the default instance checks are "Running". Those are implementer claims. This is a composite criterion, so it is not verified. + +CRITERION: AC-04 `packer build -only='qemu.ubuntu' …` still produces the local qcow2/raw artifact. +VERDICT: not verified +EVIDENCE: The qemu source and export-raw.sh are unchanged since R-20. test_raw_export was not executed and no portable build was observed. The summary row "Passed; formats compare equal" is an implementer claim, and the portable custom build is listed as Running. + +CRITERION: AC-05 Both native and portable sealed outputs contain no site-specific hostname, static IP/netplan identity or SSH host keys; two independently initialized instances of each output receive distinct machine IDs and host keys and apply their supplied identities. +VERDICT: not verified +EVIDENCE: check-image.sh is unchanged since R-20. The R-21 dispatch did not permit a container, so the optional read-only inspection of a -final.qcow2 disk was not run. No instance was booted. The summary lists all eight fresh-instance checks as running or pending. + +CRITERION: AC-06 The sealed image retains no build password, authorized keys or generated SSH policy override. The default Ubuntu account may remain only locked and keyless, with its standard sudo policy. Usable deployed users, keys and site-specific identity are supplied at clone time; the default recipe's PDS SSH baseline remains effective after fresh cloud-init initialization. +VERDICT: not verified +EVIDENCE: seal-image.sh and check-image.sh are unchanged since R-20. tests/test_sealing.sh and the unit fixtures were not run. No sealed disk was inspected and no fresh instance was observed. + +CRITERION: AC-07 Short root and Ubuntu READMEs link canonical procedures for both output selections, PDS bootstrap, SSH/debugging and recovery; small flow diagrams use Mermaid and Proxmox is explicitly optional. +VERDICT: met +EVIDENCE: Used `git show d9282b4:` to read readme.md, packer/ubuntu/readme.md, docs/ubuntu/image-pipeline.md, local-build.md and provisioning.md. Every relative link target appears in `git ls-tree -r d9282b4`: docs/ubuntu/local-build.md, provisioning.md, proxmox.md, image-pipeline.md, ssh-and-debugging.md and recovery.md, plus docs/development.md, docs/specs/README.md, packer/ubuntu/readme.md, proxmox.auto.pkrvars.hcl.example, recipes/default.sh, armbian-build-framework/ and LICENSE. The #prerequisites and #choose-a-different-recipe anchors match the "## Prerequisites" and "## Choose a different recipe" headings. Mermaid flowcharts are in packer/ubuntu/readme.md and docs/ubuntu/image-pipeline.md. The root README says "optional native Proxmox template path" and "This path needs no Proxmox server or credentials". The Ubuntu README says "Proxmox is optional". Limitations: I did not render the diagrams or follow the guides end to end. + +CRITERION: AC-08 Both builders install the exact selected PDS package, verify its identity and provenance, and fail on missing, mismatched or untrusted inputs; candidate-package testing is distinguished from a verified signed-repository release build. +VERDICT: not verified +EVIDENCE: `sha256sum` of /tmp/builders-recipe-20261105/pds-completion-green/packaging/dist/pds_1.0.0_all.deb printed 744343e157c8d0b297daf8633fb9623839bbd4734c89f384f7c0208cc141d3ba, which matches the stated candidate. `diff -rq` against PDS 92cd558 found no difference in bash/. In packaging/, only Makefile and README.md differ. `git diff --stat e756e93 HEAD -- bash packaging/init.sh packaging/nfpm.yaml packaging/bin packaging/profile.d packaging/scripts` printed nothing, so the packaged runtime sources are unchanged since e756e93. I did not extract the package or compare its payload bytes. No built output's dpkg metadata, provenance record or APT sources were inspected. The signed-repository release route does not exist yet. + +CRITERION: AC-09 The shared provisioner applies native Ubuntu settings and the default recipe's explicit PDS function selection for Zi/Powerlevel10k, MOTD, GitHub CLI, kubectl, Krew, neat/view-secret/stern, nightly package updates and restricted SSH; reusable implementations live in the standalone PDS package, and selected-function failures stop provisioning. +VERDICT: not verified +EVIDENCE: The builders recipes and scripts are unchanged since R-20. PDS bash/ is unchanged since e756e93 and matches the candidate test source. docs/ubuntu/provisioning.md lists the seven default selections: install_zi, configure_zsh, setup_motd_preset, install_gh, install_kubectl --system, update_system_cron_entry and restricted_ssh_security_profile. The builders and PDS package suites were not executed and no real provisioning was observed. + +CRITERION: AC-10 A new deployment user of a default-recipe image receives working Zsh/Powerlevel10k, the kubectl alias/completion, Krew and the neat, view-secret and stern plugins from either output, with its configured Zsh login shell and sudo policy and without inheriting build credentials or build-home paths. Zi populates the existing plugin set on first shell startup with network access; no image-prefetched plugin cache is required. +VERDICT: not verified +EVIDENCE: check-instance.sh, check-user-shell.zsh and the PDS kubectl and zshrc sources are unchanged since R-20. No fresh instance was booted, and no Zi download, kubectl completion or Krew plugin run was observed. The summary marks the instance phases as running or pending. + +CRITERION: AC-11 The PDS package loads non-interactively without installer/network side effects, preserves the caller's shell state and reports library failures; its supported standalone setup preserves Zi, the preset and the existing plugin set. Error-reporting assertions cover explicit non-interactive loading; interactive auto-loading is documented separately. +VERDICT: not verified +EVIDENCE: The R-21 dispatch forbade the PDS root-filesystem tests on the host and permitted no container, so the installed-package suite did not run. The parent reports that 27 tests passed. That is not counted. The runtime sources are unchanged since e756e93, as shown under AC-08. + +CRITERION: AC-12 Repository checks exercise package-backed provisioning, failure paths, sealed-artifact assertions and two fresh boots of each Ubuntu amd64 output; CI reports executed versus skipped checks, and native checks preserve all pre-existing guests. +VERDICT: not verified +EVIDENCE: Ran `python3 -B -m unittest discover -s tests -p test_package_target.py -v` in PDS at 92cd558: 2 tests, OK. test_uses_the_package_produced_by_nfpm selects pds_1.0.0_all.deb and pds_0.20.0~PullRequest35.16_all.deb. test_missing_or_ambiguous_package_does_not_run_container rejects an empty dist and two packages, and docker run is never reached. The tree stayed clean afterwards. In packaging/Makefile:69-74, `set --` expands the glob, and the target requires exactly one existing file before passing it as PDS_TEST_PACKAGE. An unmatched glob leaves the literal pattern, which fails `-f`. `build: clean` (:15, :31) removes dist first, so CI builds yield one file. build-apt-package.yml:2-3 keeps `contents: read`. Write scopes remain only on release and deploy-apt-repo, which are gated to main push or dispatch at :145. Release at :177 still names `${VERSION}_all.deb`, but gitversion.yml gives main no prerelease label. This is a passing subset only. No hosted CI run, full builders or PDS suite, fresh boot or guest-preservation audit was observed. + +CRITERION: AC-13 PDS bundles selectable VHCO, Stackweaver and preserved EdgeForge MOTD text presets; builders defaults to configurable VHCO, custom-file usage remains supported, and invalid selections leave the active MOTD and other MOTD scripts unchanged. +VERDICT: not verified +EVIDENCE: The PDS bash/ tree, including bash/config/motd/, matches the candidate test source. provisioning.md documents the `vhco` default, the `stackweaver` and `edgeforge` alternatives and `setup_motd `. test_motd_presets was not executed, and the banner was not checked in either image output. + +CRITERION: AC-14 Both image outputs built with the default recipe retain one configured nightly midnight package-update job that runs non-interactively with an enabled scheduler and effective SSH settings that allow injected non-root public-key login while disabling password, keyboard-interactive and root login; repeated provisioning is safe and temporary Packer access is removed only after it is no longer needed. +VERDICT: not verified +EVIDENCE: The PDS sysadmin, SSH and updater helpers and the builders observer and sealer are unchanged since R-20. test_image_baseline and the observer tests were not executed. No scheduler state, cron execution, journal interval or authentication control was observed in an image or instance. + +CRITERION: AC-15 An operator can select a readable custom Bash recipe at invocation for either output without editing the default recipe or PDS; omitted PDS update/SSH policies are not applied elsewhere, missing recipes and failed calls stop the build, and generic-image cleanup still runs. +VERDICT: not verified +EVIDENCE: Recipe selection, run-recipe.sh and recipes/custom.example.sh are unchanged since R-20. The unit tests and Packer validation were not executed. No custom build or fresh custom instance was observed. The summary marks the portable custom build as running and the custom instance checks as pending. + +FINDING: F-01 +KIND: factual +SEVERITY: nit +WHERE: docs/validation/0001-2026-11-05.md Inputs and Local checks; Tasks T21 follow-up +EVIDENCE: The summary says "Later PDS changes affect only workflow checks and documentation" and "passes all 25 package/helper tests". The T21 follow-up says "All 25 PDS package tests" and names PDS `ac91a1e`. PDS 92cd558 changes packaging/Makefile (the test-image-provisioning target) and adds tests/test_package_target.py with 2 tests. That commit is newer than builders d9282b4 (04:42 against 04:33). The runtime payload sources are still unchanged, per `git diff --stat e756e93 HEAD` on the payload paths. +PROPOSAL: Update the summary and the T21 note to name PDS 92cd558, describe the change as build/test tooling outside the package payload, and state the current package test count. + +FINDING: F-02 +KIND: factual +SEVERITY: nit +WHERE: Review Log and Sources sections of docs/specs/0001-packer-proxmox-native-output.md +EVIDENCE: `git show d9282b4:docs/specs/0001-packer-proxmox-native-output.md | grep -n "^## \|^### R-"` puts `## Sources` at line 1625, between `### R-17` (1607) and `### R-18` (1644). The R-18, R-19 and R-20 subsections therefore sit under Sources, not Review Log. conventions/feature-documents.md says Sources is optional and goes last. +PROPOSAL: Move the R-18 to R-20 subsections, and any later ones, above `## Sources` so that they belong to the Review Log and Sources stays last. + +### R-22 + +CRITERION: AC-01 A committed `create-base-template.sh` turns the official Ubuntu cloud image into a base cloud-init template on the PVE host (qemu-guest-agent embedded), repeatably; no hand-clicking. +VERDICT: not verified +EVIDENCE: Bash was denied in this review, so I ran no git command, test, binary or container. I read .git/refs/heads/feat/0001-packer-proxmox-native: it holds 0437db7561f74c41d797201f9a7d05a42be0e742. I read the PDS ref feat/image-provisioning-pds: it holds 92cd5581a595d000f2213a63f51df4ee52f086e6. The builders .git/logs/HEAD lines 39 to 40 show that 0437db7 was committed directly on eca48c2. I could not diff the two commits. That the base-template scripts are unchanged is the dispatcher's statement, not something I observed. No bootstrap, import, repeat import or occupied-ID refusal ran. The pass in docs/validation/0001-2026-11-05.md was observed by the implementer. + +CRITERION: AC-02 `packer init .` installs both `hashicorp/proxmox` (`1.2.4`) and `hashicorp/qemu` plugins. +VERDICT: not verified +EVIDENCE: I read Makefile:6-7: `init` runs `cd packer/ubuntu && $(PACKER) init .`. I read .github/workflows/check.yaml:21-23: `make init` now has `PACKER_GITHUB_API_TOKEN: ${{ github.token }}`. Lines 6 to 15 of /tmp/builders-recipe-20261105/builders-plugin-rate-limit-ci.log show the earlier hosted run failing on the proxmox plugin with a 403 rate limit. The same log shows qemu v1.1.8 installed and make exiting with code 2. I did not run packer init, and no hosted run after the repair was observed. + +CRITERION: AC-03 `packer build -only='proxmox-clone.ubuntu' …` clones the base and produces a **template** on the PVE node (verified via `qm config ` showing `template: 1`) with an **empty cloud-init drive** attached; no per-build `qm importdisk`/upload anywhere in the flow. The native CPU model defaults to `host` and is configurable; the template and two fresh clones use the selected default, and blank or whitespace-padded model names fail local validation. +VERDICT: not verified +EVIDENCE: No native build, `qm config` check, clone or CPU validation was run or observed. The validation summary's matrix (lines 56 to 61) reports native builds, inspections and two fresh instances per recipe as passed. Those results come from the implementer. This is a composite criterion and no part was executed here. + +CRITERION: AC-04 `packer build -only='qemu.ubuntu' …` still produces the local qcow2/raw artifact. +VERDICT: not verified +EVIDENCE: No portable build, raw export or format comparison was run. The summary rows "Passed; formats compare equal" for both portable recipes come from the implementer. + +CRITERION: AC-05 Both native and portable sealed outputs contain no site-specific hostname, static IP/netplan identity or SSH host keys; two independently initialized instances of each output receive distinct machine IDs and host keys and apply their supplied identities. +VERDICT: not verified +EVIDENCE: No sealed disk was inspected and no instance was booted. Validation summary lines 76 to 78 report distinct machine IDs, host keys, DHCP identities and hostnames across eight instances. That evidence comes from the implementer. + +CRITERION: AC-06 The sealed image retains no build password, authorized keys or generated SSH policy override. The default Ubuntu account may remain only locked and keyless, with its standard sudo policy. Usable deployed users, keys and site-specific identity are supplied at clone time; the default recipe's PDS SSH baseline remains effective after fresh cloud-init initialization. +VERDICT: not verified +EVIDENCE: tests/test_sealing.sh, the unit fixtures and check-image.sh did not run. No sealed output was inspected and no fresh instance was observed. Summary lines 24 to 25 and 78 to 79 report sealing and authentication passes. Those are implementer claims. + +CRITERION: AC-07 Short root and Ubuntu READMEs link canonical procedures for both output selections, PDS bootstrap, SSH/debugging and recovery; small flow diagrams use Mermaid and Proxmox is explicitly optional. +VERDICT: met +EVIDENCE: I read readme.md and grepped the links in readme.md and packer/ubuntu/readme.md. I used Glob to check that every relative target exists in the working tree at 0437db7: docs/ubuntu/local-build.md, provisioning.md, proxmox.md, image-pipeline.md, ssh-and-debugging.md and recovery.md, plus docs/development.md, docs/specs/README.md, packer/ubuntu/readme.md, proxmox.auto.pkrvars.hcl.example, recipes/default.sh, armbian-build-framework/ and LICENSE. The anchors #prerequisites and #choose-a-different-recipe match local-build.md:6 and provisioning.md:43. Mermaid blocks are at packer/ubuntu/readme.md:35 and docs/ubuntu/image-pipeline.md:7. readme.md:3 says "optional native Proxmox template path" and readme.md:19 says "This path needs no Proxmox server or credentials". Limitations: this was inspection of the working tree, and its cleanliness comes from the gitStatus snapshot, not a status command I ran. I did not render the diagrams or follow the guides. See F-02. + +CRITERION: AC-08 Both builders install the exact selected PDS package, verify its identity and provenance, and fail on missing, mismatched or untrusted inputs; candidate-package testing is distinguished from a verified signed-repository release build. +VERDICT: not verified +EVIDENCE: No package was hashed or extracted, and no built output's dpkg metadata, provenance or APT sources were inspected. Validation summary lines 9 to 14 and 102 to 105 label 744343e1... as a candidate test package and say the signed release route is still open. Those statements come from the implementer. + +CRITERION: AC-09 The shared provisioner applies native Ubuntu settings and the default recipe's explicit PDS function selection for Zi/Powerlevel10k, MOTD, GitHub CLI, kubectl, Krew, neat/view-secret/stern, nightly package updates and restricted SSH; reusable implementations live in the standalone PDS package, and selected-function failures stop provisioning. +VERDICT: not verified +EVIDENCE: Neither the builders nor the PDS suites ran, and no real provisioning or injected failure was observed. That provisioners and recipes are unchanged since R-21 is the dispatcher's statement. I could not diff to confirm it. + +CRITERION: AC-10 A new deployment user of a default-recipe image receives working Zsh/Powerlevel10k, the kubectl alias/completion, Krew and the neat, view-secret and stern plugins from either output, with its configured Zsh login shell and sudo policy and without inheriting build credentials or build-home paths. Zi populates the existing plugin set on first shell startup with network access; no image-prefetched plugin cache is required. +VERDICT: not verified +EVIDENCE: No fresh instance was booted, and no Zi download, completion or Krew plugin run was observed. Summary line 76 reports that all eight instances passed the fresh-user shell and tool checks. That claim comes from the implementer. + +CRITERION: AC-11 The PDS package loads non-interactively without installer/network side effects, preserves the caller's shell state and reports library failures; its supported standalone setup preserves Zi, the preset and the existing plugin set. Error-reporting assertions cover explicit non-interactive loading; interactive auto-loading is documented separately. +VERDICT: not verified +EVIDENCE: The PDS package suite did not run. Summary lines 26 to 33 report 25 installed-package tests plus 2 target tests, 27 in total, and a passing hosted PDS run at 92cd558. The implementer reported these, and I did not observe them. + +CRITERION: AC-12 Repository checks exercise package-backed provisioning, failure paths, sealed-artifact assertions and two fresh boots of each Ubuntu amd64 output; CI reports executed versus skipped checks, and native checks preserve all pre-existing guests. +VERDICT: not verified +EVIDENCE: I read the workflow. check.yaml:2-7 uses the `pull_request` and main `push` triggers, not `pull_request_target`, with global `permissions: contents: read`. Line 15 sets `persist-credentials: false`. Lines 21 to 23 pass `github.token` only in the `make init` step env. Lines 13 and 16 pin the actions to full SHAs. Makefile:7 shows that step only runs `packer init`, so the token is not visible to `make check` or any plugin run in later steps. Fork PRs get a read-only token whatever the workflow requests. The token expires with the job, and a same-repository PR author who can edit the Makefile already has repository access, so I found no permission, exposure or trigger defect. The retained CI log shows the earlier hosted run stopping at init, before any check. The Makefile:10 SKIP line reports skipped checks, but I did not run `make check`, Actionlint or the scope assertion. No hosted run after the repair, fresh boot or guest-preservation audit was observed. See F-01. + +CRITERION: AC-13 PDS bundles selectable VHCO, Stackweaver and preserved EdgeForge MOTD text presets; builders defaults to configurable VHCO, custom-file usage remains supported, and invalid selections leave the active MOTD and other MOTD scripts unchanged. +VERDICT: not verified +EVIDENCE: test_motd_presets did not run, and no banner was checked in either output. Summary line 80 reports that the custom outputs kept their MOTD setup. That is an implementer claim. + +CRITERION: AC-14 Both image outputs built with the default recipe retain one configured nightly midnight package-update job that runs non-interactively with an enabled scheduler and effective SSH settings that allow injected non-root public-key login while disabling password, keyboard-interactive and root login; repeated provisioning is safe and temporary Packer access is removed only after it is no longer needed. +VERDICT: not verified +EVIDENCE: No scheduler state, cron-environment run, journal interval or authentication control was observed. Summary lines 69 to 72 and 78 to 80 report that both default outputs passed. That claim comes from the implementer. + +CRITERION: AC-15 An operator can select a readable custom Bash recipe at invocation for either output without editing the default recipe or PDS; omitted PDS update/SSH policies are not applied elsewhere, missing recipes and failed calls stop the build, and generic-image cleanup still runs. +VERDICT: not verified +EVIDENCE: The unit tests and Packer validation did not run, and no custom build or instance was observed. Summary lines 59, 61 and 80 to 81 report that custom native and portable builds passed with no PDS SSH policy or update job. Those are implementer claims. + +FINDING: F-01 +KIND: factual +SEVERITY: nit +WHERE: Tasks T19/T21 in docs/specs/0001-packer-proxmox-native-output.md; docs/validation/0001-2026-11-05.md Local checks +EVIDENCE: A Grep for PACKER_GITHUB_API_TOKEN and for rate limit across the tree matches only .github/workflows/check.yaml:23. Validation summary line 45 says "hosted CI results are reported separately", but that refers to the PDS check jobs. No document records the builders hosted run that failed at `make init` (403 rate limit, which exists only in /tmp/builders-recipe-20261105/builders-plugin-rate-limit-ci.log), the 0437db7 repair, or a hosted builders run after it. +PROPOSAL: Add one line to the T19 follow-up or the validation summary that names the hosted failure, the step-scoped github.token repair at 0437db7 and the result of the next hosted builders run, or say that it has not run yet. + +FINDING: F-02 +KIND: factual +SEVERITY: nit +WHERE: readme.md Build an Ubuntu image +EVIDENCE: readme.md:8 ends with "then run:", but lines 10 and 11 are a separate PDS-release paragraph, and the command block only starts at line 13. +PROPOSAL: Move the PDS-release paragraph above the "then run:" sentence or below the code block, so the colon leads straight into the commands. + +### R-23 + +CRITERION: AC-01 A committed `create-base-template.sh` turns the official Ubuntu cloud image into a base cloud-init template on the PVE host (qemu-guest-agent embedded), repeatably; no hand-clicking. +VERDICT: not verified +EVIDENCE: `git rev-parse HEAD` printed fcd9b0c00ea2cb3ecb76ae890e79ded24b1fa837 in builders and 92cd5581a595d000f2213a63f51df4ee52f086e6 in PDS. `git status --porcelain` printed nothing in either tree. `git diff --stat eca48c2 fcd9b0c` lists only .github/workflows/check.yaml, the feature document, docs/validation/0001-2026-11-05.md, packer/ubuntu/readme.md and readme.md, so the base-template scripts are unchanged. After those commands Bash was denied, so I ran no test, binary or container. No bootstrap, import, repeat import or occupied-ID refusal ran. The pass in the validation summary was observed by the implementer. + +CRITERION: AC-02 `packer init .` installs both `hashicorp/proxmox` (`1.2.4`) and `hashicorp/qemu` plugins. +VERDICT: not verified +EVIDENCE: Makefile:6-7 runs `cd packer/ubuntu && $(PACKER) init .`. check.yaml:21-23 passes `PACKER_GITHUB_API_TOKEN: ${{ github.token }}` to `make init` only. Lines 8 to 14 of /tmp/builders-recipe-20261105/builders-plugin-rate-limit-ci.log show the earlier hosted init failing with a 403 rate limit on packer-plugin-proxmox, a HINT to set PACKER_GITHUB_API_TOKEN, and `make: *** [Makefile:7: init] Error 1`. I did not run packer init. Validation summary line 54 says the next hosted builders run has not executed yet, so no successful init after the repair was observed. + +CRITERION: AC-03 `packer build -only='proxmox-clone.ubuntu' …` clones the base and produces a **template** on the PVE node (verified via `qm config ` showing `template: 1`) with an **empty cloud-init drive** attached; no per-build `qm importdisk`/upload anywhere in the flow. The native CPU model defaults to `host` and is configurable; the template and two fresh clones use the selected default, and blank or whitespace-padded model names fail local validation. +VERDICT: not verified +EVIDENCE: The diff since eca48c2 does not touch packer/ubuntu sources. No native build, `qm config` check, clone or CPU validation was run or observed. Validation summary lines 65 to 66 report that both native builds, their inspections and their fresh instances passed. The implementer observed these. This is a composite criterion and no part of it was executed here. + +CRITERION: AC-04 `packer build -only='qemu.ubuntu' …` still produces the local qcow2/raw artifact. +VERDICT: not verified +EVIDENCE: The qemu source and export script are unchanged since eca48c2. No portable build, raw export or format comparison was run. Summary lines 67 to 68, "Passed; formats compare equal", report the implementer's results. + +CRITERION: AC-05 Both native and portable sealed outputs contain no site-specific hostname, static IP/netplan identity or SSH host keys; two independently initialized instances of each output receive distinct machine IDs and host keys and apply their supplied identities. +VERDICT: not verified +EVIDENCE: No sealed disk was inspected and no instance was booted. Summary lines 83 to 85 report distinct machine IDs, host keys, DHCP identities and hostnames across eight instances. The implementer observed these. + +CRITERION: AC-06 The sealed image retains no build password, authorized keys or generated SSH policy override. The default Ubuntu account may remain only locked and keyless, with its standard sudo policy. Usable deployed users, keys and site-specific identity are supplied at clone time; the default recipe's PDS SSH baseline remains effective after fresh cloud-init initialization. +VERDICT: not verified +EVIDENCE: tests/test_sealing.sh, the unit fixtures and check-image.sh did not run. Their sources are unchanged since eca48c2. No sealed output was inspected and no fresh instance was observed. Summary lines 24 to 25 and 85 to 86 report passing sealing and authentication checks. The implementer reported these. + +CRITERION: AC-07 Short root and Ubuntu READMEs link canonical procedures for both output selections, PDS bootstrap, SSH/debugging and recovery; small flow diagrams use Mermaid and Proxmox is explicitly optional. +VERDICT: met +EVIDENCE: I read readme.md and packer/ubuntu/readme.md at fcd9b0c in a clean tree. Glob confirms these relative targets exist: docs/ubuntu/local-build.md, provisioning.md, proxmox.md, image-pipeline.md, ssh-and-debugging.md and recovery.md, plus docs/development.md, docs/specs/README.md, LICENSE, armbian-build-framework/, packer/ubuntu/proxmox.auto.pkrvars.hcl.example and recipes/default.sh. Grep shows the anchors #prerequisites at local-build.md:6 and #choose-a-different-recipe at provisioning.md:43. A Mermaid block is at packer/ubuntu/readme.md:35. readme.md:3-4 says "optional native Proxmox template path", and readme.md:19 says "This path needs no Proxmox server or credentials". Packer/ubuntu/readme.md:3 says "Proxmox is optional". The delta since eca48c2 only moves the PDS caveat paragraph, at readme.md:8-9 and packer/ubuntu/readme.md:13-14, above the prerequisites sentence. Both colons, at readme.md:11 and packer/ubuntu/readme.md:16, now lead straight into the command blocks, and no link was lost. Limitations: this was inspection only. I did not render the diagrams or follow the guides. + +CRITERION: AC-08 Both builders install the exact selected PDS package, verify its identity and provenance, and fail on missing, mismatched or untrusted inputs; candidate-package testing is distinguished from a verified signed-repository release build. +VERDICT: not verified +EVIDENCE: No package was hashed or extracted, and no built output's dpkg metadata, provenance or APT sources were inspected. Validation summary lines 9 to 14 and 109 to 112 label 744343e1... as a test package and keep the signed-release route and AC-08 open. The implementer wrote these statements. + +CRITERION: AC-09 The shared provisioner applies native Ubuntu settings and the default recipe's explicit PDS function selection for Zi/Powerlevel10k, MOTD, GitHub CLI, kubectl, Krew, neat/view-secret/stern, nightly package updates and restricted SSH; reusable implementations live in the standalone PDS package, and selected-function failures stop provisioning. +VERDICT: not verified +EVIDENCE: The diff since eca48c2 confirms that the provisioners and recipes are unchanged. Neither the builders suite nor the PDS suite ran, and no real provisioning or injected failure was observed. + +CRITERION: AC-10 A new deployment user of a default-recipe image receives working Zsh/Powerlevel10k, the kubectl alias/completion, Krew and the neat, view-secret and stern plugins from either output, with its configured Zsh login shell and sudo policy and without inheriting build credentials or build-home paths. Zi populates the existing plugin set on first shell startup with network access; no image-prefetched plugin cache is required. +VERDICT: not verified +EVIDENCE: No fresh instance was booted, and no Zi download, completion or Krew plugin run was observed. Summary line 83 reports that all eight instances passed the fresh-user shell and tool checks. The implementer made this claim. + +CRITERION: AC-11 The PDS package loads non-interactively without installer/network side effects, preserves the caller's shell state and reports library failures; its supported standalone setup preserves Zi, the preset and the existing plugin set. Error-reporting assertions cover explicit non-interactive loading; interactive auto-loading is documented separately. +VERDICT: not verified +EVIDENCE: The PDS tree is clean at 92cd558, but its package suite did not run. Summary lines 26 to 33 report 25 installed-package tests plus 2 target tests, and a passing hosted PDS run. The implementer reported these, and I did not observe them. + +CRITERION: AC-12 Repository checks exercise package-backed provisioning, failure paths, sealed-artifact assertions and two fresh boots of each Ubuntu amd64 output; CI reports executed versus skipped checks, and native checks preserve all pre-existing guests. +VERDICT: not verified +EVIDENCE: The only workflow change since eca48c2 is check.yaml:22-23, which adds an `env` block to the `make init` step. Global `permissions: contents: read` (lines 6 to 7) is unchanged, and checkout still sets `persist-credentials: false` (line 15). The triggers are `pull_request` and a main `push`, not `pull_request_target`. Both actions are pinned to full SHAs. The token is scoped to the step that runs only `packer init` (Makefile:7), so neither `make check` nor plugin execution sees it. I found no permission, exposure or trigger defect. The Makefile:10 SKIP line reports the skipped checks. I did not run `make check`, Actionlint or the scope assertion. No hosted run after the repair was observed, and validation line 54 says none has executed. No fresh boot or guest-preservation audit was observed. + +CRITERION: AC-13 PDS bundles selectable VHCO, Stackweaver and preserved EdgeForge MOTD text presets; builders defaults to configurable VHCO, custom-file usage remains supported, and invalid selections leave the active MOTD and other MOTD scripts unchanged. +VERDICT: not verified +EVIDENCE: test_motd_presets did not run, and no banner was checked in either output. Summary lines 87 to 88 report that the custom outputs kept their MOTD setup. The implementer made this claim. + +CRITERION: AC-14 Both image outputs built with the default recipe retain one configured nightly midnight package-update job that runs non-interactively with an enabled scheduler and effective SSH settings that allow injected non-root public-key login while disabling password, keyboard-interactive and root login; repeated provisioning is safe and temporary Packer access is removed only after it is no longer needed. +VERDICT: not verified +EVIDENCE: No scheduler state, cron-environment run, journal interval or authentication control was observed. Summary lines 76 to 79 and 85 to 87 report that both default outputs passed. The implementer made this claim. + +CRITERION: AC-15 An operator can select a readable custom Bash recipe at invocation for either output without editing the default recipe or PDS; omitted PDS update/SSH policies are not applied elsewhere, missing recipes and failed calls stop the build, and generic-image cleanup still runs. +VERDICT: not verified +EVIDENCE: The unit tests and Packer validation did not run, and no custom build or instance was observed. Summary lines 66, 68 and 87 to 88 report custom native and portable passes with no PDS SSH policy or update job. The implementer made this claim. + +NO FINDINGS + +### R-24 + +CRITERION: AC-01 A committed `create-base-template.sh` turns the official Ubuntu cloud image into a base cloud-init template on the PVE host (qemu-guest-agent embedded), repeatably; no hand-clicking. +VERDICT: not verified +EVIDENCE: Read create-base-template.sh, import-base-template.sh, prepare-base-image.sh and the test_base_template.py cases, and read evidence/build-inputs.json at target 51872a3 (scripts unchanged since c3c1421 per git diff --stat). Committed scripts and failure-path tests exist. The only proof of the bootstrap, the occupied-ID and corrupt-bundle refusals, and import on a new ID is the author's validation prose plus the base bundle record. The host refused all seven checks.sh modes and the repository checks, so I observed no execution and no Proxmox state. +CRITERION: AC-02 `packer init .` installs both `hashicorp/proxmox` (`1.2.4`) and `hashicorp/qemu` plugins. +VERDICT: not verified +EVIDENCE: Read ubuntu.pkr.hcl:1-12 (exact pins "= 1.2.4" and "= 1.1.8"), Makefile init target and evidence/make-init.log, which lists packer-plugin-proxmox_v1.2.4 and packer-plugin-qemu_v1.1.8 at target 51872a3. That log is an author trace. The host denied my `checks.sh builders` run, so I did not observe init or validate. +CRITERION: AC-03 `packer build -only='proxmox-clone.ubuntu' …` clones the base and produces a **template** on the PVE node (verified via `qm config ` showing `template: 1`) with an **empty cloud-init drive** attached; no per-build `qm importdisk`/upload anywhere in the flow. The native CPU model defaults to `host` and is configurable; the template and two fresh clones use the selected default, and blank or whitespace-padded model names fail local validation. +VERDICT: not verified +EVIDENCE: Read ubuntu.pkr.hcl:49-80 (proxmox-clone with full_clone, cloud_init, cpu_type) and variables.pkr.hcl:297-306 (host default, trimspace guard), and read native-default-final-build.log at target 51872a3. The source has no import or upload step. The author log ends "Converting VM to template", "Adding a cloud-init cdrom" and "A template was created: 990144". I saw no qm config output or clone CPU records in the subset. My local validate run was denied, and the template and clones have since been removed. +CRITERION: AC-04 `packer build -only='qemu.ubuntu' …` still produces the local qcow2/raw artifact. +VERDICT: not verified +EVIDENCE: Read the qemu source, the export-raw post-processor and portable-*-final-formats.log at target 51872a3. The author logs show "Images are identical" with qcow2 and raw at a 10 GiB virtual size for both recipes, and portable-archive-digests.json records the transfer digests. I could not hash the files or run the portable-default and portable-custom offline checks because the host denied execution. +CRITERION: AC-05 Both native and portable sealed outputs contain no site-specific hostname, static IP/netplan identity or SSH host keys; two independently initialized instances of each output receive distinct machine IDs and host keys and apply their supplied identities. +VERDICT: not verified +EVIDENCE: Read seal-image.sh, check-image.sh, test_sealing.sh, the four *-final-instance-results.json files and final-eight-instance-audit.json at target 51872a3. The author results list eight distinct machine IDs, host keys, DHCP client IDs and hostnames. check-image.sh does not assert netplan or cloud instance-state absence offline (F-05). Persistence of each instance's ID across reboot was not tested (F-04). All four of my offline inspections were denied, and the instances no longer exist. +CRITERION: AC-06 The sealed image retains no build password, authorized keys or generated SSH policy override. The default Ubuntu account may remain only locked and keyless, with its standard sudo policy. Usable deployed users, keys and site-specific identity are supplied at clone time; the default recipe's PDS SSH baseline remains effective after fresh cloud-init initialization. +VERDICT: not verified +EVIDENCE: Read seal-image.sh:14-44 (usermod '*', key removal, cloud-init clean of ssh_config, build-home allowlist), check-image.sh:33-101 and check-instance.sh:24-28 (sshd -T), plus the author logs sealing-fixed-normal.log, transient-sealing-green.log and instance PASS lines at target 51872a3. The source covers the criterion. My sealing-normal, sealing-transient and image checks were all denied, so I observed no execution. +CRITERION: AC-07 Short root and Ubuntu READMEs link canonical procedures for both output selections, PDS bootstrap, SSH/debugging and recovery; small flow diagrams use Mermaid and Proxmox is explicitly optional. +VERDICT: met +EVIDENCE: Read readme.md, packer/readme.md, packer/ubuntu/readme.md and the docs/ubuntu pages at target 51872a3, and grepped every relative link and anchor against tracked files and headings. Both READMEs are short. They link the QEMU and Proxmox procedures, the provisioning and PDS guide, SSH and debugging, and recovery. Every relative link and anchor I checked resolves. Two mermaid flowcharts exist (packer/ubuntu/readme.md:35, docs/ubuntu/image-pipeline.md:7), and Proxmox is called optional in all three READMEs. Limits: I did not render the diagrams or follow the procedures live. +CRITERION: AC-08 Both builders install the exact selected PDS package, verify its identity and provenance, and fail on missing, mismatched or untrusted inputs; candidate-package testing is distinguished from a verified signed-repository release build. +VERDICT: not verified +EVIDENCE: Read install-pds.sh, test_pds_provisioning.py, check-image.sh:47-48, signed-repository-install.log, the *-provenance.log files and build-inputs.json at target 51872a3. The source pins pds=$version, requires exactly one primary key fingerprint, and refuses a candidate without a digest or with a mismatched one. The author logs show pds 0.20.0 fetched from the signed repository with source signed-repository. The provenance JSON is self-reported; the dpkg, APT-source and key cross-checks come from an uncommitted author script. My local and offline runs were denied. Retention of old versions in the repository is unverified (F-06). +CRITERION: AC-09 The shared provisioner applies native Ubuntu settings and the default recipe's explicit PDS function selection for Zi/Powerlevel10k, MOTD, GitHub CLI, kubectl, Krew, neat/view-secret/stern, nightly package updates and restricted SSH; reusable implementations live in the standalone PDS package, and selected-function failures stop provisioning. +VERDICT: not verified +EVIDENCE: Read install.sh, run-recipe.sh, recipes/default.sh, the ubuntu.pkr.hcl inline provisioner (bash -e) and the failure-path unit tests at target 51872a3. The author build and instance logs show gh, kubectl 1.37.2, krew, neat, stern and view-secret. The PDS implementations inside the installed 0.20.0 package were not inspected because the offline checks were denied and the PDS checkout was out of bounds. My unit test execution was also denied. +CRITERION: AC-10 A new deployment user of a default-recipe image receives working Zsh/Powerlevel10k, the kubectl alias/completion, Krew and the neat, view-secret and stern plugins from either output, with its configured Zsh login shell and sudo policy and without inheriting build credentials or build-home paths. Zi populates the existing plugin set on first shell startup with network access; no image-prefetched plugin cache is required. +VERDICT: not verified +EVIDENCE: Read check-instance.sh, check-user-shell.zsh, instance-99014x and 99014y check logs, the plugin-revisions logs and standalone-per-user-krew.log at target 51872a3. The author traces show two Zsh startups, k=kubectl with _kubectl, krew, neat, stern, view-secret, Zi plugin revisions and PASS lines for all four default instances. These are author executions on instances that no longer exist. I ran nothing. +CRITERION: AC-11 The PDS package loads non-interactively without installer/network side effects, preserves the caller's shell state and reports library failures; its supported standalone setup preserves Zi, the preset and the existing plugin set. Error-reporting assertions cover explicit non-interactive loading; interactive auto-loading is documented separately. +VERDICT: not verified +EVIDENCE: Read pds-release-package-tests.log at target 51872a3: the author ran 36 tests OK, including load, options and broken-library cases. I could not inspect the published package code: the offline image checks were denied and the PDS checkout and caches were out of bounds. I observed no execution. +CRITERION: AC-12 Repository checks exercise package-backed provisioning, failure paths, sealed-artifact assertions and two fresh boots of each Ubuntu amd64 output; CI reports executed versus skipped checks, and native checks preserve all pre-existing guests. +VERDICT: not verified +EVIDENCE: Read the Makefile (check echoes an explicit SKIP), check.yaml, the 44 unit tests, check-image.sh, check-instance.sh, protected.json and final-cleanup-audit.json at target 51872a3. Boot orchestration, guest snapshots and cleanup are not committed (F-02). The pre-existing guest baseline falls from seven to six without explanation (F-03). My `checks.sh builders` run was denied. Hosted CI results are author-reported links that I did not open. +CRITERION: AC-13 PDS bundles selectable VHCO, Stackweaver and preserved EdgeForge MOTD text presets; builders defaults to configurable VHCO, custom-file usage remains supported, and invalid selections leave the active MOTD and other MOTD scripts unchanged. +VERDICT: not verified +EVIDENCE: Read variables.pkr.hcl:236-244 (vhco default with validation), run-recipe.sh:10 and check-image.sh:39 at target 51872a3. The author's pds-release-package-tests.log lists the MOTD preset, EdgeForge, invalid-selection and custom-file tests as passing, and the instance cron logs show the VHCO banner. The packaged assets were not inspected because the offline checks were denied. I ran nothing. +CRITERION: AC-14 Both image outputs built with the default recipe retain one configured nightly midnight package-update job that runs non-interactively with an enabled scheduler and effective SSH settings that allow injected non-root public-key login while disabling password, keyboard-interactive and root login; repeated provisioning is safe and temporary Packer access is removed only after it is no longer needed. +VERDICT: not verified +EVIDENCE: Read check-image.sh:88-98, check-instance.sh:21-28, ssh-policy-observer.sh, and the default build logs at target 51872a3. The build logs show "SSH service evidence" three times with the same MainPID and no journal entries. The instance cron logs show only active, enabled, the gh version and the banner, with no exit status for the update command. Authentication controls appear only as ssh_auth_controls true booleans written by the controller (F-02). The silent-skip path is F-01. I observed no execution. +CRITERION: AC-15 An operator can select a readable custom Bash recipe at invocation for either output without editing the default recipe or PDS; omitted PDS update/SSH policies are not applied elsewhere, missing recipes and failed calls stop the build, and generic-image cleanup still runs. +VERDICT: not verified +EVIDENCE: Read variables.pkr.hcl:176-184 (fileexists), run-recipe.sh, custom.example.sh, check-image.sh:99-101, the native-custom and portable-custom offline logs and the instance results at target 51872a3. The author traces show both custom images passing the custom offline checks, cron_run and ssh_auth_controls false, and four custom-instance PASS lines. My unit tests and offline inspections were denied. +FINDING: F-01 +KIND: judgement +SEVERITY: should-fix +WHERE: Design, Baked update and SSH policy; packer/ubuntu/scripts/run-recipe.sh, ssh-policy-observer.sh +EVIDENCE: run-recipe.sh:17 defines pds_before_ssh_policy before line 19 sources the PDS library, so any same-named definition in PDS silently replaces it. builders_check_ssh_policy at ssh-policy-observer.sh:24 returns 0 when no snapshot exists. If the PDS hook is not called or is overridden, a recipe that applies restricted_ssh_security_profile passes with no restart evidence. The unit stub at test_pds_provisioning.py:38 always calls the hook. The 0.20.0 build logs show it fired. +PROPOSAL: Define the hook after sourcing PDS, or verify it is still builders' function. Fail run-recipe when 00-pds-security.conf was created or changed during the recipe but no snapshot was captured, and add that regression. +FINDING: F-02 +KIND: judgement +SEVERITY: should-fix +WHERE: Test Plan AC-12 and AC-14; docs/development.md Live checks +EVIDENCE: The repository has no committed procedure or script for booting the instance pairs, the permissive SSH control (ssh_pwauth true, 10-test-permissive.conf, root key), running the exact pds-update command under the cron environment, or snapshotting and comparing pre-existing guests. A grep for permissive, ssh_pwauth: true, preflight and protected under packer/ and docs/ubuntu finds only the build seed. check-instance.sh only checks sshd -T. The instance cron logs carry no exit status. The authentication results exist only as controller booleans. +PROPOSAL: Commit the bounded controller steps, or a written procedure with explicit pass conditions, for these live checks. Retain command-level traces such as exit codes and refusal messages instead of summary booleans. +FINDING: F-03 +KIND: factual +SEVERITY: should-fix +WHERE: docs/validation/0001-2026-11-05.md Ownership and final cleanup; AC-12 +EVIDENCE: 0001-2026-11-04.md:42 and 0001-2026-11-05.md:96 state that all seven original guests were preserved. 0001-2026-11-05.md:184 and evidence/protected.json record a fresh baseline of six guests (100, 101, 102, 103, 200, 201) and give no reason one is missing. +PROPOSAL: Identify the absent original guest and state when it was removed and by whom. Confirm against the earlier seven-guest hashes that no task operation removed it before claiming that all pre-existing guests were preserved. +FINDING: F-04 +KIND: judgement +SEVERITY: should-fix +WHERE: Tasks T25; packer/ubuntu/scripts/seal-image.sh:22-24 +EVIDENCE: machine-id-readonly-diagnostic.log shows systemd-machine-id-commit.service timing out after 30s, then taking 14 more seconds to exit after TERM, while / was rw. The root cause is not recorded. The sealer fix only covers the build guest. Every deployed clone boots from an empty ID and runs the same commit service. No evidence checks that a deployed instance's machine ID and DHCP client ID survive a reboot. +PROPOSAL: Record the cause of the commit stall, and add a reboot-persistence check of machine ID and DHCP identity for one instance per output. If neither is done, document this as a limit. +FINDING: F-05 +KIND: factual +SEVERITY: should-fix +WHERE: packer/ubuntu/scripts/check-image.sh:83-87; Test Plan AC-05 +EVIDENCE: The offline artifact check requires absence of authorized_keys, histories, /var/lib/cloud/seed and 50-cloud-init.conf. It does not check /etc/netplan/50-cloud-init.yaml or /var/lib/cloud/instance(s). Only the container test_sealing.sh:64 checks netplan removal, so no sealed real image has been checked for netplan identity. +PROPOSAL: Add require_absent for the cloud-init netplan file and instance state, with a negative fixture in test_artifact_checks.py. +FINDING: F-06 +KIND: judgement +SEVERITY: nit +WHERE: Design, PDS provisioning and package identity; packer/ubuntu/scripts/install-pds.sh:48 +EVIDENCE: signed-repository-install.log shows "stable/main all Packages [849 B]". That size is consistent with an index holding a single version, but this is unverified. If the repository keeps only the latest release, `apt-get install pds=0.20.0` will fail once a newer PDS is published, so this commit's pinned build would stop being reproducible. +PROPOSAL: Confirm and document whether the PDS APT repository keeps superseded versions. If it does not, document that pinned builds require a pin update after each release. + +### R-25 + +CRITERION: AC-01 A committed `create-base-template.sh` turns the official Ubuntu cloud image into a base cloud-init template on the PVE host (qemu-guest-agent embedded), repeatably; no hand-clicking. +VERDICT: not verified +EVIDENCE: checks.sh builders, target a55568b. All 16 BaseTemplateSafety, BaseImagePreparationSafety and RemoteImportSafety cases passed, covering an occupied ID, a corrupt bundle, a checksum failure, a disk shrink and cleanup refusal, all with stubbed commands. I also read evidence/bootstrap-occupied-refusal.log ("VM 990220 already exists ... nothing was changed") and bootstrap-corrupt-refusal.log (a sha256sum FAILED line). Limits: the review bundle has no log of the bundle being prepared from source or imported on a new ID, and no repeat-import record. I observed no Proxmox state, and the base 990220 has been removed. +CRITERION: AC-02 `packer init .` installs both `hashicorp/proxmox` (`1.2.4`) and `hashicorp/qemu` plugins. +VERDICT: met +EVIDENCE: checks.sh init, target a55568b. `make init` ran `packer init .` with exit 0, and `packer plugins installed` listed packer-plugin-proxmox_v1.2.4 and packer-plugin-qemu_v1.1.8. checks.sh builders then passed `packer validate .`, which loads both plugins. ubuntu.pkr.hcl pins "= 1.2.4" and "= 1.1.8". Limits: the plugin directory was mounted pre-populated and read-only, so init found the pinned plugins already present and I did not observe a fresh download. +CRITERION: AC-03 `packer build -only='proxmox-clone.ubuntu' …` clones the base and produces a **template** on the PVE node (verified via `qm config ` showing `template: 1`) with an **empty cloud-init drive** attached; no per-build `qm importdisk`/upload anywhere in the flow. The native CPU model defaults to `host` and is configurable; the template and two fresh clones use the selected default, and blank or whitespace-padded model names fail local validation. +VERDICT: not verified +EVIDENCE: Source inspection and author traces, target a55568b. variables.pkr.hcl:148-156 defaults to host and uses a trimspace guard. native-default-final-ownership.json shows template 1, cpu host, ide0 vm-990244-cloudinit and no ciuser, cipassword or sshkeys. native-*-final-build.log has no importdisk or disk upload, only file provisioner uploads into the guest. The validate-instances controller asserts cpu host and AES/AVX on the clones. Limits: no build, template or clone was executed or observed by me, and those resources are gone. No test I ran rejects blank or padded CPU names; `make check` only validates the defaults. +CRITERION: AC-04 `packer build -only='qemu.ubuntu' …` still produces the local qcow2/raw artifact. +VERDICT: not verified +EVIDENCE: checks.sh portable-default and portable-custom, target a55568b. Both mounted *-final-deployment.qcow2 disks passed read-only inspection. test_raw_export passed in checks.sh builders. Limits: I ran no QEMU build. The qcow2/raw equality and archive digests come only from the author's portable-*-final-formats.log and portable-archive-digests.json. The raw files were not mounted, and checks.sh offers no hashing mode, so I could not tie the disks to source f78ac9a myself. +CRITERION: AC-05 Both native and portable sealed outputs contain no site-specific hostname, static IP/netplan identity or SSH host keys; two independently initialized instances of each output receive distinct machine IDs and host keys and apply their supplied identities. +VERDICT: not verified +EVIDENCE: checks.sh native-default, native-custom, portable-default and portable-custom, target a55568b. All four ran the repaired check-image.sh and passed. It confirmed an empty machine-id, hostname localhost, no ssh_host_* keys and no /etc/netplan/50-cloud-init.yaml, /var/lib/cloud/instance, instances or seed. So R-24 F-05 is repaired and exercised on real artifacts. test_cloud_init_network_and_instance_state_fail_offline_inspection passed. Limits: the eight boots are author traces only. The per-instance results and final-eight-instance-audit.json show 8 distinct machine, client, ed25519 host-key and hostname values. The reboot JSONs for 990242 and 990249 show changed boot IDs with the same machine ID, DHCP client ID and ed25519 fingerprint. I executed none of these, and the instances are gone. +CRITERION: AC-06 The sealed image retains no build password, authorized keys or generated SSH policy override. The default Ubuntu account may remain only locked and keyless, with its standard sudo policy. Usable deployed users, keys and site-specific identity are supplied at clone time; the default recipe's PDS SSH baseline remains effective after fresh cloud-init initialization. +VERDICT: not verified +EVIDENCE: checks.sh sealing-normal, sealing-transient and the four disk modes, target a55568b. Both sealing runs reproduced "passwordauthentication yes" and then printed PASS. The transient run passed with a read-only bind-mounted /etc/machine-id, which truncate could only clear after `systemd-machine-id-setup --commit`. All four disks have an ubuntu shadow hash of '*', no authorized_keys, no 50-cloud-init.conf and allowlisted build homes. Limits: the requirement that the baseline stays effective after fresh cloud-init, and that clone-time users and keys work, rests only on author authentication-events.jsonl and instance logs. I observed no boot. +CRITERION: AC-07 Short root and Ubuntu READMEs link canonical procedures for both output selections, PDS bootstrap, SSH/debugging and recovery; small flow diagrams use Mermaid and Proxmox is explicitly optional. +VERDICT: met +EVIDENCE: Inspection at target a55568b. I read readme.md, packer/readme.md, packer/ubuntu/readme.md and docs/ubuntu/*.md, including the new live-validation.md. I grepped every relative link and checked each target file and anchor heading by glob and grep (provisioning.md#supply-the-deployed-identity, #choose-a-different-recipe, proxmox.md stage 1, recovery.md#rebuild-when-the-bundle-is-also-lost, local-build.md#prerequisites, pds/readme.md#retain-reproducible-package-inputs). All resolve. Mermaid blocks are at packer/ubuntu/readme.md:35 and docs/ubuntu/image-pipeline.md:7, and all three READMEs call Proxmox optional. Limits: I did not render the diagrams or follow the procedures live. +CRITERION: AC-08 Both builders install the exact selected PDS package, verify its identity and provenance, and fail on missing, mismatched or untrusted inputs; candidate-package testing is distinguished from a verified signed-repository release build. +VERDICT: not verified +EVIDENCE: checks.sh builders and the four disk modes, target a55568b. All 9 PdsProvisioning tests passed, covering wrong checksum, name and version, trust failure without fallback, exact version request and the candidate failing a signed check. On all four disks the actual dpkg status shows pds 0.20.0 "install ok installed" for architecture all. pds.list is the signed-by source, and the key fingerprint is 37C7D029C0FE4DB0E66E5F72AFA1101D94CBF301. pds.json reports signed-repository with an empty candidate_sha256. Limits: the failure-path tests intercept apt and gpg, so I saw no real rejection of an untrusted repository. I could not hash the disks or the .deb (expected d73c3c94...) to tie them to f78ac9a and the published release. +CRITERION: AC-09 The shared provisioner applies native Ubuntu settings and the default recipe's explicit PDS function selection for Zi/Powerlevel10k, MOTD, GitHub CLI, kubectl, Krew, neat/view-secret/stern, nightly package updates and restricted SSH; reusable implementations live in the standalone PDS package, and selected-function failures stop provisioning. +VERDICT: not verified +EVIDENCE: checks.sh builders, pds and the disk modes, target a55568b. The default/custom selection and missing-library or failed-call tests passed, and the observer ownership tests passed. The PDS suite passed 36 tests against the installed 0.20.0 package, and the hook guard is in ssh_security.sh:36. The default disks contain 90-pds, the policy file and the midnight cron line. Limits: my disk checks did not inspect gh, kubectl, Krew or the plugin binaries. Real provisioning of these tools is only in the author build and instance logs. +CRITERION: AC-10 A new deployment user of a default-recipe image receives working Zsh/Powerlevel10k, the kubectl alias/completion, Krew and the neat, view-secret and stern plugins from either output, with its configured Zsh login shell and sudo policy and without inheriting build credentials or build-home paths. Zi populates the existing plugin set on first shell startup with network access; no image-prefetched plugin cache is required. +VERDICT: not verified +EVIDENCE: checks.sh builders (UserShell tests) and the disk modes, target a55568b. The disks show no /root or /home/ubuntu paths in skel configuration and allowlisted build homes. Limits: fresh-user Zsh, kubectl, Krew and plugin execution and the Zi first-login downloads appear only in author traces, such as instance-990249-plugin-revisions.log with five plugin commits and standalone-per-user-krew.log. I observed none of it. +CRITERION: AC-11 The PDS package loads non-interactively without installer/network side effects, preserves the caller's shell state and reports library failures; its supported standalone setup preserves Zi, the preset and the existing plugin set. Error-reporting assertions cover explicit non-interactive loading; interactive auto-loading is documented separately. +VERDICT: not verified +EVIDENCE: checks.sh pds, target a55568b, with the e25f603 snapshot tests against the mounted 0.20.0 .deb in a network-none container. All 36 tests passed, including strict load without installers, option preservation, missing and broken library reporting, the standalone shell and asset paths, and preset/Zi configuration. Limits: the Zi tests use a stub. The test plan's real selected-installer and new-user coverage exists only in author instance traces. I could not hash the .deb against the published digest. +CRITERION: AC-12 Repository checks exercise package-backed provisioning, failure paths, sealed-artifact assertions and two fresh boots of each Ubuntu amd64 output; CI reports executed versus skipped checks, and native checks preserve all pre-existing guests. +VERDICT: not verified +EVIDENCE: checks.sh builders, target a55568b. All 47 tests, fmt, validate, ShellCheck and the zsh syntax check passed, and make printed an explicit live-test "SKIP:" line. I read the live-validation.md procedure. Limits: I observed no hosted CI at this head, and T29 is open. The fresh boots are author-only. Guest preservation evidence is limited to the protected.json preflight (six hashes) and a boolean-only final-cleanup-audit.json (F-01). Guest 104 was deleted by root@pam inside the campaign window (F-02). +CRITERION: AC-13 PDS bundles selectable VHCO, Stackweaver and preserved EdgeForge MOTD text presets; builders defaults to configurable VHCO, custom-file usage remains supported, and invalid selections leave the active MOTD and other MOTD scripts unchanged. +VERDICT: met +EVIDENCE: checks.sh pds and all four disk modes, target a55568b. In the installed 0.20.0 package, all four MotdPresets tests passed: packaging and switching of all presets, EdgeForge preserving the legacy banner, custom-file and standalone resolution, and invalid selection preserving the active banner and scripts. test_motd_manages_only_its_own_script also passed. On every disk, /etc/pds/motd-banner equals the bundled vhco.txt and all three preset files exist. variables.pkr.hcl defaults the configurable preset to vhco, and the export test passed. Limits: banner comparison is text equality only, and I did not hash the .deb or the disks. +CRITERION: AC-14 Both image outputs built with the default recipe retain one configured nightly midnight package-update job that runs non-interactively with an enabled scheduler and effective SSH settings that allow injected non-root public-key login while disabling password, keyboard-interactive and root login; repeated provisioning is safe and temporary Packer access is removed only after it is no longer needed. +VERDICT: not verified +EVIDENCE: checks.sh pds, builders, sealing modes and the default disks, target a55568b. The PDS baseline tests passed: repeatable update job, modified conffile, bounded lock contention, SSH precedence and rollback, and no reload. The default disks carry the exact `0 0 * * * root /usr/local/sbin/pds-update` line and the four policy lines. The repaired observer passed both regressions. Limits: cron execution (EXACT_CRON_COMMAND and UPDATE_EXIT_CODE=0 logs), the 34 authentication events and the build-side PID and journal evidence (three identical MainPID blocks with "-- No entries --") are author traces. The fixture did not capture sshd -T while the permissive file and the baseline were both present (F-03). +CRITERION: AC-15 An operator can select a readable custom Bash recipe at invocation for either output without editing the default recipe or PDS; omitted PDS update/SSH policies are not applied elsewhere, missing recipes and failed calls stop the build, and generic-image cleanup still runs. +VERDICT: not verified +EVIDENCE: checks.sh builders, native-custom and portable-custom, target a55568b. The recipe selection, missing-recipe and failed-call tests passed. An unchanged-policy custom recipe passes the digest guard. Both custom disks lack 00-pds-security.conf and the pds-update job, carry the VHCO banner and pass all cleanup and identity assertions. Limits: the custom builds and four custom boots are author traces only. The Packer guard checks existence, not readability (F-04). +FINDING: F-01 +KIND: judgement +SEVERITY: should-fix +WHERE: docs/validation/0001-2026-11-05.md Rebuilt validation (lines 275-279); evidence final-cleanup-audit.json; AC-12 +EVIDENCE: cleanup-sanitized.txt:190-192 writes protected_configs_and_states_unchanged=True and the other fields as constants after the asserts pass. final-cleanup-audit.json and final-eight-instance-audit.json retain only booleans and counts. No post-run guest config hashes, power states or storage hashes are retained, so I cannot compare preflight digests with the audit evidence myself. Authentication and cron now have command-level traces, but guest preservation, the part R-24 F-02 also covered, does not. +PROPOSAL: Retain the observed post-cleanup per-guest config SHA256, status and normalized storage hashes beside protected.json and protected-storage.json, and derive the summary from those values. +FINDING: F-02 +KIND: factual +SEVERITY: should-fix +WHERE: docs/validation/0001-2026-11-05.md:184-190 and :211-212; AC-12 +EVIDENCE: historical-guest104-delete.json records qmdestroy 104 by root@pam at 06:51:23-24 UTC. The record says that principal "does not identify the person or process". It does not disclose that this task's own controllers authenticate to the API as root@pam (cleanup-sanitized.txt:88). So the task record cannot exclude a task operation in the 04:57 to 07:50 window, which R-24 F-03 asked to confirm. The current run's audit only covers its own six-guest snapshot. +PROPOSAL: State that the task controllers used the same root@pam principal, so this record neither identifies nor excludes a task operation. Keep AC-12's guest-preservation claim scoped to each run's own snapshot, and name no actor. +FINDING: F-03 +KIND: factual +SEVERITY: nit +WHERE: docs/ubuntu/live-validation.md:139; evidence validate-instances-sanitized.txt:258-268, 358-366; validation record :268-270 +EVIDENCE: The procedure says to keep 00-pds-security.conf in place with the permissive file and check sshd -T first. The controller writes the permissive file and moves the policy aside in the same step. The baseline-wins condition is only shown through the later authentication refusals, and sshd -T is captured only after the fixture is restored and the guest rebooted. Persistence compares only the ed25519 fingerprint. "Result=success" with ActiveState inactive does not show that systemd-machine-id-commit actually ran, though the record calls it "a successful machine-ID commit-service result". +PROPOSAL: Capture sshd -T with both files present before moving the policy, compare all host-key types, and describe the commit-service observation as "not failed". +FINDING: F-04 +KIND: factual +SEVERITY: nit +WHERE: packer/ubuntu/variables.pkr.hcl:31-34; Test Plan AC-15 +EVIDENCE: The validation is `fileexists(var.provisioning_recipe)` with the message "Select an existing readable Bash recipe". The test plan requires rejecting an unreadable recipe before building. An existing but unreadable file passes validation, and the build only fails later at the file upload or at run-recipe.sh:7 inside the guest. +PROPOSAL: Either add a readability check (for example `can(file(...))`) or reword the message and test plan to match existence-only validation plus the in-guest failure. + +### R-26 + +CRITERION: AC-01 A committed `create-base-template.sh` turns the official Ubuntu cloud image into a base cloud-init template on the PVE host (qemu-guest-agent embedded), repeatably; no hand-clicking. +VERDICT: not verified +EVIDENCE: checks.sh builders, target eca9c59 (HEAD verified, tree clean). All 16 BaseTemplateSafety, BaseImagePreparationSafety and RemoteImportSafety cases passed with stubbed commands. They cover an occupied ID, a corrupt or partial bundle, an upstream checksum failure, a disk shrink and refused cleanup. I read the author traces evidence/base-import.log (base.qcow2 OK twice, import to 990220, cloudinit ide2, agent enabled=1, "Base template created"), bootstrap-occupied-refusal.log and bootstrap-corrupt-refusal.log. git diff f78ac9a..eca9c59 shows no change to the bootstrap scripts. Limits: I ran no bootstrap or import and observed no Proxmox state. No retained trace shows a repeat import of the same bundle on another ID, or that qemu-guest-agent is present inside the base disk. Base 990220 has been removed. +CRITERION: AC-02 `packer init .` installs both `hashicorp/proxmox` (`1.2.4`) and `hashicorp/qemu` plugins. +VERDICT: met +EVIDENCE: checks.sh init, target eca9c59. `make init` ran `packer init .` with exit 0, and `packer plugins installed` listed packer-plugin-proxmox_v1.2.4 and packer-plugin-qemu_v1.1.8. checks.sh builders then ran `packer validate .`, which reported "The configuration is valid." and so loaded both plugins. ubuntu.pkr.hcl pins both versions exactly. Limits: the plugin directory was mounted pre-populated and read-only, so I did not observe a fresh download. +CRITERION: AC-03 `packer build -only='proxmox-clone.ubuntu' …` clones the base and produces a **template** on the PVE node (verified via `qm config ` showing `template: 1`) with an **empty cloud-init drive** attached; no per-build `qm importdisk`/upload anywhere in the flow. The native CPU model defaults to `host` and is configurable; the template and two fresh clones use the selected default, and blank or whitespace-padded model names fail local validation. +VERDICT: not verified +EVIDENCE: Source inspection and author traces, target eca9c59. variables.pkr.hcl:148-156 defaults proxmox_cpu_type to host and requires a non-empty value equal to its trimspace. In the author's native-default-final-ownership.json, template 990244 shows template 1, cpu host, ide0 vm-990244-cloudinit and no ciuser, cipassword or sshkeys. validate-instances-sanitized.txt:335-337 asserts cpu host and the AES and AVX flags on each native clone. Limits: I executed no native build or clone, and those resources are gone. None of the 48 tests rejects a blank or padded CPU name; make check only validates the defaults. +CRITERION: AC-04 `packer build -only='qemu.ubuntu' …` still produces the local qcow2/raw artifact. +VERDICT: not verified +EVIDENCE: checks.sh hashes, portable-default and portable-custom, target eca9c59. Both transferred archives match portable-archive-digests.json (04159380... and e4f708f5...). In each archive, the ubuntu-noble-amd64.qcow2 member is byte-identical to the deployment qcow2 I inspected. Both disks passed the read-only checks, and test_raw_export passed. Limits: I ran no QEMU build. The qcow2 and raw equality comes only from the author's portable-*-final-formats.log, because no raw file was mounted for me. The disks are tied to f78ac9a only through the author's build-inputs.json. +CRITERION: AC-05 Both native and portable sealed outputs contain no site-specific hostname, static IP/netplan identity or SSH host keys; two independently initialized instances of each output receive distinct machine IDs and host keys and apply their supplied identities. +VERDICT: not verified +EVIDENCE: checks.sh native-default, native-custom, portable-default and portable-custom, target eca9c59. All four real disks passed check-image.sh. Each has an empty machine-id, hostname localhost, no ssh_host_* keys, no /etc/netplan/50-cloud-init.yaml and no /var/lib/cloud instance, instances or seed state. test_cloud_init_network_and_instance_state_fail_offline_inspection passed. The native disk hashes match native-*-artifact.json. Limits: the eight boots exist only as author traces. They show eight distinct machine IDs, client IDs, ed25519 keys and hostnames. In the reboot JSONs for 990242 and 990249, the boot IDs change while the machine ID, client ID and ed25519 fingerprint persist. Only ed25519 was measured. I booted nothing, and the instances are gone. +CRITERION: AC-06 The sealed image retains no build password, authorized keys or generated SSH policy override. The default Ubuntu account may remain only locked and keyless, with its standard sudo policy. Usable deployed users, keys and site-specific identity are supplied at clone time; the default recipe's PDS SSH baseline remains effective after fresh cloud-init initialization. +VERDICT: not verified +EVIDENCE: checks.sh sealing-normal, sealing-transient and the four disk modes, target eca9c59. Both sealing runs reproduced "passwordauthentication yes" with real cloud-init and then printed PASS. The transient run kept the read-only mounted public ID until seal-image.sh committed it; the test exits on a non-mount fallback write, and transient-sealing-red.log shows the earlier truncate failure. All four disks pass the locked-ubuntu ('*'), no authorized_keys, no 50-cloud-init.conf and allowlisted build-home checks. Limits: whether clone-time users and keys work, and whether the baseline stays effective after fresh cloud-init, rests on author authentication-events.jsonl and instance logs. I observed no boot. +CRITERION: AC-07 Short root and Ubuntu READMEs link canonical procedures for both output selections, PDS bootstrap, SSH/debugging and recovery; small flow diagrams use Mermaid and Proxmox is explicitly optional. +VERDICT: met +EVIDENCE: Inspection at target eca9c59. I read readme.md, packer/readme.md, packer/ubuntu/readme.md, docs/development.md and docs/ubuntu/*.md, including the changed live-validation.md and recovery.md. I extracted every relative link with grep and checked each target and anchor: provisioning.md#supply-the-deployed-identity and #choose-a-different-recipe, local-build.md#prerequisites, recovery.md#rebuild-when-the-bundle-is-also-lost, proxmox.md#stage-1-build-a-golden-template and pds/readme.md#retain-reproducible-package-inputs. All resolve. Mermaid blocks are at packer/ubuntu/readme.md:35 and docs/ubuntu/image-pipeline.md:7, and all three READMEs call Proxmox optional. Limits: I did not render the diagrams or follow the procedures live. +CRITERION: AC-08 Both builders install the exact selected PDS package, verify its identity and provenance, and fail on missing, mismatched or untrusted inputs; candidate-package testing is distinguished from a verified signed-repository release build. +VERDICT: not verified +EVIDENCE: checks.sh hashes, builders and the four disk modes, target eca9c59. The mounted .deb hashes to d73c3c94...6abc. All 9 PdsProvisioning tests passed, covering wrong checksum, name and version, trust failure without fallback, an exact version request and a candidate failing a signed check. Every disk's actual dpkg status shows pds 0.20.0, "install ok installed", architecture all. Each disk has the signed-by pds.list, and its keyring fingerprint is 37C7D029C0FE4DB0E66E5F72AFA1101D94CBF301. pds.json reports signed-repository with an empty candidate_sha256. Limits: the failure tests stub apt and gpg, so I saw no real rejection of an untrusted repository. I observed no build installing the package. My checks match the .deb to the expected digest, not to the live release asset. +CRITERION: AC-09 The shared provisioner applies native Ubuntu settings and the default recipe's explicit PDS function selection for Zi/Powerlevel10k, MOTD, GitHub CLI, kubectl, Krew, neat/view-secret/stern, nightly package updates and restricted SSH; reusable implementations live in the standalone PDS package, and selected-function failures stop provisioning. +VERDICT: not verified +EVIDENCE: checks.sh builders, pds and the disk modes, target eca9c59. The recipe selection, missing-library, failed-call and observer-ownership tests passed (test_library_cannot_replace_the_builders_ssh_observer and test_policy_change_without_observation_fails_but_unchanged_custom_passes). run-recipe.sh now defines the hook after sourcing PDS and fails when the policy digest changes without a snapshot. All 36 PDS tests passed against the installed 0.20.0. The default disks carry the policy, the midnight job and the VHCO banner. Limits: my disk checks did not look for gh, kubectl, Krew or the plugin binaries. Real tool provisioning appears only in author build and instance logs. +CRITERION: AC-10 A new deployment user of a default-recipe image receives working Zsh/Powerlevel10k, the kubectl alias/completion, Krew and the neat, view-secret and stern plugins from either output, with its configured Zsh login shell and sudo policy and without inheriting build credentials or build-home paths. Zi populates the existing plugin set on first shell startup with network access; no image-prefetched plugin cache is required. +VERDICT: not verified +EVIDENCE: checks.sh builders (3 UserShell tests passed) and the four disk modes (allowlisted build homes, no build keys), target eca9c59. Limits: fresh-user Zsh, kubectl, Krew and plugin execution, and the Zi first-login downloads, appear only in author traces, for example instance-99024x-check.log, the plugin-revisions logs and standalone-per-user-krew.log. I observed none of it, and the instances are gone. +CRITERION: AC-11 The PDS package loads non-interactively without installer/network side effects, preserves the caller's shell state and reports library failures; its supported standalone setup preserves Zi, the preset and the existing plugin set. Error-reporting assertions cover explicit non-interactive loading; interactive auto-loading is documented separately. +VERDICT: not verified +EVIDENCE: checks.sh pds, target eca9c59. The e25f603 snapshot tests ran against the installed published .deb in a network-none container, and all 36 passed. They include strict load without installers, option preservation, missing, broken and empty library reporting, standalone asset fetching only when configuring, and existing preset and Zi use. Limits: the Zi tests use stubs, and the test plan's real selected-installer and new-user coverage exists only in author instance traces. The snapshot origin is attested, not verified by me. I did not inspect the separate documentation of interactive auto-loading. +CRITERION: AC-12 Repository checks exercise package-backed provisioning, failure paths, sealed-artifact assertions and two fresh boots of each Ubuntu amd64 output; CI reports executed versus skipped checks, and native checks preserve all pre-existing guests. +VERDICT: not verified +EVIDENCE: checks.sh builders, observations and lifecycle, target eca9c59. make check ran 48 tests: 47 ok plus the explicit root skip of the readability case. It also passed fmt, validate, ShellCheck and the Zsh syntax check, then printed an explicit "SKIP:" line for the live tests. observations derived six per-guest hash and state matches and two normalized storage matches from post-cleanup-observed.json (11:12:59 UTC), with no owned resources. vh-adlc lint passed, and fresh reports R-25 stale. Limits: I observed no hosted CI at this head, and the boots are author-only. The observation is author-produced, and the script that produced it is not retained. Raw storage hashes differ (F-01). Guest 104's deletion remains unattributed, so preservation holds only per snapshot. +CRITERION: AC-13 PDS bundles selectable VHCO, Stackweaver and preserved EdgeForge MOTD text presets; builders defaults to configurable VHCO, custom-file usage remains supported, and invalid selections leave the active MOTD and other MOTD scripts unchanged. +VERDICT: met +EVIDENCE: checks.sh pds, builders, hashes and all four disk modes, target eca9c59. In the installed 0.20.0 package, whose digest matches d73c3c94..., all four MotdPresets tests passed. They cover packaging and switching of all presets, EdgeForge preserving the legacy banner, custom-file and standalone resolution, and invalid selection preserving the active banner and scripts. test_motd_manages_only_its_own_script also passed. On every disk, /etc/pds/motd-banner equals the bundled vhco.txt and all three preset files exist. variables.pkr.hcl defaults the validated, configurable preset to vhco. Limits: banner checks compare text only, and custom-file use was exercised in the container, not on an image. +CRITERION: AC-14 Both image outputs built with the default recipe retain one configured nightly midnight package-update job that runs non-interactively with an enabled scheduler and effective SSH settings that allow injected non-root public-key login while disabling password, keyboard-interactive and root login; repeated provisioning is safe and temporary Packer access is removed only after it is no longer needed. +VERDICT: not verified +EVIDENCE: checks.sh pds, builders, sealing modes and the default disks, target eca9c59. The PDS baseline tests passed: a repeatable update job, a modified conffile, bounded lock contention, SSH precedence, rollback and no reload. The default disks carry the exact midnight pds-update line and the policy file. The observer regressions passed. Limits: these are author traces only: the four cron logs with UPDATE_EXIT_CODE=0, 34 authentication events (18 successes and 16 refusals, refused while both files were present per validate-instances-sanitized.txt:268-271) and the build-side PID and journal evidence. No sshd -T was captured at the two-file point. I booted nothing. +CRITERION: AC-15 An operator can select a readable custom Bash recipe at invocation for either output without editing the default recipe or PDS; omitted PDS update/SSH policies are not applied elsewhere, missing recipes and failed calls stop the build, and generic-image cleanup still runs. +VERDICT: not verified +EVIDENCE: checks.sh recipe-readability, builders, native-custom and portable-custom, target eca9c59. As the unprivileged caller, real Packer rejected a mode-000 recipe with "readable Bash recipe", and the test passed. The git diff shows only fileexists replaced by can(file(...)), plus the test and the Makefile PACKER pass-through. Selection, missing-recipe and failed-call tests passed. Both custom disks lack 00-pds-security.conf and pds-update and pass cleanup. Limits: the custom builds and four boots are author traces at f78ac9a, not builds of the later guard. +FINDING: F-01 +KIND: factual +SEVERITY: nit +WHERE: docs/validation/0001-2026-11-05.md:297-301; evidence post-cleanup-observed.json, protected-storage.json +EVIDENCE: The record says the observation retains "raw and normalized hashes" and that "all values match". The raw storage hashes differ: local is 15ae35e9... before and e0484cbc... after, and local-lvm is 1a965ec1... before and e89a47e5... after. Only the normalized hashes match. cleanup-sanitized.txt:125-127 shows the normalization drops digest and sorts content. The record does not state this rule, and the 11:12:59 observer source is not retained. +PROPOSAL: State that the raw storage hashes changed and only normalized values match, and name the normalization rule. Retain the observing script or command so the guest hash scheme can be checked. + +### R-27 + +CRITERION: AC-01 A committed `create-base-template.sh` turns the official Ubuntu cloud image into a base cloud-init template on the PVE host (qemu-guest-agent embedded), repeatably; no hand-clicking. +VERDICT: met +EVIDENCE: Once inspected, I ran checks.sh start-live once and checks.sh repeat-import once, then read prepare-base.log, base-import.log, base-ownership.json, bootstrap-occupied-refusal.log, bootstrap-corrupt-refusal.log, repeat-base-import.log, repeat-base-ownership.json, repeat-import-complete.json and repeat-import-controller.log, and ran checks.sh base-agent. The upstream image checksum was OK. virt-customize installed qemu-guest-agent and the build asserted that /etc/machine-id was empty. The committed create-base-template.sh, run from the builders-offnode-import container, created template 990320 with template 1, agent enabled=1, a cloudinit drive and ipconfig0 dhcp. base-agent read the base.qcow2 dpkg status and printed "qemu-guest-agent install ok installed" for 1:8.2.2+ds-0ubuntu1.18. A second import of the same bundle on unused ID 990336 printed "Base template created" and had the same fixed configuration; only the generated MAC, UUID and IDs differed. Occupied ID 990320 was refused with "nothing was changed". The corrupt bundle failed with "base.qcow2: FAILED", and protected guests were unchanged. Limitations: I did not inspect the import container image to confirm that Packer and libguestfs are absent. The scratch cleanup's first DELETE for 990336 was refused HTTP 501 and redone by a guarded cleanup with query encoding. That was harness code only. + +CRITERION: AC-02 `packer init .` installs both `hashicorp/proxmox` (`1.2.4`) and `hashicorp/qemu` plugins. +VERDICT: met +EVIDENCE: I ran checks.sh init: make init exited 0 and packer plugins installed listed hashicorp/proxmox v1.2.4 and hashicorp/qemu v1.1.8. I ran checks.sh builders: make check showed "The configuration is valid." fresh-packer-init.log for the live run shows both plugins freshly installed. Limitation: the init mode mounts a plugin directory that is already populated. + +CRITERION: AC-03 `packer build -only='proxmox-clone.ubuntu' …` clones the base and produces a **template** on the PVE node (verified via `qm config ` showing `template: 1`) with an **empty cloud-init drive** attached; no per-build `qm importdisk`/upload anywhere in the flow. The native CPU model defaults to `host` and is configurable; the template and two fresh clones use the selected default, and blank or whitespace-padded model names fail local validation. +VERDICT: met +EVIDENCE: I read native-default-final-build.log, native-custom-final-build.log, the two -final-ownership.json files and validate-instances.py, and ran checks.sh cpu-validation. Both native builds ran with a temporary VM-scoped API identity, which the log reports as removed. Ownership configs 990344 and 990345 show template 1, cpu host and an ide0 cloudinit volume, with no ciuser, cipassword, sshkeys or ipconfig. Searching both native build logs for importdisk, import-from and upload found only Packer provisioner file uploads into the guest, and no disk import or disk upload. For each of the four native clones, validate-instances.py asserts the cpu is host and greps the aes and avx flags. All four printed "Fresh instance passed" and all 94 guest-command-exits.jsonl entries are exit 0. cpu-validation ran real packer validate: host and kvm64 exited 0; blank, leading-space and trailing-space values exited 1 with "The Proxmox CPU type must be a non-empty model name without surrounding whitespace". Limitations: config was read through the Proxmox API config endpoint rather than the qm CLI. The first cpu-validation run failed on a harness message assertion; the blank value was already refused with exit 1, and the rerun passed all five cases. + +CRITERION: AC-04 `packer build -only='qemu.ubuntu' …` still produces the local qcow2/raw artifact. +VERDICT: met +EVIDENCE: I read portable-default-final-build.log and portable-custom-final-build.log ("Build 'qemu.ubuntu' finished", export-raw.sh post-processor). I ran checks.sh portable-default-formats and portable-custom-formats. Each extracted ubuntu-noble-amd64.raw from the transferred archive (raw, virtual size 10737418240), compared it against the deployment qcow2 and printed "Images are identical." I ran checks.sh hashes: each archive digest matches the digest recorded on the runner, and the archive qcow2 member matches the deployment qcow2 (default 9e43e2de.../dca93244..., custom 7a8120b5.../29225abe...). Limitation: the builds ran inside the owned nested-KVM runner and I observed their logs, not the runner shell. + +CRITERION: AC-05 Both native and portable sealed outputs contain no site-specific hostname, static IP/netplan identity or SSH host keys; two independently initialized instances of each output receive distinct machine IDs and host keys and apply their supplied identities. +VERDICT: met +EVIDENCE: I ran checks.sh native-default, native-custom, portable-default and portable-custom, which mount the individual disks read-only. Each printed the repository check-image.sh PASS line. check-image.sh asserts hostname localhost, no ssh_host keys and no 50-cloud-init netplan or seed. The four -final-offline.log files also say PASS. I read the four *-final-instance-results.json files and final-eight-instance-audit.json: 8 instances with 8 unique machine IDs, host keys, DHCP client IDs, hostnames and injected keys. Each pair applied its supplied hostname (pds-nd1/nd2, nc1/nc2, pd1/pd2, pc1/pc2) and user, and key login succeeded in authentication-events.jsonl. Limitation: applied static IP identity was not exercised; the instances used DHCP. + +CRITERION: AC-06 The sealed image retains no build password, authorized keys or generated SSH policy override. The default Ubuntu account may remain only locked and keyless, with its standard sudo policy. Usable deployed users, keys and site-specific identity are supplied at clone time; the default recipe's PDS SSH baseline remains effective after fresh cloud-init initialization. +VERDICT: met +EVIDENCE: I ran checks.sh sealing-normal and sealing-transient (network-none container with real cloud-init). Both printed "Reproduced temporary build policy: passwordauthentication yes" then "PASS: build password, SSH override, keys and identity removed." On all four disks, check-image.sh passed: the ubuntu shadow field is '*', there are no root or ubuntu authorized_keys or history, and there is no 50-cloud-init sshd override. Fresh default instances 990342, 990343, 990349 and 990350 accepted only the clone-time user key. For 990342 and 990349, instance-*-two-file-sshd-T.log shows permitrootlogin no, passwordauthentication no, kbdinteractiveauthentication no and pubkeyauthentication yes with the permissive drop-in present. The two identity-reboot.json files repeat these values after reboot. Limitation: the standard ubuntu sudo policy was inferred from source and image checks; it was not exercised as that user. + +CRITERION: AC-07 Short root and Ubuntu READMEs link canonical procedures for both output selections, PDS bootstrap, SSH/debugging and recovery; small flow diagrams use Mermaid and Proxmox is explicitly optional. +VERDICT: met +EVIDENCE: I inspected readme.md, packer/readme.md, packer/ubuntu/readme.md, recovery.md and docs/ubuntu guides at 9f4db43 with grep and glob. Every relative link target and anchor exists. Mermaid blocks are at packer/ubuntu/readme.md:35 and docs/ubuntu/image-pipeline.md:7. All three READMEs state Proxmox is optional. Limitations: I did not render the diagrams or follow the guides through a live SSH or VNC session. + +CRITERION: AC-08 Both builders install the exact selected PDS package, verify its identity and provenance, and fail on missing, mismatched or untrusted inputs; candidate-package testing is distinguished from a verified signed-repository release build. +VERDICT: met +EVIDENCE: All four builds logged "Installed PDS 0.20.0 (signed-repository)". All four artifact modes show: +- dpkg pds 0.20.0, install ok installed, Architecture all +- a signed-by pds.list source +- key fingerprint 37C7D029C0FE4DB0E66E5F72AFA1101D94CBF301 +- pds.json provenance source signed-repository with an empty candidate_sha256 + +The four instance-*-package.json files match this. checks.sh release-metadata showed 0.20.0 is not a draft or prerelease, with asset digest d73c3c94...6abc; checks.sh hashes matched the deb. I ran checks.sh real-bootstrap-refusals after the harness gpg-agent fixture repair: +- Real refusals for checksum, version, missing candidate and fingerprint each exited 1 with no package or provenance. +- An APT repository-signature refusal exited 100 with NO_PUBKEY. + +Limitation: package-name mismatch and missing-function rejection were observed only through the passing make check unit tests, not live. + +CRITERION: AC-09 The shared provisioner applies native Ubuntu settings and the default recipe's explicit PDS function selection for Zi/Powerlevel10k, MOTD, GitHub CLI, kubectl, Krew, neat/view-secret/stern, nightly package updates and restricted SSH; reusable implementations live in the standalone PDS package, and selected-function failures stop provisioning. +VERDICT: met +EVIDENCE: The native-default and portable-default build logs show: +- the recipe run (recipe SHA256 0e29b773..., matching build-inputs.json) +- Krew plus neat, view-secret and stern installed +- cron enabled +- "SSH policy installed and validated" + +The default instance check and cron logs show gh 2.103.3, kubectl, krew list, the three plugins, the VHCO MOTD and an active, enabled cron. The PDS functions come from the installed signed 0.20.0 package; the 36 PDS tests passed in checks.sh pds. make check (48 tests, 1 root-only skip covered separately by checks.sh recipe-readability) passed, including propagation of recipe and selected-function failures. Limitation: failure propagation was observed in unit tests, not a live failing build. + +CRITERION: AC-10 A new deployment user of a default-recipe image receives working Zsh/Powerlevel10k, the kubectl alias/completion, Krew and the neat, view-secret and stern plugins from either output, with its configured Zsh login shell and sudo policy and without inheriting build credentials or build-home paths. Zi populates the existing plugin set on first shell startup with network access; no image-prefetched plugin cache is required. +VERDICT: met +EVIDENCE: For the four default instances (native 990342/990343, portable 990349/990350), each instance-*-check.log ends "PASS: default fresh-user tooling, shell and selected policy checks." The logs show: +- Zi first-login Cloning of zsh-syntax-highlighting, history-substring-search, zsh-z, zsh-readline and powerlevel10k +- a second startup with k=kubectl, _kubectl completion, and krew, neat, stern and view-secret listed + +instance-*-plugin-revisions.log records the downloaded commits. Results JSON shows shell /usr/bin/zsh. check-instance.sh runs sudo -n and the shared KREW_ROOT tree. standalone-per-user-krew.log ends "kubectl and required Krew plugins installed", and the controller printed "shared tree unchanged". check-image.sh rejected /root/ and /home/ubuntu/ paths in shared configuration on all four disks. + +CRITERION: AC-11 The PDS package loads non-interactively without installer/network side effects, preserves the caller's shell state and reports library failures; its supported standalone setup preserves Zi, the preset and the existing plugin set. Error-reporting assertions cover explicit non-interactive loading; interactive auto-loading is documented separately. +VERDICT: met +EVIDENCE: checks.sh pds installed the published 0.20.0 deb in a network-none container and ran 36 tests, all OK. They cover strict load, missing library, caller state, Zi/preset repeatability, MOTD presets, the update job and the standalone path. checks.sh pds-release-source showed tag 0.20.0 is 046b141, one commit ahead of tested snapshot e25f603 with an empty file list. Interactive auto-loading via /etc/profile.d/pds.sh is documented in pds-release-packaging-guide.md and in the package Description I read from dpkg status on the disks. Limitation: the guide copy was fetched by the dispatcher; I did not fetch it myself. + +CRITERION: AC-12 Repository checks exercise package-backed provisioning, failure paths, sealed-artifact assertions and two fresh boots of each Ubuntu amd64 output; CI reports executed versus skipped checks, and native checks preserve all pre-existing guests. +VERDICT: met +EVIDENCE: make check (checks.sh builders) passed fmt, validate, ShellCheck, zsh -n and 48 tests, including negative artifact fixtures, and printed the explicit "SKIP: real image builds" line. Hosted run 42093139484 at 9f4db43 concluded success (checks.sh ci and gh run list); its log shows the 48 tests and the SKIP line. Live, the repository check-image.sh and check-instance.sh ran on four artifacts and eight fresh boots, two per output and recipe. protected.json snapshotted 6 pre-existing guests. final-cleanup-audit.json records removal of only 990344, 990345, 990324 and 990320. I ran checks.sh observations against raw post-cleanup-observed.json captured after independent-run-complete.json: all 6 guest config hashes and power states match, normalized storage hashes match, and no owned guests, volumes, temporary storage or API users remain. Limitation: raw storage hashes for local and local-lvm differ from the baseline while normalized content-order hashes match. + +CRITERION: AC-13 PDS bundles selectable VHCO, Stackweaver and preserved EdgeForge MOTD text presets; builders defaults to configurable VHCO, custom-file usage remains supported, and invalid selections leave the active MOTD and other MOTD scripts unchanged. +VERDICT: met +EVIDENCE: checks.sh pds passed test_motd_presets (all presets packaged and switched repeatably, custom file, invalid selection unchanged). All four artifact modes printed "selected VHCO banner matches the bundled asset; all three presets exist." The default instance cron logs show the VHCO MOTD on login. + +CRITERION: AC-14 Both image outputs built with the default recipe retain one configured nightly midnight package-update job that runs non-interactively with an enabled scheduler and effective SSH settings that allow injected non-root public-key login while disabling password, keyboard-interactive and root login; repeated provisioning is safe and temporary Packer access is removed only after it is no longer needed. +VERDICT: met +EVIDENCE: check-image.sh passed on both default disks; it requires exactly "0 0 * * * root /usr/local/sbin/pds-update >> /var/log/pds-update.log 2>&1" in /etc/cron.d/pds-update plus 00-pds-security.conf. For all four default instances, instance-*-cron.log shows that exact command run under env -i cron PATH with stdin /dev/null: UPDATE_EXIT_CODE=0, cron active and enabled. authentication-events.jsonl for 990342 (native) and 990349 (portable): +- The permissive controls succeeded: password, keyboard and root key all authenticated. +- After restoring 00-pds-security.conf with 10-builders-test-permissive.conf still present, the non-root key succeeded. +- Password and keyboard failed with BadAuthenticationType, allowed only publickey. +- The root key failed with AuthenticationException, an authentication denial and not a banner. +- auth none offered only publickey. + +The two-file sshd -T logs match. The build logs show three ssh.service blocks with the same MainPID and activation timestamp and "-- No entries --", then ephemeral Packer key removal after sealing. checks.sh pds passed test_update_job_is_repeatable_and_handles_modified_conffiles and test_update_lock_contention_is_bounded_and_can_recover. Limitation: the reboot check measured only the ed25519 host key. + +CRITERION: AC-15 An operator can select a readable custom Bash recipe at invocation for either output without editing the default recipe or PDS; omitted PDS update/SSH policies are not applied elsewhere, missing recipes and failed calls stop the build, and generic-image cleanup still runs. +VERDICT: met +EVIDENCE: The native-custom and portable-custom builds uploaded recipes/custom.example.sh, unchanged per the build-inputs.json hashes, and installed signed PDS 0.20.0. checks.sh native-custom and portable-custom ran check-image.sh in custom mode and passed: 00-pds-security.conf and the PDS update job are absent, the example selections are present and the sealing cleanup held. Instances 990347, 990348, 990351 and 990352 each passed "custom fresh-user tooling, shell and selected policy checks", with distinct identities in final-eight-instance-audit.json. checks.sh recipe-readability passed test_unreadable_recipe_is_rejected_before_building as an unprivileged user. make check covered missing recipes and failed calls. Limitation: failed-call propagation was observed in unit tests, not in a live failing build. + +FINDING: F-01 +KIND: factual +SEVERITY: nit +WHERE: packer/ubuntu/cloud-init/build-config.yaml:15 +EVIDENCE: The comment says the zsh plugins/p10k, MOTD and hardening "come from the PDS package in issue #3", but at 9f4db43 they come from the signed PDS 0.20.0 package through recipes/default.sh, as the live build logs show. +PROPOSAL: Replace the issue reference with a pointer to the PDS package and the recipe, for example recipes/default.sh. + +### R-28 + +CRITERION: AC-01 A committed `create-base-template.sh` turns the official Ubuntu cloud image into a base cloud-init template on the PVE host (qemu-guest-agent embedded), repeatably; no hand-clicking. +VERDICT: met +EVIDENCE: At 9f4db43 I ran checks.sh start-live once. The committed scripts prepared the official Ubuntu bundle and imported the base from an unprivileged SSH-only container. The occupied-ID and corrupt-bundle refusals were observed. checks.sh base-agent showed qemu-guest-agent "install ok installed". The one repeat-import import on VM 990336 succeeded and the VM was removed under guards (repeat-import-complete.json). At b6975ef, git diff 9f4db43..HEAD touches only the spec, docs/validation/0001-2026-11-05.md and two comment lines in packer/ubuntu/cloud-init/build-config.yaml. No script changed. checks-final.sh builders (make check) exited 0. Limitations: no rebuild or boot ran at b6975ef, so the live evidence stays labelled 9f4db43. I did not inspect the import container's contents. The harness DELETE-encoding fix affected scratch cleanup only. + +CRITERION: AC-02 `packer init .` installs both `hashicorp/proxmox` (`1.2.4`) and `hashicorp/qemu` plugins. +VERDICT: met +EVIDENCE: At 9f4db43, checks.sh init installed hashicorp/proxmox 1.2.4 and hashicorp/qemu. At b6975ef no HCL or required_plugins changed (git diff). checks-final.sh builders ran packer validate: "The configuration is valid." Limitation: init was not re-run at b6975ef because plugin inputs are unchanged. + +CRITERION: AC-03 `packer build -only='proxmox-clone.ubuntu' …` clones the base and produces a **template** on the PVE node (verified via `qm config ` showing `template: 1`) with an **empty cloud-init drive** attached; no per-build `qm importdisk`/upload anywhere in the flow. The native CPU model defaults to `host` and is configurable; the template and two fresh clones use the selected default, and blank or whitespace-padded model names fail local validation. +VERDICT: met +EVIDENCE: The 9f4db43 matrix built the native default and custom templates by clone. The config showed template 1, an empty cloud-init drive and CPU host, and the two fresh clones also used host. The flow has no per-build importdisk or upload. checks.sh cpu-validation passed on rerun: host and kvm64 exited 0, while blank, leading and trailing spaces exited 1 with the CPU-type diagnostic. At b6975ef there is no HCL or variable change (git diff), and checks-final.sh builders passed. Limitations: the template config was read through the API, not the qm CLI. The CPU harness message assertion was repaired before the rerun. No rebuild ran at b6975ef. + +CRITERION: AC-04 `packer build -only='qemu.ubuntu' …` still produces the local qcow2/raw artifact. +VERDICT: met +EVIDENCE: The 9f4db43 matrix produced portable default and custom archives. I re-ran checks-final.sh at b6975ef: +- hashes: PASS for the portable default and custom archives and their deployment qcow2. +- portable-default-formats and portable-custom-formats: "Images are identical" (raw/qcow2 comparison, run at 9f4db43). +Limitation: no rebuild ran at b6975ef. The source change is comment-only and parsed YAML is equal (comment-equivalence PASS). + +CRITERION: AC-05 Both native and portable sealed outputs contain no site-specific hostname, static IP/netplan identity or SSH host keys; two independently initialized instances of each output receive distinct machine IDs and host keys and apply their supplied identities. +VERDICT: met +EVIDENCE: At 9f4db43, the four artifact modes, mounting each image read-only, passed the checks for hostname, netplan, host keys and machine-id. final-eight-instance-audit.json shows 8 unique machine IDs and 8 unique host keys, with each supplied hostname and user applied. At b6975ef, checks-final.sh hashes PASS shows the same immutable artifacts. Limitations: only DHCP was exercised, not static IP. No rebuild or boot ran at b6975ef. + +CRITERION: AC-06 The sealed image retains no build password, authorized keys or generated SSH policy override. The default Ubuntu account may remain only locked and keyless, with its standard sudo policy. Usable deployed users, keys and site-specific identity are supplied at clone time; the default recipe's PDS SSH baseline remains effective after fresh cloud-init initialization. +VERDICT: met +EVIDENCE: At 9f4db43, the read-only checks on all four disks showed no build password, no authorized_keys, no generated override, and the ubuntu account locked and keyless. The instance two-file sshd -T logs show the PDS baseline still effective after fresh cloud-init, even though cloud-init set permissive ssh_pwauth and disable_root flags. Clone-time users and keys worked, per authentication-events.jsonl. At b6975ef, the only change to build-config.yaml is a comment, and checks-final.sh comment-equivalence reported "parsed cloud-init data unchanged". Limitations: I did not exercise the ubuntu account's sudo policy as that user. No boot ran at b6975ef. + +CRITERION: AC-07 Short root and Ubuntu READMEs link canonical procedures for both output selections, PDS bootstrap, SSH/debugging and recovery; small flow diagrams use Mermaid and Proxmox is explicitly optional. +VERDICT: met +EVIDENCE: At 9f4db43 I inspected the root and Ubuntu READMEs: they link the procedures, include Mermaid blocks and state that Proxmox is optional. At b6975ef, git diff shows the READMEs unchanged. Limitation: I did not render the diagrams. + +CRITERION: AC-08 Both builders install the exact selected PDS package, verify its identity and provenance, and fail on missing, mismatched or untrusted inputs; candidate-package testing is distinguished from a verified signed-repository release build. +VERDICT: met +EVIDENCE: At 9f4db43: +- All four builds installed signed, published PDS 0.20.0. build-inputs.json and the published package hash recheck with checks-final.sh hashes PASS at b6975ef. +- Refusals: missing or corrupt inputs exited 1, and the untrusted APT case showed NO_PUBKEY with exit 100. +- At b6975ef, checks-final.sh builders ran the 48 unit tests, OK with 1 root skip. These include candidate versus signed release, wrong checksum, name, version and identity, and trust failure. +Limitation: the package-name mismatch and the missing selected function are covered by unit tests only. + +CRITERION: AC-09 The shared provisioner applies native Ubuntu settings and the default recipe's explicit PDS function selection for Zi/Powerlevel10k, MOTD, GitHub CLI, kubectl, Krew, neat/view-secret/stern, nightly package updates and restricted SSH; reusable implementations live in the standalone PDS package, and selected-function failures stop provisioning. +VERDICT: met +EVIDENCE: The 9f4db43 default instance check, plugin and package logs show every selected capability on both outputs. guest-command-exits.jsonl has 94 entries, all exit 0. recipe-readability confirmed the explicit function selection in recipes/default.sh. At b6975ef, no recipe or script changed (git diff) and the unit tests passed (checks-final.sh builders). Limitation: stopping on a selected-function failure is proven by unit tests, not a live failed build. + +CRITERION: AC-10 A new deployment user of a default-recipe image receives working Zsh/Powerlevel10k, the kubectl alias/completion, Krew and the neat, view-secret and stern plugins from either output, with its configured Zsh login shell and sudo policy and without inheriting build credentials or build-home paths. Zi populates the existing plugin set on first shell startup with network access; no image-prefetched plugin cache is required. +VERDICT: met +EVIDENCE: At 9f4db43, the instance check and plugin logs for the native and portable default deployments show: +- Zsh login shell and sudo policy. +- Powerlevel10k, the kubectl alias and completion, and Krew with neat, view-secret and stern. +- Zi first-login population, with no build home or credentials inherited. +guest-command-exits.jsonl shows all exit 0. At b6975ef, the source is equivalent (git diff, comment-equivalence PASS). Limitation: no boot ran at b6975ef. + +CRITERION: AC-11 The PDS package loads non-interactively without installer/network side effects, preserves the caller's shell state and reports library failures; its supported standalone setup preserves Zi, the preset and the existing plugin set. Error-reporting assertions cover explicit non-interactive loading; interactive auto-loading is documented separately. +VERDICT: met +EVIDENCE: At 9f4db43, checks.sh pds ran 36 PDS tests from the public tracked source, using the published deb in a read-only, network-none container: all passed. At b6975ef, the PDS inputs are unchanged and the published package hash shows PASS (checks-final.sh hashes). Limitation: the guide was fetched by the dispatcher. + +CRITERION: AC-12 Repository checks exercise package-backed provisioning, failure paths, sealed-artifact assertions and two fresh boots of each Ubuntu amd64 output; CI reports executed versus skipped checks, and native checks preserve all pre-existing guests. +VERDICT: met +EVIDENCE: At b6975ef, checks-final.sh builders (make check) exited 0: 48 tests with 1 skip, and it reports the SKIP for real builds. The 9f4db43 matrix covered two fresh boots per output and recipe (8 deployments) and the sealed-artifact checks. checks-final.sh observations at b6975ef: "PASS: all observed guest hashes/states and normalized storage hashes match; no owned resources remain" (post-cleanup-comparison.json). Limitations: the raw storage hashes differ and only the normalized hashes match. No rebuild ran at b6975ef. + +CRITERION: AC-13 PDS bundles selectable VHCO, Stackweaver and preserved EdgeForge MOTD text presets; builders defaults to configurable VHCO, custom-file usage remains supported, and invalid selections leave the active MOTD and other MOTD scripts unchanged. +VERDICT: met +EVIDENCE: At 9f4db43, the PDS tests from checks.sh pds passed, covering the presets, custom-file usage and invalid-selection preservation. The default instances showed the VHCO MOTD. At b6975ef, no package input or variable changed (git diff), and the comment-only YAML is parse-equal. Limitation: no boot ran at b6975ef. + +CRITERION: AC-14 Both image outputs built with the default recipe retain one configured nightly midnight package-update job that runs non-interactively with an enabled scheduler and effective SSH settings that allow injected non-root public-key login while disabling password, keyboard-interactive and root login; repeated provisioning is safe and temporary Packer access is removed only after it is no longer needed. +VERDICT: met +EVIDENCE: At 9f4db43: +- The cron logs show the actual nightly command ran with UPDATE_EXIT_CODE=0 on all four default instances, and the scheduler was enabled. +- authentication-events.jsonl shows non-root key login succeeding. Password and keyboard-interactive were denied with BadAuthenticationType, and the root key was denied, after permissive positive controls succeeded. +- The identity-reboot JSONs show 2 reboots per default instance with ed25519 stable. +- The sealed disks show no Packer access. +At b6975ef the source is equivalent (git diff, comment-equivalence PASS). Limitations: the reboot measurement is ed25519 only. The password and root-key fixtures were inserted after boot through the guest agent. No boot ran at b6975ef. + +CRITERION: AC-15 An operator can select a readable custom Bash recipe at invocation for either output without editing the default recipe or PDS; omitted PDS update/SSH policies are not applied elsewhere, missing recipes and failed calls stop the build, and generic-image cleanup still runs. +VERDICT: met +EVIDENCE: At 9f4db43: +- Native and portable custom builds were selected at invocation, with no policy leak (custom artifact modes PASS). +- The custom instances were checked with only their selected shell. +- recipe-readability passed. +- A missing recipe was refused. +At b6975ef, the unit tests for the missing library or selected call, the custom recipe hiding an SSH restart, and the custom selected shell passed (checks-final.sh builders). Limitation: failed-call propagation is covered by unit tests, and no rebuild ran at b6975ef. + +NO FINDINGS + +### R-29 + +CRITERION: AC-01 A committed `create-base-template.sh` turns the official Ubuntu cloud image into a base cloud-init template on the PVE host (qemu-guest-agent embedded), repeatably; no hand-clicking. +VERDICT: met +EVIDENCE: At 9f4db43 I ran checks.sh start-live once. The committed scripts prepared the official Ubuntu bundle and imported the base from an unprivileged SSH-only container. The occupied-ID and corrupt-bundle refusals were observed. checks.sh base-agent showed qemu-guest-agent "install ok installed". The one repeat-import import on VM 990336 succeeded and the VM was removed under guards (repeat-import-complete.json). From 9f4db43 to 86f740b, git diff touches no script. The only image-input change is a build-config.yaml comment, and checks-records.sh comment-equivalence passed. Limitations: no rebuild or boot ran after 9f4db43, and the live evidence stays labelled 9f4db43. I did not inspect the import container's contents. The harness DELETE-encoding fix affected scratch cleanup only. + +CRITERION: AC-02 `packer init .` installs both `hashicorp/proxmox` (`1.2.4`) and `hashicorp/qemu` plugins. +VERDICT: met +EVIDENCE: At 9f4db43, checks.sh init installed hashicorp/proxmox 1.2.4 and hashicorp/qemu. Since then no HCL or required_plugins changed (git diff 9f4db43..86f740b). At b6975ef, checks-final.sh builders ran packer validate and got "The configuration is valid". Limitation: init was not re-run after 9f4db43 because the plugin inputs are unchanged. + +CRITERION: AC-03 `packer build -only='proxmox-clone.ubuntu' …` clones the base and produces a **template** on the PVE node (verified via `qm config ` showing `template: 1`) with an **empty cloud-init drive** attached; no per-build `qm importdisk`/upload anywhere in the flow. The native CPU model defaults to `host` and is configurable; the template and two fresh clones use the selected default, and blank or whitespace-padded model names fail local validation. +VERDICT: met +EVIDENCE: The 9f4db43 matrix built the native default and custom templates by clone. The config showed template 1, an empty cloud-init drive and CPU host, and the fresh clones also used host. The flow has no per-build importdisk or upload. checks.sh cpu-validation passed on rerun: host and kvm64 exited 0, while blank, leading and trailing spaces exited 1 with the CPU-type diagnostic. No HCL or variable changed through 86f740b (git diff). Limitations: the template config was read through the API, not the qm CLI. The CPU fixture message assertion was repaired before the rerun. No rebuild ran after 9f4db43. + +CRITERION: AC-04 `packer build -only='qemu.ubuntu' …` still produces the local qcow2/raw artifact. +VERDICT: met +EVIDENCE: The 9f4db43 matrix produced portable default and custom archives. The portable-default-formats and portable-custom-formats modes reported "Images are identical" for the actual raw and qcow2 members. checks-records.sh hashes at 86f740b reported PASS for both portable archives and their deployment qcow2. Limitation: no rebuild ran after 9f4db43. The only image-input change is a comment, and parsed YAML is equal (comment-equivalence PASS). + +CRITERION: AC-05 Both native and portable sealed outputs contain no site-specific hostname, static IP/netplan identity or SSH host keys; two independently initialized instances of each output receive distinct machine IDs and host keys and apply their supplied identities. +VERDICT: met +EVIDENCE: At 9f4db43, all four artifact modes, each mounting one image read-only, passed the hostname, netplan, host key and machine-id checks. final-eight-instance-audit.json shows 8 unique machine IDs and 8 unique host keys, with the supplied hostnames and users applied. checks-records.sh hashes at 86f740b matched the same immutable artifacts. Limitations: only DHCP was exercised, not static IP. No boot ran after 9f4db43. + +CRITERION: AC-06 The sealed image retains no build password, authorized keys or generated SSH policy override. The default Ubuntu account may remain only locked and keyless, with its standard sudo policy. Usable deployed users, keys and site-specific identity are supplied at clone time; the default recipe's PDS SSH baseline remains effective after fresh cloud-init initialization. +VERDICT: met +EVIDENCE: At 9f4db43, the read-only checks on all four disks found: +- no build password, no authorized_keys and no generated SSH override; +- the ubuntu account locked and keyless. + +The instance two-file sshd -T logs show the PDS baseline still effective after fresh cloud-init, even though cloud-init set permissive ssh_pwauth and disable_root flags. Clone-time users and keys worked, per authentication-events.jsonl. The only later build-config.yaml change is a comment, and comment-equivalence passed at 86f740b. Limitations: I did not exercise the ubuntu account's sudo policy as that user. No boot ran after 9f4db43. + +CRITERION: AC-07 Short root and Ubuntu READMEs link canonical procedures for both output selections, PDS bootstrap, SSH/debugging and recovery; small flow diagrams use Mermaid and Proxmox is explicitly optional. +VERDICT: met +EVIDENCE: At 9f4db43 I inspected the root and Ubuntu READMEs: they link the procedures, contain Mermaid blocks and state that Proxmox is optional. git diff 9f4db43..86f740b shows both READMEs unchanged. Limitation: I did not render the diagrams. + +CRITERION: AC-08 Both builders install the exact selected PDS package, verify its identity and provenance, and fail on missing, mismatched or untrusted inputs; candidate-package testing is distinguished from a verified signed-repository release build. +VERDICT: met +EVIDENCE: At 9f4db43, all four builds installed signed, published PDS 0.20.0 (build-inputs.json). checks-records.sh hashes at 86f740b reported PASS for the published package hash. The real-bootstrap-refusals mode showed missing or corrupt inputs exiting 1, and the untrusted APT case reporting NO_PUBKEY with exit 100. At b6975ef, checks-final.sh builders ran 48 unit tests, OK with 1 root skip. These cover candidate versus signed release, wrong checksum, name, version and identity, and trust failure. Limitation: the package-name mismatch is covered by unit tests only. + +CRITERION: AC-09 The shared provisioner applies native Ubuntu settings and the default recipe's explicit PDS function selection for Zi/Powerlevel10k, MOTD, GitHub CLI, kubectl, Krew, neat/view-secret/stern, nightly package updates and restricted SSH; reusable implementations live in the standalone PDS package, and selected-function failures stop provisioning. +VERDICT: met +EVIDENCE: The 9f4db43 default instance check, plugin and package logs show each selected capability on both outputs. guest-command-exits.jsonl has 94 entries, all exit 0. The explicit function selection comes from my inspection of recipes/default.sh and from the unit test test_default_and_custom_recipe_select_different_functions. That the selected-function failures stop provisioning comes from test_missing_recipe_library_and_selected_call_fail, which passed in checks-final.sh builders at b6975ef. No recipe or script changed through 86f740b. Limitation: function selection and failure propagation are covered by source and unit tests, not by a live failed build. + +CRITERION: AC-10 A new deployment user of a default-recipe image receives working Zsh/Powerlevel10k, the kubectl alias/completion, Krew and the neat, view-secret and stern plugins from either output, with its configured Zsh login shell and sudo policy and without inheriting build credentials or build-home paths. Zi populates the existing plugin set on first shell startup with network access; no image-prefetched plugin cache is required. +VERDICT: met +EVIDENCE: At 9f4db43, the instance check and plugin logs for the native and portable default deployments show: +- the Zsh login shell and sudo policy; +- Powerlevel10k, the kubectl alias and completion, and Krew with neat, view-secret and stern; +- Zi first-login population, with no build home or credentials inherited. + +guest-command-exits.jsonl shows all exit 0. The source is equivalent through 86f740b (git diff, comment-equivalence PASS). Limitation: no boot ran after 9f4db43. + +CRITERION: AC-11 The PDS package loads non-interactively without installer/network side effects, preserves the caller's shell state and reports library failures; its supported standalone setup preserves Zi, the preset and the existing plugin set. Error-reporting assertions cover explicit non-interactive loading; interactive auto-loading is documented separately. +VERDICT: met +EVIDENCE: At 9f4db43, checks.sh pds ran 36 PDS tests, all passing. They used the public tracked source and the published deb in a read-only, network-none container. The PDS inputs are unchanged, and the published package hash passed in checks-records.sh hashes at 86f740b. Limitation: the standalone guide was fetched by the dispatcher. + +CRITERION: AC-12 Repository checks exercise package-backed provisioning, failure paths, sealed-artifact assertions and two fresh boots of each Ubuntu amd64 output; CI reports executed versus skipped checks, and native checks preserve all pre-existing guests. +VERDICT: met +EVIDENCE: At b6975ef, checks-final.sh builders (make check) exited 0 with 48 tests and 1 skip, and printed the real-build SKIP. The 9f4db43 matrix ran two fresh deployments per output and recipe (8 in total) and the sealed-artifact checks. checks-records.sh observations at 86f740b reported "PASS: all observed guest hashes/states and normalized storage hashes match; no owned resources remain" (post-cleanup-comparison.json). Limitations: the raw storage hashes differ, and only the normalized hashes match. No rebuild ran after 9f4db43. + +CRITERION: AC-13 PDS bundles selectable VHCO, Stackweaver and preserved EdgeForge MOTD text presets; builders defaults to configurable VHCO, custom-file usage remains supported, and invalid selections leave the active MOTD and other MOTD scripts unchanged. +VERDICT: met +EVIDENCE: At 9f4db43, the checks.sh pds tests passed, covering the presets, custom-file usage and invalid-selection preservation. The default instances showed the VHCO MOTD. No package input or variable changed through 86f740b, and the YAML change is a parse-equal comment. Limitation: no boot ran after 9f4db43. + +CRITERION: AC-14 Both image outputs built with the default recipe retain one configured nightly midnight package-update job that runs non-interactively with an enabled scheduler and effective SSH settings that allow injected non-root public-key login while disabling password, keyboard-interactive and root login; repeated provisioning is safe and temporary Packer access is removed only after it is no longer needed. +VERDICT: met +EVIDENCE: At 9f4db43: +- Cron logs show the exact nightly command ran with UPDATE_EXIT_CODE=0 on all four default instances, with cron active and enabled. +- authentication-events.jsonl shows non-root key login succeeding. Password and keyboard-interactive were denied with BadAuthenticationType and the root key was denied, after the permissive positive controls succeeded. +- I read the reboot branch in validate-instances.py and the two identity-reboot JSONs. The harness rebooted only the first default instance of each output, so there were two reboot operations in total, one on 990342 and one on 990349. Each JSON holds one changed before/after boot-ID pair. Machine ID, DHCP client ID and ed25519 host key were unchanged, key login worked after the reboot, and the sshd settings were confirmed. +- The sealed disks show no Packer access. + +Limitations: there was one reboot per selected default instance, and the measured host key is ed25519 only. The password and root-key fixtures were inserted after boot through the guest agent. No boot ran after 9f4db43. + +CRITERION: AC-15 An operator can select a readable custom Bash recipe at invocation for either output without editing the default recipe or PDS; omitted PDS update/SSH policies are not applied elsewhere, missing recipes and failed calls stop the build, and generic-image cleanup still runs. +VERDICT: met +EVIDENCE: At 9f4db43: +- Native and portable custom builds were selected at invocation, with no policy leak (custom artifact modes PASS). +- The custom instances were checked with only their selected shell. +- The recipe-readability mode, run as a non-root user, executed the unit test that refuses a mode-000 unreadable recipe. +- A missing recipe was refused. + +At b6975ef, unit tests covered the missing library or selected call, a custom recipe hiding an SSH restart, and the custom selected shell; they passed in checks-final.sh builders. Limitation: failed-call propagation is covered by source and unit tests, and no rebuild ran after 9f4db43. + +NO FINDINGS + +## Sources + +- [Proxmox cloud-init source](https://github.com/proxmox/qemu-server/blob/master/src/PVE/QemuServer/Cloudinit.pm), `cloudinit_userdata` and `get_custom_cloudinit_files`/`read_cloudinit_snippets_file`, read on 2026-11-04: generated user data omits an explicit shell, while custom user data is read from snippet storage. This upstream inspection does not validate the installed node. + +- PDS candidate `/home/m/code/PDS-image-provisioning` at `04c8dee+dirty`: `packaging/init.sh`, `packaging/nfpm.yaml:50-66`, `bash/common/shell/zsh.sh:4-68`, `bash/config/zshrc`, `bash/debian/software/install_kubectl.sh:7-107` and `tests/image_provisioning_test.py` establish the observed package contract and remaining installer gaps. +- `gh api repos/michielvha/PDS/releases/latest`, `commits/main` and `pulls`, read on 2026-11-04: published release, source baseline and unrelated open PR boundary. The private preparation snapshot and package-test log preserve this run's inputs. - [Packer `proxmox-clone` builder](https://developer.hashicorp.com/packer/integrations/hashicorp/proxmox/latest/components/builder/clone) - [Create Proxmox cloud-init templates for Packer (base bootstrap)](https://dev.to/mike1237/create-proxmox-cloud-init-templates-for-use-with-packer-193a) @@ -283,4 +2625,223 @@ create VMs, use the target storage, and template VMs (a `PVEVMAdmin`-style role - [Building Ubuntu 24.04 Proxmox templates with Packer](https://thecomalley.github.io/packer-proxmox-ubuntu) - [Packer `-only` / `-except`](https://developer.hashicorp.com/packer/docs/commands/build#only-foo-bar-baz) - [`bpg/proxmox` Terraform provider](https://registry.terraform.io/providers/bpg/proxmox/latest/docs) -- Legacy flow being replaced: `packer/ubuntu/ubuntu.pkr.hcl`, `scripts/install.sh`, `scripts/cleanup.sh`. +- Legacy flow before `deae257`: `packer/ubuntu/ubuntu.pkr.hcl`, `scripts/install.sh` and the removed `scripts/cleanup.sh`. +- [Feature-document standard](https://github.com/vhco-pro/docs/blob/0e52f51f01b84eda75a976763c42d8ec0a07b544/conventions/feature-documents.md): lifecycle, criteria, proof and review-record formats. + +- [Committed validation summary](../validation/0001-2026-11-04.md): implementer-observed build, recovery, clone and cleanup checks, with their limits. + +- [systemd-machine-id-setup](https://www.freedesktop.org/software/systemd/man/258/systemd-machine-id-setup.html), --commit: commit and unmount a transient machine-id before clearing the persistent image identity. The real custom-guest failure and disposable mount regression were observed on 2026-11-05. + +### R-30 + +CRITERION: AC-01 A committed `create-base-template.sh` turns the official Ubuntu cloud image into a base cloud-init template on the PVE host (qemu-guest-agent embedded), repeatably; no hand-clicking. +VERDICT: met +EVIDENCE: At 9f4db43 I ran checks.sh start-live once. The committed scripts prepared the official Ubuntu bundle and imported the base from an unprivileged SSH-only container. I observed the occupied-ID and corrupt-bundle refusals. checks.sh base-agent showed qemu-guest-agent "install ok installed". The single repeat-import on 990336 succeeded and was then removed under guards (repeat-import-complete.json). git diff 86f740b..2d0c610 changes only Markdown under docs/ and packer/readme.md, so no script changed. Limitations: no rebuild or boot ran after 9f4db43, and the live evidence stays labelled 9f4db43. I did not inspect the import container's contents. The DELETE-encoding fix applied to scratch cleanup only. + +CRITERION: AC-02 `packer init .` installs both `hashicorp/proxmox` (`1.2.4`) and `hashicorp/qemu` plugins. +VERDICT: met +EVIDENCE: At 9f4db43, checks.sh init installed hashicorp/proxmox 1.2.4 and hashicorp/qemu. At b6975ef, checks-final.sh builders reported "The configuration is valid". No HCL changed from then through 2d0c610 (git diff). The new docs/ubuntu/build-host-setup.md runs `packer init .` in packer/ubuntu. Limitation: init was not re-run after 9f4db43 because the plugin inputs are unchanged. + +CRITERION: AC-03 `packer build -only='proxmox-clone.ubuntu' …` clones the base and produces a **template** on the PVE node (verified via `qm config ` showing `template: 1`) with an **empty cloud-init drive** attached; no per-build `qm importdisk`/upload anywhere in the flow. The native CPU model defaults to `host` and is configurable; the template and two fresh clones use the selected default, and blank or whitespace-padded model names fail local validation. +VERDICT: met +EVIDENCE: The 9f4db43 matrix produced the native default and custom templates by cloning: +- Their config showed template 1, an empty cloud-init drive and CPU host. +- The fresh clones also used host. +- The flow has no per-build import or upload. + +checks.sh cpu-validation passed on rerun: host and kvm64 exited 0, while blank, leading-space and trailing-space values exited 1 with the CPU-type diagnostic. No HCL or variable changed through 2d0c610. Limitations: I read the config through the API, not the qm CLI. The CPU fixture's message assertion was repaired before that rerun. No rebuild ran after 9f4db43. + +CRITERION: AC-04 `packer build -only='qemu.ubuntu' …` still produces the local qcow2/raw artifact. +VERDICT: met +EVIDENCE: The 9f4db43 matrix produced the portable default and custom archives. portable-default-formats and portable-custom-formats reported "Images are identical" for the actual raw and qcow2 members. checks-records.sh hashes at 86f740b passed for both archives and their deployment qcow2. Since then only Markdown changed. checks.sh comment-equivalence at 2d0c610 printed "PASS: parsed cloud-init data unchanged". The path output-noble-amd64/ubuntu-noble-amd64.qcow2 in the new docs matches ubuntu.pkr.hcl:29,34 and variables.pkrvars.hcl. Limitation: no rebuild ran after 9f4db43. + +CRITERION: AC-05 Both native and portable sealed outputs contain no site-specific hostname, static IP/netplan identity or SSH host keys; two independently initialized instances of each output receive distinct machine IDs and host keys and apply their supplied identities. +VERDICT: met +EVIDENCE: At 9f4db43, the four artifact modes passed the hostname, netplan, host-key and machine-id checks, each mounting one image read-only. final-eight-instance-audit.json shows 8 unique machine IDs and 8 unique host keys, with the supplied hostnames and users applied. At 2d0c610, checks.sh observations printed "PASS: all observed guest hashes/states and normalized storage hashes match; no owned resources remain". Limitations: only DHCP was exercised, not a static IP. No boot ran after 9f4db43. + +CRITERION: AC-06 The sealed image retains no build password, authorized keys or generated SSH policy override. The default Ubuntu account may remain only locked and keyless, with its standard sudo policy. Usable deployed users, keys and site-specific identity are supplied at clone time; the default recipe's PDS SSH baseline remains effective after fresh cloud-init initialization. +VERDICT: met +EVIDENCE: At 9f4db43, the read-only checks on all four disks found no build password, no authorized_keys and no generated SSH override. The ubuntu account was locked and keyless. The two-file sshd -T logs showed the PDS baseline still in effect after fresh cloud-init, even though cloud-init set permissive ssh_pwauth and disable_root flags. Clone-time users and keys worked (authentication-events.jsonl). The new docs/ubuntu/manual-boot.md also supplies a deployment user and public key through a NoCloud seed rather than a build login. Limitations: I did not exercise the ubuntu account's sudo policy as that user. No boot ran after 9f4db43. + +CRITERION: AC-07 Short root and Ubuntu READMEs link canonical procedures for both output selections, PDS bootstrap, SSH/debugging and recovery; small flow diagrams use Mermaid and Proxmox is explicitly optional. +VERDICT: met +EVIDENCE: At 9f4db43 I inspected the root and Ubuntu READMEs: they have the procedure links and Mermaid blocks, and Proxmox is stated as optional. At 2d0c610, packer/readme.md stays a short list. It now links build-host-setup.md, manual-boot.md, image-inspection.md and docs/legacy/armbian-qemu.md, and still says Proxmox is optional. + +checks.sh docs at 2d0c610 printed "PASS: 49 relative targets and 44 shell blocks". I checked the recovery.md#rebuild-when-the-bundle-is-also-lost anchor against recovery.md:59. I compared these against origin/main packer/readme.md and packer/ubuntu/readme.md: the Packer install, build and alias, VNC viewer and tunnel, PACKER_LOG, x86 boot, ARM boot, chroot and offset mount, and U-Boot commands are all present in linked guides. + +Limitations: +- I did not render the diagrams. +- check-docs.py does not verify anchors or external URLs. +- seed-check.log (cloud-init schema valid, ISO built) is author evidence I inspected, not something I executed. + +CRITERION: AC-08 Both builders install the exact selected PDS package, verify its identity and provenance, and fail on missing, mismatched or untrusted inputs; candidate-package testing is distinguished from a verified signed-repository release build. +VERDICT: met +EVIDENCE: At 9f4db43, all four builds installed signed, published PDS 0.20.0 (build-inputs.json). checks-records.sh hashes at 86f740b passed for the published package. In real-bootstrap-refusals, missing or corrupt inputs exited 1, and the untrusted APT case showed NO_PUBKEY with exit 100. At b6975ef, checks-final.sh builders ran 48 unit tests, OK with 1 root skip; they cover candidate versus signed release, wrong checksum, name, version or identity, and trust failure. No package input changed through 2d0c610. Limitation: the package-name mismatch is covered by unit tests only. + +CRITERION: AC-09 The shared provisioner applies native Ubuntu settings and the default recipe's explicit PDS function selection for Zi/Powerlevel10k, MOTD, GitHub CLI, kubectl, Krew, neat/view-secret/stern, nightly package updates and restricted SSH; reusable implementations live in the standalone PDS package, and selected-function failures stop provisioning. +VERDICT: met +EVIDENCE: The 9f4db43 default instance check, plugin and package logs show every selected capability on both outputs. guest-command-exits.jsonl has 94 entries, all exit 0. Function selection is established by my reading of recipes/default.sh and the unit test test_default_and_custom_recipe_select_different_functions. Stopping on failure is established by test_missing_recipe_library_and_selected_call_fail, which passed in checks-final.sh builders at b6975ef. No recipe or script changed through 2d0c610. Limitation: selection and failure propagation rest on source and unit coverage, not a live failed build. + +CRITERION: AC-10 A new deployment user of a default-recipe image receives working Zsh/Powerlevel10k, the kubectl alias/completion, Krew and the neat, view-secret and stern plugins from either output, with its configured Zsh login shell and sudo policy and without inheriting build credentials or build-home paths. Zi populates the existing plugin set on first shell startup with network access; no image-prefetched plugin cache is required. +VERDICT: met +EVIDENCE: At 9f4db43, the instance check and plugin logs for the native and portable default deployments show: +- the Zsh login shell and sudo policy; +- Powerlevel10k and the kubectl alias and completion; +- Krew with neat, view-secret and stern; +- Zi populating plugins at first login, with no build home or credentials inherited. + +guest-command-exits.jsonl shows all exit 0. The source is equivalent through 2d0c610 (git diff, comment-equivalence PASS). Limitation: no boot ran after 9f4db43. + +CRITERION: AC-11 The PDS package loads non-interactively without installer/network side effects, preserves the caller's shell state and reports library failures; its supported standalone setup preserves Zi, the preset and the existing plugin set. Error-reporting assertions cover explicit non-interactive loading; interactive auto-loading is documented separately. +VERDICT: met +EVIDENCE: At 9f4db43, checks.sh pds ran 36 PDS tests, and all passed. They used the public tracked source and the published deb in a read-only, network-none container. PDS inputs are unchanged through 2d0c610, and the published package hash passed at 86f740b. Limitation: the standalone guide was fetched by the dispatcher. + +CRITERION: AC-12 Repository checks exercise package-backed provisioning, failure paths, sealed-artifact assertions and two fresh boots of each Ubuntu amd64 output; CI reports executed versus skipped checks, and native checks preserve all pre-existing guests. +VERDICT: met +EVIDENCE: At b6975ef, checks-final.sh builders (make check) exited 0: 48 tests, 1 skip, and the real-build SKIP line printed. The 9f4db43 matrix covered two fresh deployments per output and recipe, eight in total, plus the sealed-artifact checks. At 2d0c610, checks.sh observations passed, and post-cleanup-comparison.json lists six pre-existing guests whose config and state match. Limitations: raw storage hashes differ and only the normalized hashes match. No rebuild ran after 9f4db43. I did not observe hosted CI for the later commits. + +CRITERION: AC-13 PDS bundles selectable VHCO, Stackweaver and preserved EdgeForge MOTD text presets; builders defaults to configurable VHCO, custom-file usage remains supported, and invalid selections leave the active MOTD and other MOTD scripts unchanged. +VERDICT: met +EVIDENCE: At 9f4db43, the checks.sh pds tests passed for the presets, custom-file usage and invalid-selection preservation. The default instances showed the VHCO MOTD. No package input or variable changed through 2d0c610, and parsed YAML is unchanged. Limitation: no boot ran after 9f4db43. + +CRITERION: AC-14 Both image outputs built with the default recipe retain one configured nightly midnight package-update job that runs non-interactively with an enabled scheduler and effective SSH settings that allow injected non-root public-key login while disabling password, keyboard-interactive and root login; repeated provisioning is safe and temporary Packer access is removed only after it is no longer needed. +VERDICT: met +EVIDENCE: At 9f4db43: +- Cron logs show the exact nightly command ran with UPDATE_EXIT_CODE=0 on all four default instances, with cron active and enabled. +- authentication-events.jsonl shows non-root key login succeeding. Password and keyboard-interactive were denied with BadAuthenticationType, and the root key was denied, after the permissive positive controls succeeded. +- I read the reboot branch in validate-instances.py and the two identity-reboot JSONs. There were two reboot operations in total, one on 990342 and one on 990349. Each JSON holds one changed boot-ID pair, with machine ID, DHCP client ID and ed25519 host key unchanged, and key login worked after the reboot. +- The sealed disks show no Packer access. + +Limitations: there was one reboot per selected default instance, and only the ed25519 host key was measured. The password and root-key fixtures were inserted after boot through the guest agent. No boot ran after 9f4db43. + +CRITERION: AC-15 An operator can select a readable custom Bash recipe at invocation for either output without editing the default recipe or PDS; omitted PDS update/SSH policies are not applied elsewhere, missing recipes and failed calls stop the build, and generic-image cleanup still runs. +VERDICT: met +EVIDENCE: At 9f4db43: +- The native and portable custom builds were selected at invocation, with no policy leak (the custom artifact modes passed). +- The custom instances were checked with only their selected shell. +- The recipe-readability mode, run as a non-root user, executed the unit test that refuses a mode-000 unreadable recipe. +- A missing recipe was refused. + +At b6975ef, the missing-library or missing-call, SSH-restart and custom-shell unit tests passed. No recipe changed through 2d0c610. Limitation: failed-call propagation rests on source and unit coverage, and no rebuild ran after 9f4db43. + +FINDING: F-01 +KIND: judgement +SEVERITY: nit +WHERE: docs/ubuntu/build-host-setup.md, docs/ubuntu/local-build.md, docs/ubuntu/image-inspection.md +EVIDENCE: conventions/documentation.md:10-11 at 0e52f51 says to keep the current or intended state, not the conversation that produced it. The new current-procedure guides frame steps by their history instead: +- build-host-setup.md:3 "retain the host setup from the original Packer README" +- build-host-setup.md:55 "These tools from the old setup" +- build-host-setup.md:76 "this replaces the old manual `sudo packer plugins install github.com/hashicorp/qemu` step" +- local-build.md:41 "the optional shell shortcut from the original README" +- image-inspection.md:3-4 "remain available for the manual workflows from the original README" + +That README text no longer exists on this branch. +PROPOSAL: State each procedure by its current purpose, such as an optional build alias or raw-image chroot. Keep historical provenance only in docs/legacy/armbian-qemu.md, where it explains the unvalidated scope. + +### R-31 + +CRITERION: AC-01 A committed `create-base-template.sh` turns the official Ubuntu cloud image into a base cloud-init template on the PVE host (qemu-guest-agent embedded), repeatably; no hand-clicking. +VERDICT: met +EVIDENCE: At 9f4db43 I ran checks.sh start-live once. The committed scripts prepared the official Ubuntu bundle and imported the base from an unprivileged SSH-only container. I observed the occupied-ID and corrupt-bundle refusals. checks.sh base-agent showed qemu-guest-agent "install ok installed". The single repeat-import on 990336 succeeded and was then removed under guards (repeat-import-complete.json). git diff 2d0c610..24c12d3 changes only the spec review log and R-30 subsection plus prose in three docs/ubuntu guides. No script changed. Limitations: no rebuild or boot ran after 9f4db43, and that live evidence stays labelled 9f4db43. I did not inspect the import container's contents. The DELETE-encoding fix applied only to scratch cleanup. + +CRITERION: AC-02 `packer init .` installs both `hashicorp/proxmox` (`1.2.4`) and `hashicorp/qemu` plugins. +VERDICT: met +EVIDENCE: At 9f4db43, checks.sh init installed hashicorp/proxmox 1.2.4 and hashicorp/qemu. At b6975ef, checks-final.sh builders reported "The configuration is valid". No HCL changed through 24c12d3 (git diff). docs/ubuntu/build-host-setup.md still runs `packer init .` in packer/ubuntu and now says that a separate manual plugin installation is unnecessary. Limitation: init was not re-run after 9f4db43 because the plugin inputs are unchanged. + +CRITERION: AC-03 `packer build -only='proxmox-clone.ubuntu' …` clones the base and produces a **template** on the PVE node (verified via `qm config ` showing `template: 1`) with an **empty cloud-init drive** attached; no per-build `qm importdisk`/upload anywhere in the flow. The native CPU model defaults to `host` and is configurable; the template and two fresh clones use the selected default, and blank or whitespace-padded model names fail local validation. +VERDICT: met +EVIDENCE: The 9f4db43 matrix produced the native default and custom templates by cloning: +- Their config showed template 1, an empty cloud-init drive and CPU host. +- The fresh clones also used host. +- The flow has no per-build import or upload. + +checks.sh cpu-validation passed on rerun: host and kvm64 exited 0, while blank, leading-space and trailing-space values exited 1 with the CPU-type diagnostic. No HCL or variable changed through 24c12d3. Limitations: I read the config through the API, not the qm CLI. The CPU fixture's message assertion was repaired before that rerun. No rebuild ran after 9f4db43. + +CRITERION: AC-04 `packer build -only='qemu.ubuntu' …` still produces the local qcow2/raw artifact. +VERDICT: met +EVIDENCE: The 9f4db43 matrix produced the portable default and custom archives. portable-default-formats and portable-custom-formats reported "Images are identical" for the actual raw and qcow2 members. checks-records.sh hashes at 86f740b passed for both archives and their deployment qcow2. Since then only Markdown has changed (git diff 86f740b..24c12d3). At 2d0c610, checks.sh comment-equivalence printed "PASS: parsed cloud-init data unchanged". Limitation: no rebuild ran after 9f4db43. + +CRITERION: AC-05 Both native and portable sealed outputs contain no site-specific hostname, static IP/netplan identity or SSH host keys; two independently initialized instances of each output receive distinct machine IDs and host keys and apply their supplied identities. +VERDICT: met +EVIDENCE: At 9f4db43, all four artifact modes passed the hostname, netplan, host-key and machine-id checks, each mounting one image read-only. final-eight-instance-audit.json shows 8 unique machine IDs and 8 unique host keys, with the supplied hostnames and users applied. At 2d0c610, checks.sh observations printed "PASS: all observed guest hashes/states and normalized storage hashes match; no owned resources remain". Image inputs are unchanged through 24c12d3. Limitations: only DHCP was exercised, not a static IP. No boot ran after 9f4db43. + +CRITERION: AC-06 The sealed image retains no build password, authorized keys or generated SSH policy override. The default Ubuntu account may remain only locked and keyless, with its standard sudo policy. Usable deployed users, keys and site-specific identity are supplied at clone time; the default recipe's PDS SSH baseline remains effective after fresh cloud-init initialization. +VERDICT: met +EVIDENCE: At 9f4db43, the read-only checks on all four disks found no build password, no authorized_keys and no generated SSH override. The ubuntu account was locked and keyless. The two-file sshd -T logs showed the PDS baseline still in effect after fresh cloud-init, even though cloud-init set permissive ssh_pwauth and disable_root flags. Clone-time users and keys worked (authentication-events.jsonl). docs/ubuntu/manual-boot.md is unchanged since 2d0c610 and supplies a deployment user and public key through NoCloud. Limitations: I did not exercise the ubuntu account's sudo policy as that user. No boot ran after 9f4db43. + +CRITERION: AC-07 Short root and Ubuntu READMEs link canonical procedures for both output selections, PDS bootstrap, SSH/debugging and recovery; small flow diagrams use Mermaid and Proxmox is explicitly optional. +VERDICT: met +EVIDENCE: +- At 9f4db43 I inspected the root and Ubuntu READMEs. They have the procedure links and Mermaid blocks, and they state that Proxmox is optional. +- At 2d0c610 I compared the new linked guides with origin/main packer/readme.md and packer/ubuntu/readme.md and found the usable commands retained. +- At 24c12d3 I read the corrected build-host-setup.md, image-inspection.md and local-build.md. Their text now states each procedure's current purpose. +- A grep for "original README", "old setup", "old manual" and en or em dashes across docs/ubuntu and both readmes found no matches. +- docs/legacy/armbian-qemu.md is unchanged and keeps its provenance and unvalidated scope. +- No shell fence changed. checks.sh docs at 24c12d3 printed "PASS: 49 relative targets and 44 shell blocks". + +Limitations: I did not render the diagrams. check-docs.py does not verify anchors or external URLs. seed-check.log is author evidence that I inspected but did not execute. + +CRITERION: AC-08 Both builders install the exact selected PDS package, verify its identity and provenance, and fail on missing, mismatched or untrusted inputs; candidate-package testing is distinguished from a verified signed-repository release build. +VERDICT: met +EVIDENCE: +- At 9f4db43, all four builds installed signed, published PDS 0.20.0 (build-inputs.json). checks-records.sh hashes at 86f740b passed for the published package. +- In real-bootstrap-refusals, missing or corrupt inputs exited 1, and the untrusted APT case showed NO_PUBKEY with exit 100. +- At b6975ef, checks-final.sh builders ran 48 unit tests, OK with 1 root skip. They cover candidate versus signed release, wrong checksum, name, version or identity, and trust failure. +- No package input changed through 24c12d3. + +Limitation: the package-name mismatch is covered by unit tests only. + +CRITERION: AC-09 The shared provisioner applies native Ubuntu settings and the default recipe's explicit PDS function selection for Zi/Powerlevel10k, MOTD, GitHub CLI, kubectl, Krew, neat/view-secret/stern, nightly package updates and restricted SSH; reusable implementations live in the standalone PDS package, and selected-function failures stop provisioning. +VERDICT: met +EVIDENCE: +- The 9f4db43 default instance check, plugin and package logs show every selected capability on both outputs. +- guest-command-exits.jsonl has 94 entries, all exit 0. +- I established function selection from recipes/default.sh and the unit test test_default_and_custom_recipe_select_different_functions. +- Stopping on failure is covered by test_missing_recipe_library_and_selected_call_fail, which passed in checks-final.sh builders at b6975ef. +- No recipe or script changed through 24c12d3. + +Limitation: selection and failure propagation rest on source and unit coverage, not on a live failed build. + +CRITERION: AC-10 A new deployment user of a default-recipe image receives working Zsh/Powerlevel10k, the kubectl alias/completion, Krew and the neat, view-secret and stern plugins from either output, with its configured Zsh login shell and sudo policy and without inheriting build credentials or build-home paths. Zi populates the existing plugin set on first shell startup with network access; no image-prefetched plugin cache is required. +VERDICT: met +EVIDENCE: At 9f4db43, the instance check and plugin logs for the native and portable default deployments show: +- the Zsh login shell and sudo policy; +- Powerlevel10k and the kubectl alias and completion; +- Krew with neat, view-secret and stern; +- Zi populating plugins at first login, with no build home or credentials inherited. + +guest-command-exits.jsonl shows all exit 0. The source is equivalent through 24c12d3: only Markdown changed after the comment-only YAML change, which passed comment-equivalence. Limitation: no boot ran after 9f4db43. + +CRITERION: AC-11 The PDS package loads non-interactively without installer/network side effects, preserves the caller's shell state and reports library failures; its supported standalone setup preserves Zi, the preset and the existing plugin set. Error-reporting assertions cover explicit non-interactive loading; interactive auto-loading is documented separately. +VERDICT: met +EVIDENCE: At 9f4db43, checks.sh pds ran 36 PDS tests, and all passed. They used the public tracked source and the published deb in a read-only, network-none container. PDS inputs are unchanged through 24c12d3, and the published package hash passed at 86f740b. Limitation: the standalone guide was fetched by the dispatcher. + +CRITERION: AC-12 Repository checks exercise package-backed provisioning, failure paths, sealed-artifact assertions and two fresh boots of each Ubuntu amd64 output; CI reports executed versus skipped checks, and native checks preserve all pre-existing guests. +VERDICT: met +EVIDENCE: At b6975ef, checks-final.sh builders (make check) exited 0: 48 tests, 1 skip, and the real-build SKIP line printed. The 9f4db43 matrix covered two fresh deployments per output and recipe, eight in total, plus the sealed-artifact checks. At 2d0c610, checks.sh observations passed. post-cleanup-comparison.json lists six pre-existing guests whose config and state match. At 24c12d3, checks.sh lifecycle lint passed. Limitations: raw storage hashes differ and only the normalized hashes match. No rebuild ran after 9f4db43. I did not observe hosted CI for the later commits. + +CRITERION: AC-13 PDS bundles selectable VHCO, Stackweaver and preserved EdgeForge MOTD text presets; builders defaults to configurable VHCO, custom-file usage remains supported, and invalid selections leave the active MOTD and other MOTD scripts unchanged. +VERDICT: met +EVIDENCE: At 9f4db43, the checks.sh pds tests passed for the presets, custom-file usage and invalid-selection preservation. The default instances showed the VHCO MOTD. No package input or variable changed through 24c12d3, and the parsed YAML is unchanged. Limitation: no boot ran after 9f4db43. + +CRITERION: AC-14 Both image outputs built with the default recipe retain one configured nightly midnight package-update job that runs non-interactively with an enabled scheduler and effective SSH settings that allow injected non-root public-key login while disabling password, keyboard-interactive and root login; repeated provisioning is safe and temporary Packer access is removed only after it is no longer needed. +VERDICT: met +EVIDENCE: At 9f4db43: +- Cron logs show the exact nightly command ran with UPDATE_EXIT_CODE=0 on all four default instances, with cron active and enabled. +- authentication-events.jsonl shows non-root key login succeeding. After the permissive positive controls succeeded, password and keyboard-interactive were denied with BadAuthenticationType, and the root key was denied. +- I read the reboot branch in validate-instances.py and the two identity-reboot JSONs. There were two reboot operations in total, one on 990342 and one on 990349. Each JSON holds one changed boot-ID pair. Machine ID, DHCP client ID and ed25519 host key were unchanged, and key login worked after the reboot. +- The sealed disks show no Packer access. + +Limitations: there was one reboot per selected default instance, and only the ed25519 host key was measured. The password and root-key fixtures were inserted after boot through the guest agent. No boot ran after 9f4db43. + +CRITERION: AC-15 An operator can select a readable custom Bash recipe at invocation for either output without editing the default recipe or PDS; omitted PDS update/SSH policies are not applied elsewhere, missing recipes and failed calls stop the build, and generic-image cleanup still runs. +VERDICT: met +EVIDENCE: At 9f4db43: +- The native and portable custom builds were selected at invocation, with no policy leak (the custom artifact modes passed). +- The custom instances were checked with only their selected shell. +- The recipe-readability mode, run as a non-root user, executed the unit test that refuses a mode-000 unreadable recipe. +- A missing recipe was refused. + +At b6975ef, the missing-library or missing-call, SSH-restart and custom-shell unit tests passed. No recipe changed through 24c12d3. Limitation: failed-call propagation rests on source and unit coverage, and no rebuild ran after 9f4db43. + +NO FINDINGS diff --git a/docs/specs/0002-image-build-testing.md b/docs/specs/0002-image-build-testing.md index fbad5e3..ecd9286 100644 --- a/docs/specs/0002-image-build-testing.md +++ b/docs/specs/0002-image-build-testing.md @@ -1,15 +1,30 @@ -# 0002 — Automated testing harness for image builds - -- **Status:** draft -- **Scope:** A layered, automated test harness so agents can iterate on templates with confidence, - and so adding a new OS is "plug into the harness" rather than "reinvent testing." Covers static - validation, build smoke tests, offline artifact assertions, and boot/functional tests, plus where - each layer runs (local Apple Silicon vs GitHub-hosted CI vs self-hosted homelab runner). - **Out of scope:** Terraform `bpg/proxmox` clone-time integration testing (that's the consumer; - noted as Layer 4 for context only). +--- +status: draft +status_description: "Migrated for owner review; no current vh-adlc acceptance or completion is claimed." +issue: https://github.com/vhco-pro/builders/issues/2 +goal: "Verify image builds through reusable local and CI test layers with explicit runtime requirements." +covers: + - Makefile + - tests/ + - packer/ + - .github/workflows/ +--- + +# Plan: Automated testing harness for image builds + +Verify image builds through reusable local and CI test layers with explicit runtime requirements. ## Context +Feature 0001 now owns the bounded Ubuntu amd64 package/build/offline/fresh-boot checks required by +PR #4. This draft retains the wider multi-OS/macOS harness and later runner topology. Its status +claims do not establish that the wider matrix is implemented or that the bounded checks have passed. + + +Migration: this file now uses the pinned vh-adlc format in its existing location. Earlier checklist ticks are historical and are not imported as current acceptance. No review or owner-acceptance record has been invented. + +The design below is imported from the earlier draft and has not gained review or acceptance through migration. Current implementation status must be checked before starting it. + Spec 0001 gives us one template with two builders (`proxmox-clone` for a native Proxmox template, `qemu` for a local qcow2/raw) that share the **same cloud-image base** and the **same provisioners**. Before we expand to more operating systems we need an automated way to prove a build is correct — @@ -33,23 +48,25 @@ local/CI qemu loop catches the overwhelming majority of regressions instantly; o Proxmox-specific behaviour (clone succeeds, template flag set, empty cloud-init drive attached) needs the homelab. -## Primer — where CI actually runs (new to this) +### Primer; where CI actually runs (new to this) A GitHub Actions **runner** is just the machine that executes a CI job. Two kinds: - **GitHub-hosted:** lives in GitHub's cloud. Great for anything self-contained, but it **cannot reach - your homelab Proxmox** — that's on your LAN, behind your router. It has no line-of-sight and no + your homelab Proxmox**; that's on your LAN, behind your router. It has no line-of-sight and no business holding your Proxmox credentials. - **Self-hosted:** a small agent *you* install on a machine **inside** your homelab (e.g. a VM on the - Proxmox). It dials out to GitHub, picks up jobs, and runs them locally — so it *can* reach Proxmox. + Proxmox). It dials out to GitHub, picks up jobs, and runs them locally; so it *can* reach Proxmox. -**Do we need a self-hosted runner? Not to start.** The thing you actually want — "the agent checks its -own work without waiting on CI" — is served entirely by the cheap **local** checks (Layer 0, plus an +**Do we need a self-hosted runner? Not to start.** The thing you actually want; "the agent checks its +own work without waiting on CI"; is served entirely by the cheap **local** checks (Layer 0, plus an optional fast arm64 build for Layer 2). A self-hosted runner is only needed later to *automate* the Proxmox-path verification; until then that step is a manual run when you're on the homelab. It's an explicit **phase 2**, not a prerequisite. -## Goals +Current source: `packer/ubuntu/ubuntu.pkr.hcl` defines the two outputs; `Makefile` defines the available local checks. The feature links were confirmed by reading GitHub issues #1, #2 and #3 during this migration. + +## Scope - A test harness with clear **layers**, each independently runnable, cheapest-first. - Every layer's **execution environment is explicit** (local Mac / GitHub-hosted / self-hosted). @@ -59,9 +76,9 @@ explicit **phase 2**, not a prerequisite. - Adding a **new OS** means dropping in a per-template test manifest, not writing a new harness. - One entrypoint (`make test` / a task runner) that selects layers by flag, mirrored 1:1 by CI. -## Non-goals +Out of scope: -- Terraform clone-time / end-to-end infra tests (Layer 4 — the consumer repo owns this). +- Terraform clone-time / end-to-end infra tests (Layer 4; the consumer repo owns this). - Standing up a dedicated always-on test PVE cluster. We reuse the homelab PVE via a self-hosted runner (with a dedicated test storage pool / vmid range to avoid clobbering real templates). @@ -71,13 +88,13 @@ explicit **phase 2**, not a prerequisite. | Layer | What it checks | Needs KVM? | Needs PVE? | Speed | | --- | --- | --- | --- | --- | -| **0 — Lint/validate** | `packer fmt -check`, `packer validate` (dummy vars), `shellcheck` on `scripts/*.sh`, `cloud-init schema` + `yamllint` on user-data | no | no | instant | -| **1 — Build smoke** | The build actually completes and yields an artifact (exercises all shared provisioners) | qemu: yes (or slow TCG); proxmox: n/a | proxmox path only | mins | -| **2 — Offline assertions** | Inspect the produced qcow2/raw *without booting*: `/etc/machine-id` empty, no `authorized_keys`, no static netplan identity, no persisted SSH host keys, expected files present | no | no | seconds | -| **3 — Boot/functional** | Boot the artifact headless in QEMU with a throwaway cloud-init NoCloud seed; assert cloud-init applied identity, machine-id is freshly generated (and differs across two boots), expected packages/services present | yes (or slow TCG) | no | mins | -| **4 — Clone integration** *(out of scope)* | `bpg/proxmox` clones the template + smoke-tests the VM | — | yes | mins | +| **0; Lint/validate** | `packer fmt -check`, `packer validate` (dummy vars), `shellcheck` on `scripts/*.sh`, `cloud-init schema` + `yamllint` on user-data | no | no | instant | +| **1; Build smoke** | The build actually completes and yields an artifact (exercises all shared provisioners) | qemu: yes (or slow TCG); proxmox: n/a | proxmox path only | mins | +| **2; Offline assertions** | Inspect the produced qcow2/raw *without booting*: `/etc/machine-id` empty, no `authorized_keys`, no static netplan identity, no persisted SSH host keys, expected files present | no | no | seconds | +| **3; Boot/functional** | Boot the artifact headless in QEMU with a throwaway cloud-init NoCloud seed; assert cloud-init applied identity, machine-id is freshly generated (and differs across two boots), expected packages/services present | yes (or slow TCG) | no | mins | +| **4; Clone integration** *(out of scope)* | `bpg/proxmox` clones the template + smoke-tests the VM |; | yes | mins | -Layers 0 and 2 are the cheap, deterministic, secret-free core — they should be the mandatory PR gate. +Layers 0 and 2 are the cheap, deterministic, secret-free core; they should be the mandatory PR gate. ### Where each layer runs @@ -88,10 +105,10 @@ Layers 0 and 2 are the cheap, deterministic, secret-free core — they should be | **Self-hosted homelab runner** | ✅ | ✅ | ✅ (PVE line-of-sight + secrets) | ✅ | ✅ | Notes: -- **`packer validate` does not contact Proxmox** — it's a static config check, so it runs anywhere +- **`packer validate` does not contact Proxmox**; it's a static config check, so it runs anywhere with placeholder Proxmox vars. That's why Layer 0 covers the proxmox source too. - **GitHub-hosted Linux runners** now expose KVM/nested virt on public repos, but this must not be - assumed — a preflight (`ls -l /dev/kvm` / `kvm-ok`) gates whether Layer 1/3 accelerate or skip. + assumed; a preflight (`ls -l /dev/kvm` / `kvm-ok`) gates whether Layer 1/3 accelerate or skip. - **Offline inspection (Layer 2)** is arch-agnostic (it reads the amd64 filesystem, doesn't execute it), so it runs fast on the Mac. Use `libguestfs` (`guestfish`/`virt-cat`); on macOS run it via a container image to avoid the finicky native install, or loopback-mount the raw image. @@ -100,17 +117,17 @@ Notes: - **Local agent self-check (your Mac, no wait, no CI):** Layer 0 always (instant), plus an optional fast **arm64** `qemu` build + Layer 2 offline assertions when deeper confidence is wanted. This is the - loop an agent runs to check its own work before pushing. **amd64 builds are not run locally** — arm64 + loop an agent runs to check its own work before pushing. **amd64 builds are not run locally**; arm64 is close enough for provisioner-logic feedback, and full amd64 goes to the pipeline (decided). - **PR gate (GitHub-hosted, every PR):** Layer 0 + Layer 1 (**amd64** `qemu` build, KVM) + Layer 2 offline assertions + Layer 3 boot test if KVM present. No homelab, no secrets, deterministic. This is where amd64 gets exercised for real. -- **Proxmox verification (phase 2 — self-hosted runner = a VM on the homelab Proxmox host, on merge to +- **Proxmox verification (phase 2; self-hosted runner = a VM on the homelab Proxmox host, on merge to `main` or manual dispatch; until then run manually on the homelab):** Layer 1 `proxmox-clone` build against the real PVE → assert the output is flagged `template: 1` (`qm config `) with an empty cloud-init drive attached, and that the clone+provision succeeded. Uses a **dedicated vmid range + `test-*` names** (optionally a `packer-test` pool) on the existing Proxmox host; API token supplied - via runner/shell env, never committed. Kept **off the per-PR path** — it needs the physical host and + via runner/shell env, never committed. Kept **off the per-PR path**; it needs the physical host and must not block fast iteration. ### Multi-OS extensibility @@ -125,65 +142,95 @@ against any template + manifest. Adding an OS = new `packer//` + its manifes - **Layer 0:** `packer fmt`/`validate` (built in), `shellcheck`, `cloud-init schema`, `yamllint`. - **Layer 2:** `libguestfs` (`guestfish`, `virt-cat`, `virt-inspector`); on macOS run it via a container. -- **Layer 3 assertions: Goss / dgoss** — lightweight YAML, no runtime deps on the target, and it fits +- **Layer 3 assertions: Goss / dgoss**; lightweight YAML, no runtime deps on the target, and it fits the "per-template manifest" model cleanly. (InSpec/Testinfra considered and dropped as heavier.) -- **Runner/entrypoint: `Makefile`** — preinstalled everywhere (Mac + Linux + CI), zero-dependency so an +- **Runner/entrypoint: `Makefile`**; preinstalled everywhere (Mac + Linux + CI), zero-dependency so an agent can always run it. Targets like `make check` (Layer 0), `make test-local` (0 + arm64 1 + 2), `make test-proxmox`. CI invokes the same targets verbatim, so local and CI run identical commands. -## Acceptance criteria - -- [ ] `make check` runs Layer 0 (fmt/validate/shellcheck/cloud-init schema) with **no KVM and no PVE** - and passes on both Apple Silicon and a GitHub-hosted runner — the agent's instant self-check. -- [ ] `make test-local` runs an **arm64** `qemu` build + Layer 2 offline assertions on Apple Silicon, - no PVE, giving the agent deeper confidence without waiting on CI. -- [ ] Layer 1 (**amd64** `qemu` build) + Layer 3 boot test run in GitHub-hosted CI (KVM-gated) on every PR. -- [ ] Layer 2 machine-asserts every spec-0001 generic-image invariant (empty machine-id, no - authorized_keys, no static netplan identity, no persisted SSH host keys) and fails the build if - any is violated. -- [ ] Layer 3 proves cloud-init applies clone-time identity and that machine-id is freshly generated - and differs between two independent boots of the same artifact. -- [ ] The `proxmox-clone` path is verified against the homelab PVE (clone+provision succeeds, output - flagged `template: 1`, empty cloud-init drive attached), using a reserved vmid range + `test-*` - names and env-supplied secrets — run manually at first, automated on a self-hosted runner (a VM on - the Proxmox host) in phase 2. -- [ ] Documented "how to run tests locally on macOS" including the arm64-fast / amd64-slow caveat and - the container-based `libguestfs` path. -- [ ] Adding a hypothetical second OS requires only a new template dir + test manifest — no harness - changes (validated by dry-running the harness against a stub manifest). - -## Decisions (resolved) +### Earlier recorded decisions - **Test target:** the **existing** homelab Proxmox host (no separate node). Isolate test builds with a reserved **vmid range** (e.g. 9000–9099) + `test-*` template names, optionally grouped in a - `packer-test` **pool** for easy bulk cleanup. (A "pool" is just a label for grouping — it doesn't + `packer-test` **pool** for easy bulk cleanup. (A "pool" is just a label for grouping; it doesn't reserve compute; a separate "node" would be a whole extra host, which we don't need.) - **Self-hosted runner:** **not required to start.** The agent's no-wait loop is local (Layer 0 + arm64 Layer 1/2). A self-hosted runner is **phase 2**, only to automate the Proxmox verification; until then that step is a manual run on the homelab. When we do it, it's a **VM on the homelab Proxmox host** (decided). - **Layer 3 framework:** **Goss / dgoss.** -- **amd64-on-Mac:** don't build amd64 locally — arm64 is close enough for provisioner-logic feedback; +- **amd64-on-Mac:** don't build amd64 locally; arm64 is close enough for provisioner-logic feedback; amd64 build/boot runs in the pipeline. - **Runner entrypoint:** **Makefile.** - **NoCloud seed for Layer 3 (explained):** to boot-test the image we must feed it a cloud-init the same - way production will — via a small **NoCloud** seed disk (a mini virtual drive holding `user-data` + + way production will; via a small **NoCloud** seed disk (a mini virtual drive holding `user-data` + `meta-data`). **Decided: the test seed mirrors the shape `bpg/proxmox` injects at clone time** (same fields: hostname, SSH keys, network, edgectl user-data). That way a green boot test means the *real* clone-time path works, not just some artificial one. -## Open questions +## Acceptance Criteria + +- [ ] AC-01: `make check` runs Layer 0 (fmt/validate/shellcheck/cloud-init schema) with **no KVM and no PVE** and passes on both Apple Silicon and a GitHub-hosted runner; the agent's instant self-check. +- [ ] AC-02: `make test-local` runs an **arm64** `qemu` build + Layer 2 offline assertions on Apple Silicon, no PVE, giving the agent deeper confidence without waiting on CI. +- [ ] AC-03: Layer 1 (**amd64** `qemu` build) + Layer 3 boot test run in GitHub-hosted CI (KVM-gated) on every PR. +- [ ] AC-04: Layer 2 machine-asserts every spec-0001 generic-image invariant (empty machine-id, no authorized_keys, no static netplan identity, no persisted SSH host keys) and fails the build if any is violated. +- [ ] AC-05: Layer 3 proves cloud-init applies clone-time identity and that machine-id is freshly generated and differs between two independent boots of the same artifact. +- [ ] AC-06: The `proxmox-clone` path is verified against the homelab PVE (clone+provision succeeds, output flagged `template: 1`, empty cloud-init drive attached), using a reserved vmid range + `test-*` names and env-supplied secrets; run manually at first, automated on a self-hosted runner (a VM on the Proxmox host) in phase 2. +- [ ] AC-07: Documented "how to run tests locally on macOS" including the arm64-fast / amd64-slow caveat and the container-based `libguestfs` path. +- [ ] AC-08: Adding a hypothetical second OS requires only a new template dir + test manifest; no harness changes (validated by dry-running the harness against a stub manifest). + +## Test Plan + +| Criterion | Proof | +| --- | --- | +| AC-01 | Run the documented Layer 0 target without KVM or Proxmox on Apple Silicon and a GitHub-hosted runner; check every promised validator executes. | +| AC-02 | Run the documented arm64 local build and offline assertions on Apple Silicon without Proxmox. | +| AC-03 | Run the PR workflow with and without KVM; verify amd64 build/boot checks execute when available and report an explicit skip otherwise. | +| AC-04 | Run offline assertions against valid and deliberately invalid artifacts; each baked identity/key violation must fail. | +| AC-05 | Boot the same artifact twice with different NoCloud seeds and compare applied identity and machine IDs. | +| AC-06 | Run the reserved-ID Proxmox integration procedure; verify output configuration and ownership-limited cleanup. Validate runner automation separately when phase 2 is implemented. | +| AC-07 | Execute the documented macOS procedure, including its container-based artifact inspection. | +| AC-08 | Run the harness against a second stub manifest without modifying harness code. | + +## Tasks + +None scheduled under vh-adlc yet. Do not reconstruct completed task commits retrospectively. Plan the unchecked work after review and owner acceptance. + +## Open Questions + +### Q1: Where should the phase-2 runner obtain its restricted Proxmox token? + +**Recommendation:** A. Use a protected runner environment with permissions restricted to owned test resources. + +| Option | You get | It costs | +| --- | --- | --- | +| A. Protected runner environment | Central credential rotation and protected execution | Environment and runner access policies must be configured | +| B. Local runner secret file | A simple host-managed credential source | File access and rotation need a separate operational procedure | + +**Why this is yours:** The original draft left credential storage and scoping open; this migration grants no live credential or runner configuration changes. + +### Q2: How should macOS users run the libguestfs inspection tools? + +**Recommendation:** A. Select a verified container invocation and record its prerequisites. + +| Option | You get | It costs | +| --- | --- | --- | +| A. Container-based inspection | A repeatable tool environment | Requires a supported local container runtime | +| B. Separate Linux inspection host | Native Linux tools | Adds a remote host to the local test procedure | + +**Why this is yours:** The original draft has no tested macOS packaging choice. + +## Review Log -- **API token scoping on the phase-2 runner VM:** how the Proxmox token is stored/limited on that VM - (the placement itself is decided: a VM on the Proxmox host). -- **libguestfs-on-macOS packaging:** which container image / invocation is the least-friction path for - Layer 2 locally. +| Date | Review | Kind | Commit | Model | Isolation | Outcome | +| --- | --- | --- | --- | --- | --- | --- | -## References +## Sources -- [`packer validate`](https://developer.hashicorp.com/packer/docs/commands/validate) — static, no API contact. -- [QEMU on Apple Silicon / HVF accelerator](https://www.qemu.org/docs/master/system/target-i386.html) — HVF only accelerates same-arch guests. +- [`packer validate`](https://developer.hashicorp.com/packer/docs/commands/validate); static, no API contact. +- [QEMU on Apple Silicon / HVF accelerator](https://www.qemu.org/docs/master/system/target-i386.html); HVF only accelerates same-arch guests. - [GitHub-hosted runners & KVM/nested virtualization](https://docs.github.com/actions/using-github-hosted-runners/about-github-hosted-runners). -- [Goss / dgoss](https://github.com/goss-org/goss) — server/image validation via YAML manifests. -- [libguestfs](https://libguestfs.org/) — offline image inspection. +- [Goss / dgoss](https://github.com/goss-org/goss); server/image validation via YAML manifests. +- [libguestfs](https://libguestfs.org/); offline image inspection. - Depends on: [`0001-packer-proxmox-native-output.md`](0001-packer-proxmox-native-output.md). +- [Feature-document standard](https://github.com/vhco-pro/docs/blob/0e52f51f01b84eda75a976763c42d8ec0a07b544/conventions/feature-documents.md): lifecycle, criteria, proof and review-record formats. diff --git a/docs/specs/0003-pds-provisioning-migration.md b/docs/specs/0003-pds-provisioning-migration.md index b93c0f6..f832995 100644 --- a/docs/specs/0003-pds-provisioning-migration.md +++ b/docs/specs/0003-pds-provisioning-migration.md @@ -1,21 +1,42 @@ -# 0003 — Move provisioning into PDS ("select and apply") +--- +status: superseded +status_description: "Delivery scope folded into feature 0001 and PR #4; no PDS implementation or issue completion is claimed." +issue: https://github.com/vhco-pro/builders/issues/3 +goal: "Configure builder images through selected functions from an exact version of the standalone PDS package." +covers: + - packer/ubuntu/ + - readme.md +--- -- **Status:** draft -- **Scope:** the `build` block's provisioners for `packer/ubuntu` — replace inline install/config logic - with calls into the **PDS** apt package. Applies to *both* builders from 0001 (they share the `build` - block). **Out of scope:** identity provisioning (hostname/user/SSH keys → cloud-init at clone time, - per 0001), the builder/output mechanics (0001), the test harness (0002), and PDS's own internals. +# Superseded: Move provisioning into PDS + +Configure builder images through selected functions from an exact version of the standalone PDS package. ## Context +The owner selected one builders delivery for PDS bootstrap and the image outputs on 2026-11-04. +The current normative scope, bootstrap mapping and verification plan are in +[feature 0001](0001-packer-proxmox-native-output.md#pds-provisioning-and-package-identity), delivered +through PR #4. The body below preserves the earlier proposal as history; its assumed entrypoints, +function list and verification claims must not be used as current acceptance. + +The dependent PDS repository still has its own changes and review. This document's `superseded` +state does not mean PDS integration is implemented or issue #3 is closed. The local transition check +returned `vh-adlc gate superseded: pass (rules 1, docs 0e52f51)`. + + +Migration: this file now uses the pinned vh-adlc format in its existing location. Earlier checklist ticks are historical and are not imported as current acceptance. No review or owner-acceptance record has been invented. + +The design below is imported from the earlier draft and has not gained review or acceptance through migration. Current implementation status must be checked before starting it. + The old readme said it out loud: *"Move all the functionality to PDS and just import here, script should -be select and apply."* Today `packer/ubuntu/scripts/install.sh` is the opposite of that — a long inline +be select and apply."* Today `packer/ubuntu/scripts/install.sh` is the opposite of that; a long inline script that **duplicates logic PDS already has**, while also *calling* PDS-style functions it never reliably installs (there's a standing `TODO: Rework fetching the functions to using the pds apt package`). The copied `scripts/.p10k.zsh` and `scripts/zshrc` are likewise duplicates of files that live in PDS (`bash/config/.p10k.zsh`). -PDS is now a real, installable artifact — the **`pds` Debian package** served from a GitHub Pages APT +PDS is now a real, installable artifact; the **`pds` Debian package** served from a GitHub Pages APT repo (`https://michielvha.github.io/PDS/apt/`), which lands functions under `/usr/share/pds/` and adds a `pds` CLI. So the migration is now concrete: **install the package, source it, call functions.** @@ -46,21 +67,23 @@ logic. Concretely: - **MOTD:** contribute as `setup_motd`; PDS may pick a maintained tool (e.g. fastfetch) since `neofetch` is deprecated upstream. -## Goals +Current source: `packer/ubuntu/ubuntu.pkr.hcl` defines the two outputs; `Makefile` defines the available local checks. The feature links were confirmed by reading GitHub issues #1, #2 and #3 during this migration. + +## Scope - Builder provisioning = **install the `pds` package → source it → call a declarative list of PDS functions**. No inline install/config logic in the repo. - Remove the duplicated shell-config files (`scripts/.p10k.zsh`, `scripts/zshrc`) in favour of PDS's. - Establish a **"select and apply" manifest** per image so adding an OS/role is "list the functions," - not "write a script" — dovetails with the multi-OS goal in 0002. + not "write a script"; dovetails with the multi-OS goal in 0002. - Everything that makes the image *machine-specific* stays **out** (that's 0001's cloud-init boundary). -## Non-goals +Out of scope: -- Identity provisioning (hostname, admin user, SSH keys, static net) — owned by clone-time cloud-init. +- Identity provisioning (hostname, admin user, SSH keys, static net); owned by clone-time cloud-init. - Changing PDS itself beyond **filling gaps** the builder needs (e.g. a MOTD function) and ensuring the needed functions are actually bundled in the `pds` package. -- Reworking the `cleanup.sh` teardown beyond what 0001 already specifies (machine-id, cloud-init reset). +- Reworking the `seal-image.sh` teardown beyond what 0001 already specifies (machine-id, cloud-init reset). ## Design @@ -87,7 +110,7 @@ non-interactive, so we source the init script directly rather than relying on pr source /usr/share/pds/init.sh # exposes install_kubectl, configure_zsh, ... (verify exact path) ``` -### 3. "Select and apply" — the thin per-image provisioner +### 3. "Select and apply"; the thin per-image provisioner `install.sh` collapses to a declarative sequence of PDS calls (the *only* logic builders keeps), e.g.: @@ -108,7 +131,7 @@ The exact list is the image's "manifest." Keeping it a plain, readable sequence enough for now; a per-role manifest file can come later if we grow many roles. Shell-config files come from the PDS package, so `scripts/.p10k.zsh` / `scripts/zshrc` and their `file` provisioners are deleted. -### 4. Gaps to close in PDS (cross-repo — tracked/worked in the PDS repo) +### 4. Gaps to close in PDS (cross-repo; tracked/worked in the PDS repo) Verified against PDS `packaging/nfpm.yaml` (bundles `bash/debian/` + `bash/common/` → `/usr/share/pds/`; `init.sh` auto-sources two levels deep, `platform/category/*.sh`) and the function locations: @@ -118,50 +141,79 @@ Verified against PDS `packaging/nfpm.yaml` (bundles `bash/debian/` + `bash/commo (`common/shell` + `common/admin`), `update_system_cron_entry` + `restricted_ssh_security_profile` (`common/admin/sysadmin.sh`), `install_kubectl` (`debian/software`). `bash/module/` is **not** packaged, which is fine since it only holds duplicates. -- **One real gap — MOTD:** the custom MOTD/neofetch block has no PDS equivalent. Contribute it (e.g. +- **One real gap; MOTD:** the custom MOTD/neofetch block has no PDS equivalent. Contribute it (e.g. `setup_motd`) so builders can drop its last inline block. -- **Cleanup — duplicate definitions:** several functions exist in *both* `bash/module/` and `bash/common/` +- **Cleanup; duplicate definitions:** several functions exist in *both* `bash/module/` and `bash/common/` (`set_sudo_nopasswd`, `update_system_cron_entry`, `configure_zsh`, ...). The unpackaged `module/` copies risk drift; pick `common/` as canonical and retire/repackage `module/` consistently. - **Non-interactive contract:** `profile.d/pds.sh` (interactive-only, prints a welcome banner) is *not* - our entry point — builders sources `init.sh` directly. Confirm `source /usr/share/pds/init.sh` is + our entry point; builders sources `init.sh` directly. Confirm `source /usr/share/pds/init.sh` is **side-effect-free and safe under `set -eux`** (it sources *all* category `*.sh`, so any file with top-level side effects or required env would break a non-interactive build). Worth a guarantee in PDS. - **Path/name consistency:** PDS `packaging/README.md` says `/usr/share/pds-funcs/` while the real install - path is `/usr/share/pds/` — align the docs. + path is `/usr/share/pds/`; align the docs. > These are PDS-repo tasks. This spec only *depends* on them landing; builders work starts once the `pds` > package exposes `setup_motd` and the non-interactive `source` contract is confirmed. -## Acceptance criteria - -- [ ] `packer/ubuntu/scripts/install.sh` contains **no** inline install/config implementations — only - PDS install + `source` + a select-and-apply list of PDS function calls. -- [ ] The `pds` package is installed from the APT repo at a **pinned version** during the build. -- [ ] Duplicated `scripts/.p10k.zsh` and `scripts/zshrc` are removed; their config comes from PDS. -- [ ] Every PDS function the manifest calls is **resolved from the installed package** (confirmed via - `pds show `), not from a local copy — and any gap is filed/added upstream in PDS first. -- [ ] The Ubuntu image still builds green through 0002's harness (Layer 0–3), proving the PDS-provisioned - image has the expected tooling (kubectl, zsh/p10k, cron updater, MOTD) and no identity baked in. -- [ ] `packer/ubuntu/readme.md` documents the select-and-apply model and the per-image function list. - -## Open questions - -- **Build-time SSH ordering:** `restricted_ssh_security_profile` disables password auth / root login. - Packer connects over SSH during the build — applying hardening too early can sever that connection. - Run it last / ensure it's compatible with the temporary build key and with clone-time key injection. - (Decide: apply in `install.sh` late, or defer purely-SSH hardening to cloud-init?) -- **`pds` version pinning vs latest:** pin an exact version per builders release (reproducible) vs track - `stable` (fresh). Leaning pinned, bumped deliberately. -- **Manifest form:** plain bash sequence (now) vs a declarative per-role manifest file (later, when there - are multiple roles/OSes). Start simple. -- **Offline/air-gapped builds:** the old script had a `TODO: check for internet or provide some local - way to pull the module`. Out of scope now, but note the APT-repo dependency means builds need network. - -## References +## Acceptance Criteria + +- [ ] AC-01: `packer/ubuntu/scripts/install.sh` contains **no** inline install/config implementations; only PDS install + `source` + a select-and-apply list of PDS function calls. +- [ ] AC-02: The `pds` package is installed from the APT repo at a **pinned version** during the build. +- [ ] AC-03: Duplicated `scripts/.p10k.zsh` and `scripts/zshrc` are removed; their config comes from PDS. +- [ ] AC-04: Every PDS function the manifest calls is **resolved from the installed package** (confirmed via `pds show `), not from a local copy; and any gap is filed/added upstream in PDS first. +- [ ] AC-05: The Ubuntu image still builds green through 0002's harness (Layer 0–3), proving the PDS-provisioned image has the expected tooling (kubectl, zsh/p10k, cron updater, MOTD) and no identity baked in. +- [ ] AC-06: `packer/ubuntu/readme.md` documents the select-and-apply model and the per-image function list. + +## Test Plan + +| Criterion | Proof | +| --- | --- | +| AC-01 | Inspect the provisioning entrypoint and run a package-backed image build; confirm shared installation/configuration is selected through PDS calls rather than copied implementations. | +| AC-02 | Build with a chosen exact published PDS package version and verify the installed package version inside the image. | +| AC-03 | Inspect the resulting filesystem and source references; shell configuration must come from the installed PDS package, not local duplicate files. | +| AC-04 | Use `pds show` and package-file inspection to establish the origin of every selected function; inspect its upstream tracking when a gap remains. | +| AC-05 | Run the implemented image harness through Layers 0-3 for the PDS-backed image, checking selected tooling and fresh identity. | +| AC-06 | Follow the Ubuntu guide and compare the documented function selection with the executable provisioner. | + +## Tasks + +None scheduled under vh-adlc yet. Do not reconstruct completed task commits retrospectively. Plan the unchecked work after review and owner acceptance. + +## Open Questions + +### Q1: When should optional SSH hardening be applied? + +**Recommendation:** A. Defer SSH policy to consumer configuration until build and first-boot access are independently verified. + +| Option | You get | It costs | +| --- | --- | --- | +| A. Consumer configuration | Explicit access policy per deployed machine | Consumers must apply the policy | +| B. Final image provisioner | One common policy in the image | The build connection and clone-time access must remain usable | + +**Why this is yours:** The original draft left this access-policy choice open. PDS remains reusable in either case. + +### Q2: Should the PDS image selection stay in Bash or move to a separate manifest? + +**Recommendation:** A. Keep a short Bash selection while only one image recipe needs it. + +| Option | You get | It costs | +| --- | --- | --- | +| A. Bash function selection | Direct calls to the standalone library | Multiple roles may eventually repeat selection lists | +| B. Separate role manifest | A data-driven selection interface | Requires a new schema and interpreter | + +**Why this is yours:** The original draft proposed starting with Bash but did not record an owner decision in the current workflow. + +## Review Log + +| Date | Review | Kind | Commit | Model | Isolation | Outcome | +| --- | --- | --- | --- | --- | --- | --- | + +## Sources - [PDS repo](https://github.com/michielvha/PDS) and its `packaging/README.md` (apt package + `pds` CLI). - PDS APT repo: `https://michielvha.github.io/PDS/apt/` (GPG key + `deb` source, `apt install pds`). - Depends on / shares the `build` block with [`0001-packer-proxmox-native-output.md`](0001-packer-proxmox-native-output.md); verified by [`0002-image-build-testing.md`](0002-image-build-testing.md). - Legacy being replaced: `packer/ubuntu/scripts/install.sh`, `scripts/.p10k.zsh`, `scripts/zshrc`. +- [Feature-document standard](https://github.com/vhco-pro/docs/blob/0e52f51f01b84eda75a976763c42d8ec0a07b544/conventions/feature-documents.md): lifecycle, criteria, proof and review-record formats. diff --git a/docs/specs/README.md b/docs/specs/README.md index 5821b43..9a4d240 100644 --- a/docs/specs/README.md +++ b/docs/specs/README.md @@ -1,20 +1,27 @@ -# Specs +# Feature documents -Every non-trivial change to this repo starts here. We design the behaviour, review it, then implement. -This is the deliberate replacement for the old copy-paste workflow. +The canonical lifecycle is vh-adlc at the revision pinned in [AGENTS.md](../../AGENTS.md). +Each feature has one document containing its scope, criteria, test plan, tasks, questions and reviews. +Use the shared vh-adlc reviewer; do not replace independent review with the implementing agent's assessment. -## Workflow +Feature #1 has an accepted spec and is in progress. Its dated validation and independent review +records distinguish observed tests from acceptance. Feature #2 retains its wider draft scope; #3 is +superseded by #1. Earlier implementation and review history remains in the documents and Git history. -1. **Draft** — copy [`_template.md`](_template.md) to `NNNN-short-slug.md` (next free number) and fill it in. -2. **Review** — discuss and refine until the design is agreed. Status stays `draft`. -3. **Implement** — build it. Flip status to `in-progress`, then `done` when the acceptance criteria pass. -4. **Document** — a done spec is a self-contained record of *what* changed and *why*, readable on its own. - (The writing agent turns these into blog posts, so keep the narrative honest and complete.) +| Issue | Feature | Status | +| --- | --- | --- | +| #1 | [Ubuntu images and PDS bootstrap](0001-packer-proxmox-native-output.md) | in-progress | +| #2 | [Image test harness](0002-image-build-testing.md) | draft | +| #3 | [PDS delivery folded into #1](0003-pds-provisioning-migration.md) | superseded | -## Index +Issue #3 remains open until the integrated bootstrap is verified and merged. Feature #2 keeps its +wider multi-OS/macOS scope; the bounded Ubuntu checks belong to #1. -| # | Spec | Status | -| --- | --- | --- | -| 0001 | [Packer: Proxmox-native builder with selectable output formats](0001-packer-proxmox-native-output.md) | draft | -| 0002 | [Automated testing harness for image builds](0002-image-build-testing.md) | draft | -| 0003 | [Move provisioning into PDS ("select and apply")](0003-pds-provisioning-migration.md) | draft | +Start with `vh-adlc find --issue ` or `vh-adlc find --slug `, then follow the procedure named by `vh-adlc next`. Run `knowledge` and read +the resolved pages before editing. `lint` checks document shape; `fresh` checks review currency; a +status change needs the corresponding `gate` result. Commit and publication restrictions in +[AGENTS.md](../../AGENTS.md) still apply. A review of uncommitted work uses `+dirty` and cannot complete +a feature. + +Use the [pinned central template](https://github.com/vhco-pro/docs/blob/0e52f51f01b84eda75a976763c42d8ec0a07b544/guides/feature-document-template.md). +Fill it with measured facts rather than copying another feature's decisions or evidence. diff --git a/docs/specs/_template.md b/docs/specs/_template.md deleted file mode 100644 index dc9583c..0000000 --- a/docs/specs/_template.md +++ /dev/null @@ -1,33 +0,0 @@ -# NNNN — Title - -- **Status:** draft | in-progress | done -- **Scope:** what this touches (and what it explicitly does not) - -## Context - -Why are we doing this? What exists today, and what's wrong or limiting about it? - -## Goals - -- Bullet the concrete outcomes this spec must achieve. - -## Non-goals - -- Bullet what is explicitly out of scope so it doesn't creep in. - -## Design - -The actual approach. Include illustrative config/HCL snippets where they clarify intent, but keep -them design-level — the implementation may refine details. - -## Acceptance criteria - -- [ ] Testable statements. When all are checked, the spec is `done`. - -## Open questions - -- Anything undecided that needs an answer before or during implementation. - -## References - -- Links to docs, upstream issues, prior art. diff --git a/docs/ubuntu/build-host-setup.md b/docs/ubuntu/build-host-setup.md new file mode 100644 index 0000000..5475228 --- /dev/null +++ b/docs/ubuntu/build-host-setup.md @@ -0,0 +1,74 @@ +# Set up a Packer build host + +Install these Ubuntu/Debian build tools on the workstation or a disposable build VM. Proxmox itself only needs its native import tools. + +## Install Packer + +Add [HashiCorp's apt repository](https://developer.hashicorp.com/packer/install): + +```bash +sudo apt-get update +sudo apt-get install -y wget curl gnupg ca-certificates lsb-release +wget -qO- https://apt.releases.hashicorp.com/gpg | + sudo gpg --dearmor --yes -o /usr/share/keyrings/hashicorp-archive-keyring.gpg +printf 'deb [arch=%s signed-by=/usr/share/keyrings/hashicorp-archive-keyring.gpg] https://apt.releases.hashicorp.com %s main\n' \ + "$(dpkg --print-architecture)" "$(lsb_release -cs)" | + sudo tee /etc/apt/sources.list.d/hashicorp.list +sudo apt-get update +sudo apt-get install -y packer +packer version +``` + +The package command installs the repository's available version. To reproduce a dated validation, +select its recorded Packer version from `apt-cache madison packer`, then install that exact apt +version. The [CI workflow](../../.github/workflows/check.yaml) records the reference version used by checks. + +## Install QEMU and local check tools + +For an amd64 build host: + +```bash +sudo apt-get install -y qemu-system-x86 qemu-utils genisoimage shellcheck jq python3 zsh +``` + +For an ARM64 build host, the corresponding emulators are: + +```bash +sudo apt-get install -y qemu-system-arm qemu-system-aarch64 qemu-utils genisoimage shellcheck jq python3 zsh +``` + +The current live validation covers Ubuntu amd64. Installing ARM emulators does not establish that +an ARM image boots; keep the [legacy ARM recipes](../legacy/armbian-qemu.md) separate from that result. + +KVM requires access to `/dev/kvm`. Check it as the user who will run Packer: + +```bash +test -r /dev/kvm && test -w /dev/kvm +``` + +If access is missing, configure the host's KVM group membership and start a new login session. +The [local build guide](local-build.md) also shows software emulation with TCG. + +## Optional libvirt desktop tools + +These tools manage local guests through libvirt or Virt Manager. +The Packer QEMU builder invokes QEMU directly and does not need a libvirt daemon. + +```bash +sudo apt-get install -y libvirt-daemon-system libvirt-clients bridge-utils virtinst virt-manager +``` + +For libguestfs inspection and off-node base preparation, use the additional prerequisites in the +[recovery guide](recovery.md#rebuild-when-the-bundle-is-also-lost). They include a readable kernel and +the appliance DHCP client. + +## Initialize the project's plugins + +From the repository root: + +```bash +cd packer/ubuntu +packer init . +``` + +Run initialization and builds as the same user so they share the plugin cache. The template selects the plugin versions; a separate manual plugin installation is unnecessary. Continue with the [local build](local-build.md) or [optional Proxmox build](proxmox.md). diff --git a/docs/ubuntu/image-inspection.md b/docs/ubuntu/image-inspection.md new file mode 100644 index 0000000..364c0e8 --- /dev/null +++ b/docs/ubuntu/image-inspection.md @@ -0,0 +1,62 @@ +# Inspect an exported image + +Choose guestfish for filesystem inspection without booting. Use raw-image mounting and chroot when a repair needs direct access to the image userspace. + +## Read a qcow2 or raw disk with guestfish + +Fedora 43 provides `guestfish` in +[`libguestfs`](https://packages.fedoraproject.org/pkgs/libguestfs/libguestfs/fedora-43.html); +Ubuntu/Debian include it in `libguestfs-tools`. From the repository root: + +```bash +image=packer/ubuntu/output-noble-amd64/ubuntu-noble-amd64.qcow2 +guestfish --ro -a "$image" -i cat /etc/hostname +``` + +Use the [recovery guide's prerequisites](recovery.md#rebuild-when-the-bundle-is-also-lost) if the host +kernel is unreadable or the appliance cannot start. `--ro` keeps the disk unchanged. + +## Mount a raw image and enter chroot + +Loop mounting applies to raw files. A qcow2 file needs guestfish or a conversion to raw first. +Use a working copy for repairs, on a host with the same CPU architecture as the image: + +```bash +cp --reflink=auto /path/to/exported-image.raw /path/to/working-copy.raw +image=/path/to/working-copy.raw +sudo mkdir -p /mnt/image +sudo fdisk -l "$image" +``` + +A raw file containing one filesystem can be mounted directly: + +```bash +sudo mount -o loop "$image" /mnt/image +``` + +For a partitioned raw disk, use the root partition's start sector and sector size shown by `fdisk`. +Set both values from that output; the values below are examples: + +```bash +start_sector=2048 # Replace with the root partition's start sector. +sector_bytes=512 # Replace with the reported sector size. +offset_bytes=$((start_sector * sector_bytes)) +sudo mount -o "loop,offset=$offset_bytes" "$image" /mnt/image +``` + +Choose one of the two mount commands, then enter its userspace and unmount when finished: + +```bash +sudo chroot /mnt/image /bin/bash +# Run the inspection or repair commands inside the image. +exit +sudo umount /mnt/image +``` + +The mount is writable, so changes affect the working copy. Add `ro` to the chosen mount options for +inspection only. A repair that needs `/proc`, devices or DNS requires those chroot prerequisites as +well; the shell command alone does not set up a complete package-repair environment. A modified copy +needs artifact and fresh-boot checks before being used as a template. + +See [guestfish's manual](https://libguestfs.org/guestfish.1.html) for inspection options and +[manual boot](manual-boot.md) for a disposable QEMU run with a deployment seed. diff --git a/docs/ubuntu/image-pipeline.md b/docs/ubuntu/image-pipeline.md new file mode 100644 index 0000000..01d7fde --- /dev/null +++ b/docs/ubuntu/image-pipeline.md @@ -0,0 +1,58 @@ +# Ubuntu image preparation + +The [QEMU](local-build.md) and [native Proxmox](proxmox.md) builders share the same configuration and +sealing steps. QEMU produces a local qcow2 and optional raw disk; the native builder produces a +Proxmox template. Choose the builder with `-only`. + +```mermaid +flowchart TD + Build["QEMU or optional Proxmox"] --> Upload["Upload build config"] + Upload --> Wait["Wait for cloud-init"] + Wait --> Configure["Apply Ubuntu settings"] + Configure --> Package["Verify and install PDS package"] + Package --> Recipe["Run selected Bash recipe"] + Recipe --> Seal["Seal image"] + Seal --> Output["Selected image output"] +``` + +Both apply the packages, locale, keyboard and timezone in +[build-config.yaml](../../packer/ubuntu/cloud-init/build-config.yaml). Clone-time cloud-init supplies +users, SSH keys, hostname and network identity. + +## Script responsibilities + +`install.sh` is an image provisioner. It stays a short Bash entrypoint with an explicit config input. +PDS remains the standalone Bash function library. `install-pds.sh` verifies the package/version +and signing-key inputs and records `/var/lib/builders/pds.json`. `run-recipe.sh` loads the installed +library and runs the selected [image recipe](provisioning.md). Native package operations finish +before the recipe's final SSH-policy call. The observer checks SSH service state and exports the +journal before sealing truncates logs; it does not duplicate or reapply that policy. + +`wait-cloud-init.sh` uses Bash and `jq`, shared by both builders. It accepts a completed boot with +deprecation notices only; warnings, malformed results and other failures stop the build. The current +noble/amd64 [package manifest](https://cloud-images.ubuntu.com/noble/current/noble-server-cloudimg-amd64.manifest) +includes jq. Recheck that prerequisite when changing the source image. Python is used for the local +regression tests, not for guest provisioning. + +`seal-image.sh` is destructive image preparation. Its explicit `--image-build` argument prevents an +accidental invocation from immediately removing keys or resetting identity. Run it only inside a +fresh disposable image-build guest. Packer supplies that argument in the final provisioning step. +Before clearing the machine ID, it runs `systemd-machine-id-setup --commit` to persist and unmount +a transient read-only ID left by early boot. The command is a no-op for a persistent ID; see the +[systemd reference](https://www.freedesktop.org/software/systemd/man/258/systemd-machine-id-setup.html#--commit). +The default Ubuntu account remains with an unusable password and no authorized keys. Its standard +cloud-init sudo policy remains too, allowing the authenticated build session to request shutdown. +Clone-time configuration must supply any usable deployed login; the image does not retain the +build password or key. The account is disabled, not deleted. + +`prepare-base-image.sh` customizes a disk on the build host. `create-base-template.sh` transfers a +verified bundle over SSH and runs `import-base-template.sh` on Proxmox using its native tools. +`export-raw.sh` runs on +the build host after a QEMU build when raw output is requested. These scripts are not part of PDS. + +## Source and further reading + +- [Executable Packer template](../../packer/ubuntu/ubuntu.pkr.hcl) and [variables](../../packer/ubuntu/variables.pkr.hcl). +- [Cloud-init documentation](https://cloudinit.readthedocs.io/en/latest/). +- [Original Ubuntu template](https://github.com/nbarnum/packer-ubuntu-cloud-image): the starting point credited in the earlier guide. +- [Armbian build customisations](../../armbian-build-framework/): separate board-specific images. Ubuntu ARM/HVF and generic QEMU boot recipes for those boards are not verified here. diff --git a/docs/ubuntu/live-validation.md b/docs/ubuntu/live-validation.md new file mode 100644 index 0000000..246753f --- /dev/null +++ b/docs/ubuntu/live-validation.md @@ -0,0 +1,188 @@ +# Validate Ubuntu images with disposable deployments + +Run this procedure for default and custom recipes, for both native and portable outputs. Use two +new instances per output/recipe pair. The [local checks](../development.md) do not run these steps. +Record the source commit, Packer/plugin versions, PDS version and package digest with the results. +Keep failed attempts separate from completed runs. + +## Reserve resources and record the baseline + +Use a management machine with Packer, OpenSSH, jq, qemu-img, libguestfs and a NoCloud ISO builder. +Portable builds need KVM or an explicitly selected emulator. A disposable nested-KVM runner can +provide that environment; record and remove that runner with the other owned test resources. +Packer and libguestfs stay off the hypervisor. + +Before creating anything, read the cluster inventory and storage configuration: + +```bash +ssh "$PVE_HOST" pvesh get /cluster/resources --output-format json +ssh "$PVE_HOST" pvesh get /storage --output-format json +``` + +Save the original guest IDs, node/type, power states and SHA256 of each configuration after removing +its volatile `digest` field and sorting JSON keys. Use `pvesh get /nodes/NODE/qemu/ID/config` for VMs +and the corresponding `lxc` path for containers. Record storage configuration hashes too; normalize +comma ordering in `content` before comparing. Save these baselines privately outside the repository. +A later comparison must use the original ID list, so a missing guest fails the audit. + +Choose unused IDs and unique names for the base, native outputs, optional runner and eight test +instances. Check both the guest inventory and storage contents for those IDs. An orphan volume is +an occupied resource even when no guest configuration exists. Keep an ownership record with each +new resource's exact name, ID, configuration and associated disks/seed paths. Refuse an occupied ID; +do not stop or delete a pre-existing guest to make room. + +Use existing snippet-capable storage for native user-data, or explicitly authorize and record a +temporary snippet-only store. Do not enable snippets on an unrelated storage configuration as part +of a test. Scope the Packer token to the selected base/output IDs, storage and bridge; record its +expiry and remove it after testing. Never retain its secret in logs or committed inputs. + +## Build and inspect before booting + +Follow the [native build](proxmox.md) and [portable build](local-build.md) procedures with explicit +unused IDs/output directories. Select `recipes/default.sh`, then repeat from a clean base with +`recipes/custom.example.sh`. Do not reuse an already provisioned default image as the custom base. +Keep full build logs and the recipe hash. For native outputs, retain `qm config OUTPUT_ID` showing +`template: 1`, cloud-init media, `cpu: host` when using the default, and no temporary `ciuser`, +`cipassword` or `sshkeys`. + +Inspect each stopped, unbooted output with `make check-image` before making writable deployments. +Use a read-only export of an owned native disk; record its volume/export checksum and restore its +prior activation state. For portable output, compare both formats: + +```bash +qemu-img compare -f qcow2 -F raw image.qcow2 image.raw +``` + +Require exit 0 and identical contents. Keep exported disks unchanged for later inspection. Cross-check +`/var/lib/builders/pds.json` against the actual dpkg database, retained APT source and public-key +fingerprint inside every disk. A provenance JSON file alone does not establish installed identity. +The offline checker rejects generated netplan, cloud-init instance state, host keys and build access. + +## Create two independently initialized instances + +Generate separate SSH keys, user names, hostnames and cloud-init instance IDs. Use the complete +[deployment user-data](provisioning.md#supply-the-deployed-identity), setting each user's Zsh shell +and sudo policy explicitly. Keep private test keys and passwords out of logs; discard them afterward. + +For native output, full-clone the owned template to each reserved ID, then select the complete user-data +with `qm set ID --cicustom user=STORE:snippets/FILE.yaml --ipconfig0 ip=dhcp` before starting it. +Record the exact snippet path and contents for ownership checks. Inspect both clones' CPU settings +and expected AES/AVX features when validating the single-node `host` default. + +For portable output, copy the inspected qcow2 into a new writable disk for each instance. Give each +NoCloud seed its own `user-data` and `meta-data`; the latter contains a unique `instance-id` and the +matching `local-hostname`. Build the seed with: + +```bash +genisoimage -output seed.iso -volid cidata -joliet -rock user-data meta-data +``` + +Attach that seed to the new instance before first boot. When using Proxmox to boot the portable disk, +create a new owned VM, import only its disk, attach it as `scsi0`, set `boot: order=scsi0`, attach its +seed ISO and enable the guest agent. Record the imported volume and ISO checksum. These are deployment +test imports; the native Packer build must have no per-build import/upload step. + +Require completed cloud-init without errors; the known generator deprecation alone is accepted as +[documented](proxmox.md). Log in using each supplied non-root key and run `id -un`, retaining the exit +code and returned user. Copy `check-instance.sh` and `check-user-shell.zsh` into the same directory +and run the former as that user with `default` or `custom`. Both Zsh startups must pass. Keep the +actual downloaded Zi/plugin commit IDs, shell, sudo, MOTD and tool results. The first startup needs +network access. Each user must reject the other instance's private key at authentication. + +Record each instance's `/etc/machine-id`, SSH host-key fingerprints, hostname and DHCP client ID +(`CLIENTID` in `/run/systemd/netif/leases/` for the tested Ubuntu/networkd images). Require eight +distinct values in the final matrix. Absence of a client ID is a failed observation. + +For at least one default instance per output, record `/proc/sys/kernel/random/boot_id`, reboot only +that owned instance, then wait for a different boot ID and completed cloud-init. Require the same +machine ID, DHCP client ID and every host-key fingerprint, successful non-root key login and the +expected SSH settings afterward. Record each key type separately before and after: + +```bash +for key in /etc/ssh/ssh_host_*_key.pub; do + printf '%s ' "${key##*/}" + ssh-keygen -lf "$key" +done +``` + +Retain `systemd-machine-id-commit.service` result/state. An inactive unit with `Result=success` only +records no failure; its conditions may have skipped execution. Distinct first-boot IDs +do not establish that those IDs survive reboot. + +## Exercise the exact update job + +Inside each default instance, use sudo to run the following as root and retain its full output and +process exit status. Run it only on these owned disposable guests; it performs real upgrades. + +```bash +set -euo pipefail +job=$(awk '$1=="0" && $2=="0" && $6=="root" { + $1=$2=$3=$4=$5=$6=""; sub(/^ +/, ""); print +}' /etc/cron.d/pds-update) +test -n "$job" +printf 'EXACT_CRON_COMMAND=%s\n' "$job" +set +e +env -i PATH=/usr/sbin:/usr/bin:/sbin:/bin HOME=/root SHELL=/bin/sh LOGNAME=root \ + /bin/sh -c "$job" -/`. Raw export performs an actual `qemu-img convert`; it +refuses to overwrite an existing raw artifact. Packer also refuses an existing output directory. +The QEMU seed uses a temporary `ubuntu`/`ubuntu` login on the isolated build guest; cleanup discards +that password hash, removes cloud-init's SSH password override and deletes the seed before export. +Keep build networking private. + +For same-architecture emulation on Apple Silicon, select `-var 'arch=arm64'` and +`-var 'qemu_accelerator=hvf'`. This configuration needs separate runtime validation. + +## Connect or inspect + +The exported image has no usable build login. Supply a user and SSH key at deployment time before +connecting. The [SSH and debugging guide](ssh-and-debugging.md) covers temporary build access, VNC +tunnels and read-only inspection. [Image preparation](image-pipeline.md) explains the shared configuration +and sealing steps. +The [manual boot guide](manual-boot.md) provides a complete QEMU command and a deployment seed. diff --git a/docs/ubuntu/manual-boot.md b/docs/ubuntu/manual-boot.md new file mode 100644 index 0000000..7c6eba9 --- /dev/null +++ b/docs/ubuntu/manual-boot.md @@ -0,0 +1,81 @@ +# Boot an exported Ubuntu disk manually + +Use QEMU to inspect a sealed amd64 image without Proxmox. The image needs a deployment user and key; +the temporary Packer login has already been removed. This procedure uses an ephemeral disk overlay, +so guest writes disappear when QEMU exits. + +## Create a NoCloud seed + +Run from the repository root. Set `public_key_file` to an existing public key, never a private key: + +```bash +public_key_file="$HOME/.ssh/id_ed25519.pub" +ssh-keygen -lf "$public_key_file" +public_key=$(awk 'NR == 1 {print $1, $2}' "$public_key_file") +seed_dir=$(mktemp -d) +cat > "$seed_dir/meta-data" <<'EOF' +instance-id: manual-image-check +local-hostname: manual-image-check +EOF +cat > "$seed_dir/user-data" <` for an operator's own text banner. + +## Supply the deployed identity + +Real users, public keys, shell, sudo policy, hostname and networking belong to deployment inputs. +The temporary build account is locked and loses its keys during sealing. For a Zsh admin user, +use a complete cloud-config, replacing the example key: + +```yaml +#cloud-config +hostname: my-service +ssh_pwauth: false +disable_root: true +users: + - name: operator + groups: [sudo] + shell: /usr/bin/zsh + sudo: ["ALL=(ALL) NOPASSWD:ALL"] + lock_passwd: true + ssh_authorized_keys: + - ssh-ed25519 REPLACE_WITH_YOUR_PUBLIC_KEY +``` + +For Proxmox, store the complete user-data on snippet-capable storage and select it with the +clone's `cicustom` user input. Storage must already permit snippets and the operator needs access +to that storage; builders does not enable the capability automatically. For a portable disk, +supply the same configuration through a NoCloud seed. Each instance needs its own identity. + +See [SSH and debugging](ssh-and-debugging.md) for connection commands and +[development checks](../development.md) for local, artifact and fresh-instance validation. diff --git a/docs/ubuntu/proxmox.md b/docs/ubuntu/proxmox.md new file mode 100644 index 0000000..880491f --- /dev/null +++ b/docs/ubuntu/proxmox.md @@ -0,0 +1,123 @@ +# Build an Ubuntu template on Proxmox + +This is the optional native Proxmox path. For a local disk image without Proxmox, use the +[QEMU guide](local-build.md). + +Install Packer on the build machine and initialize the pinned plugins. The build machine needs +access to the Proxmox API and the build guest's SSH address. Guests need DHCP and access to Ubuntu's +package repositories. These commands start from the repository root: + +```bash +cd packer/ubuntu +packer init . +``` + +## Stage 0: create a base template + +Run image preparation on the management/build machine. Proxmox needs SSH access and its existing +`qm`, `pvesh` and `qemu-img` commands; Packer and libguestfs stay off the hypervisor. Preparation needs Bash, +curl, sha256sum and virt-customize with working appliance networking. Ubuntu/Debian package the +tools as `libguestfs-tools`; Fedora 43 provides virt-customize in +[`guestfs-tools`](https://packages.fedoraproject.org/pkgs/guestfs-tools/guestfs-tools/fedora-43.html). +Preparation defaults to libguestfs' direct backend, so it does not need a libvirt daemon. +The build account must be able to read the host kernel. The tested Ubuntu preparation uses sudo; +see the recovery guide for the reference environment and privilege requirements. + +Create a reusable bundle first so it can be backed up independently of the Fedora workstation: + +```bash +mkdir -p "$HOME/builders-artifacts" +sudo bash scripts/prepare-base-image.sh "$HOME/builders-artifacts/ubuntu-noble-amd64" +``` + +Preparation downloads Ubuntu, verifies the published SHA-256, installs the guest agent and clears +machine-id and SSH host keys. The bundle contains the prepared disk, its checksum, the upstream +checksum records, source information and preparation log. Existing output directories are refused. +The source defaults to the Ubuntu `current` directory; `UBUNTU_IMAGE_RELEASE` selects a dated image +directory when available. Retain the bundle for exact base-disk reuse; fetching `current` and apt +packages again is not a byte-identical rebuild. + +Verify the Proxmox SSH host key through a trusted route, then use normal SSH configuration for your +identity and any non-default port. Choose an **unused** ID and a name unique to this base: + +```bash +PVE_HOST=root@pve BASE_VMID=9000 BASE_NAME=ubuntu-noble-cloudimg \ + BASE_IMAGE_DIR="$HOME/builders-artifacts/ubuntu-noble-amd64" \ + STORAGE=local-lvm BRIDGE=vmbr0 bash scripts/create-base-template.sh +``` + +The importer verifies the bundle locally and after upload, creates the VM and cloud-init drive, +then converts the new VM to a template. Clearing the base identity prevents concurrent builds from +sharing a DHCP client ID. Strict SSH host-key checking remains enabled. +The temporary uploaded disk is grown to `DISK_SIZE` before VM creation; shrinking is refused. +The saved local bundle is left unchanged. + +There is no default ID. An occupied ID or failed availability check stops the script before any +preparation or upload. The node checks again immediately before creating the VM. Existing VMs are +never replaced. If a later step fails, inspect the partial new VM before +removing it or choosing another unused ID. Repeating the command against the same ID is refused. +The default disk size is 32G; override `DISK_SIZE` when needed. Set `UBUNTU_VERSION` and `ARCH` when +preparing another release or architecture. Omitting `BASE_IMAGE_DIR` lets the creation command +prepare a temporary bundle itself, but that bundle is removed afterward. +That inline path needs the invoking user to have a working libguestfs environment and readable host +kernel. Running the whole command with sudo also changes the SSH identity and known_hosts to root's. +Prefer the separate preparation and import steps above, which retain the bundle and keep those +privilege requirements separate. Only that retained-bundle workflow has passed the live recovery test. + +If Fedora is unavailable, follow [recovery from another machine](recovery.md). Restoring a saved +bundle needs only Bash, OpenSSH and sha256sum on that machine, without Stackweaver, Packer or libguestfs. + +## Stage 1: build a golden template + +Building an image does not deploy a production workload. A consumer such as Terraform with the +`bpg/proxmox` provider clones the resulting template and supplies per-clone cloud-init settings. + +Copy the example and set the endpoint, node, storage and base template name: + +```bash +cp proxmox.auto.pkrvars.hcl.example proxmox.auto.pkrvars.hcl +# Edit this ignored file for your host. +read -rs -p 'Proxmox API token: ' PKR_VAR_proxmox_api_token; echo +export PKR_VAR_proxmox_api_token +packer build -only='proxmox-clone.ubuntu' . +unset PKR_VAR_proxmox_api_token +``` + +Authentication uses a token ID such as `packer@pve!packer` and its separate secret. Never commit the +secret. Certificate verification is enabled by default. Trust your host's CA; explicitly setting +`proxmox_insecure = true` skips verification for a controlled test host. + +`template_vmid = 0` lets Proxmox choose a free ID. You can instead reserve an unused ID explicitly. +Packer full-clones the base and applies provisioning. Its Proxmox plugin removes the temporary +cloud-init credentials and converts the result to a template. Check `qm config ` for +`template: 1`, a cloud-init volume and no retained build `ciuser`, `cipassword` or `sshkeys`. +For a token restricted to particular VM IDs, choose an unused `template_vmid` covered by its +permissions. The base template is retained for future builds. The OS disk inherits the base +template's storage; +`proxmox_storage_pool` selects the final cloud-init volume's storage. + +`proxmox_task_timeout` defaults to `10m` for Proxmox API tasks such as a full clone. The tested +plugin's one-minute default expired before a successful clone finished on this node. Increase the +value for slower storage; it bounds the API wait, not the complete build or SSH readiness wait. +An expired wait or aborted build can leave a VM at the output ID while the server-side task continues. +Inspect the task and VM before retrying. Remove only a confirmed disposable build VM after its task +has stopped, or choose another unused ID; the bootstrap scripts never delete VMs for you. + +`proxmox_cpu_type` defaults to `host`, exposing the Proxmox node's CPU features to the native build +and its template. It refers to the hypervisor CPU, not the off-node Packer machine. For a cluster +requiring live migration between different processors, choose a CPU model supported by every target +node. Override it in the vars file or with `-var 'proxmox_cpu_type=x86-64-v2-AES'`; that example still +requires compatible hardware. The portable QEMU builder keeps its separate CPU configuration. +Check `cpu: host` in the template and each fresh clone when using the default, and verify the expected +CPU features inside the guest. A clone's deployment configuration can select a different supported model. + +Some Proxmox releases generate the deprecated cloud-init `user` string. cloud-init reports a +completed boot with deprecation notices as exit code 2. The readiness adapter logs those notices and +continues only when `DEPRECATED` is the sole recoverable-error category; other errors stop the build. +The Proxmox generator will need to use the supported `users` list before cloud-init removes that +legacy input. Per-clone cloud-init can report the same notices until the host generator is updated. + +Use a dedicated build identity. It needs read access for node/template discovery, VM clone and +configuration permissions on the base and output VM IDs, allocation permissions on the target +storage, and access to the selected bridge. Scope write permissions to these resources; a root API +token is unnecessary. The exact role requirements depend on the Proxmox version and storage setup. diff --git a/docs/ubuntu/recovery.md b/docs/ubuntu/recovery.md new file mode 100644 index 0000000..b1bd230 --- /dev/null +++ b/docs/ubuntu/recovery.md @@ -0,0 +1,109 @@ +# Recover image building when Fedora is unavailable + +Base preparation passed in a fresh Ubuntu environment, and importing the retained bundle passed +from a separate, unprivileged SSH-only client. See the [validation record](../validation/0001-2026-11-04.md) +for the measured environment and verification limits. +A completed Fedora system recovery has not been demonstrated. + +The normal management plane is a separate bare-metal Fedora workstation. This procedure restores +builders' ability to create a Proxmox base template from another Linux machine. It does not depend +on Stackweaver or on restoring Fedora first. Restoring the Fedora system itself is a separate task. + +## Keep the recovery inputs outside the workstation + +Retain a reviewed builders revision or source archive and the base-image bundle produced by +`scripts/prepare-base-image.sh`. The bundle contains `base.qcow2`, `base-image.sha256`, upstream +checksum records, `build-info.txt` and `prepare.log`. Save it in backup storage that remains +accessible when Fedora is down, alongside the recorded Proxmox endpoint, storage, bridge and +template names. Keep access credentials in their approved secret store, separate from the repository. + +Independent access to Proxmox must work without the missing workstation. The recovery machine +needs the network route and SSH identity required for node administration. An existing healthy +template can still be used directly in Proxmox; rebuild it only if it is missing or needs refreshing. + +## Import a retained base bundle + +Use a Linux machine with Bash, OpenSSH client and sha256sum. Packer, libguestfs and the Fedora user +configuration are not needed for this path. For rebuilding the provisioned images afterward, also retain +the exact PDS release package and digest as [described here](../../packer/ubuntu/pds/readme.md#retain-reproducible-package-inputs). Retrieve the saved source revision and bundle, verify +the Proxmox SSH host key through the trusted recovery record, and configure the recovered SSH +identity using normal OpenSSH configuration. Do not disable host-key checking. + +From the recovered repository: + +```bash +cd packer/ubuntu +BASE_IMAGE_DIR=/path/to/restored/base-bundle +(cd "$BASE_IMAGE_DIR" && sha256sum -c base-image.sha256) +PVE_HOST=root@pve BASE_VMID=9000 BASE_NAME=ubuntu-noble-recovered \ + BASE_IMAGE_DIR="$BASE_IMAGE_DIR" STORAGE=local-lvm BRIDGE=vmbr0 \ + bash scripts/create-base-template.sh +``` + +Replace the example node, unused ID, name, storage and bridge with the recorded recovery values. +The script refuses occupied IDs, checks the uploaded disk again on Proxmox, and uses native node +commands to create the template. It removes its temporary upload directory and never deletes a VM. +If import fails after VM creation, inspect that partial new VM before deciding how to recover it. +If upload cleanup fails, the command reports the exact temporary directory requiring attention. + +Check the result through Proxmox: + +```bash +ssh root@pve qm config 9000 +``` + +Expect `template: 1`, the imported `scsi0` disk, a cloud-init drive, the recorded bridge and the guest +agent enabled. A later disposable clone must boot and report a distinct machine ID before relying +on the restored template. Keep pre-existing VM IDs out of the recovery test. + +## Rebuild when the bundle is also lost + +The reference replacement environment is Ubuntu 24.04 on amd64. Rebuilding additionally needs curl, +virt-customize and a working libguestfs appliance with access to Ubuntu's package repositories. +The following prerequisite set completed preparation in a fresh Ubuntu container: + +```bash +sudo apt-get update +sudo apt-get install -y --no-install-recommends \ + bash ca-certificates curl openssh-client libguestfs-tools \ + linux-image-virtual isc-dhcp-client +``` + +The DHCP client is explicit because the appliance must configure its own network before it can +install packages. For a different distribution, use its supported libguestfs packages and verify +appliance networking. Fedora 43 packages virt-customize in `guestfs-tools`; that package mapping +alone is not evidence that a particular Fedora installation has passed the recovery test. + +Prepare a new bundle, then import it with the earlier command: + +```bash +sudo bash scripts/prepare-base-image.sh /path/to/new/base-bundle +``` + +The measured preparation ran as root inside that disposable environment. A fresh Ubuntu host can +restrict reading `/boot/vmlinuz-*` to root, so the command above uses sudo. An unprivileged run needs +readable host kernel files and permission to use the selected libguestfs backend. Importing a saved +bundle does not need these local privileges or image-preparation tools. + +The output directory must not exist. A failed preparation is retained for inspection and cannot +be imported without a valid final checksum record. Hardware virtualization makes preparation +faster; software emulation depends on the build host's libguestfs backend and available resources. +The script defaults to the direct backend and does not require a libvirt daemon. + +Rebuilding against `current` and the current apt repositories can change package contents. The +recorded upstream checksum identifies the downloaded bytes. The source URL records the download +location, but its moving `current` path will not locate the same bytes indefinitely. Retaining the +completed bundle preserves the exact prepared base. This procedure does not promise byte-identical rebuilds +from moving upstream repositories or operation without those repositories being reachable. + +## Resume golden-image builds + +Install [Packer](https://developer.hashicorp.com/packer/install) on the replacement build machine +and run `packer init .` against the recovered source to install its declared plugins. Follow the +[native build procedure](proxmox.md#stage-1-build-a-golden-template), supplying a scoped API token and +the recovered base-template name. The build machine must reach both the Proxmox API and the build +guest's SSH address; node SSH access alone does not establish that path. + +The new golden template needs the same artifact and fresh-clone checks as a normal build. Restore +Stackweaver's own configuration, state and credentials through their documented recovery procedure +before resuming infrastructure applies. Generating an image does not restore workload data. diff --git a/docs/ubuntu/ssh-and-debugging.md b/docs/ubuntu/ssh-and-debugging.md new file mode 100644 index 0000000..14194c7 --- /dev/null +++ b/docs/ubuntu/ssh-and-debugging.md @@ -0,0 +1,101 @@ +# SSH and image debugging + +Choose the connection for the stage you are troubleshooting. Temporary build access is removed +when Packer seals the image; an exported image needs its own deployment user and SSH key. + +## Keep a QEMU build open for inspection + +From the repository root: + +```bash +cd packer/ubuntu +PACKER_LOG=1 packer build -debug -only='qemu.ubuntu' . +``` + +Packer pauses between build steps in debug mode. Connect at the pause after its SSH connection +step (`StepConnect`), then run `cloud-init status --wait` in the guest if needed. Configuration and +sealing run together in the next provisioning step; debug mode does not pause between them. +The QEMU seed uses the temporary `ubuntu` / `ubuntu` login. After sealing, its password hash, SSH +policy override and build keys are removed. + +Read the selected SSH forwarding port from Packer's debug output; it is not a fixed template setting. +For a build on the same machine, this example assumes Packer selected port 2222: + +```bash +build_ssh_port=2222 # Replace with the port reported by this build. +ssh -p "$build_ssh_port" ubuntu@127.0.0.1 +``` + +For a build on a remote host, forward its selected port to your workstation first. The example +retains the existing `sysadmin@x86` build-host connection; replace it with your SSH destination. +Run the tunnel in one terminal and the guest login in another: + +```bash +build_ssh_port=2222 # Replace with the build host's selected SSH port. +ssh -N -L "127.0.0.1:2222:127.0.0.1:${build_ssh_port}" sysadmin@x86 +``` + +```bash +ssh -p 2222 ubuntu@127.0.0.1 +``` + +Verify the guest's SSH host key when connecting. A newly built guest can have a different key from +an earlier guest that used the same local port. + +## Forward VNC over SSH + +For a headless build, use the VNC address and port printed by Packer. QEMU's Packer builder selects +an available VNC port and binds it to loopback by default. For build host `sysadmin@x86` and port 5905: + +```bash +ssh -N -L 127.0.0.1:5905:127.0.0.1:5905 sysadmin@x86 +``` + +That example assumes Packer reports VNC port 5905. Replace the final port with the actual remote +port when it differs, then connect a viewer on your workstation: + +```bash +vncviewer 127.0.0.1::5905 +``` + +The double colon specifies a TCP port in TigerVNC. A Linux viewer can be installed as +`tigervnc-viewer` on Ubuntu/Debian or `tigervnc` on Fedora. On Windows, use a compatible VNC viewer +such as MobaXterm through the same SSH tunnel. + +Install the viewer on the workstation that will display it: + +```bash +# Ubuntu/Debian +sudo apt-get install tigervnc-viewer +# Fedora +sudo dnf install tigervnc +``` + +## Connect to a deployed VM + +The sealed image has no shared password or baked-in personal key. Configure a user and its public +key through the deployment platform's cloud-init inputs, then connect with that identity: + +```bash +ssh -i ~/.ssh/id_ed25519 your_user@vm.example.local +``` + +For a locally booted disk, supply a [NoCloud seed](https://cloudinit.readthedocs.io/en/latest/reference/datasources/nocloud.html) +with the deployment user and key. +For a Proxmox clone, supply the user/key in its cloud-init configuration and connect to the guest's +address. The temporary build password is not a recovery login for either output. + +During a native Proxmox build, Packer injects its own temporary SSH key. Use the Proxmox console +to watch boot and cloud-init output; the build account has no console password. + +## Inspect an exported disk without booting it + +The [image inspection guide](image-inspection.md) covers read-only guestfish access, raw partition +mounts and chroot. Use [manual boot](manual-boot.md) when you need to run the exported image instead. +Keep debug logs local until credentials and private connection details have been removed before sharing. + +## References + +- [Packer QEMU configuration](https://developer.hashicorp.com/packer/integrations/hashicorp/qemu/latest/components/builder/qemu): selected SSH/VNC ports and loopback VNC binding. +- [TigerVNC viewer](https://tigervnc.org/doc/vncviewer.html): viewer connection syntax. +- [guestfish](https://libguestfs.org/guestfish.1.html): read-only filesystem inspection. diff --git a/docs/validation/0001-2026-11-04.md b/docs/validation/0001-2026-11-04.md new file mode 100644 index 0000000..125d006 --- /dev/null +++ b/docs/validation/0001-2026-11-04.md @@ -0,0 +1,69 @@ +# Ubuntu image validation, 2026-11-04 + +These are the implementing agent's observed results, not independent reviewer execution or formal +feature acceptance. The owner inspected the candidate before authorizing its commit and PR update. + +## Environment and commands + +- Packer 1.16.2, Proxmox plugin 1.2.4, QEMU plugin 1.1.8 and Proxmox VE 9.1.7. +- Ubuntu noble amd64 cloud-image inputs. The replacement build environment was a fresh Ubuntu 24.04 + container using the direct libguestfs backend, a readable host kernel and an explicit DHCP client. +- The Proxmox server has two Xeon E5-2620 processors with AES and AVX. Native builds used a temporary + VM-scoped API identity. The controlled self-signed test endpoint used the explicit TLS-verification + opt-out; production certificate trust was not established by this test. +- `make init` installed both pinned plugins into an empty plugin directory. +- `make check` passed Packer formatting/validation, ShellCheck and all 26 local regression tests in + a disposable tool environment with the declared dependencies. A host attempt lacked ShellCheck; + the subsequent complete container run passed. + +## Bootstrap and recovery + +The off-node preparer produced a checksummed base bundle with the guest agent installed and identity +reset. A separate non-root SSH-only client imported that bundle using the committed transport scripts, +without local Packer or libguestfs. Repeating an occupied ID was refused. Corrupt and partial bundles, +unsafe staging replies, upload failures, remote ID races and shrinking are covered by local fixtures; +these failure cases were not all repeated against live Proxmox. + +No Packer or libguestfs packages were installed on the hypervisor. The tests required independent +Proxmox access and upstream reachability. They do not establish a full Fedora restoration or an +already-configured off-host backup destination. + +## Native image and fresh clones + +`packer build -only='proxmox-clone.ubuntu' .` completed in 2 minutes 56 seconds with the `host` CPU +default. The golden template had `template: 1`, a cloud-init drive and no retained build cloud-init +credentials. Two fresh full clones inherited `cpu: host`, exposed AES and AVX, accepted their separate +consumer users and SSH keys, and reported different machine IDs and SSH host keys. Both retained a +locked, keyless default Ubuntu account and disabled SSH password authentication. + +Read-only disk inspection confirmed generic hostname, empty machine-id, no generated netplan, seed, +build keys, key backups or SSH policy override, and the expected baseline packages and OS settings. +The four owned disposable resources and temporary API identities were removed. Configuration hashes +and power states for all seven original guests matched the fresh preflight baseline. + +The final validation guard was tightened after the live build to reject surrounding whitespace. Only +its condition and error message changed: the valid `host` default, CPU wiring and guest scripts are +identical. Complete local checks passed again. Exact local commands validated +`-var 'proxmox_cpu_type=x86-64-v2-AES'` and rejected empty and whitespace-padded model names. +This proves local configuration validation, not target-node support for the alternate model. + +## Portable image + +The portable KVM build produced qcow2 and raw disks with a 10 GiB virtual size and identical logical +contents. Offline sealing inspection and two independently initialized fresh boots passed; consumer +keys worked, password authentication was disabled, and machine IDs and host keys differed. + +The later native task timeout and CPU settings do not alter the QEMU source, shared provisioners or +raw exporter. Source comparisons verified that boundary. The portable image was not rebuilt for the +native-only CPU setting or the stricter valid-input guard. + +## Evidence boundaries + +The task retained logs, source manifests, failed attempts, clone observations and cleanup audits in +its private review artifacts. Paths used during execution were `/tmp/builders-offnode/` and +`/tmp/builders-hostcpu-20261104/`; these are local artifacts rather than public downloadable fixtures. +This committed summary makes the observations durable, but cannot substitute for an independent run. + +ARM/HVF, other storage backends, a full Fedora restoration, off-host backup provisioning, alternate +CPU models on real hardware and a complete automated CI image-build harness remain unverified or +separate work. No production guest was changed by these tests. diff --git a/docs/validation/0001-2026-11-05.md b/docs/validation/0001-2026-11-05.md new file mode 100644 index 0000000..2af5a7d --- /dev/null +++ b/docs/validation/0001-2026-11-05.md @@ -0,0 +1,429 @@ +# PDS image integration validation, 2026-11-05 + +These are implementer-observed results. Independent reviews are retained in +[feature 0001](../specs/0001-packer-proxmox-native-output.md); they do not establish independent +execution of the live Proxmox tests. This feature remains in progress. + +## Inputs + +The final candidate builds use builders `e5cf7b370078437d3fef3a65d659a3cf44081bc0` and the PDS +runtime at `e756e93f52e4ade5113f2a96e89858d7670a371d`. The explicit local package identifies itself +as version `1.0.0`, with SHA256 +`744343e157c8d0b297daf8633fb9623839bbd4734c89f384f7c0208cc141d3ba`. +This is a test package, not a published release. These inputs describe the earlier candidate run. +Later PDS Krew/Zsh runtime fixes and the final logo assets are included in release 0.20.0; the +signed-release validation below uses that package and does not relabel these older builds. + +Packer is 1.16.2, with QEMU plugin 1.1.8 and Proxmox plugin 1.2.4. Both native outputs use the `host` +CPU default. Portable builds run in an owned disposable Ubuntu runner with nested KVM. No Packer +or libguestfs packages were installed on the hypervisor. + +## Local checks and review repairs + +- `make check` passes formatting, Packer validation, ShellCheck, Zsh syntax checks and 44 tests. + Its live checks are explicitly reported as skipped; the separate live runs below supply that evidence. +- The real disposable sealing regression passes. It checks removal of build passwords, keys, + identity and client-state residue while retaining the selected shared shell configuration. +- The installed PDS candidate passes all 25 package/helper tests in disposable Ubuntu with networking + disabled, including real SSH authentication controls and updater lock/conffile handling. +- The first hosted PDS package run failed because its test target assumed a hyphenated prerelease + filename; nFPM emits a Debian-normalized tilde. A regression reproduced the failure. The repaired + target selects exactly one actual built archive and refuses missing/ambiguous inputs. All 27 tests + pass locally using the real prerelease package. [Hosted CI](https://github.com/michielvha/PDS/actions/runs/41969799951) + passes at PDS `92cd5581a595d000f2213a63f51df4ee52f086e6`, including installation on Ubuntu 22.04 and + 24.04. Release and APT deployment are skipped on this PR. +- Actual first-user validation exposed a Zsh completion defect. The selected PDS installer/configuration + now maps the `k` alias to kubectl's generated completion registration. The failing and passing + regression runs are retained. The older `configure_kubectl_plugins` helper is outside this integration; + its legacy completion mapping remains a documented limitation. +- R-18's incomplete shell checks now fail on each missing capability or failed tool. Build homes use + an explicit allowlist, and artifact checks require the expected package source. R-19 independently + verified those repairs and returned two nits. R-20 returned no source findings; its Docker execution + was denied, so that review is not independent runtime proof. PDS workflow-only PR coverage is repaired; the legacy + helper limit is documented. +- PDS check jobs use read-only tokens, discard checkout credentials and calculate versions without + tagging. Publication remains confined to the existing main-branch release/deployment jobs. Local + Actionlint and structured workflow-policy checks pass; hosted CI results are reported separately. +- All relative documentation links resolve. Both Mermaid diagrams render to SVG in Chromium and + Firefox. A Bun-only attempt lacked browser DOM support and is not counted as a render. + +The final documentation-head [builders run](https://github.com/vhco-pro/builders/actions/runs/41971370078) +failed before tests at `make init`: GitHub rate-limited Packer's anonymous plugin metadata lookup. +Commit `0437db7561f74c41d797201f9a7d05a42be0e742` supplies the existing `contents: read` job token only +to that initialization step. It adds no configured credential or write permission. Actionlint and a +structured token-scope check pass. R-22 returned no code defect and two documentation nits, now repaired. +The [authenticated hosted run](https://github.com/vhco-pro/builders/actions/runs/41972133867) passes +at `fcd9b0c00ea2cb3ecb76ae890e79ded24b1fa837`, including both plugin downloads and the full 44-check +target. R-23 independently verified the README/CI-evidence repairs and returned no findings; it did +not independently execute the live tests. + +The artifact checker at `3cf647af825c04609344959ec83e54513fad95d8` reuses one read-only libguestfs +session and closes it after success or failure. This validation-only change does not alter images. +An earlier local inspection was stopped because each file restarted the appliance under emulation; +the final inspections use the tested session lifecycle. + +## Candidate build and deployment matrix + +| Output | Recipe | Build | Read-only inspection | Two fresh instances | +| --- | --- | --- | --- | --- | +| Native Proxmox | Default | Passed | Passed | Passed | +| Native Proxmox | Custom example | Passed | Passed | Passed | +| Portable qcow2/raw | Default | Passed; formats compare equal | Passed | Passed | +| Portable qcow2/raw | Custom example | Passed; formats compare equal | Passed | Passed | + +The final native templates use owned IDs 990114 and 990115. Native deployments use complete +`cicustom` user-data on the owner-approved temporary snippet-only storage. Existing storage settings +are preserved. Portable deployments use explicit NoCloud seeds, with separate users, keys and identities. +Each phase must record distinct machine IDs, host keys, DHCP identities and hostnames, reject the other +instance's key, and remove its own test instances and seed files. + +The default-image checks execute the installed midnight job's exact command with cron PATH and closed +stdin. An owned authentication fixture establishes working permissive password/keyboard/root controls, +then restores the PDS baseline and requires non-root key success and all three refusals. The test +credentials remain in memory and the disposable fixture; they are not retained in evidence files. + +## Limits and cleanup + +All eight final instances passed fresh-user shell/tool and supplied-key checks. Across the complete +matrix, machine IDs, SSH host keys, DHCP client identities and hostnames were distinct. Each pair +rejected the other instance's key. Both default outputs passed permissive authentication controls +followed by baseline enforcement, and all four default instances ran the exact update command under +the cron environment. Both custom outputs retained their selected shell/MOTD setup with no PDS-managed +SSH policy or update job. + +Every deployment phase removed its two owned instances and verified seed/snippet cleanup. The final +cleanup removed the seven retained build/base resources, their volumes, the approved snippet-only +storage and leftover owned export directories. No task API identity or owned volume remains. All seven +original guests' configuration hashes and power states match the preflight snapshot. Original storage +settings are semantically unchanged: Proxmox returned the same content sets in different orders, and +reconstructing those orders reproduced both original hashes before cleanup proceeded. + +The failed custom-archive download is retained separately. A bounded-buffer retry recovered the +complete archive and verified the checksum against the runner before deployment. The first runner +timed out waiting without creating portable guests. Earlier attempts also exposed the SSH journal +observer's identity-reset gap and an inactive owned template volume during export; their failed logs +remain separate from the corrected final builds. Preliminary clone results do not substitute for the +final eight-instance matrix. + +These are implementer-observed live results. R-21 reviewed the CI repair at PDS `92cd558` and returned +two documentation nits; the current test count/source description and Review Log/Sources placement +are repaired. Returned reviewer records remain unchanged. Full independent runtime/release acceptance +is not inferred from these results. + +At the time of the candidate run, published PDS 0.19.0 installed through the signed repository but +lacked the new image helpers. That smoke test did not establish the later feature release. The +subsequent PDS 0.20.0 run below supplies signed-release evidence; independent criterion acceptance +and owner review remain separate. ARM/HVF, other storage backends, +a full Fedora restoration and an off-host backup destination are not established here. + +No merge, release or website publication is part of this validation. Homelab guides stay draft. + + +## Published PDS 0.20.0 validation + +The owner authorized the remaining PR #4 checks after PDS PR #35 merged. The existing +[publication run](https://github.com/michielvha/PDS/actions/runs/41988622594) passed release and signed +APT deployment. [PDS 0.20.0](https://github.com/michielvha/PDS/releases/tag/0.20.0) has package SHA256 +`d73c3c946e1cb9316341e806c747431e4e8811679fcd07f2aa4d73e262ef6abc`. +The actual `install-pds.sh` repository route installed that version with all selected helpers and +recorded `source: signed-repository`; no candidate package was supplied. + +The final images use builders `c3c142163f7777520c10c113e80681a52aa31546`, Packer 1.16.2, +Proxmox plugin 1.2.4 and QEMU plugin 1.1.8. `make init` confirms those plugin versions. +All 44 builders checks pass. The checksum-verified release package passes all 36 PDS checks in +disposable Ubuntu with networking disabled. Both ordinary and transient-ID sealing regressions pass. +The development host lacks ShellCheck, so the full local check target runs in the existing tool +container with the repository, Packer binary and plugins mounted read-only. + +| Output | Recipe | Build | Read-only disk checks | Two fresh deployments | +| --- | --- | --- | --- | --- | +| Native Proxmox | Default | Passed | Passed | Passed | +| Native Proxmox | Custom example | Passed | Passed | Passed | +| Portable qcow2/raw | Default | Passed; disk contents compare equal | Passed | Passed | +| Portable qcow2/raw | Custom example | Passed; disk contents compare equal | Passed | Passed | + +All four disks independently expose installed dpkg version 0.20.0, architecture `all`, the retained +signed APT source and the actual public-key fingerprint +`37C7D029C0FE4DB0E66E5F72AFA1101D94CBF301`. These filesystem checks cross-check the build's provenance +JSON; they do not rely on that JSON alone. Both transferred portable archives match checksums +computed on the owned build runner before it was removed. + +All eight fresh deployments passed their supplied non-root key login, configured Zsh shell and sudo +policy, selected MOTD, Zi/Powerlevel10k startup and tool checks. First-user plugin downloads and +subsequent startup were exercised; downloaded revisions are retained. Machine IDs, SSH host keys, +DHCP client identities, hostnames and injected public keys are globally distinct across the eight +instances. Each pair rejected its other instance's key. Native templates and deployments use `host` +and expose the expected AES/AVX features. + +Both default outputs passed the permissive authentication controls followed by key-only/root-denial +checks, and both instances of each output ran the exact installed update command under the cron +environment with closed stdin. Build-side SSH PID, activation timestamp and journal evidence show no +reload/restart between policy selection and sealing. The custom outputs retain the selected shell +and branding without the PDS-managed SSH policy or midnight update job. One native default user also +performed a real ordinary `install_kubectl` call from Zsh: a later interactive shell selected its own +Krew tree, and checksums confirmed the shared system tree was unchanged. + +### Failures and repairs retained separately + +The first custom native attempt failed because the machine-id commit service timed out, leaving a +read-only transient mount over `/etc/machine-id` while the root filesystem remained writable. +The real disposable tmpfs bind-mount regression reproduced the sealer's `truncate` failure. +Commit `c3c1421` uses systemd's supported commit operation before clearing the persistent ID. +Both transient and ordinary regressions, the failed owned guest's direct repair probe, and all four +fresh final image builds pass. The final matrix uses the repaired source throughout. + +The first additional per-user Krew check incorrectly expected noninteractive Zsh to read `.zshrc`. +An interactive diagnostic established the correct root; that partial clone pair was removed and the +whole phase rerun with an interactive shell. A local evidence-log quota failure interrupted the old +portable controller; final logs moved to the data filesystem. An auxiliary key-inspection retry +initialized its disposable GPG home. These are harness failures, retained separately from the passing +final results; no failed or partial attempt is counted in the final matrix. + +### Ownership and final cleanup + +The fresh preflight at 07:50 UTC recorded six pre-existing guests, whose configuration hashes and +power states remain unchanged. The earlier candidate audit at 04:57 UTC preserved seven, including +stopped guest 104 (`controlplane`). A read-only node-task query records successful `qmdestroy:104` +at 06:51:23 to 06:51:24 UTC, authenticated as `root@pam`, between those two baselines. The owner +subsequently confirmed that they intentionally removed 104 because it was an old, unused server. +This resolves the previously unattributed deletion. The shared root principal alone did not identify +the operator; the attribution comes from the owner's confirmation. Each guest-preservation claim +applies to its own observed baseline. Historical seven-guest and later six-guest claims refer to +their respective snapshots, not a constant inventory. The off-node retained bundle was imported on a new ID; occupied-ID and corrupt-bundle +controls refused their inputs before creating or uploading resources. Packer/libguestfs execution +stayed on the controller or the owned disposable KVM runner; the hypervisor used its native tools. + +Each deployment phase removed its two owned instances and exact seeds/snippets. Final cleanup removed +templates 990144/990145, runner 990124 and base 990120 after matching their recorded ownership and +configurations. The earlier failed/partial owned attempts were removed separately. The temporary +snippet-only storage is removed, original storage settings are unchanged, and no task API identity +or owned volume remains. Volume auditing includes the final clone IDs and the earlier attempt IDs; +unknown volumes cause cleanup to stop rather than delete them. + +Raw manifests, hashes, downloaded revisions, failed logs and passing results remain privately under +`/home/m/code/.cache/builders-release-fixed-20261105/evidence/` and the preceding attempt directory. +Images and archives remain on the data filesystem for read-only independent inspection. These are +local evidence paths, not public links. These observations are the implementer's results; the next +independent review must record its own observations and limits. ARM/HVF, other storage backends, a +full Fedora restoration and an off-host backup destination remain outside this proof. PR #4 remains +unmerged and the homelab guides remain draft. + +### R-24 follow-up boundaries + +The owner confirmed the intentional removal of old server 104, explaining the different snapshot +counts. The earlier reviews reflect the evidence available before that confirmation; their returned +records remain unchanged. The single build-time machine-ID commit stall's root +cause remains unknown: the root filesystem stayed writable, and no I/O-remount failure was observed. +The sealer handles the remaining transient mount explicitly. Distinct IDs at first boot do not prove +reboot persistence; the follow-up owned-instance checks must establish that separately. + +The [live-validation procedure](../ubuntu/live-validation.md) specifies resource baselines, both +boot paths, explicit update exit codes, real authentication controls, reboot identity and cleanup. +The observed public PDS APT index contains only 0.20.0; the [package-input guide](../../packer/ubuntu/pds/readme.md#retain-reproducible-package-inputs) +records that retention limit and the separate saved-package recovery route. These documentation +repairs do not upgrade the R-24 verdicts. Fresh repaired-source validation and review remain pending. + +## Rebuilt validation after R-24 repairs + +The fresh run at source `f78ac9a491c19a59788b6d24b8bd098ac52a3194` repeats all four builds after +fixing observer ownership/missing evidence and strengthening offline cleanup assertions. Its own +10:02 UTC preflight records the same six existing guests. Later commits change guides and records; +all recorded non-documentation build inputs still match the tested source. Earlier runs above +remain evidence for their original commits, not substitutes for this rerun. + +Both observer regressions fail before the repair: a library can replace the callback, and a changed +policy can pass without a service snapshot. The three netplan/instance-state fixtures also fail +against the old checker. After the fixes, all 47 builders checks pass, including both Packer +configurations and ShellCheck. The standalone QEMU configuration also validates with the Proxmox +token unset. The public PDS runtime/test snapshot and checksum-verified published package pass all +36 contract checks in disposable Ubuntu with networking disabled. + +| Output | Recipe | Build and disk inspection | Fresh instances | Cleanup | +| --- | --- | --- | --- | --- | +| Native Proxmox | Default | Passed | 990242, 990243 passed | Removed | +| Native Proxmox | Custom example | Passed | 990247, 990248 passed | Removed | +| Portable qcow2/raw | Default | Passed; formats equal | 990249, 990250 passed | Removed | +| Portable qcow2/raw | Custom example | Passed; formats equal | 990251, 990252 passed | Removed | + +The stronger read-only checks pass on every real output: no generated netplan, cloud-init +instance/seed state, build access or SSH host keys remain. Separate filesystem checks again verify +actual dpkg version 0.20.0/architecture `all`, retained signed APT source and the expected signing-key +fingerprint for all four outputs. The default policy/job is present only in the selected default +images; custom images retain their chosen shell and VHCO banner without those PDS policies. + +All eight supplied users pass actual key login, Zsh/sudo configuration, first and subsequent Zi +startup and their selected tools/MOTD. Plugin revisions are retained. Machine IDs, host keys, DHCP +client IDs, hostnames and injected public keys are globally distinct. Both native templates and +clones use the selected `host` CPU and expose the expected AES/AVX features. A real standalone +per-user Krew installation selects its own tree on a later interactive Zsh startup; the shared-file +checksums remain unchanged. + +The four default instances each run the exact installed cron command under the cron environment +with stdin closed, retaining `UPDATE_EXIT_CODE=0` and active/enabled scheduler results. The native and +portable authentication fixtures retain 34 method-level events across the full matrix: 18 successful +authentications and 16 expected refusals, including isolated peer keys. Permissive password, +keyboard-interactive and root-key controls succeed; restoring the baked baseline admits the supplied +non-root key, denies those other methods and offers only `publickey`. Temporary password/root-key +credentials are set through the owned guest agent after boot, while cloud-init sets `ssh_pwauth: +true` and `disable_root: false`. This tests effective policy precedence and real authentication; +it does not establish cloud-init injection of those temporary passwords/root keys. + +One default instance per output, 990242 and 990249, is rebooted after its checks. Both get a different +kernel boot ID while preserving machine ID, DHCP client ID and the measured ed25519 host-key +fingerprint; key login and the expected SSH settings still work. Both report `Result=success` and +`ActiveState=inactive` for the machine-ID commit service. That records no failure; it does not show +that this condition-gated service ran. +The cause of the earlier single build-time commit stall remains unknown. Build-side PID/timestamp +and journal observations still establish no SSH reload/restart between policy selection and sealing; +the post-deployment fixture reloads and reboots are separate operations. + +Each phase removes its owned instances and exact seed/snippet paths. Final cleanup removes verified +templates 990244/990245, runner 990224 and base 990220, after checking both transferred archive hashes +against the runner. The temporary snippet-only storage and API identity are gone. No owned volumes +remain; original storage settings and all six preflight guest configuration hashes/power states are +unchanged. The repaired-source controller allows mutations only on its recorded 990xxx IDs; guest +104 was already absent at that run's 10:02 preflight. + +Logs, command exits, authentication/refusal events, reboot comparisons, configurations, input hashes +and cleanup results remain privately under +`/home/m/code/.cache/builders-opus-fixes-20261105/evidence/`; exported images/archives are retained +alongside it for independent read-only inspection. The final portable archive SHA256 values are +`04159380de48d8e59be7439724c1d4301731504b1b226609a27e54b6ef8a41e9` (default) and +`e4f708f5f941a4ad0364d80011d330d13038a02556c28f77f12922d772a7ee88` (custom). +These remain implementer-observed live results; the following independent review must state its own +executed checks and limits. PR #4 remains unmerged and homelab guides remain drafts. + +### Post-cleanup observations and final input guard + +A follow-up read-only observation at 11:12:59 UTC retains the actual per-guest configuration hashes +and power states for all six protected IDs, plus raw and normalized hashes for the two original +storage configurations. `post-cleanup-observed.json` also records no owned guest IDs, volumes, +temporary storage or API identities. Guest hashes omit the volatile API `digest` field and hash +JSON with sorted object keys. Storage comparison also sorts the comma-separated `content` list +before hashing. The unsorted-content storage hashes differ between reads; only their normalized +hashes match. `post-cleanup-comparison.json` derives its summary from the observed values and the +preflight snapshots: all six guest hash/state pairs and both normalized storage hashes match. +These are observations after cleanup, not a reconstruction of activity between earlier snapshots. +The owner has since confirmed that they intentionally deleted old server 104. + +The fixture's authentication refusals were measured with both the baked baseline and the permissive +file present after restoration. No `sshd -T` dump was retained at that two-file point; later dumps +were taken after fixture cleanup/reboot. The reboot comparison measures ed25519, rather than every +host-key algorithm. The live procedure asks future runs to retain both-file settings and every +host-key fingerprint. The commit-service observation above records no failure, not proof of service +execution. These limitations do not change the measured authentication or identity results. + +R-25's recipe-readability nit reproduced with real Packer as an unprivileged caller: a mode-000 +recipe was accepted before the fix. The regression fails against that guard and passes with +`can(file(var.provisioning_recipe))`, which rejects the input before a build. `make check` now has +48 cases: 47 pass in the root tools container and the permission case explicitly skips there because +root can read the fixture. That case separately passes as the unprivileged host user; normal +unprivileged CI runs it directly. Packer formatting/configuration and ShellCheck also pass. + +This last change affects local input validation and its test invocation. It changes no provisioning +script, recipe, variable default, guest configuration or hardware setting. The four builds/eight +boots remain recorded at `f78ac9a`; they are not relabelled as builds of the later guard. The guard is +validated separately. The following independent review still decides its own source and proof limits. + +### Final independent review + +R-26 at `eca9c5918ed1d2d199b24febcaf82f83707e2b7b` independently executes both sealing regressions, +all four disk/package/key/MOTD inspections, Packer initialization, the local and PDS suites, the +unprivileged recipe-readability regression, archive/package/disk hashes and the comparison derived +from raw post-cleanup observations. All executed checks pass. It returns one documentation nit: +raw storage hashes differ while normalized configuration hashes match. The wording above is corrected +without relabelling the review. The original read-only observer and comparison scripts are retained +beside the raw data as `observe-post-cleanup.py` and `compare-observations.py`; endpoint-redacted +source copies were added to the review supplement after R-26, not presented as already reviewed. + +The reviewer marks AC-02, AC-07 and AC-13 met. Other composite criteria remain not independently +verified, including the live builds/boots and hosted CI at that target. Returned records remain +unchanged in the feature document. The feature stays in progress, with no completion or merge claim. + + +## Controlled acceptance at the current PR source + +A new run tested exact builders commit `9f4db433675beb03eb86a9312e83292647a57655`. +This supersedes the earlier independent-verification gap; the earlier attempts and their review +records remain history. The run used published PDS `0.20.0` from its signed APT repository, not a +candidate package. No functional image code changed during the run. + +| Output | Recipe | Build and sealed inspection | Fresh deployments | +| --- | --- | --- | --- | +| Native Proxmox | Default | Pass | Two pass | +| Native Proxmox | Custom example | Pass | Two pass | +| Portable qcow2/raw | Default | Pass; formats compare equal | Two pass | +| Portable qcow2/raw | Custom example | Pass; formats compare equal | Two pass | + +The eight deployments have eight distinct machine IDs, measured ed25519 host keys, DHCP client IDs, +hostnames and injected public keys. Default deployments pass first-login Zi downloads, subsequent +Zsh startup, Powerlevel10k, kubectl completion/alias, Krew/plugins, MOTD, sudo and real package-update +command execution under the cron environment. All four default update commands return exit zero; +cron is active and enabled. A real per-user Krew installation also passes with unchanged shared files. + +One default instance per output passes a reboot: the kernel boot ID changes while the machine ID, +DHCP client ID and measured ed25519 fingerprint persist, and the supplied key still works. +Password, keyboard-interactive and root-key permissive controls succeed before restoring the PDS +policy; afterward those methods are refused and the non-root key still works. Effective `sshd -T` +settings are retained while both the permissive and security drop-ins are present. The fixture puts +passwords and the root key into the owned guest after boot; it does not claim cloud-init injected them. +Custom deployments pass their selected tooling checks without the omitted PDS SSH/update policy files. + +### Bootstrap, package and independent checks + +- A fresh Ubuntu base is downloaded, checksum-verified and prepared off-node using the committed + scripts. Read-only inspection finds `qemu-guest-agent` installed in that actual prepared disk. +- The same fresh bundle imports successfully on two unused IDs. Occupied-ID and corrupt-bundle + attempts are refused. Both successful imports are owned disposable resources and are removed. +- Both Packer plugins install into a fresh cache. Real CPU validation accepts `host` and `kvm64`, + and rejects blank, leading-space and trailing-space values. Native templates and clones use `host`. +- Local checks run 48 cases: the root container explicitly skips the permission fixture, which passes + separately as the unprivileged build user. All 36 published-package contract tests pass. +- Real SHA-256, package-version, missing-input and GPG-fingerprint refusals pass. A real APT fetch + with the wrong trust key is refused with `NO_PUBKEY` and exit 100, leaving no installed PDS package + or success provenance. Package-name/selected-function failure paths remain unit-test coverage. +- All four disks have the actual installed PDS identity, signed repository/key and expected MOTD + assets. Independent checks compare each transferred raw member with its qcow2 disk and confirm + archive/disk hashes. The live release digest matches the tested published package. + +Opus 5.5 independently initiated the bounded matrix and second import, inspected the test harness, +executed local/package/sealing/artifact/format/hash checks, and observed the live outcomes. Its +[R-27 records](../specs/0001-packer-proxmox-native-output.md#r-27) return all 15 criteria as met with +one stale-comment nit. Isolation is procedural. The reviewer resumed its saved session after process +interruption and replacement of the app plugin cache; the repository engineering pin stayed +`0e52f51`. Returned records are preserved unchanged. + +The stale `issue #3` comment is corrected to point at `recipes/default.sh`. Parsing the before/after +cloud-init YAML produces identical values. This does not relabel the live builds as builds of a later +comment/documentation commit; a follow-up review checks that diff separately. + +### Cleanup and retained evidence + +All owned test guests, templates, volumes, seeds, temporary snippet storage and API identities are +removed. All six pre-existing guest configurations and power states match their preflight snapshots. +Both original storage definitions match after removing volatile `digest`, sorting the `content` CSV +and sorting JSON keys. Raw storage hashes differ because content ordering differs; normalized hashes +match. A separate read-only observation at `2026-11-05T22:04:44Z` retains the actual post-cleanup +values; its comparison is derived from those values, not constant summary flags. + +Private evidence remains under `/home/m/code/.cache/builders-acceptance-20261105/`, with its +`/tmp/builders-acceptance-20261105` alias. It includes `build-inputs.json`, per-build and per-instance +logs, authentication/command-exit traces, both reboot records, artifact/archive hashes, protected +baselines, cleanup audits, raw post-cleanup observations, comparison/observer source and the reviewer +execution/return records. These are local review artifacts, not public download links. + +Supplemental fixture failures are retained: a missing `gpg-agent` dependency was avoided by using an +existing public Ubuntu key; the CPU fixture's diagnostic assertion was corrected; and Proxmox refused +a scratch cleanup DELETE body before guarded query-parameter cleanup succeeded. These were test +harness repairs, not changes to builders. Builds and tests are current Ubuntu amd64 evidence, not +other operating systems, a completed Fedora restore, RKE2 installation or byte-identical future builds. +No merge, release, production deployment or homelab publication is performed by this validation. + + +The follow-up [R-29](../specs/0001-packer-proxmox-native-output.md#r-29), at +`86f740b666b8fc1d96e417ad57cc4625bda9f02d`, returns all 15 criteria met and no findings. It verifies +source equivalence, parsed YAML equality, the retained artifact hashes and the raw cleanup comparison. +R-28's mistaken "2 reboots per default instance" remains unchanged in its historical record; R-29 +correctly records two reboot operations total, one per selected default instance. No further VM test +ran after the `9f4db43` matrix. Hosted CI `42121748326` passes for the pushed acceptance-record commit +`58595e1`; CI for the later completion commit is checked separately in the PR handoff. diff --git a/packer/readme.md b/packer/readme.md index 6708e5b..e21afd1 100644 --- a/packer/readme.md +++ b/packer/readme.md @@ -1,214 +1,13 @@ -# Packer - -This repository provides Packer templates and scripts for building linux images, specifically tailored for use with cloud-init and automation tools. -The goal is to create a streamlined process for generating ready-to-use images that can be deployed in various environments. -This is great for organisations that need to maintain consistent and secure base images across their infrastructure ([golden image concept](https://www.redhat.com/en/topics/linux/what-is-a-golden-image)). - -## Installation - -Packer can be installed on both x86 and ARM64 architectures. The recommended installation method uses Hashicorp's official package repositories with dynamic architecture detection. - -```bash -# Install required packages -sudo apt install -y wget curl gnupg software-properties-common -# Add HashiCorp GPG key and repository -wget -O - https://apt.releases.hashicorp.com/gpg | sudo gpg --dearmor -o /usr/share/keyrings/hashicorp-archive-keyring.gpg -echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/hashicorp-archive-keyring.gpg] https://apt.releases.hashicorp.com $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/hashicorp.list - -# Install Packer and required QEMU packages -sudo apt update -sudo apt install -y packer - -# Install architecture-specific dependencies -if [ "$(dpkg --print-architecture)" = "amd64" ]; then - # x86 (amd64) specific packages - sudo apt install -y qemu-kvm libvirt-daemon-system libvirt-clients bridge-utils virtinst virt-manager genisoimage guestfs-tools -else - # ARM64 specific packages - sudo apt install -y qemu-system-arm qemu-system-aarch64 qemu-kvm libvirt-daemon-system libvirt-clients bridge-utils virtinst virt-manager genisoimage guestfs-tools -fi - -# Install QEMU plugin for Packer -sudo packer plugins install github.com/hashicorp/qemu -``` - -> [!NOTE] -> The installation scripts auto-detect your system architecture and install the appropriate packages. For non-Debian based distributions, adjust the package installation commands accordingly. - -## Creating Images with Packer - -### Packer Template Structure - -Our Packer templates define how to build custom images. Key components include: - -- **Source Configuration**: Specifies the base image, VM settings, and QEMU parameters -- **Build Configuration**: Defines provisioners for customization and post-processors for output format -- **Variable Definitions**: Parameters that can be customized per build - -### Cloud-init Configuration - -The Cloud-init configuration is packed into the image as a virtual CD-ROM (ISO):y - -- The `cd_files` directive specifies the path to the `user-data` and `meta-data` files. -- The `cd_label` is set to `cidata`, which Cloud-Init expects for NoCloud configuration. -- When the VM boots, Cloud-Init reads these files to configure the instance. - -### Extra Provisioning Scripts - -In addition to Cloud-init, we use shell scripts to perform additional customization: - -- Install packages -- Configure system settings -- Set up custom motd messages -- Any other specialized configuration needed - -## Build Instructions - -To build the image: - -```bash -cd build/packer/ubuntu-cloud-image/ -sudo packer init -sudo packer build -var-file=variables.pkrvars.hcl . -# Tip: Add this alias to your shell config -# alias pb='sudo packer build -var-file=variables.pkrvars.hcl .' -``` - -After running the Packer build, you'll find the final raw image in the `output-ubuntu-image` directory. - -## Testing & Troubleshooting - -### Troubleshoot image during creation - -#### Connect to image via VNC during build - -If you're on a Linux system with graphical capabilities: - -1. **Install TigerVNC Viewer**: - ```bash - sudo apt-get install tigervnc-viewer # Ubuntu/Debian - sudo dnf install tigervnc # Fedora - ``` - -2. **Connect to the VNC server**: - ```bash - vncviewer 127.0.0.1:5956 - ``` - -#### SSH Tunnel for Remote Shell Use - -For headless environments, tunnel VNC through SSH: - -1. **Create an SSH tunnel**: - ```bash - ssh -N -L 5956:127.0.0.1:5956 remote_user@remote_host - ``` - -2. **Connect via VNC locally**: - ```bash - vncviewer 127.0.0.1:5956 - ``` - -3. **For Windows users**: Use MobaXterm as VNC viewer. - -### Troubleshoot image after creation - -#### Use QEMU to Boot x86 Images - -To boot and access the shell of an x86 image: - -```bash -sudo qemu-system-x86_64 \ --drive file=/path/to/output-noble/ubuntu-noble.img,format=qcow2 \ --smp cores=4,sockets=1 \ --m 4G \ --net nic -net user,hostfwd=tcp::2222-:22 \ --nographic -``` - -#### Use QEMU to Boot ARM64 Images - -To boot an ARM64 image with QEMU: - -```bash -sudo qemu-system-aarch64 -m 2048 -cpu cortex-a72 \ - -M virt \ - -drive file=/path/to/armbian-image.img,format=raw \ - -serial mon:stdio \ - -netdev user,id=user.0 \ - -device virtio-net,netdev=user.0,romfile= -``` - -#### Shell Access via chroot - -To inspect the image filesystem without booting: - -1. **Create a mount directory**: - ```bash - sudo mkdir /mnt/image - ``` - -2. **Mount the image**: - ```bash - sudo mount -o loop /path/to/your/image.raw /mnt/image - ``` - - For images with multiple partitions: - ```bash - sudo fdisk -l /path/to/your/image.img # Find partition offset - # Calculate offset: start_sector * 512 - sudo mount -o loop,offset= /path/to/your/image.img /mnt/image - ``` - -3. **Enter chroot environment**: - ```bash - sudo chroot /mnt/image /bin/bash - ``` - -4. **Exit and unmount**: - ```bash - exit - sudo umount /mnt/image - ``` - -## References - -- [Customize MOTD](https://www.putorius.net/custom-motd-login-screen-linux.html) -- [Original Repo Reference For Packer Config](https://github.com/nbarnum/packer-ubuntu-cloud-image/tree/main) -- [Packer Builder ARM](https://github.com/mkaczanowski/packer-builder-arm) -- [Official Qemu Docs](https://developer.hashicorp.com/packer/integrations/hashicorp/qemu/latest/components/builder/qemu) -- [Armbian QEMU Boot Guide](https://forum.armbian.com/topic/38258-running-self-build-image-on-qemu-arm64/) -- [ARM64 QEMU Examples](https://gist.github.com/wuhanstudio/e9b37b07312a52ceb5973aacf580c453) +# Packer images + +Choose a template, then select its output with `-only`. Proxmox is an optional backend; a local +QEMU build needs no Proxmox server or credentials. + +- [Ubuntu template](ubuntu/readme.md): available outputs and the shared build flow. +- [Build host setup](../docs/ubuntu/build-host-setup.md): Packer, QEMU and optional desktop tools. +- [Local QEMU build](../docs/ubuntu/local-build.md): prerequisites, commands and output files. +- [Optional Proxmox build](../docs/ubuntu/proxmox.md): base bootstrap and native golden templates. +- [SSH and debugging](../docs/ubuntu/ssh-and-debugging.md): build access, VNC tunnels and disk inspection. +- [Manual boot](../docs/ubuntu/manual-boot.md) and [image inspection](../docs/ubuntu/image-inspection.md): QEMU, deployment seeds, raw mounts and chroot. +- [Legacy ARM recipes](../docs/legacy/armbian-qemu.md): preserved Armbian and U-Boot commands. +- [Development checks](../docs/development.md): local verification and the manual sealing test. diff --git a/packer/ubuntu/.gitignore b/packer/ubuntu/.gitignore index a1fa82f..99b380c 100644 --- a/packer/ubuntu/.gitignore +++ b/packer/ubuntu/.gitignore @@ -1,2 +1,12 @@ # built images *.img +*.qcow2 +*.raw +output-*/ + +# real secrets / per-host values (keep the .example) +*.auto.pkrvars.hcl +!*.auto.pkrvars.hcl.example + +# Python safety-test bytecode +__pycache__/ diff --git a/packer/ubuntu/cloud-init/build-config.yaml b/packer/ubuntu/cloud-init/build-config.yaml new file mode 100644 index 0000000..8eaefc6 --- /dev/null +++ b/packer/ubuntu/cloud-init/build-config.yaml @@ -0,0 +1,30 @@ +#cloud-config +# Locale / keyboard / timezone defaults (overridable at clone time). +locale: nl_BE.UTF-8 +keyboard: + layout: be +timezone: Europe/Brussels + +# Update packages on first boot. +package_update: true +package_upgrade: true + +# Baseline tooling from Ubuntu's default apt repos (native apt integration). +# qemu-guest-agent is required so Proxmox can read the VM's IP. Things apt can't +# do cleanly (third-party repos like gh/kubectl, and config/setup logic such as +# the zsh plugins/p10k, MOTD, and hardening) come from the PDS package, selected by +# recipes/default.sh. +packages: + - qemu-guest-agent + - git + - net-tools + - nmap + - nfs-common + - curl + - ca-certificates + - gpg + - file + - build-essential + - zsh + - btop + - cron diff --git a/packer/ubuntu/cloud-init/meta-data b/packer/ubuntu/cloud-init/meta-data index e69de29..37a7499 100644 --- a/packer/ubuntu/cloud-init/meta-data +++ b/packer/ubuntu/cloud-init/meta-data @@ -0,0 +1 @@ +instance-id: builder diff --git a/packer/ubuntu/cloud-init/user-data b/packer/ubuntu/cloud-init/user-data index deda953..d308ac1 100644 --- a/packer/ubuntu/cloud-init/user-data +++ b/packer/ubuntu/cloud-init/user-data @@ -1,44 +1,7 @@ #cloud-config +# Temporary QEMU build access. Lock the account and remove this seed at sealing. password: ubuntu ssh_pwauth: true chpasswd: expire: false - -write_files: -- path: /etc/profile.d/hostname_vars.sh - content: | - export ROLE="main" - export ENV="prd" - export COUNTER=01 - -# # Set the locale and keyboard layout -locale: nl_BE.UTF-8 -keyboard: - layout: be - -# # Timezone setup -timezone: Europe/Brussels - -# # Preserve hostname preserve_hostname: false - -# # Update and upgrade packages on first boot -package_update: true -package_upgrade: true - -# # Install packages -packages: - - qemu-guest-agent - - git - - net-tools - - nmap - - nfs-common - - curl - - file - - build-essential - - zsh - - neofetch - - btop - - gh - - grub-efi-amd64 - - shim-signed \ No newline at end of file diff --git a/packer/ubuntu/pds/readme.md b/packer/ubuntu/pds/readme.md new file mode 100644 index 0000000..bd9f530 --- /dev/null +++ b/packer/ubuntu/pds/readme.md @@ -0,0 +1,34 @@ +# PDS package inputs + +`repository-key.asc` is the public signing key served by +[PDS's APT repository](https://michielvha.github.io/PDS/pds-repo.gpg), inspected on 2026-11-05. +Its primary fingerprint is `37C7D029C0FE4DB0E66E5F72AFA1101D94CBF301`. +The installer checks that the supplied key contains exactly that primary key before configuring APT. +No private key belongs in this directory. + +The default `pds_version` pins published PDS 0.20.0, which contains the image recipe's selected +helpers. The normal build installs that exact version from the signed APT repository. Builds fail +if selected functions are missing; there is no fallback to an unpinned script or another version. + +To test the dependent package before release, prepare a new directory outside Git containing this +public key and the candidate package named `candidate.deb`. Set `pds_input_directory` to its absolute +path, `pds_version` to the package's exact Debian version, and `pds_candidate_sha256` to its checksum. +Both package metadata and installed metadata must match. The image records this route as `candidate` +in `/var/lib/builders/pds.json`; it does not count as signed-release validation. The signed APT +source remains configured for later deployed updates. + +The ordinary route leaves `pds_candidate_sha256` empty and installs `pds=` through the +signed repository. An unexpected `candidate.deb` without a checksum is rejected. + +## Retain reproducible package inputs + +The default route requests the exact `pds_version` from the signed APT repository. A publisher's +retention policy is not an availability guarantee: on 2026-11-05, the served `binary-all/Packages` +index contained only 0.20.0. The publisher attempts to rebuild from GitHub releases, but older +versions were not present in that observed index. A later release may require updating this pin. + +Retain the release `.deb` and its verified SHA256 with recovery artifacts. The explicit local-package +route above can install that saved package when the repository no longer serves its version. It +records `source: candidate` because the build used a supplied file; it is not evidence of an APT +installation from a signed index. Rebuilding also depends on Ubuntu and upstream tool downloads; +a retained package does not make those inputs immutable. diff --git a/packer/ubuntu/pds/repository-key.asc b/packer/ubuntu/pds/repository-key.asc new file mode 100644 index 0000000..53f784d --- /dev/null +++ b/packer/ubuntu/pds/repository-key.asc @@ -0,0 +1,52 @@ +-----BEGIN PGP PUBLIC KEY BLOCK----- + +mQINBGl5H84BEAC3IFBJo5MmYfUa4ocPefKd9OIqV7h3W/oUl1jWQGe+hIJF7MZj +ZoRUS243V5ntWIdNmiXEto4afYPJkMRwHde2jwjvKPzO6qM/VVdPVucch68KQjAX +fMvC8mbYWEsr5ckxzUumdKL6q7MrYAN04vMxEbNhYaXz3uHoZMhdNaUjnr8dD5qy +s8HPciSjJro0msQsaaqy2e5NXIxW4SO5tDrROq1Db7d9ztoHWsCfHK5px/jR4/sG +sW4lY8N6Q0a7Iq5eBVxwqsvrdxSfFQHFqhlzM2Tc6YoPuJERqy8RuO9xadt47Qal +2qBRQX33a68kAVxErM7PZIsWbQqxr8s2Aseza0gkOANw5Jb4hoOFCjUhFxt+1q+e +kP0BcTiIwu5qLQCAeLnNYkyYdCmon3bXFq8iO8tUKcqDd0y7PGhwICK1G2vQ3UfZ +y1drMI/eZYOuzXyCqq9tPyY8wwSXsLK79KYVFGZJoFxIHRvHsuM4qUTUvkC4sk2T +vNTdMwePiGvlFKIFcuPvKpBo29wJiYv0H5y+VEm5JQpoAYtwaec8CMSyJYpWnJZZ +FaGgNmKRZK9lEShE7of3D9cZtNUN8Y5Yw4MVTeEjd4LH+LN+3N4I13KVpCI5DT2M +kQM7Pcs4sbetbIEz/K5sLnKs8jhjsSEF7HIyg4GpMLY8b28+yj3n+EwgzwARAQAB +tDRNaWNoaWVsIFZhbiBIYWVnZW5ib3JnaCAoVkggJiBDbykgPG1pY2hpZWxAdmhj +by5wcm8+iQJRBBMBCAA7FiEEN8fQKcD+TbDmbl9yr6EQHZTL8wEFAml5H84CGwMF +CwkIBwICIgIGFQoJCAsCBBYCAwECHgcCF4AACgkQr6EQHZTL8wG1yw/8DmnTV2nR +G9g254ibmVUr4vMsZ/XUlQU5eVjmPbxsn4xWVDiNmEBy9WvE+uYCz5dDLdFNMCny +JjxWVeqiJUWN4stdFG5ZfUFA4/8Y35raa4rzbtc1t9VXT31JXr5ZP6hHZojRr60C +rbFs3u6fxzNbknvzMqSEieMQdchKqPghaOPMpKYFdKHAKFVwKF84HQYLNcZr+BIH +UdBWFfsHGfn4rmhNeUrkVkrwORTLJ/3MaeHdbQ1Hp7Z9f/YYymfQ5jnR0R9fO8pO +5kelUU8D4j0m7HLwNwbcoI2TqMinSnL6A8ysHp2CfUfjk0FI/yG5MetwtxsocZCc +wcvXKnl6dV4bJ2fyaqxu+qBhVGTsH8yHkhJ3KpyUF19riDSbxPhdPs8Vu1hBHDyG +msCnadOv+Kfb6RgLn/L9t/GD+DhnNlf0Ce6D3xXvJr4f3SLLy1kwiqtXOrlVBYFl +T5H8YDung1179ZgsoQISDKjZCHpAHy4ExcI3Hr/GWn7vtQSXjQHHl6XdEibRXpwu +AKAAG0e/x7W6+e4i5GnCiSyiDnm+QRsQsdJtkgUEonxh99lrAKNy7bVxkyRPj2Ye +OwXPpSMM/0FWjo13B2eKlIbFpBIfggqxg/X7iipxxrnJiHOkw2dF3mWxNTCiM5xt +/qqQqrc1PBHl2L0LlparsHJ4YJHfrFnSzvW5Ag0EaXkfzgEQAKfKXSrrWuoT0Iwf +nZ+6VCerMfXiQVVxlsRgQtK0Ln7GSemBzgHooCvo3frPu5qISiG8e9FSUYxhpCMq +/WDzHRjmHLwJQoThDknw9uLW7iHjrpZ9lsIBMOKTqmgIsZYV/5j2iKHsrn1nBOtI +ApvfqCPEJK2Hm60wgfy9iS3l/NuS4bR7jIpjktN5FtesVTpCyJwY8QXuLcTYep9A +fmgON6nM8dDfiNcTp8KXMW0DzrhYx8NVodvFilp0Lvuu2rnB6LrhcB+/rAORVfsF +HijGFcKZzTUfHEi4GHZVQvPBEdW6JaSnIek+TJVsXDvvdUqEzSATmiTciZ3Y5wZw +9C3V9RJYq2sm+Ve0/bPskt/jewHhcdBLTYgA5OXJf5SqYFn3LDOal81R5xv5iiGr +FmLEi16b0sAUXiBkU8rm7+f3oGnvgjJLyQKYem0QAgtY30c785OTxkUzdnGXKkOR +qm7VdNNw7IdMm2dGM+MvdhNqXcopHI0Sh1rxCDxS8vWl3xPTHLQehZo3R7lsgCkc +3Ov3k15+Z7YVFFeybJa4o6JMi7mlHqx86YODwOsdVBIx7iiYC/nrtM3RlmcP0I68 +AdENg3FPH7eC9ufEpn6D0pZ50OjtUqiowaaLy4gOJd6QZv2YmpgH1SMCgQbpgK4s +d5ut6Xc+2C4gZpS2gLaLYYYU1VsVABEBAAGJAjYEGAEIACAWIQQ3x9ApwP5NsOZu +X3KvoRAdlMvzAQUCaXkfzgIbDAAKCRCvoRAdlMvzATEGD/9h2yEPGUB+ILyt8bfH +V91/tdU8ysALeIzQutIGdUFYAQIGteQzInWf8zwUDMNEmJlbuWPeR+u3TP7+MSk9 +Ib8DmOmCJOXKQDwE+PLXzDQv2p2Ppr+Asf2os/tF6FT+SypbjZh3DF2IjkIMGMqo +BQqMlJ01PivYypHJHIfx1bISryItsIRn1fG4JK0KNvAvMm8Po2Vcg9tA7SAYOABI +gnrQvLCSFRxQbZYp3UIGb4xdNWzbV5cPj1rQ1HLqJMWy/yzTNfXaZ1b1EFkMaqYz +1/w8YJxBuK+qnfpGzJuf4cyRR1BRXyri1e3e5A/xgSefPlLq8X38jcFhj0Tg0Ynh +b87hrajPD6KU/9YovmEy4aN4MFk5Ob0rjDNP6fiHyGDapxFoPXrsZEDhouHileG+ +beyK7djCGEHWg7zEX7U4RFbyuc5TdKAUvnDo/5tLEWBWop3uj3vqRMAs8y9B3xtS +CS6JChXM3Zr64W6GWCx/EO8MsDIryO5Vg0FeuYRjNAiKO5TyMcQcXrxLMmoHWDgJ +NNSh4uiy2Kd81oUjCXrdxqbySj5mknMGn8bBhdsshULHTe9w04H0vLTPazMw82Wl +G54+4osf5Jqcj2jb28u+cVZKVRs3S1v6dqjV9nga+RFuqY2XAz7vdhuZ4wr2sQ8f +ZjA/rRdvO2XDt6Kf9ciTu3o8Qg== +=BRPJ +-----END PGP PUBLIC KEY BLOCK----- diff --git a/packer/ubuntu/proxmox.auto.pkrvars.hcl.example b/packer/ubuntu/proxmox.auto.pkrvars.hcl.example new file mode 100644 index 0000000..ff977c4 --- /dev/null +++ b/packer/ubuntu/proxmox.auto.pkrvars.hcl.example @@ -0,0 +1,18 @@ +# Copy to proxmox.auto.pkrvars.hcl (git-ignored) and fill in your homelab values. +# The token secret is best supplied via the environment instead of this file: +# export PKR_VAR_proxmox_api_token='xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' +# +# proxmox.auto.pkrvars.hcl is loaded automatically by Packer (*.auto.pkrvars.hcl). + +proxmox_url = "https://pve.example.local:8006/api2/json" +proxmox_api_token_id = "packer@pve!packer" +# proxmox_api_token = "..." # prefer PKR_VAR_proxmox_api_token; NEVER commit +proxmox_node = "pve" +proxmox_insecure = false +proxmox_storage_pool = "local-lvm" +proxmox_cpu_type = "host" # Use a shared supported model for migration between different CPUs. +proxmox_task_timeout = "10m" # Full clones can exceed the plugin's one-minute default. + +base_template_name = "ubuntu-noble-cloudimg" +template_name = "ubuntu-2404-base" +template_vmid = 0 # Automatic free ID. Use an explicitly checked ID for reserved ranges. diff --git a/packer/ubuntu/readme.md b/packer/ubuntu/readme.md index 5b3980f..c86302c 100644 --- a/packer/ubuntu/readme.md +++ b/packer/ubuntu/readme.md @@ -1,106 +1,53 @@ -# Ubuntu Cloud Image (WIP) +# Ubuntu images -# ☁️ Cloud-Init Configuration +Build a generic Ubuntu image from the official cloud image. Proxmox is optional; choose the output +that fits the target machine. -Our Cloud-Init configuration automates the initial setup of an Ubuntu instance, including **hostname configuration, system locale, timezone, and software installation**. +| Builder | Output | Procedure | +| --- | --- | --- | +| `qemu.ubuntu` | Local qcow2, optionally also raw. | [Build locally](../../docs/ubuntu/local-build.md) | +| `proxmox-clone.ubuntu` | Native Proxmox template with clone-time cloud-init. | [Build on Proxmox](../../docs/ubuntu/proxmox.md) | -## 📦 Software Installation -These packages are automatically installed on first boot: +## Build -- `qemu-guest-agent` – Improves VM integration -- `git` – Version control -- `net-tools` – Networking tools -- `nfs-common` – NFS support -- `curl` – HTTP request tool -- `file` – File type detection -- `build-essential` – Compiler tools -- `zsh` – Alternative shell -- `neofetch` – System info display -- `bpytop` – System monitoring +The build installs the pinned PDS release from its signed repository. See the +[recipe guide](../../docs/ubuntu/provisioning.md) for defaults and customization. -## 🛠️ Configuration Overview -### Hostname Setup -- **Cloud-Init defines variables** (`ROLE`, `ENV`, `COUNTER`) in `/etc/profile.d/hostname_vars.sh`. -- The **post-Cloud-Init script** reads these variables and configures the **hostname dynamically** using: - ```bash - "${ROLE}-${ARCH}-${ENV}-${COUNTER}" - ``` +With the [local prerequisites](../../docs/ubuntu/local-build.md#prerequisites) installed, start from the repository root: -### 🚧 User & SSH Authentication - **TODO: Improve SSH Key Handling** - -- Currently, Cloud-Init **enables password authentication** (`ssh_pwauth: true`). -- **Password: `ubuntu`** is set but later removed by the script. -- **Better approach:** Set up SSH keys **immediately** in Cloud-Init. - -### **System Localization** -- **Locale:** `nl_BE.UTF-8` -- **Keyboard Layout:** `be` (Belgian) -- **Timezone:** `Europe/Brussels` - -## 🚀 Future Improvements -- [ ] **Replace password auth with SSH key authentication** in Cloud-Init. This can break packer so carefully implement -- [ ] **Enable Fail2Ban** security rules in Cloud-Init. -- [ ] **Refactor hostname governance** logic to ensure proper dynamic assignment. - -# 📜 Script Architecture - -**TODO: Move all the functionality to PDS and just import here, script should be select and apply** - -The script automates post-cloud-init configuration for a Linux instance, ensuring proper system setup, user creation, shell customization, and security hardening. - -## 🔧 Configuration Overview -### 1️⃣ System Configuration -- **User Management** - - Creates an admin user (`sysadmin`). - - Sets up SSH key-based authentication. - - Enables passwordless sudo for the admin. - - ⚠️ *Cloud-Init user provisioning can break SSH access—investigate or handle via script.* - -- **Hostname Setup** - - Generates hostname dynamically based on system variables. - - Applies the new hostname to `/etc/hosts`. - -- **SSHD Configuration** - - Disables root login. - - Enables only key-based authentication. - - Password authentication is disabled by default. - -- **Zsh Configuration** - - Installs and sets up **Zi** (Zsh package manager). - - Configures **Powerlevel10k**, **autosuggestions**, and **syntax highlighting**. - - Applies system-wide Zsh configuration to `/etc/zshrc`. +```bash +cd packer/ubuntu +packer init . +packer build -only='qemu.ubuntu' . +``` -- **Custom MOTD (Message of the Day)** - - Configures **Neofetch** as the system MOTD. - - Backs up existing MOTD scripts. +For Proxmox, first follow the [base-template and API-token setup](../../docs/ubuntu/proxmox.md), then run: -## 🛡️ Security Hardening -- **Disables password authentication and root login** -- **Configures Fail2Ban (TBD)** -- **Enables Uncomplicated Firewall (UFW) (TBD)** -- **Automated Updates via Cron** - - Ensures a **nightly update at midnight**. - - Uses `grep` to prevent duplicate cron entries. +```bash +packer build -only='proxmox-clone.ubuntu' . +``` -## 📦 Tooling & Extras -### **🐳 Kubernetes CLI (kubectl)** -- Installs `kubectl` and additional utilities (`stern`, `kubectl-view-secret`). -- Adds **alias `k=kubectl`** and enables shell completion. +Keep the API secret in `PKR_VAR_proxmox_api_token` or an ignored vars file. +The [example configuration](proxmox.auto.pkrvars.hcl.example) lists the native build inputs. -## 🔗 References -- **[Packer Documentation](https://www.packer.io/docs)** - Official Packer -- **[Cloud-Init Documentation](https://cloudinit.readthedocs.io/en/latest/)** - Official Cloud-Init -- **[Ubuntu Cloud Images](https://cloud-images.ubuntu.com/)** - Official Ubuntu Cloud Images -- **[Original Template Repository](https://github.com/nbarnum/packer-ubuntu-cloud-image/tree/main)** - Shout out to the original author for the base template, @nbarnum, I used it as a starting point for this project. +## Build flow -## Debugging +```mermaid +flowchart LR + Build["Choose builder"] --> Native["Ubuntu settings"] + Native --> Recipe["Selected PDS recipe"] + Recipe --> Seal["Seal image"] + Seal --> Output["Disk or template"] +``` -Set the environment variable `PACKER_LOG=1` to provide additional debug logging +The [pipeline guide](../../docs/ubuntu/image-pipeline.md) explains configuration, sealing and script boundaries. -forward vnc +## Connect and recover -```shell -ssh -N -L 5905:127.0.0.1:5905 sysadmin@x86 -``` +- [SSH and debugging](../../docs/ubuntu/ssh-and-debugging.md): connect during a build, forward VNC over SSH, or inspect an exported disk. +- [Recovery](../../docs/ubuntu/recovery.md): rebuild the Proxmox base from another machine if Fedora is unavailable. +- [Development checks](../../docs/development.md): verify changes locally. +Images are sealed before export. Supply deployed users and keys through cloud-init; the temporary +build login does not survive. The [default recipe](recipes/default.sh) selects the shared tooling +and policies; [custom recipes](../../docs/ubuntu/provisioning.md#choose-a-different-recipe) control those choices. diff --git a/packer/ubuntu/recipes/custom.example.sh b/packer/ubuntu/recipes/custom.example.sh new file mode 100644 index 0000000..2b16a95 --- /dev/null +++ b/packer/ubuntu/recipes/custom.example.sh @@ -0,0 +1,5 @@ +#!/usr/bin/env bash +# Example selection: shell and branding. Native settings and sealing still run. +install_zi +configure_zsh +setup_motd_preset "$BUILD_MOTD_PRESET" diff --git a/packer/ubuntu/recipes/default.sh b/packer/ubuntu/recipes/default.sh new file mode 100644 index 0000000..96951b3 --- /dev/null +++ b/packer/ubuntu/recipes/default.sh @@ -0,0 +1,9 @@ +#!/usr/bin/env bash +# Shared implementations live in PDS. Order service-changing installs before SSH policy. +install_zi +configure_zsh +setup_motd_preset "$BUILD_MOTD_PRESET" +install_gh +install_kubectl "$BUILD_KUBECTL_CHANNEL" --system +update_system_cron_entry +restricted_ssh_security_profile diff --git a/packer/ubuntu/recovery.md b/packer/ubuntu/recovery.md new file mode 100644 index 0000000..49d5b6f --- /dev/null +++ b/packer/ubuntu/recovery.md @@ -0,0 +1,4 @@ +# Base-template recovery + +The procedure has moved to [recover image building when Fedora is unavailable](../../docs/ubuntu/recovery.md). +It covers importing a retained bundle and rebuilding from a replacement machine. diff --git a/packer/ubuntu/scripts/.p10k.zsh b/packer/ubuntu/scripts/.p10k.zsh deleted file mode 100644 index dccbaaf..0000000 --- a/packer/ubuntu/scripts/.p10k.zsh +++ /dev/null @@ -1,1843 +0,0 @@ -# Generated by Powerlevel10k configuration wizard on 2024-11-10 at 17:50 CET. -# Based on romkatv/powerlevel10k/config/p10k-rainbow.zsh, checksum 49619. -# Wizard options: powerline, rainbow, unicode, 24h time, vertical separators, -# sharp heads, flat tails, 2 lines, disconnected, full frame, light-ornaments, sparse, -# concise, transient_prompt, instant_prompt=verbose. -# Type `p10k configure` to generate another config. -# -# Config for Powerlevel10k with powerline prompt style with colorful background. -# Type `p10k configure` to generate your own config based on it. -# -# Tip: Looking for a nice color? Here's a one-liner to print colormap. -# -# for i in {0..255}; do print -Pn "%K{$i} %k%F{$i}${(l:3::0:)i}%f " ${${(M)$((i%6)):#3}:+$'\n'}; done - -# Temporarily change options. -'builtin' 'local' '-a' 'p10k_config_opts' -[[ ! -o 'aliases' ]] || p10k_config_opts+=('aliases') -[[ ! -o 'sh_glob' ]] || p10k_config_opts+=('sh_glob') -[[ ! -o 'no_brace_expand' ]] || p10k_config_opts+=('no_brace_expand') -'builtin' 'setopt' 'no_aliases' 'no_sh_glob' 'brace_expand' - -() { - emulate -L zsh -o extended_glob - - # Unset all configuration options. This allows you to apply configuration changes without - # restarting zsh. Edit ~/.p10k.zsh and type `source ~/.p10k.zsh`. - unset -m '(POWERLEVEL9K_*|DEFAULT_USER)~POWERLEVEL9K_GITSTATUS_DIR' - - # Zsh >= 5.1 is required. - [[ $ZSH_VERSION == (5.<1->*|<6->.*) ]] || return - - # The list of segments shown on the left. Fill it with the most important segments. - typeset -g POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=( - # =========================[ Line #1 ]========================= - # os_icon # os identifier - dir # current directory - vcs # git status - # =========================[ Line #2 ]========================= - newline # \n - # prompt_char # prompt symbol - ) - - # The list of segments shown on the right. Fill it with less important segments. - # Right prompt on the last prompt line (where you are typing your commands) gets - # automatically hidden when the input line reaches it. Right prompt above the - # last prompt line gets hidden if it would overlap with left prompt. - typeset -g POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=( - # =========================[ Line #1 ]========================= - status # exit code of the last command - command_execution_time # duration of the last command - background_jobs # presence of background jobs - direnv # direnv status (https://direnv.net/) - asdf # asdf version manager (https://github.com/asdf-vm/asdf) - virtualenv # python virtual environment (https://docs.python.org/3/library/venv.html) - anaconda # conda environment (https://conda.io/) - pyenv # python environment (https://github.com/pyenv/pyenv) - goenv # go environment (https://github.com/syndbg/goenv) - nodenv # node.js version from nodenv (https://github.com/nodenv/nodenv) - nvm # node.js version from nvm (https://github.com/nvm-sh/nvm) - nodeenv # node.js environment (https://github.com/ekalinin/nodeenv) - # node_version # node.js version - # go_version # go version (https://golang.org) - # rust_version # rustc version (https://www.rust-lang.org) - # dotnet_version # .NET version (https://dotnet.microsoft.com) - # php_version # php version (https://www.php.net/) - # laravel_version # laravel php framework version (https://laravel.com/) - # java_version # java version (https://www.java.com/) - # package # name@version from package.json (https://docs.npmjs.com/files/package.json) - rbenv # ruby version from rbenv (https://github.com/rbenv/rbenv) - rvm # ruby version from rvm (https://rvm.io) - fvm # flutter version management (https://github.com/leoafarias/fvm) - luaenv # lua version from luaenv (https://github.com/cehoffman/luaenv) - jenv # java version from jenv (https://github.com/jenv/jenv) - plenv # perl version from plenv (https://github.com/tokuhirom/plenv) - perlbrew # perl version from perlbrew (https://github.com/gugod/App-perlbrew) - phpenv # php version from phpenv (https://github.com/phpenv/phpenv) - scalaenv # scala version from scalaenv (https://github.com/scalaenv/scalaenv) - haskell_stack # haskell version from stack (https://haskellstack.org/) - kubecontext # current kubernetes context (https://kubernetes.io/) - terraform # terraform workspace (https://www.terraform.io) - # terraform_version # terraform version (https://www.terraform.io) - aws # aws profile (https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-profiles.html) - aws_eb_env # aws elastic beanstalk environment (https://aws.amazon.com/elasticbeanstalk/) - azure # azure account name (https://docs.microsoft.com/en-us/cli/azure) - gcloud # google cloud cli account and project (https://cloud.google.com/) - google_app_cred # google application credentials (https://cloud.google.com/docs/authentication/production) - toolbox # toolbox name (https://github.com/containers/toolbox) - context # user@hostname - nordvpn # nordvpn connection status, linux only (https://nordvpn.com/) - ranger # ranger shell (https://github.com/ranger/ranger) - yazi # yazi shell (https://github.com/sxyazi/yazi) - nnn # nnn shell (https://github.com/jarun/nnn) - lf # lf shell (https://github.com/gokcehan/lf) - xplr # xplr shell (https://github.com/sayanarijit/xplr) - vim_shell # vim shell indicator (:sh) - midnight_commander # midnight commander shell (https://midnight-commander.org/) - nix_shell # nix shell (https://nixos.org/nixos/nix-pills/developing-with-nix-shell.html) - chezmoi_shell # chezmoi shell (https://www.chezmoi.io/) - vi_mode # vi mode (you don't need this if you've enabled prompt_char) - # vpn_ip # virtual private network indicator - # load # CPU load - # disk_usage # disk usage - # ram # free RAM - # swap # used swap - todo # todo items (https://github.com/todotxt/todo.txt-cli) - timewarrior # timewarrior tracking status (https://timewarrior.net/) - taskwarrior # taskwarrior task count (https://taskwarrior.org/) - per_directory_history # Oh My Zsh per-directory-history local/global indicator - # cpu_arch # CPU architecture - time # current time - # =========================[ Line #2 ]========================= - newline - # ip # ip address and bandwidth usage for a specified network interface - # public_ip # public IP address - # proxy # system-wide http/https/ftp proxy - # battery # internal battery - # wifi # wifi speed - # example # example user-defined segment (see prompt_example function below) - ) - - # Defines character set used by powerlevel10k. It's best to let `p10k configure` set it for you. - typeset -g POWERLEVEL9K_MODE=powerline - # When set to `moderate`, some icons will have an extra space after them. This is meant to avoid - # icon overlap when using non-monospace fonts. When set to `none`, spaces are not added. - typeset -g POWERLEVEL9K_ICON_PADDING=none - - # When set to true, icons appear before content on both sides of the prompt. When set - # to false, icons go after content. If empty or not set, icons go before content in the left - # prompt and after content in the right prompt. - # - # You can also override it for a specific segment: - # - # POWERLEVEL9K_STATUS_ICON_BEFORE_CONTENT=false - # - # Or for a specific segment in specific state: - # - # POWERLEVEL9K_DIR_NOT_WRITABLE_ICON_BEFORE_CONTENT=false - typeset -g POWERLEVEL9K_ICON_BEFORE_CONTENT= - - # Add an empty line before each prompt. - typeset -g POWERLEVEL9K_PROMPT_ADD_NEWLINE=true - - # Connect left prompt lines with these symbols. You'll probably want to use the same color - # as POWERLEVEL9K_MULTILINE_FIRST_PROMPT_GAP_FOREGROUND below. - typeset -g POWERLEVEL9K_MULTILINE_FIRST_PROMPT_PREFIX='%242F╭─' - typeset -g POWERLEVEL9K_MULTILINE_NEWLINE_PROMPT_PREFIX='%242F├─' - typeset -g POWERLEVEL9K_MULTILINE_LAST_PROMPT_PREFIX='%242F╰─' - # Connect right prompt lines with these symbols. - typeset -g POWERLEVEL9K_MULTILINE_FIRST_PROMPT_SUFFIX='%242F─╮' - typeset -g POWERLEVEL9K_MULTILINE_NEWLINE_PROMPT_SUFFIX='%242F─┤' - typeset -g POWERLEVEL9K_MULTILINE_LAST_PROMPT_SUFFIX='%242F─╯' - - # Filler between left and right prompt on the first prompt line. You can set it to ' ', '·' or - # '─'. The last two make it easier to see the alignment between left and right prompt and to - # separate prompt from command output. You might want to set POWERLEVEL9K_PROMPT_ADD_NEWLINE=false - # for more compact prompt if using this option. - typeset -g POWERLEVEL9K_MULTILINE_FIRST_PROMPT_GAP_CHAR=' ' - typeset -g POWERLEVEL9K_MULTILINE_FIRST_PROMPT_GAP_BACKGROUND= - typeset -g POWERLEVEL9K_MULTILINE_NEWLINE_PROMPT_GAP_BACKGROUND= - if [[ $POWERLEVEL9K_MULTILINE_FIRST_PROMPT_GAP_CHAR != ' ' ]]; then - # The color of the filler. You'll probably want to match the color of POWERLEVEL9K_MULTILINE - # ornaments defined above. - typeset -g POWERLEVEL9K_MULTILINE_FIRST_PROMPT_GAP_FOREGROUND=242 - # Start filler from the edge of the screen if there are no left segments on the first line. - typeset -g POWERLEVEL9K_EMPTY_LINE_LEFT_PROMPT_FIRST_SEGMENT_END_SYMBOL='%{%}' - # End filler on the edge of the screen if there are no right segments on the first line. - typeset -g POWERLEVEL9K_EMPTY_LINE_RIGHT_PROMPT_FIRST_SEGMENT_START_SYMBOL='%{%}' - fi - - # Separator between same-color segments on the left. - typeset -g POWERLEVEL9K_LEFT_SUBSEGMENT_SEPARATOR='\u2502' - # Separator between same-color segments on the right. - typeset -g POWERLEVEL9K_RIGHT_SUBSEGMENT_SEPARATOR='\u2502' - # Separator between different-color segments on the left. - typeset -g POWERLEVEL9K_LEFT_SEGMENT_SEPARATOR='' - # Separator between different-color segments on the right. - typeset -g POWERLEVEL9K_RIGHT_SEGMENT_SEPARATOR='' - # To remove a separator between two segments, add "_joined" to the second segment name. - # For example: POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=(os_icon context_joined) - - # The right end of left prompt. - typeset -g POWERLEVEL9K_LEFT_PROMPT_LAST_SEGMENT_END_SYMBOL='\uE0B0' - # The left end of right prompt. - typeset -g POWERLEVEL9K_RIGHT_PROMPT_FIRST_SEGMENT_START_SYMBOL='\uE0B2' - # The left end of left prompt. - typeset -g POWERLEVEL9K_LEFT_PROMPT_FIRST_SEGMENT_START_SYMBOL='' - # The right end of right prompt. - typeset -g POWERLEVEL9K_RIGHT_PROMPT_LAST_SEGMENT_END_SYMBOL='' - # Left prompt terminator for lines without any segments. - typeset -g POWERLEVEL9K_EMPTY_LINE_LEFT_PROMPT_LAST_SEGMENT_END_SYMBOL= - - #################################[ os_icon: os identifier ]################################## - # OS identifier color. - typeset -g POWERLEVEL9K_OS_ICON_FOREGROUND=232 - typeset -g POWERLEVEL9K_OS_ICON_BACKGROUND=7 - # Custom icon. - # typeset -g POWERLEVEL9K_OS_ICON_CONTENT_EXPANSION='⭐' - - ################################[ prompt_char: prompt symbol ]################################ - # Transparent background. - typeset -g POWERLEVEL9K_PROMPT_CHAR_BACKGROUND= - # Green prompt symbol if the last command succeeded. - typeset -g POWERLEVEL9K_PROMPT_CHAR_OK_{VIINS,VICMD,VIVIS,VIOWR}_FOREGROUND=76 - # Red prompt symbol if the last command failed. - typeset -g POWERLEVEL9K_PROMPT_CHAR_ERROR_{VIINS,VICMD,VIVIS,VIOWR}_FOREGROUND=196 - # Default prompt symbol. - typeset -g POWERLEVEL9K_PROMPT_CHAR_{OK,ERROR}_VIINS_CONTENT_EXPANSION='❯' - # Prompt symbol in command vi mode. - typeset -g POWERLEVEL9K_PROMPT_CHAR_{OK,ERROR}_VICMD_CONTENT_EXPANSION='❮' - # Prompt symbol in visual vi mode. - typeset -g POWERLEVEL9K_PROMPT_CHAR_{OK,ERROR}_VIVIS_CONTENT_EXPANSION='V' - # Prompt symbol in overwrite vi mode. - typeset -g POWERLEVEL9K_PROMPT_CHAR_{OK,ERROR}_VIOWR_CONTENT_EXPANSION='▶' - typeset -g POWERLEVEL9K_PROMPT_CHAR_OVERWRITE_STATE=true - # No line terminator if prompt_char is the last segment. - typeset -g POWERLEVEL9K_PROMPT_CHAR_LEFT_PROMPT_LAST_SEGMENT_END_SYMBOL= - # No line introducer if prompt_char is the first segment. - typeset -g POWERLEVEL9K_PROMPT_CHAR_LEFT_PROMPT_FIRST_SEGMENT_START_SYMBOL= - # No surrounding whitespace. - typeset -g POWERLEVEL9K_PROMPT_CHAR_LEFT_{LEFT,RIGHT}_WHITESPACE= - - ##################################[ dir: current directory ]################################## - # Current directory background color. - typeset -g POWERLEVEL9K_DIR_BACKGROUND=4 - # Default current directory foreground color. - typeset -g POWERLEVEL9K_DIR_FOREGROUND=254 - # If directory is too long, shorten some of its segments to the shortest possible unique - # prefix. The shortened directory can be tab-completed to the original. - typeset -g POWERLEVEL9K_SHORTEN_STRATEGY=truncate_to_unique - # Replace removed segment suffixes with this symbol. - typeset -g POWERLEVEL9K_SHORTEN_DELIMITER= - # Color of the shortened directory segments. - typeset -g POWERLEVEL9K_DIR_SHORTENED_FOREGROUND=250 - # Color of the anchor directory segments. Anchor segments are never shortened. The first - # segment is always an anchor. - typeset -g POWERLEVEL9K_DIR_ANCHOR_FOREGROUND=255 - # Display anchor directory segments in bold. - typeset -g POWERLEVEL9K_DIR_ANCHOR_BOLD=true - # Don't shorten directories that contain any of these files. They are anchors. - local anchor_files=( - .bzr - .citc - .git - .hg - .node-version - .python-version - .go-version - .ruby-version - .lua-version - .java-version - .perl-version - .php-version - .tool-versions - .mise.toml - .shorten_folder_marker - .svn - .terraform - CVS - Cargo.toml - composer.json - go.mod - package.json - stack.yaml - ) - typeset -g POWERLEVEL9K_SHORTEN_FOLDER_MARKER="(${(j:|:)anchor_files})" - # If set to "first" ("last"), remove everything before the first (last) subdirectory that contains - # files matching $POWERLEVEL9K_SHORTEN_FOLDER_MARKER. For example, when the current directory is - # /foo/bar/git_repo/nested_git_repo/baz, prompt will display git_repo/nested_git_repo/baz (first) - # or nested_git_repo/baz (last). This assumes that git_repo and nested_git_repo contain markers - # and other directories don't. - # - # Optionally, "first" and "last" can be followed by ":" where is an integer. - # This moves the truncation point to the right (positive offset) or to the left (negative offset) - # relative to the marker. Plain "first" and "last" are equivalent to "first:0" and "last:0" - # respectively. - typeset -g POWERLEVEL9K_DIR_TRUNCATE_BEFORE_MARKER=false - # Don't shorten this many last directory segments. They are anchors. - typeset -g POWERLEVEL9K_SHORTEN_DIR_LENGTH=1 - # Shorten directory if it's longer than this even if there is space for it. The value can - # be either absolute (e.g., '80') or a percentage of terminal width (e.g, '50%'). If empty, - # directory will be shortened only when prompt doesn't fit or when other parameters demand it - # (see POWERLEVEL9K_DIR_MIN_COMMAND_COLUMNS and POWERLEVEL9K_DIR_MIN_COMMAND_COLUMNS_PCT below). - # If set to `0`, directory will always be shortened to its minimum length. - typeset -g POWERLEVEL9K_DIR_MAX_LENGTH=80 - # When `dir` segment is on the last prompt line, try to shorten it enough to leave at least this - # many columns for typing commands. - typeset -g POWERLEVEL9K_DIR_MIN_COMMAND_COLUMNS=40 - # When `dir` segment is on the last prompt line, try to shorten it enough to leave at least - # COLUMNS * POWERLEVEL9K_DIR_MIN_COMMAND_COLUMNS_PCT * 0.01 columns for typing commands. - typeset -g POWERLEVEL9K_DIR_MIN_COMMAND_COLUMNS_PCT=50 - # If set to true, embed a hyperlink into the directory. Useful for quickly - # opening a directory in the file manager simply by clicking the link. - # Can also be handy when the directory is shortened, as it allows you to see - # the full directory that was used in previous commands. - typeset -g POWERLEVEL9K_DIR_HYPERLINK=false - - # Enable special styling for non-writable and non-existent directories. See POWERLEVEL9K_LOCK_ICON - # and POWERLEVEL9K_DIR_CLASSES below. - typeset -g POWERLEVEL9K_DIR_SHOW_WRITABLE=v3 - - # The default icon shown next to non-writable and non-existent directories when - # POWERLEVEL9K_DIR_SHOW_WRITABLE is set to v3. - typeset -g POWERLEVEL9K_LOCK_ICON='∅' - - # POWERLEVEL9K_DIR_CLASSES allows you to specify custom icons and colors for different - # directories. It must be an array with 3 * N elements. Each triplet consists of: - # - # 1. A pattern against which the current directory ($PWD) is matched. Matching is done with - # extended_glob option enabled. - # 2. Directory class for the purpose of styling. - # 3. An empty string. - # - # Triplets are tried in order. The first triplet whose pattern matches $PWD wins. - # - # If POWERLEVEL9K_DIR_SHOW_WRITABLE is set to v3, non-writable and non-existent directories - # acquire class suffix _NOT_WRITABLE and NON_EXISTENT respectively. - # - # For example, given these settings: - # - # typeset -g POWERLEVEL9K_DIR_CLASSES=( - # '~/work(|/*)' WORK '' - # '~(|/*)' HOME '' - # '*' DEFAULT '') - # - # Whenever the current directory is ~/work or a subdirectory of ~/work, it gets styled with one - # of the following classes depending on its writability and existence: WORK, WORK_NOT_WRITABLE or - # WORK_NON_EXISTENT. - # - # Simply assigning classes to directories doesn't have any visible effects. It merely gives you an - # option to define custom colors and icons for different directory classes. - # - # # Styling for WORK. - # typeset -g POWERLEVEL9K_DIR_WORK_VISUAL_IDENTIFIER_EXPANSION='⭐' - # typeset -g POWERLEVEL9K_DIR_WORK_BACKGROUND=4 - # typeset -g POWERLEVEL9K_DIR_WORK_FOREGROUND=254 - # typeset -g POWERLEVEL9K_DIR_WORK_SHORTENED_FOREGROUND=250 - # typeset -g POWERLEVEL9K_DIR_WORK_ANCHOR_FOREGROUND=255 - # - # # Styling for WORK_NOT_WRITABLE. - # typeset -g POWERLEVEL9K_DIR_WORK_NOT_WRITABLE_VISUAL_IDENTIFIER_EXPANSION='⭐' - # typeset -g POWERLEVEL9K_DIR_WORK_NOT_WRITABLE_BACKGROUND=4 - # typeset -g POWERLEVEL9K_DIR_WORK_NOT_WRITABLE_FOREGROUND=254 - # typeset -g POWERLEVEL9K_DIR_WORK_NOT_WRITABLE_SHORTENED_FOREGROUND=250 - # typeset -g POWERLEVEL9K_DIR_WORK_NOT_WRITABLE_ANCHOR_FOREGROUND=255 - # - # # Styling for WORK_NON_EXISTENT. - # typeset -g POWERLEVEL9K_DIR_WORK_NON_EXISTENT_VISUAL_IDENTIFIER_EXPANSION='⭐' - # typeset -g POWERLEVEL9K_DIR_WORK_NON_EXISTENT_BACKGROUND=4 - # typeset -g POWERLEVEL9K_DIR_WORK_NON_EXISTENT_FOREGROUND=254 - # typeset -g POWERLEVEL9K_DIR_WORK_NON_EXISTENT_SHORTENED_FOREGROUND=250 - # typeset -g POWERLEVEL9K_DIR_WORK_NON_EXISTENT_ANCHOR_FOREGROUND=255 - # - # If a styling parameter isn't explicitly defined for some class, it falls back to the classless - # parameter. For example, if POWERLEVEL9K_DIR_WORK_NOT_WRITABLE_FOREGROUND is not set, it falls - # back to POWERLEVEL9K_DIR_FOREGROUND. - # - typeset -g POWERLEVEL9K_DIR_CLASSES=() - - # Custom prefix. - # typeset -g POWERLEVEL9K_DIR_PREFIX='in ' - - #####################################[ vcs: git status ]###################################### - # Version control background colors. - typeset -g POWERLEVEL9K_VCS_CLEAN_BACKGROUND=2 - typeset -g POWERLEVEL9K_VCS_MODIFIED_BACKGROUND=3 - typeset -g POWERLEVEL9K_VCS_UNTRACKED_BACKGROUND=2 - typeset -g POWERLEVEL9K_VCS_CONFLICTED_BACKGROUND=3 - typeset -g POWERLEVEL9K_VCS_LOADING_BACKGROUND=8 - - # Branch icon. Set this parameter to '\UE0A0 ' for the popular Powerline branch icon. - typeset -g POWERLEVEL9K_VCS_BRANCH_ICON= - - # Untracked files icon. It's really a question mark, your font isn't broken. - # Change the value of this parameter to show a different icon. - typeset -g POWERLEVEL9K_VCS_UNTRACKED_ICON='?' - - # Formatter for Git status. - # - # Example output: master wip ⇣42⇡42 *42 merge ~42 +42 !42 ?42. - # - # You can edit the function to customize how Git status looks. - # - # VCS_STATUS_* parameters are set by gitstatus plugin. See reference: - # https://github.com/romkatv/gitstatus/blob/master/gitstatus.plugin.zsh. - function my_git_formatter() { - emulate -L zsh - - if [[ -n $P9K_CONTENT ]]; then - # If P9K_CONTENT is not empty, use it. It's either "loading" or from vcs_info (not from - # gitstatus plugin). VCS_STATUS_* parameters are not available in this case. - typeset -g my_git_format=$P9K_CONTENT - return - fi - - # Styling for different parts of Git status. - local meta='%7F' # white foreground - local clean='%0F' # black foreground - local modified='%0F' # black foreground - local untracked='%0F' # black foreground - local conflicted='%1F' # red foreground - - local res - - if [[ -n $VCS_STATUS_LOCAL_BRANCH ]]; then - local branch=${(V)VCS_STATUS_LOCAL_BRANCH} - # If local branch name is at most 32 characters long, show it in full. - # Otherwise show the first 12 … the last 12. - # Tip: To always show local branch name in full without truncation, delete the next line. - (( $#branch > 32 )) && branch[13,-13]="…" # <-- this line - res+="${clean}${(g::)POWERLEVEL9K_VCS_BRANCH_ICON}${branch//\%/%%}" - fi - - if [[ -n $VCS_STATUS_TAG - # Show tag only if not on a branch. - # Tip: To always show tag, delete the next line. - && -z $VCS_STATUS_LOCAL_BRANCH # <-- this line - ]]; then - local tag=${(V)VCS_STATUS_TAG} - # If tag name is at most 32 characters long, show it in full. - # Otherwise show the first 12 … the last 12. - # Tip: To always show tag name in full without truncation, delete the next line. - (( $#tag > 32 )) && tag[13,-13]="…" # <-- this line - res+="${meta}#${clean}${tag//\%/%%}" - fi - - # Display the current Git commit if there is no branch and no tag. - # Tip: To always display the current Git commit, delete the next line. - [[ -z $VCS_STATUS_LOCAL_BRANCH && -z $VCS_STATUS_TAG ]] && # <-- this line - res+="${meta}@${clean}${VCS_STATUS_COMMIT[1,8]}" - - # Show tracking branch name if it differs from local branch. - if [[ -n ${VCS_STATUS_REMOTE_BRANCH:#$VCS_STATUS_LOCAL_BRANCH} ]]; then - res+="${meta}:${clean}${(V)VCS_STATUS_REMOTE_BRANCH//\%/%%}" - fi - - # Display "wip" if the latest commit's summary contains "wip" or "WIP". - if [[ $VCS_STATUS_COMMIT_SUMMARY == (|*[^[:alnum:]])(wip|WIP)(|[^[:alnum:]]*) ]]; then - res+=" ${modified}wip" - fi - - if (( VCS_STATUS_COMMITS_AHEAD || VCS_STATUS_COMMITS_BEHIND )); then - # ⇣42 if behind the remote. - (( VCS_STATUS_COMMITS_BEHIND )) && res+=" ${clean}⇣${VCS_STATUS_COMMITS_BEHIND}" - # ⇡42 if ahead of the remote; no leading space if also behind the remote: ⇣42⇡42. - (( VCS_STATUS_COMMITS_AHEAD && !VCS_STATUS_COMMITS_BEHIND )) && res+=" " - (( VCS_STATUS_COMMITS_AHEAD )) && res+="${clean}⇡${VCS_STATUS_COMMITS_AHEAD}" - elif [[ -n $VCS_STATUS_REMOTE_BRANCH ]]; then - # Tip: Uncomment the next line to display '=' if up to date with the remote. - # res+=" ${clean}=" - fi - - # ⇠42 if behind the push remote. - (( VCS_STATUS_PUSH_COMMITS_BEHIND )) && res+=" ${clean}⇠${VCS_STATUS_PUSH_COMMITS_BEHIND}" - (( VCS_STATUS_PUSH_COMMITS_AHEAD && !VCS_STATUS_PUSH_COMMITS_BEHIND )) && res+=" " - # ⇢42 if ahead of the push remote; no leading space if also behind: ⇠42⇢42. - (( VCS_STATUS_PUSH_COMMITS_AHEAD )) && res+="${clean}⇢${VCS_STATUS_PUSH_COMMITS_AHEAD}" - # *42 if have stashes. - (( VCS_STATUS_STASHES )) && res+=" ${clean}*${VCS_STATUS_STASHES}" - # 'merge' if the repo is in an unusual state. - [[ -n $VCS_STATUS_ACTION ]] && res+=" ${conflicted}${VCS_STATUS_ACTION}" - # ~42 if have merge conflicts. - (( VCS_STATUS_NUM_CONFLICTED )) && res+=" ${conflicted}~${VCS_STATUS_NUM_CONFLICTED}" - # +42 if have staged changes. - (( VCS_STATUS_NUM_STAGED )) && res+=" ${modified}+${VCS_STATUS_NUM_STAGED}" - # !42 if have unstaged changes. - (( VCS_STATUS_NUM_UNSTAGED )) && res+=" ${modified}!${VCS_STATUS_NUM_UNSTAGED}" - # ?42 if have untracked files. It's really a question mark, your font isn't broken. - # See POWERLEVEL9K_VCS_UNTRACKED_ICON above if you want to use a different icon. - # Remove the next line if you don't want to see untracked files at all. - (( VCS_STATUS_NUM_UNTRACKED )) && res+=" ${untracked}${(g::)POWERLEVEL9K_VCS_UNTRACKED_ICON}${VCS_STATUS_NUM_UNTRACKED}" - # "─" if the number of unstaged files is unknown. This can happen due to - # POWERLEVEL9K_VCS_MAX_INDEX_SIZE_DIRTY (see below) being set to a non-negative number lower - # than the number of files in the Git index, or due to bash.showDirtyState being set to false - # in the repository config. The number of staged and untracked files may also be unknown - # in this case. - (( VCS_STATUS_HAS_UNSTAGED == -1 )) && res+=" ${modified}─" - - typeset -g my_git_format=$res - } - functions -M my_git_formatter 2>/dev/null - - # Don't count the number of unstaged, untracked and conflicted files in Git repositories with - # more than this many files in the index. Negative value means infinity. - # - # If you are working in Git repositories with tens of millions of files and seeing performance - # sagging, try setting POWERLEVEL9K_VCS_MAX_INDEX_SIZE_DIRTY to a number lower than the output - # of `git ls-files | wc -l`. Alternatively, add `bash.showDirtyState = false` to the repository's - # config: `git config bash.showDirtyState false`. - typeset -g POWERLEVEL9K_VCS_MAX_INDEX_SIZE_DIRTY=-1 - - # Don't show Git status in prompt for repositories whose workdir matches this pattern. - # For example, if set to '~', the Git repository at $HOME/.git will be ignored. - # Multiple patterns can be combined with '|': '~(|/foo)|/bar/baz/*'. - typeset -g POWERLEVEL9K_VCS_DISABLED_WORKDIR_PATTERN='~' - - # Disable the default Git status formatting. - typeset -g POWERLEVEL9K_VCS_DISABLE_GITSTATUS_FORMATTING=true - # Install our own Git status formatter. - typeset -g POWERLEVEL9K_VCS_CONTENT_EXPANSION='${$((my_git_formatter()))+${my_git_format}}' - # Enable counters for staged, unstaged, etc. - typeset -g POWERLEVEL9K_VCS_{STAGED,UNSTAGED,UNTRACKED,CONFLICTED,COMMITS_AHEAD,COMMITS_BEHIND}_MAX_NUM=-1 - - # Custom icon. - typeset -g POWERLEVEL9K_VCS_VISUAL_IDENTIFIER_EXPANSION= - # Custom prefix. - # typeset -g POWERLEVEL9K_VCS_PREFIX='on ' - - # Show status of repositories of these types. You can add svn and/or hg if you are - # using them. If you do, your prompt may become slow even when your current directory - # isn't in an svn or hg repository. - typeset -g POWERLEVEL9K_VCS_BACKENDS=(git) - - ##########################[ status: exit code of the last command ]########################### - # Enable OK_PIPE, ERROR_PIPE and ERROR_SIGNAL status states to allow us to enable, disable and - # style them independently from the regular OK and ERROR state. - typeset -g POWERLEVEL9K_STATUS_EXTENDED_STATES=true - - # Status on success. No content, just an icon. No need to show it if prompt_char is enabled as - # it will signify success by turning green. - typeset -g POWERLEVEL9K_STATUS_OK=true - typeset -g POWERLEVEL9K_STATUS_OK_VISUAL_IDENTIFIER_EXPANSION='✔' - typeset -g POWERLEVEL9K_STATUS_OK_FOREGROUND=2 - typeset -g POWERLEVEL9K_STATUS_OK_BACKGROUND=0 - - # Status when some part of a pipe command fails but the overall exit status is zero. It may look - # like this: 1|0. - typeset -g POWERLEVEL9K_STATUS_OK_PIPE=true - typeset -g POWERLEVEL9K_STATUS_OK_PIPE_VISUAL_IDENTIFIER_EXPANSION='✔' - typeset -g POWERLEVEL9K_STATUS_OK_PIPE_FOREGROUND=2 - typeset -g POWERLEVEL9K_STATUS_OK_PIPE_BACKGROUND=0 - - # Status when it's just an error code (e.g., '1'). No need to show it if prompt_char is enabled as - # it will signify error by turning red. - typeset -g POWERLEVEL9K_STATUS_ERROR=true - typeset -g POWERLEVEL9K_STATUS_ERROR_VISUAL_IDENTIFIER_EXPANSION='✘' - typeset -g POWERLEVEL9K_STATUS_ERROR_FOREGROUND=3 - typeset -g POWERLEVEL9K_STATUS_ERROR_BACKGROUND=1 - - # Status when the last command was terminated by a signal. - typeset -g POWERLEVEL9K_STATUS_ERROR_SIGNAL=true - # Use terse signal names: "INT" instead of "SIGINT(2)". - typeset -g POWERLEVEL9K_STATUS_VERBOSE_SIGNAME=false - typeset -g POWERLEVEL9K_STATUS_ERROR_SIGNAL_VISUAL_IDENTIFIER_EXPANSION='✘' - typeset -g POWERLEVEL9K_STATUS_ERROR_SIGNAL_FOREGROUND=3 - typeset -g POWERLEVEL9K_STATUS_ERROR_SIGNAL_BACKGROUND=1 - - # Status when some part of a pipe command fails and the overall exit status is also non-zero. - # It may look like this: 1|0. - typeset -g POWERLEVEL9K_STATUS_ERROR_PIPE=true - typeset -g POWERLEVEL9K_STATUS_ERROR_PIPE_VISUAL_IDENTIFIER_EXPANSION='✘' - typeset -g POWERLEVEL9K_STATUS_ERROR_PIPE_FOREGROUND=3 - typeset -g POWERLEVEL9K_STATUS_ERROR_PIPE_BACKGROUND=1 - - ###################[ command_execution_time: duration of the last command ]################### - # Execution time color. - typeset -g POWERLEVEL9K_COMMAND_EXECUTION_TIME_FOREGROUND=0 - typeset -g POWERLEVEL9K_COMMAND_EXECUTION_TIME_BACKGROUND=3 - # Show duration of the last command if takes at least this many seconds. - typeset -g POWERLEVEL9K_COMMAND_EXECUTION_TIME_THRESHOLD=3 - # Show this many fractional digits. Zero means round to seconds. - typeset -g POWERLEVEL9K_COMMAND_EXECUTION_TIME_PRECISION=0 - # Duration format: 1d 2h 3m 4s. - typeset -g POWERLEVEL9K_COMMAND_EXECUTION_TIME_FORMAT='d h m s' - # Custom icon. - typeset -g POWERLEVEL9K_COMMAND_EXECUTION_TIME_VISUAL_IDENTIFIER_EXPANSION= - # Custom prefix. - # typeset -g POWERLEVEL9K_COMMAND_EXECUTION_TIME_PREFIX='took ' - - #######################[ background_jobs: presence of background jobs ]####################### - # Background jobs color. - typeset -g POWERLEVEL9K_BACKGROUND_JOBS_FOREGROUND=6 - typeset -g POWERLEVEL9K_BACKGROUND_JOBS_BACKGROUND=0 - # Don't show the number of background jobs. - typeset -g POWERLEVEL9K_BACKGROUND_JOBS_VERBOSE=false - # Custom icon. - typeset -g POWERLEVEL9K_BACKGROUND_JOBS_VISUAL_IDENTIFIER_EXPANSION='≡' - - #######################[ direnv: direnv status (https://direnv.net/) ]######################## - # Direnv color. - typeset -g POWERLEVEL9K_DIRENV_FOREGROUND=3 - typeset -g POWERLEVEL9K_DIRENV_BACKGROUND=0 - # Custom icon. - # typeset -g POWERLEVEL9K_DIRENV_VISUAL_IDENTIFIER_EXPANSION='⭐' - - ###############[ asdf: asdf version manager (https://github.com/asdf-vm/asdf) ]############### - # Default asdf color. Only used to display tools for which there is no color override (see below). - # Tip: Override these parameters for ${TOOL} with POWERLEVEL9K_ASDF_${TOOL}_FOREGROUND and - # POWERLEVEL9K_ASDF_${TOOL}_BACKGROUND. - typeset -g POWERLEVEL9K_ASDF_FOREGROUND=0 - typeset -g POWERLEVEL9K_ASDF_BACKGROUND=7 - - # There are four parameters that can be used to hide asdf tools. Each parameter describes - # conditions under which a tool gets hidden. Parameters can hide tools but not unhide them. If at - # least one parameter decides to hide a tool, that tool gets hidden. If no parameter decides to - # hide a tool, it gets shown. - # - # Special note on the difference between POWERLEVEL9K_ASDF_SOURCES and - # POWERLEVEL9K_ASDF_PROMPT_ALWAYS_SHOW. Consider the effect of the following commands: - # - # asdf local python 3.8.1 - # asdf global python 3.8.1 - # - # After running both commands the current python version is 3.8.1 and its source is "local" as - # it takes precedence over "global". If POWERLEVEL9K_ASDF_PROMPT_ALWAYS_SHOW is set to false, - # it'll hide python version in this case because 3.8.1 is the same as the global version. - # POWERLEVEL9K_ASDF_SOURCES will hide python version only if the value of this parameter doesn't - # contain "local". - - # Hide tool versions that don't come from one of these sources. - # - # Available sources: - # - # - shell `asdf current` says "set by ASDF_${TOOL}_VERSION environment variable" - # - local `asdf current` says "set by /some/not/home/directory/file" - # - global `asdf current` says "set by /home/username/file" - # - # Note: If this parameter is set to (shell local global), it won't hide tools. - # Tip: Override this parameter for ${TOOL} with POWERLEVEL9K_ASDF_${TOOL}_SOURCES. - typeset -g POWERLEVEL9K_ASDF_SOURCES=(shell local global) - - # If set to false, hide tool versions that are the same as global. - # - # Note: The name of this parameter doesn't reflect its meaning at all. - # Note: If this parameter is set to true, it won't hide tools. - # Tip: Override this parameter for ${TOOL} with POWERLEVEL9K_ASDF_${TOOL}_PROMPT_ALWAYS_SHOW. - typeset -g POWERLEVEL9K_ASDF_PROMPT_ALWAYS_SHOW=false - - # If set to false, hide tool versions that are equal to "system". - # - # Note: If this parameter is set to true, it won't hide tools. - # Tip: Override this parameter for ${TOOL} with POWERLEVEL9K_ASDF_${TOOL}_SHOW_SYSTEM. - typeset -g POWERLEVEL9K_ASDF_SHOW_SYSTEM=true - - # If set to non-empty value, hide tools unless there is a file matching the specified file pattern - # in the current directory, or its parent directory, or its grandparent directory, and so on. - # - # Note: If this parameter is set to empty value, it won't hide tools. - # Note: SHOW_ON_UPGLOB isn't specific to asdf. It works with all prompt segments. - # Tip: Override this parameter for ${TOOL} with POWERLEVEL9K_ASDF_${TOOL}_SHOW_ON_UPGLOB. - # - # Example: Hide nodejs version when there is no package.json and no *.js files in the current - # directory, in `..`, in `../..` and so on. - # - # typeset -g POWERLEVEL9K_ASDF_NODEJS_SHOW_ON_UPGLOB='*.js|package.json' - typeset -g POWERLEVEL9K_ASDF_SHOW_ON_UPGLOB= - - # Ruby version from asdf. - typeset -g POWERLEVEL9K_ASDF_RUBY_FOREGROUND=0 - typeset -g POWERLEVEL9K_ASDF_RUBY_BACKGROUND=1 - # typeset -g POWERLEVEL9K_ASDF_RUBY_VISUAL_IDENTIFIER_EXPANSION='⭐' - # typeset -g POWERLEVEL9K_ASDF_RUBY_SHOW_ON_UPGLOB='*.foo|*.bar' - - # Python version from asdf. - typeset -g POWERLEVEL9K_ASDF_PYTHON_FOREGROUND=0 - typeset -g POWERLEVEL9K_ASDF_PYTHON_BACKGROUND=4 - # typeset -g POWERLEVEL9K_ASDF_PYTHON_VISUAL_IDENTIFIER_EXPANSION='⭐' - # typeset -g POWERLEVEL9K_ASDF_PYTHON_SHOW_ON_UPGLOB='*.foo|*.bar' - - # Go version from asdf. - typeset -g POWERLEVEL9K_ASDF_GOLANG_FOREGROUND=0 - typeset -g POWERLEVEL9K_ASDF_GOLANG_BACKGROUND=4 - # typeset -g POWERLEVEL9K_ASDF_GOLANG_VISUAL_IDENTIFIER_EXPANSION='⭐' - # typeset -g POWERLEVEL9K_ASDF_GOLANG_SHOW_ON_UPGLOB='*.foo|*.bar' - - # Node.js version from asdf. - typeset -g POWERLEVEL9K_ASDF_NODEJS_FOREGROUND=0 - typeset -g POWERLEVEL9K_ASDF_NODEJS_BACKGROUND=2 - # typeset -g POWERLEVEL9K_ASDF_NODEJS_VISUAL_IDENTIFIER_EXPANSION='⭐' - # typeset -g POWERLEVEL9K_ASDF_NODEJS_SHOW_ON_UPGLOB='*.foo|*.bar' - - # Rust version from asdf. - typeset -g POWERLEVEL9K_ASDF_RUST_FOREGROUND=0 - typeset -g POWERLEVEL9K_ASDF_RUST_BACKGROUND=208 - # typeset -g POWERLEVEL9K_ASDF_RUST_VISUAL_IDENTIFIER_EXPANSION='⭐' - # typeset -g POWERLEVEL9K_ASDF_RUST_SHOW_ON_UPGLOB='*.foo|*.bar' - - # .NET Core version from asdf. - typeset -g POWERLEVEL9K_ASDF_DOTNET_CORE_FOREGROUND=0 - typeset -g POWERLEVEL9K_ASDF_DOTNET_CORE_BACKGROUND=5 - # typeset -g POWERLEVEL9K_ASDF_DOTNET_CORE_VISUAL_IDENTIFIER_EXPANSION='⭐' - # typeset -g POWERLEVEL9K_ASDF_DOTNET_CORE_SHOW_ON_UPGLOB='*.foo|*.bar' - - # Flutter version from asdf. - typeset -g POWERLEVEL9K_ASDF_FLUTTER_FOREGROUND=0 - typeset -g POWERLEVEL9K_ASDF_FLUTTER_BACKGROUND=4 - # typeset -g POWERLEVEL9K_ASDF_FLUTTER_VISUAL_IDENTIFIER_EXPANSION='⭐' - # typeset -g POWERLEVEL9K_ASDF_FLUTTER_SHOW_ON_UPGLOB='*.foo|*.bar' - - # Lua version from asdf. - typeset -g POWERLEVEL9K_ASDF_LUA_FOREGROUND=0 - typeset -g POWERLEVEL9K_ASDF_LUA_BACKGROUND=4 - # typeset -g POWERLEVEL9K_ASDF_LUA_VISUAL_IDENTIFIER_EXPANSION='⭐' - # typeset -g POWERLEVEL9K_ASDF_LUA_SHOW_ON_UPGLOB='*.foo|*.bar' - - # Java version from asdf. - typeset -g POWERLEVEL9K_ASDF_JAVA_FOREGROUND=1 - typeset -g POWERLEVEL9K_ASDF_JAVA_BACKGROUND=7 - # typeset -g POWERLEVEL9K_ASDF_JAVA_VISUAL_IDENTIFIER_EXPANSION='⭐' - # typeset -g POWERLEVEL9K_ASDF_JAVA_SHOW_ON_UPGLOB='*.foo|*.bar' - - # Perl version from asdf. - typeset -g POWERLEVEL9K_ASDF_PERL_FOREGROUND=0 - typeset -g POWERLEVEL9K_ASDF_PERL_BACKGROUND=4 - # typeset -g POWERLEVEL9K_ASDF_PERL_VISUAL_IDENTIFIER_EXPANSION='⭐' - # typeset -g POWERLEVEL9K_ASDF_PERL_SHOW_ON_UPGLOB='*.foo|*.bar' - - # Erlang version from asdf. - typeset -g POWERLEVEL9K_ASDF_ERLANG_FOREGROUND=0 - typeset -g POWERLEVEL9K_ASDF_ERLANG_BACKGROUND=1 - # typeset -g POWERLEVEL9K_ASDF_ERLANG_VISUAL_IDENTIFIER_EXPANSION='⭐' - # typeset -g POWERLEVEL9K_ASDF_ERLANG_SHOW_ON_UPGLOB='*.foo|*.bar' - - # Elixir version from asdf. - typeset -g POWERLEVEL9K_ASDF_ELIXIR_FOREGROUND=0 - typeset -g POWERLEVEL9K_ASDF_ELIXIR_BACKGROUND=5 - # typeset -g POWERLEVEL9K_ASDF_ELIXIR_VISUAL_IDENTIFIER_EXPANSION='⭐' - # typeset -g POWERLEVEL9K_ASDF_ELIXIR_SHOW_ON_UPGLOB='*.foo|*.bar' - - # Postgres version from asdf. - typeset -g POWERLEVEL9K_ASDF_POSTGRES_FOREGROUND=0 - typeset -g POWERLEVEL9K_ASDF_POSTGRES_BACKGROUND=6 - # typeset -g POWERLEVEL9K_ASDF_POSTGRES_VISUAL_IDENTIFIER_EXPANSION='⭐' - # typeset -g POWERLEVEL9K_ASDF_POSTGRES_SHOW_ON_UPGLOB='*.foo|*.bar' - - # PHP version from asdf. - typeset -g POWERLEVEL9K_ASDF_PHP_FOREGROUND=0 - typeset -g POWERLEVEL9K_ASDF_PHP_BACKGROUND=5 - # typeset -g POWERLEVEL9K_ASDF_PHP_VISUAL_IDENTIFIER_EXPANSION='⭐' - # typeset -g POWERLEVEL9K_ASDF_PHP_SHOW_ON_UPGLOB='*.foo|*.bar' - - # Haskell version from asdf. - typeset -g POWERLEVEL9K_ASDF_HASKELL_FOREGROUND=0 - typeset -g POWERLEVEL9K_ASDF_HASKELL_BACKGROUND=3 - # typeset -g POWERLEVEL9K_ASDF_HASKELL_VISUAL_IDENTIFIER_EXPANSION='⭐' - # typeset -g POWERLEVEL9K_ASDF_HASKELL_SHOW_ON_UPGLOB='*.foo|*.bar' - - # Julia version from asdf. - typeset -g POWERLEVEL9K_ASDF_JULIA_FOREGROUND=0 - typeset -g POWERLEVEL9K_ASDF_JULIA_BACKGROUND=2 - # typeset -g POWERLEVEL9K_ASDF_JULIA_VISUAL_IDENTIFIER_EXPANSION='⭐' - # typeset -g POWERLEVEL9K_ASDF_JULIA_SHOW_ON_UPGLOB='*.foo|*.bar' - - ##########[ nordvpn: nordvpn connection status, linux only (https://nordvpn.com/) ]########### - # NordVPN connection indicator color. - typeset -g POWERLEVEL9K_NORDVPN_FOREGROUND=7 - typeset -g POWERLEVEL9K_NORDVPN_BACKGROUND=4 - # Hide NordVPN connection indicator when not connected. - typeset -g POWERLEVEL9K_NORDVPN_{DISCONNECTED,CONNECTING,DISCONNECTING}_CONTENT_EXPANSION= - typeset -g POWERLEVEL9K_NORDVPN_{DISCONNECTED,CONNECTING,DISCONNECTING}_VISUAL_IDENTIFIER_EXPANSION= - # Custom icon. - typeset -g POWERLEVEL9K_NORDVPN_VISUAL_IDENTIFIER_EXPANSION='nord' - - #################[ ranger: ranger shell (https://github.com/ranger/ranger) ]################## - # Ranger shell color. - typeset -g POWERLEVEL9K_RANGER_FOREGROUND=3 - typeset -g POWERLEVEL9K_RANGER_BACKGROUND=0 - # Custom icon. - typeset -g POWERLEVEL9K_RANGER_VISUAL_IDENTIFIER_EXPANSION='▲' - - ####################[ yazi: yazi shell (https://github.com/sxyazi/yazi) ]##################### - # Yazi shell color. - typeset -g POWERLEVEL9K_YAZI_FOREGROUND=3 - typeset -g POWERLEVEL9K_YAZI_BACKGROUND=0 - # Custom icon. - typeset -g POWERLEVEL9K_YAZI_VISUAL_IDENTIFIER_EXPANSION='▲' - - ######################[ nnn: nnn shell (https://github.com/jarun/nnn) ]####################### - # Nnn shell color. - typeset -g POWERLEVEL9K_NNN_FOREGROUND=0 - typeset -g POWERLEVEL9K_NNN_BACKGROUND=6 - # Custom icon. - # typeset -g POWERLEVEL9K_NNN_VISUAL_IDENTIFIER_EXPANSION='⭐' - - ######################[ lf: lf shell (https://github.com/gokcehan/lf) ]####################### - # lf shell color. - typeset -g POWERLEVEL9K_LF_FOREGROUND=0 - typeset -g POWERLEVEL9K_LF_BACKGROUND=6 - # Custom icon. - # typeset -g POWERLEVEL9K_LF_VISUAL_IDENTIFIER_EXPANSION='⭐' - - ##################[ xplr: xplr shell (https://github.com/sayanarijit/xplr) ]################## - # xplr shell color. - typeset -g POWERLEVEL9K_XPLR_FOREGROUND=0 - typeset -g POWERLEVEL9K_XPLR_BACKGROUND=6 - # Custom icon. - # typeset -g POWERLEVEL9K_XPLR_VISUAL_IDENTIFIER_EXPANSION='⭐' - - ###########################[ vim_shell: vim shell indicator (:sh) ]########################### - # Vim shell indicator color. - typeset -g POWERLEVEL9K_VIM_SHELL_FOREGROUND=0 - typeset -g POWERLEVEL9K_VIM_SHELL_BACKGROUND=2 - # Custom icon. - # typeset -g POWERLEVEL9K_VIM_SHELL_VISUAL_IDENTIFIER_EXPANSION='⭐' - - ######[ midnight_commander: midnight commander shell (https://midnight-commander.org/) ]###### - # Midnight Commander shell color. - typeset -g POWERLEVEL9K_MIDNIGHT_COMMANDER_FOREGROUND=3 - typeset -g POWERLEVEL9K_MIDNIGHT_COMMANDER_BACKGROUND=0 - # Custom icon. - # typeset -g POWERLEVEL9K_MIDNIGHT_COMMANDER_VISUAL_IDENTIFIER_EXPANSION='⭐' - - #[ nix_shell: nix shell (https://nixos.org/nixos/nix-pills/developing-with-nix-shell.html) ]## - # Nix shell color. - typeset -g POWERLEVEL9K_NIX_SHELL_FOREGROUND=0 - typeset -g POWERLEVEL9K_NIX_SHELL_BACKGROUND=4 - - # Display the icon of nix_shell if PATH contains a subdirectory of /nix/store. - # typeset -g POWERLEVEL9K_NIX_SHELL_INFER_FROM_PATH=false - - # Tip: If you want to see just the icon without "pure" and "impure", uncomment the next line. - # typeset -g POWERLEVEL9K_NIX_SHELL_CONTENT_EXPANSION= - - # Custom icon. - # typeset -g POWERLEVEL9K_NIX_SHELL_VISUAL_IDENTIFIER_EXPANSION='⭐' - - ##################[ chezmoi_shell: chezmoi shell (https://www.chezmoi.io/) ]################## - # chezmoi shell color. - typeset -g POWERLEVEL9K_CHEZMOI_SHELL_FOREGROUND=0 - typeset -g POWERLEVEL9K_CHEZMOI_SHELL_BACKGROUND=4 - # Custom icon. - # typeset -g POWERLEVEL9K_CHEZMOI_SHELL_VISUAL_IDENTIFIER_EXPANSION='⭐' - - ##################################[ disk_usage: disk usage ]################################## - # Colors for different levels of disk usage. - typeset -g POWERLEVEL9K_DISK_USAGE_NORMAL_FOREGROUND=3 - typeset -g POWERLEVEL9K_DISK_USAGE_NORMAL_BACKGROUND=0 - typeset -g POWERLEVEL9K_DISK_USAGE_WARNING_FOREGROUND=0 - typeset -g POWERLEVEL9K_DISK_USAGE_WARNING_BACKGROUND=3 - typeset -g POWERLEVEL9K_DISK_USAGE_CRITICAL_FOREGROUND=7 - typeset -g POWERLEVEL9K_DISK_USAGE_CRITICAL_BACKGROUND=1 - # Thresholds for different levels of disk usage (percentage points). - typeset -g POWERLEVEL9K_DISK_USAGE_WARNING_LEVEL=90 - typeset -g POWERLEVEL9K_DISK_USAGE_CRITICAL_LEVEL=95 - # If set to true, hide disk usage when below $POWERLEVEL9K_DISK_USAGE_WARNING_LEVEL percent. - typeset -g POWERLEVEL9K_DISK_USAGE_ONLY_WARNING=false - # Custom icon. - # typeset -g POWERLEVEL9K_DISK_USAGE_VISUAL_IDENTIFIER_EXPANSION='⭐' - - ###########[ vi_mode: vi mode (you don't need this if you've enabled prompt_char) ]########### - # Foreground color. - typeset -g POWERLEVEL9K_VI_MODE_FOREGROUND=0 - # Text and color for normal (a.k.a. command) vi mode. - typeset -g POWERLEVEL9K_VI_COMMAND_MODE_STRING=NORMAL - typeset -g POWERLEVEL9K_VI_MODE_NORMAL_BACKGROUND=2 - # Text and color for visual vi mode. - typeset -g POWERLEVEL9K_VI_VISUAL_MODE_STRING=VISUAL - typeset -g POWERLEVEL9K_VI_MODE_VISUAL_BACKGROUND=4 - # Text and color for overtype (a.k.a. overwrite and replace) vi mode. - typeset -g POWERLEVEL9K_VI_OVERWRITE_MODE_STRING=OVERTYPE - typeset -g POWERLEVEL9K_VI_MODE_OVERWRITE_BACKGROUND=3 - # Text and color for insert vi mode. - typeset -g POWERLEVEL9K_VI_INSERT_MODE_STRING= - typeset -g POWERLEVEL9K_VI_MODE_INSERT_FOREGROUND=8 - # Custom icon. - # typeset -g POWERLEVEL9K_VI_MODE_VISUAL_IDENTIFIER_EXPANSION='⭐' - - ######################################[ ram: free RAM ]####################################### - # RAM color. - typeset -g POWERLEVEL9K_RAM_FOREGROUND=0 - typeset -g POWERLEVEL9K_RAM_BACKGROUND=3 - # Custom icon. - # typeset -g POWERLEVEL9K_RAM_VISUAL_IDENTIFIER_EXPANSION='⭐' - - #####################################[ swap: used swap ]###################################### - # Swap color. - typeset -g POWERLEVEL9K_SWAP_FOREGROUND=0 - typeset -g POWERLEVEL9K_SWAP_BACKGROUND=3 - # Custom icon. - # typeset -g POWERLEVEL9K_SWAP_VISUAL_IDENTIFIER_EXPANSION='⭐' - - ######################################[ load: CPU load ]###################################### - # Show average CPU load over this many last minutes. Valid values are 1, 5 and 15. - typeset -g POWERLEVEL9K_LOAD_WHICH=5 - # Load color when load is under 50%. - typeset -g POWERLEVEL9K_LOAD_NORMAL_FOREGROUND=0 - typeset -g POWERLEVEL9K_LOAD_NORMAL_BACKGROUND=2 - # Load color when load is between 50% and 70%. - typeset -g POWERLEVEL9K_LOAD_WARNING_FOREGROUND=0 - typeset -g POWERLEVEL9K_LOAD_WARNING_BACKGROUND=3 - # Load color when load is over 70%. - typeset -g POWERLEVEL9K_LOAD_CRITICAL_FOREGROUND=0 - typeset -g POWERLEVEL9K_LOAD_CRITICAL_BACKGROUND=1 - # Custom icon. - # typeset -g POWERLEVEL9K_LOAD_VISUAL_IDENTIFIER_EXPANSION='⭐' - - ################[ todo: todo items (https://github.com/todotxt/todo.txt-cli) ]################ - # Todo color. - typeset -g POWERLEVEL9K_TODO_FOREGROUND=0 - typeset -g POWERLEVEL9K_TODO_BACKGROUND=8 - # Hide todo when the total number of tasks is zero. - typeset -g POWERLEVEL9K_TODO_HIDE_ZERO_TOTAL=true - # Hide todo when the number of tasks after filtering is zero. - typeset -g POWERLEVEL9K_TODO_HIDE_ZERO_FILTERED=false - - # Todo format. The following parameters are available within the expansion. - # - # - P9K_TODO_TOTAL_TASK_COUNT The total number of tasks. - # - P9K_TODO_FILTERED_TASK_COUNT The number of tasks after filtering. - # - # These variables correspond to the last line of the output of `todo.sh -p ls`: - # - # TODO: 24 of 42 tasks shown - # - # Here 24 is P9K_TODO_FILTERED_TASK_COUNT and 42 is P9K_TODO_TOTAL_TASK_COUNT. - # - # typeset -g POWERLEVEL9K_TODO_CONTENT_EXPANSION='$P9K_TODO_FILTERED_TASK_COUNT' - - # Custom icon. - # typeset -g POWERLEVEL9K_TODO_VISUAL_IDENTIFIER_EXPANSION='⭐' - - ###########[ timewarrior: timewarrior tracking status (https://timewarrior.net/) ]############ - # Timewarrior color. - typeset -g POWERLEVEL9K_TIMEWARRIOR_FOREGROUND=255 - typeset -g POWERLEVEL9K_TIMEWARRIOR_BACKGROUND=8 - - # If the tracked task is longer than 24 characters, truncate and append "…". - # Tip: To always display tasks without truncation, delete the following parameter. - # Tip: To hide task names and display just the icon when time tracking is enabled, set the - # value of the following parameter to "". - typeset -g POWERLEVEL9K_TIMEWARRIOR_CONTENT_EXPANSION='${P9K_CONTENT:0:24}${${P9K_CONTENT:24}:+…}' - - # Custom icon. - # typeset -g POWERLEVEL9K_TIMEWARRIOR_VISUAL_IDENTIFIER_EXPANSION='⭐' - - ##############[ taskwarrior: taskwarrior task count (https://taskwarrior.org/) ]############## - # Taskwarrior color. - typeset -g POWERLEVEL9K_TASKWARRIOR_FOREGROUND=0 - typeset -g POWERLEVEL9K_TASKWARRIOR_BACKGROUND=6 - - # Taskwarrior segment format. The following parameters are available within the expansion. - # - # - P9K_TASKWARRIOR_PENDING_COUNT The number of pending tasks: `task +PENDING count`. - # - P9K_TASKWARRIOR_OVERDUE_COUNT The number of overdue tasks: `task +OVERDUE count`. - # - # Zero values are represented as empty parameters. - # - # The default format: - # - # '${P9K_TASKWARRIOR_OVERDUE_COUNT:+"!$P9K_TASKWARRIOR_OVERDUE_COUNT/"}$P9K_TASKWARRIOR_PENDING_COUNT' - # - # typeset -g POWERLEVEL9K_TASKWARRIOR_CONTENT_EXPANSION='$P9K_TASKWARRIOR_PENDING_COUNT' - - # Custom icon. - # typeset -g POWERLEVEL9K_TASKWARRIOR_VISUAL_IDENTIFIER_EXPANSION='⭐' - - ######[ per_directory_history: Oh My Zsh per-directory-history local/global indicator ]####### - # Color when using local/global history. - typeset -g POWERLEVEL9K_PER_DIRECTORY_HISTORY_LOCAL_FOREGROUND=0 - typeset -g POWERLEVEL9K_PER_DIRECTORY_HISTORY_LOCAL_BACKGROUND=5 - typeset -g POWERLEVEL9K_PER_DIRECTORY_HISTORY_GLOBAL_FOREGROUND=0 - typeset -g POWERLEVEL9K_PER_DIRECTORY_HISTORY_GLOBAL_BACKGROUND=3 - - # Tip: Uncomment the next two lines to hide "local"/"global" text and leave just the icon. - # typeset -g POWERLEVEL9K_PER_DIRECTORY_HISTORY_LOCAL_CONTENT_EXPANSION='' - # typeset -g POWERLEVEL9K_PER_DIRECTORY_HISTORY_GLOBAL_CONTENT_EXPANSION='' - - # Custom icon. - # typeset -g POWERLEVEL9K_PER_DIRECTORY_HISTORY_LOCAL_VISUAL_IDENTIFIER_EXPANSION='⭐' - # typeset -g POWERLEVEL9K_PER_DIRECTORY_HISTORY_GLOBAL_VISUAL_IDENTIFIER_EXPANSION='⭐' - - ################################[ cpu_arch: CPU architecture ]################################ - # CPU architecture color. - typeset -g POWERLEVEL9K_CPU_ARCH_FOREGROUND=0 - typeset -g POWERLEVEL9K_CPU_ARCH_BACKGROUND=3 - - # Hide the segment when on a specific CPU architecture. - # typeset -g POWERLEVEL9K_CPU_ARCH_X86_64_CONTENT_EXPANSION= - # typeset -g POWERLEVEL9K_CPU_ARCH_X86_64_VISUAL_IDENTIFIER_EXPANSION= - - # Custom icon. - # typeset -g POWERLEVEL9K_CPU_ARCH_VISUAL_IDENTIFIER_EXPANSION='⭐' - - ##################################[ context: user@hostname ]################################## - # Context color when running with privileges. - typeset -g POWERLEVEL9K_CONTEXT_ROOT_FOREGROUND=1 - typeset -g POWERLEVEL9K_CONTEXT_ROOT_BACKGROUND=0 - # Context color in SSH without privileges. - typeset -g POWERLEVEL9K_CONTEXT_{REMOTE,REMOTE_SUDO}_FOREGROUND=3 - typeset -g POWERLEVEL9K_CONTEXT_{REMOTE,REMOTE_SUDO}_BACKGROUND=0 - # Default context color (no privileges, no SSH). - typeset -g POWERLEVEL9K_CONTEXT_FOREGROUND=3 - typeset -g POWERLEVEL9K_CONTEXT_BACKGROUND=0 - - # Context format when running with privileges: user@hostname. - typeset -g POWERLEVEL9K_CONTEXT_ROOT_TEMPLATE='%n@%m' - # Context format when in SSH without privileges: user@hostname. - typeset -g POWERLEVEL9K_CONTEXT_{REMOTE,REMOTE_SUDO}_TEMPLATE='%n@%m' - # Default context format (no privileges, no SSH): user@hostname. - typeset -g POWERLEVEL9K_CONTEXT_TEMPLATE='%n@%m' - - # Don't show context unless running with privileges or in SSH. - # Tip: Remove the next line to always show context. - typeset -g POWERLEVEL9K_CONTEXT_{DEFAULT,SUDO}_{CONTENT,VISUAL_IDENTIFIER}_EXPANSION= - - # Custom icon. - # typeset -g POWERLEVEL9K_CONTEXT_VISUAL_IDENTIFIER_EXPANSION='⭐' - # Custom prefix. - # typeset -g POWERLEVEL9K_CONTEXT_PREFIX='with ' - - ###[ virtualenv: python virtual environment (https://docs.python.org/3/library/venv.html) ]### - # Python virtual environment color. - typeset -g POWERLEVEL9K_VIRTUALENV_FOREGROUND=0 - typeset -g POWERLEVEL9K_VIRTUALENV_BACKGROUND=4 - # Don't show Python version next to the virtual environment name. - typeset -g POWERLEVEL9K_VIRTUALENV_SHOW_PYTHON_VERSION=false - # If set to "false", won't show virtualenv if pyenv is already shown. - # If set to "if-different", won't show virtualenv if it's the same as pyenv. - typeset -g POWERLEVEL9K_VIRTUALENV_SHOW_WITH_PYENV=false - # Separate environment name from Python version only with a space. - typeset -g POWERLEVEL9K_VIRTUALENV_{LEFT,RIGHT}_DELIMITER= - # Custom icon. - # typeset -g POWERLEVEL9K_VIRTUALENV_VISUAL_IDENTIFIER_EXPANSION='⭐' - - #####################[ anaconda: conda environment (https://conda.io/) ]###################### - # Anaconda environment color. - typeset -g POWERLEVEL9K_ANACONDA_FOREGROUND=0 - typeset -g POWERLEVEL9K_ANACONDA_BACKGROUND=4 - - # Anaconda segment format. The following parameters are available within the expansion. - # - # - CONDA_PREFIX Absolute path to the active Anaconda/Miniconda environment. - # - CONDA_DEFAULT_ENV Name of the active Anaconda/Miniconda environment. - # - CONDA_PROMPT_MODIFIER Configurable prompt modifier (see below). - # - P9K_ANACONDA_PYTHON_VERSION Current python version (python --version). - # - # CONDA_PROMPT_MODIFIER can be configured with the following command: - # - # conda config --set env_prompt '({default_env}) ' - # - # The last argument is a Python format string that can use the following variables: - # - # - prefix The same as CONDA_PREFIX. - # - default_env The same as CONDA_DEFAULT_ENV. - # - name The last segment of CONDA_PREFIX. - # - stacked_env Comma-separated list of names in the environment stack. The first element is - # always the same as default_env. - # - # Note: '({default_env}) ' is the default value of env_prompt. - # - # The default value of POWERLEVEL9K_ANACONDA_CONTENT_EXPANSION expands to $CONDA_PROMPT_MODIFIER - # without the surrounding parentheses, or to the last path component of CONDA_PREFIX if the former - # is empty. - typeset -g POWERLEVEL9K_ANACONDA_CONTENT_EXPANSION='${${${${CONDA_PROMPT_MODIFIER#\(}% }%\)}:-${CONDA_PREFIX:t}}' - - # Custom icon. - # typeset -g POWERLEVEL9K_ANACONDA_VISUAL_IDENTIFIER_EXPANSION='⭐' - - ################[ pyenv: python environment (https://github.com/pyenv/pyenv) ]################ - # Pyenv color. - typeset -g POWERLEVEL9K_PYENV_FOREGROUND=0 - typeset -g POWERLEVEL9K_PYENV_BACKGROUND=4 - # Hide python version if it doesn't come from one of these sources. - typeset -g POWERLEVEL9K_PYENV_SOURCES=(shell local global) - # If set to false, hide python version if it's the same as global: - # $(pyenv version-name) == $(pyenv global). - typeset -g POWERLEVEL9K_PYENV_PROMPT_ALWAYS_SHOW=false - # If set to false, hide python version if it's equal to "system". - typeset -g POWERLEVEL9K_PYENV_SHOW_SYSTEM=true - - # Pyenv segment format. The following parameters are available within the expansion. - # - # - P9K_CONTENT Current pyenv environment (pyenv version-name). - # - P9K_PYENV_PYTHON_VERSION Current python version (python --version). - # - # The default format has the following logic: - # - # 1. Display just "$P9K_CONTENT" if it's equal to "$P9K_PYENV_PYTHON_VERSION" or - # starts with "$P9K_PYENV_PYTHON_VERSION/". - # 2. Otherwise display "$P9K_CONTENT $P9K_PYENV_PYTHON_VERSION". - typeset -g POWERLEVEL9K_PYENV_CONTENT_EXPANSION='${P9K_CONTENT}${${P9K_CONTENT:#$P9K_PYENV_PYTHON_VERSION(|/*)}:+ $P9K_PYENV_PYTHON_VERSION}' - - # Custom icon. - # typeset -g POWERLEVEL9K_PYENV_VISUAL_IDENTIFIER_EXPANSION='⭐' - - ################[ goenv: go environment (https://github.com/syndbg/goenv) ]################ - # Goenv color. - typeset -g POWERLEVEL9K_GOENV_FOREGROUND=0 - typeset -g POWERLEVEL9K_GOENV_BACKGROUND=4 - # Hide go version if it doesn't come from one of these sources. - typeset -g POWERLEVEL9K_GOENV_SOURCES=(shell local global) - # If set to false, hide go version if it's the same as global: - # $(goenv version-name) == $(goenv global). - typeset -g POWERLEVEL9K_GOENV_PROMPT_ALWAYS_SHOW=false - # If set to false, hide go version if it's equal to "system". - typeset -g POWERLEVEL9K_GOENV_SHOW_SYSTEM=true - # Custom icon. - # typeset -g POWERLEVEL9K_GOENV_VISUAL_IDENTIFIER_EXPANSION='⭐' - - ##########[ nodenv: node.js version from nodenv (https://github.com/nodenv/nodenv) ]########## - # Nodenv color. - typeset -g POWERLEVEL9K_NODENV_FOREGROUND=2 - typeset -g POWERLEVEL9K_NODENV_BACKGROUND=0 - # Hide node version if it doesn't come from one of these sources. - typeset -g POWERLEVEL9K_NODENV_SOURCES=(shell local global) - # If set to false, hide node version if it's the same as global: - # $(nodenv version-name) == $(nodenv global). - typeset -g POWERLEVEL9K_NODENV_PROMPT_ALWAYS_SHOW=false - # If set to false, hide node version if it's equal to "system". - typeset -g POWERLEVEL9K_NODENV_SHOW_SYSTEM=true - # Custom icon. - # typeset -g POWERLEVEL9K_NODENV_VISUAL_IDENTIFIER_EXPANSION='⭐' - - ##############[ nvm: node.js version from nvm (https://github.com/nvm-sh/nvm) ]############### - # Nvm color. - typeset -g POWERLEVEL9K_NVM_FOREGROUND=0 - typeset -g POWERLEVEL9K_NVM_BACKGROUND=5 - # If set to false, hide node version if it's the same as default: - # $(nvm version current) == $(nvm version default). - typeset -g POWERLEVEL9K_NVM_PROMPT_ALWAYS_SHOW=false - # If set to false, hide node version if it's equal to "system". - typeset -g POWERLEVEL9K_NVM_SHOW_SYSTEM=true - # Custom icon. - # typeset -g POWERLEVEL9K_NVM_VISUAL_IDENTIFIER_EXPANSION='⭐' - - ############[ nodeenv: node.js environment (https://github.com/ekalinin/nodeenv) ]############ - # Nodeenv color. - typeset -g POWERLEVEL9K_NODEENV_FOREGROUND=2 - typeset -g POWERLEVEL9K_NODEENV_BACKGROUND=0 - # Don't show Node version next to the environment name. - typeset -g POWERLEVEL9K_NODEENV_SHOW_NODE_VERSION=false - # Separate environment name from Node version only with a space. - typeset -g POWERLEVEL9K_NODEENV_{LEFT,RIGHT}_DELIMITER= - # Custom icon. - # typeset -g POWERLEVEL9K_NODEENV_VISUAL_IDENTIFIER_EXPANSION='⭐' - - ##############################[ node_version: node.js version ]############################### - # Node version color. - typeset -g POWERLEVEL9K_NODE_VERSION_FOREGROUND=7 - typeset -g POWERLEVEL9K_NODE_VERSION_BACKGROUND=2 - # Show node version only when in a directory tree containing package.json. - typeset -g POWERLEVEL9K_NODE_VERSION_PROJECT_ONLY=true - # Custom icon. - # typeset -g POWERLEVEL9K_NODE_VERSION_VISUAL_IDENTIFIER_EXPANSION='⭐' - - #######################[ go_version: go version (https://golang.org) ]######################## - # Go version color. - typeset -g POWERLEVEL9K_GO_VERSION_FOREGROUND=255 - typeset -g POWERLEVEL9K_GO_VERSION_BACKGROUND=2 - # Show go version only when in a go project subdirectory. - typeset -g POWERLEVEL9K_GO_VERSION_PROJECT_ONLY=true - # Custom icon. - # typeset -g POWERLEVEL9K_GO_VERSION_VISUAL_IDENTIFIER_EXPANSION='⭐' - - #################[ rust_version: rustc version (https://www.rust-lang.org) ]################## - # Rust version color. - typeset -g POWERLEVEL9K_RUST_VERSION_FOREGROUND=0 - typeset -g POWERLEVEL9K_RUST_VERSION_BACKGROUND=208 - # Show rust version only when in a rust project subdirectory. - typeset -g POWERLEVEL9K_RUST_VERSION_PROJECT_ONLY=true - # Custom icon. - # typeset -g POWERLEVEL9K_RUST_VERSION_VISUAL_IDENTIFIER_EXPANSION='⭐' - - ###############[ dotnet_version: .NET version (https://dotnet.microsoft.com) ]################ - # .NET version color. - typeset -g POWERLEVEL9K_DOTNET_VERSION_FOREGROUND=7 - typeset -g POWERLEVEL9K_DOTNET_VERSION_BACKGROUND=5 - # Show .NET version only when in a .NET project subdirectory. - typeset -g POWERLEVEL9K_DOTNET_VERSION_PROJECT_ONLY=true - # Custom icon. - # typeset -g POWERLEVEL9K_DOTNET_VERSION_VISUAL_IDENTIFIER_EXPANSION='⭐' - - #####################[ php_version: php version (https://www.php.net/) ]###################### - # PHP version color. - typeset -g POWERLEVEL9K_PHP_VERSION_FOREGROUND=0 - typeset -g POWERLEVEL9K_PHP_VERSION_BACKGROUND=5 - # Show PHP version only when in a PHP project subdirectory. - typeset -g POWERLEVEL9K_PHP_VERSION_PROJECT_ONLY=true - # Custom icon. - # typeset -g POWERLEVEL9K_PHP_VERSION_VISUAL_IDENTIFIER_EXPANSION='⭐' - - ##########[ laravel_version: laravel php framework version (https://laravel.com/) ]########### - # Laravel version color. - typeset -g POWERLEVEL9K_LARAVEL_VERSION_FOREGROUND=1 - typeset -g POWERLEVEL9K_LARAVEL_VERSION_BACKGROUND=7 - # Custom icon. - # typeset -g POWERLEVEL9K_LARAVEL_VERSION_VISUAL_IDENTIFIER_EXPANSION='⭐' - - #############[ rbenv: ruby version from rbenv (https://github.com/rbenv/rbenv) ]############## - # Rbenv color. - typeset -g POWERLEVEL9K_RBENV_FOREGROUND=0 - typeset -g POWERLEVEL9K_RBENV_BACKGROUND=1 - # Hide ruby version if it doesn't come from one of these sources. - typeset -g POWERLEVEL9K_RBENV_SOURCES=(shell local global) - # If set to false, hide ruby version if it's the same as global: - # $(rbenv version-name) == $(rbenv global). - typeset -g POWERLEVEL9K_RBENV_PROMPT_ALWAYS_SHOW=false - # If set to false, hide ruby version if it's equal to "system". - typeset -g POWERLEVEL9K_RBENV_SHOW_SYSTEM=true - # Custom icon. - # typeset -g POWERLEVEL9K_RBENV_VISUAL_IDENTIFIER_EXPANSION='⭐' - - ####################[ java_version: java version (https://www.java.com/) ]#################### - # Java version color. - typeset -g POWERLEVEL9K_JAVA_VERSION_FOREGROUND=1 - typeset -g POWERLEVEL9K_JAVA_VERSION_BACKGROUND=7 - # Show java version only when in a java project subdirectory. - typeset -g POWERLEVEL9K_JAVA_VERSION_PROJECT_ONLY=true - # Show brief version. - typeset -g POWERLEVEL9K_JAVA_VERSION_FULL=false - # Custom icon. - # typeset -g POWERLEVEL9K_JAVA_VERSION_VISUAL_IDENTIFIER_EXPANSION='⭐' - - ###[ package: name@version from package.json (https://docs.npmjs.com/files/package.json) ]#### - # Package color. - typeset -g POWERLEVEL9K_PACKAGE_FOREGROUND=0 - typeset -g POWERLEVEL9K_PACKAGE_BACKGROUND=6 - - # Package format. The following parameters are available within the expansion. - # - # - P9K_PACKAGE_NAME The value of `name` field in package.json. - # - P9K_PACKAGE_VERSION The value of `version` field in package.json. - # - # typeset -g POWERLEVEL9K_PACKAGE_CONTENT_EXPANSION='${P9K_PACKAGE_NAME//\%/%%}@${P9K_PACKAGE_VERSION//\%/%%}' - - # Custom icon. - # typeset -g POWERLEVEL9K_PACKAGE_VISUAL_IDENTIFIER_EXPANSION='⭐' - - #######################[ rvm: ruby version from rvm (https://rvm.io) ]######################## - # Rvm color. - typeset -g POWERLEVEL9K_RVM_FOREGROUND=0 - typeset -g POWERLEVEL9K_RVM_BACKGROUND=240 - # Don't show @gemset at the end. - typeset -g POWERLEVEL9K_RVM_SHOW_GEMSET=false - # Don't show ruby- at the front. - typeset -g POWERLEVEL9K_RVM_SHOW_PREFIX=false - # Custom icon. - # typeset -g POWERLEVEL9K_RVM_VISUAL_IDENTIFIER_EXPANSION='⭐' - - ###########[ fvm: flutter version management (https://github.com/leoafarias/fvm) ]############ - # Fvm color. - typeset -g POWERLEVEL9K_FVM_FOREGROUND=0 - typeset -g POWERLEVEL9K_FVM_BACKGROUND=4 - # Custom icon. - # typeset -g POWERLEVEL9K_FVM_VISUAL_IDENTIFIER_EXPANSION='⭐' - - ##########[ luaenv: lua version from luaenv (https://github.com/cehoffman/luaenv) ]########### - # Lua color. - typeset -g POWERLEVEL9K_LUAENV_FOREGROUND=0 - typeset -g POWERLEVEL9K_LUAENV_BACKGROUND=4 - # Hide lua version if it doesn't come from one of these sources. - typeset -g POWERLEVEL9K_LUAENV_SOURCES=(shell local global) - # If set to false, hide lua version if it's the same as global: - # $(luaenv version-name) == $(luaenv global). - typeset -g POWERLEVEL9K_LUAENV_PROMPT_ALWAYS_SHOW=false - # If set to false, hide lua version if it's equal to "system". - typeset -g POWERLEVEL9K_LUAENV_SHOW_SYSTEM=true - # Custom icon. - # typeset -g POWERLEVEL9K_LUAENV_VISUAL_IDENTIFIER_EXPANSION='⭐' - - ###############[ jenv: java version from jenv (https://github.com/jenv/jenv) ]################ - # Java color. - typeset -g POWERLEVEL9K_JENV_FOREGROUND=1 - typeset -g POWERLEVEL9K_JENV_BACKGROUND=7 - # Hide java version if it doesn't come from one of these sources. - typeset -g POWERLEVEL9K_JENV_SOURCES=(shell local global) - # If set to false, hide java version if it's the same as global: - # $(jenv version-name) == $(jenv global). - typeset -g POWERLEVEL9K_JENV_PROMPT_ALWAYS_SHOW=false - # If set to false, hide java version if it's equal to "system". - typeset -g POWERLEVEL9K_JENV_SHOW_SYSTEM=true - # Custom icon. - # typeset -g POWERLEVEL9K_JENV_VISUAL_IDENTIFIER_EXPANSION='⭐' - - ###########[ plenv: perl version from plenv (https://github.com/tokuhirom/plenv) ]############ - # Perl color. - typeset -g POWERLEVEL9K_PLENV_FOREGROUND=0 - typeset -g POWERLEVEL9K_PLENV_BACKGROUND=4 - # Hide perl version if it doesn't come from one of these sources. - typeset -g POWERLEVEL9K_PLENV_SOURCES=(shell local global) - # If set to false, hide perl version if it's the same as global: - # $(plenv version-name) == $(plenv global). - typeset -g POWERLEVEL9K_PLENV_PROMPT_ALWAYS_SHOW=false - # If set to false, hide perl version if it's equal to "system". - typeset -g POWERLEVEL9K_PLENV_SHOW_SYSTEM=true - # Custom icon. - # typeset -g POWERLEVEL9K_PLENV_VISUAL_IDENTIFIER_EXPANSION='⭐' - - ###########[ perlbrew: perl version from perlbrew (https://github.com/gugod/App-perlbrew) ]############ - # Perlbrew color. - typeset -g POWERLEVEL9K_PERLBREW_FOREGROUND=67 - # Show perlbrew version only when in a perl project subdirectory. - typeset -g POWERLEVEL9K_PERLBREW_PROJECT_ONLY=true - # Don't show "perl-" at the front. - typeset -g POWERLEVEL9K_PERLBREW_SHOW_PREFIX=false - # Custom icon. - # typeset -g POWERLEVEL9K_PERLBREW_VISUAL_IDENTIFIER_EXPANSION='⭐' - - ############[ phpenv: php version from phpenv (https://github.com/phpenv/phpenv) ]############ - # PHP color. - typeset -g POWERLEVEL9K_PHPENV_FOREGROUND=0 - typeset -g POWERLEVEL9K_PHPENV_BACKGROUND=5 - # Hide php version if it doesn't come from one of these sources. - typeset -g POWERLEVEL9K_PHPENV_SOURCES=(shell local global) - # If set to false, hide php version if it's the same as global: - # $(phpenv version-name) == $(phpenv global). - typeset -g POWERLEVEL9K_PHPENV_PROMPT_ALWAYS_SHOW=false - # If set to false, hide PHP version if it's equal to "system". - typeset -g POWERLEVEL9K_PHPENV_SHOW_SYSTEM=true - # Custom icon. - # typeset -g POWERLEVEL9K_PHPENV_VISUAL_IDENTIFIER_EXPANSION='⭐' - - #######[ scalaenv: scala version from scalaenv (https://github.com/scalaenv/scalaenv) ]####### - # Scala color. - typeset -g POWERLEVEL9K_SCALAENV_FOREGROUND=0 - typeset -g POWERLEVEL9K_SCALAENV_BACKGROUND=1 - # Hide scala version if it doesn't come from one of these sources. - typeset -g POWERLEVEL9K_SCALAENV_SOURCES=(shell local global) - # If set to false, hide scala version if it's the same as global: - # $(scalaenv version-name) == $(scalaenv global). - typeset -g POWERLEVEL9K_SCALAENV_PROMPT_ALWAYS_SHOW=false - # If set to false, hide scala version if it's equal to "system". - typeset -g POWERLEVEL9K_SCALAENV_SHOW_SYSTEM=true - # Custom icon. - # typeset -g POWERLEVEL9K_SCALAENV_VISUAL_IDENTIFIER_EXPANSION='⭐' - - ##########[ haskell_stack: haskell version from stack (https://haskellstack.org/) ]########### - # Haskell color. - typeset -g POWERLEVEL9K_HASKELL_STACK_FOREGROUND=0 - typeset -g POWERLEVEL9K_HASKELL_STACK_BACKGROUND=3 - - # Hide haskell version if it doesn't come from one of these sources. - # - # shell: version is set by STACK_YAML - # local: version is set by stack.yaml up the directory tree - # global: version is set by the implicit global project (~/.stack/global-project/stack.yaml) - typeset -g POWERLEVEL9K_HASKELL_STACK_SOURCES=(shell local) - # If set to false, hide haskell version if it's the same as in the implicit global project. - typeset -g POWERLEVEL9K_HASKELL_STACK_ALWAYS_SHOW=true - # Custom icon. - # typeset -g POWERLEVEL9K_HASKELL_STACK_VISUAL_IDENTIFIER_EXPANSION='⭐' - - ################[ terraform: terraform workspace (https://www.terraform.io) ]################# - # Don't show terraform workspace if it's literally "default". - typeset -g POWERLEVEL9K_TERRAFORM_SHOW_DEFAULT=false - # POWERLEVEL9K_TERRAFORM_CLASSES is an array with even number of elements. The first element - # in each pair defines a pattern against which the current terraform workspace gets matched. - # More specifically, it's P9K_CONTENT prior to the application of context expansion (see below) - # that gets matched. If you unset all POWERLEVEL9K_TERRAFORM_*CONTENT_EXPANSION parameters, - # you'll see this value in your prompt. The second element of each pair in - # POWERLEVEL9K_TERRAFORM_CLASSES defines the workspace class. Patterns are tried in order. The - # first match wins. - # - # For example, given these settings: - # - # typeset -g POWERLEVEL9K_TERRAFORM_CLASSES=( - # '*prod*' PROD - # '*test*' TEST - # '*' OTHER) - # - # If your current terraform workspace is "project_test", its class is TEST because "project_test" - # doesn't match the pattern '*prod*' but does match '*test*'. - # - # You can define different colors, icons and content expansions for different classes: - # - # typeset -g POWERLEVEL9K_TERRAFORM_TEST_FOREGROUND=2 - # typeset -g POWERLEVEL9K_TERRAFORM_TEST_BACKGROUND=0 - # typeset -g POWERLEVEL9K_TERRAFORM_TEST_VISUAL_IDENTIFIER_EXPANSION='⭐' - # typeset -g POWERLEVEL9K_TERRAFORM_TEST_CONTENT_EXPANSION='> ${P9K_CONTENT} <' - typeset -g POWERLEVEL9K_TERRAFORM_CLASSES=( - # '*prod*' PROD # These values are examples that are unlikely - # '*test*' TEST # to match your needs. Customize them as needed. - '*' OTHER) - typeset -g POWERLEVEL9K_TERRAFORM_OTHER_FOREGROUND=4 - typeset -g POWERLEVEL9K_TERRAFORM_OTHER_BACKGROUND=0 - # typeset -g POWERLEVEL9K_TERRAFORM_OTHER_VISUAL_IDENTIFIER_EXPANSION='⭐' - - #############[ terraform_version: terraform version (https://www.terraform.io) ]############## - # Terraform version color. - typeset -g POWERLEVEL9K_TERRAFORM_VERSION_FOREGROUND=4 - typeset -g POWERLEVEL9K_TERRAFORM_VERSION_BACKGROUND=0 - # Custom icon. - # typeset -g POWERLEVEL9K_TERRAFORM_VERSION_VISUAL_IDENTIFIER_EXPANSION='⭐' - - ################[ terraform_version: It shows active terraform version (https://www.terraform.io) ]################# - typeset -g POWERLEVEL9K_TERRAFORM_VERSION_SHOW_ON_COMMAND='terraform|tf' - - #############[ kubecontext: current kubernetes context (https://kubernetes.io/) ]############# - # Show kubecontext only when the command you are typing invokes one of these tools. - # Tip: Remove the next line to always show kubecontext. - typeset -g POWERLEVEL9K_KUBECONTEXT_SHOW_ON_COMMAND='kubectl|helm|kubens|kubectx|oc|istioctl|kogito|k9s|helmfile|flux|fluxctl|stern|kubeseal|skaffold|kubent|kubecolor|cmctl|sparkctl' - - # Kubernetes context classes for the purpose of using different colors, icons and expansions with - # different contexts. - # - # POWERLEVEL9K_KUBECONTEXT_CLASSES is an array with even number of elements. The first element - # in each pair defines a pattern against which the current kubernetes context gets matched. - # More specifically, it's P9K_CONTENT prior to the application of context expansion (see below) - # that gets matched. If you unset all POWERLEVEL9K_KUBECONTEXT_*CONTENT_EXPANSION parameters, - # you'll see this value in your prompt. The second element of each pair in - # POWERLEVEL9K_KUBECONTEXT_CLASSES defines the context class. Patterns are tried in order. The - # first match wins. - # - # For example, given these settings: - # - # typeset -g POWERLEVEL9K_KUBECONTEXT_CLASSES=( - # '*prod*' PROD - # '*test*' TEST - # '*' DEFAULT) - # - # If your current kubernetes context is "deathray-testing/default", its class is TEST - # because "deathray-testing/default" doesn't match the pattern '*prod*' but does match '*test*'. - # - # You can define different colors, icons and content expansions for different classes: - # - # typeset -g POWERLEVEL9K_KUBECONTEXT_TEST_FOREGROUND=0 - # typeset -g POWERLEVEL9K_KUBECONTEXT_TEST_BACKGROUND=2 - # typeset -g POWERLEVEL9K_KUBECONTEXT_TEST_VISUAL_IDENTIFIER_EXPANSION='⭐' - # typeset -g POWERLEVEL9K_KUBECONTEXT_TEST_CONTENT_EXPANSION='> ${P9K_CONTENT} <' - typeset -g POWERLEVEL9K_KUBECONTEXT_CLASSES=( - # '*prod*' PROD # These values are examples that are unlikely - # '*test*' TEST # to match your needs. Customize them as needed. - '*' DEFAULT) - typeset -g POWERLEVEL9K_KUBECONTEXT_DEFAULT_FOREGROUND=7 - typeset -g POWERLEVEL9K_KUBECONTEXT_DEFAULT_BACKGROUND=5 - typeset -g POWERLEVEL9K_KUBECONTEXT_DEFAULT_VISUAL_IDENTIFIER_EXPANSION='○' - - # Use POWERLEVEL9K_KUBECONTEXT_CONTENT_EXPANSION to specify the content displayed by kubecontext - # segment. Parameter expansions are very flexible and fast, too. See reference: - # http://zsh.sourceforge.net/Doc/Release/Expansion.html#Parameter-Expansion. - # - # Within the expansion the following parameters are always available: - # - # - P9K_CONTENT The content that would've been displayed if there was no content - # expansion defined. - # - P9K_KUBECONTEXT_NAME The current context's name. Corresponds to column NAME in the - # output of `kubectl config get-contexts`. - # - P9K_KUBECONTEXT_CLUSTER The current context's cluster. Corresponds to column CLUSTER in the - # output of `kubectl config get-contexts`. - # - P9K_KUBECONTEXT_NAMESPACE The current context's namespace. Corresponds to column NAMESPACE - # in the output of `kubectl config get-contexts`. If there is no - # namespace, the parameter is set to "default". - # - P9K_KUBECONTEXT_USER The current context's user. Corresponds to column AUTHINFO in the - # output of `kubectl config get-contexts`. - # - # If the context points to Google Kubernetes Engine (GKE) or Elastic Kubernetes Service (EKS), - # the following extra parameters are available: - # - # - P9K_KUBECONTEXT_CLOUD_NAME Either "gke" or "eks". - # - P9K_KUBECONTEXT_CLOUD_ACCOUNT Account/project ID. - # - P9K_KUBECONTEXT_CLOUD_ZONE Availability zone. - # - P9K_KUBECONTEXT_CLOUD_CLUSTER Cluster. - # - # P9K_KUBECONTEXT_CLOUD_* parameters are derived from P9K_KUBECONTEXT_CLUSTER. For example, - # if P9K_KUBECONTEXT_CLUSTER is "gke_my-account_us-east1-a_my-cluster-01": - # - # - P9K_KUBECONTEXT_CLOUD_NAME=gke - # - P9K_KUBECONTEXT_CLOUD_ACCOUNT=my-account - # - P9K_KUBECONTEXT_CLOUD_ZONE=us-east1-a - # - P9K_KUBECONTEXT_CLOUD_CLUSTER=my-cluster-01 - # - # If P9K_KUBECONTEXT_CLUSTER is "arn:aws:eks:us-east-1:123456789012:cluster/my-cluster-01": - # - # - P9K_KUBECONTEXT_CLOUD_NAME=eks - # - P9K_KUBECONTEXT_CLOUD_ACCOUNT=123456789012 - # - P9K_KUBECONTEXT_CLOUD_ZONE=us-east-1 - # - P9K_KUBECONTEXT_CLOUD_CLUSTER=my-cluster-01 - typeset -g POWERLEVEL9K_KUBECONTEXT_DEFAULT_CONTENT_EXPANSION= - # Show P9K_KUBECONTEXT_CLOUD_CLUSTER if it's not empty and fall back to P9K_KUBECONTEXT_NAME. - POWERLEVEL9K_KUBECONTEXT_DEFAULT_CONTENT_EXPANSION+='${P9K_KUBECONTEXT_CLOUD_CLUSTER:-${P9K_KUBECONTEXT_NAME}}' - # Append the current context's namespace if it's not "default". - POWERLEVEL9K_KUBECONTEXT_DEFAULT_CONTENT_EXPANSION+='${${:-/$P9K_KUBECONTEXT_NAMESPACE}:#/default}' - - # Custom prefix. - # typeset -g POWERLEVEL9K_KUBECONTEXT_PREFIX='at ' - - #[ aws: aws profile (https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-profiles.html) ]# - # Show aws only when the command you are typing invokes one of these tools. - # Tip: Remove the next line to always show aws. - typeset -g POWERLEVEL9K_AWS_SHOW_ON_COMMAND='aws|awless|cdk|terraform|pulumi|terragrunt' - - # POWERLEVEL9K_AWS_CLASSES is an array with even number of elements. The first element - # in each pair defines a pattern against which the current AWS profile gets matched. - # More specifically, it's P9K_CONTENT prior to the application of context expansion (see below) - # that gets matched. If you unset all POWERLEVEL9K_AWS_*CONTENT_EXPANSION parameters, - # you'll see this value in your prompt. The second element of each pair in - # POWERLEVEL9K_AWS_CLASSES defines the profile class. Patterns are tried in order. The - # first match wins. - # - # For example, given these settings: - # - # typeset -g POWERLEVEL9K_AWS_CLASSES=( - # '*prod*' PROD - # '*test*' TEST - # '*' DEFAULT) - # - # If your current AWS profile is "company_test", its class is TEST - # because "company_test" doesn't match the pattern '*prod*' but does match '*test*'. - # - # You can define different colors, icons and content expansions for different classes: - # - # typeset -g POWERLEVEL9K_AWS_TEST_FOREGROUND=28 - # typeset -g POWERLEVEL9K_AWS_TEST_VISUAL_IDENTIFIER_EXPANSION='⭐' - # typeset -g POWERLEVEL9K_AWS_TEST_CONTENT_EXPANSION='> ${P9K_CONTENT} <' - typeset -g POWERLEVEL9K_AWS_CLASSES=( - # '*prod*' PROD # These values are examples that are unlikely - # '*test*' TEST # to match your needs. Customize them as needed. - '*' DEFAULT) - typeset -g POWERLEVEL9K_AWS_DEFAULT_FOREGROUND=7 - typeset -g POWERLEVEL9K_AWS_DEFAULT_BACKGROUND=1 - # typeset -g POWERLEVEL9K_AWS_DEFAULT_VISUAL_IDENTIFIER_EXPANSION='⭐' - - # AWS segment format. The following parameters are available within the expansion. - # - # - P9K_AWS_PROFILE The name of the current AWS profile. - # - P9K_AWS_REGION The region associated with the current AWS profile. - typeset -g POWERLEVEL9K_AWS_CONTENT_EXPANSION='${P9K_AWS_PROFILE//\%/%%}${P9K_AWS_REGION:+ ${P9K_AWS_REGION//\%/%%}}' - - #[ aws_eb_env: aws elastic beanstalk environment (https://aws.amazon.com/elasticbeanstalk/) ]# - # AWS Elastic Beanstalk environment color. - typeset -g POWERLEVEL9K_AWS_EB_ENV_FOREGROUND=2 - typeset -g POWERLEVEL9K_AWS_EB_ENV_BACKGROUND=0 - # Custom icon. - typeset -g POWERLEVEL9K_AWS_EB_ENV_VISUAL_IDENTIFIER_EXPANSION='eb' - - ##########[ azure: azure account name (https://docs.microsoft.com/en-us/cli/azure) ]########## - # Show azure only when the command you are typing invokes one of these tools. - # Tip: Remove the next line to always show azure. - typeset -g POWERLEVEL9K_AZURE_SHOW_ON_COMMAND='az|terraform|pulumi|terragrunt' - - # POWERLEVEL9K_AZURE_CLASSES is an array with even number of elements. The first element - # in each pair defines a pattern against which the current azure account name gets matched. - # More specifically, it's P9K_CONTENT prior to the application of context expansion (see below) - # that gets matched. If you unset all POWERLEVEL9K_AZURE_*CONTENT_EXPANSION parameters, - # you'll see this value in your prompt. The second element of each pair in - # POWERLEVEL9K_AZURE_CLASSES defines the account class. Patterns are tried in order. The - # first match wins. - # - # For example, given these settings: - # - # typeset -g POWERLEVEL9K_AZURE_CLASSES=( - # '*prod*' PROD - # '*test*' TEST - # '*' OTHER) - # - # If your current azure account is "company_test", its class is TEST because "company_test" - # doesn't match the pattern '*prod*' but does match '*test*'. - # - # You can define different colors, icons and content expansions for different classes: - # - # typeset -g POWERLEVEL9K_AZURE_TEST_FOREGROUND=2 - # typeset -g POWERLEVEL9K_AZURE_TEST_BACKGROUND=0 - # typeset -g POWERLEVEL9K_AZURE_TEST_VISUAL_IDENTIFIER_EXPANSION='⭐' - # typeset -g POWERLEVEL9K_AZURE_TEST_CONTENT_EXPANSION='> ${P9K_CONTENT} <' - typeset -g POWERLEVEL9K_AZURE_CLASSES=( - # '*prod*' PROD # These values are examples that are unlikely - # '*test*' TEST # to match your needs. Customize them as needed. - '*' OTHER) - - # Azure account name color. - typeset -g POWERLEVEL9K_AZURE_OTHER_FOREGROUND=7 - typeset -g POWERLEVEL9K_AZURE_OTHER_BACKGROUND=4 - # Custom icon. - # typeset -g POWERLEVEL9K_AZURE_OTHER_VISUAL_IDENTIFIER_EXPANSION='⭐' - - ##########[ gcloud: google cloud account and project (https://cloud.google.com/) ]########### - # Show gcloud only when the command you are typing invokes one of these tools. - # Tip: Remove the next line to always show gcloud. - typeset -g POWERLEVEL9K_GCLOUD_SHOW_ON_COMMAND='gcloud|gcs|gsutil' - # Google cloud color. - typeset -g POWERLEVEL9K_GCLOUD_FOREGROUND=7 - typeset -g POWERLEVEL9K_GCLOUD_BACKGROUND=4 - - # Google cloud format. Change the value of POWERLEVEL9K_GCLOUD_PARTIAL_CONTENT_EXPANSION and/or - # POWERLEVEL9K_GCLOUD_COMPLETE_CONTENT_EXPANSION if the default is too verbose or not informative - # enough. You can use the following parameters in the expansions. Each of them corresponds to the - # output of `gcloud` tool. - # - # Parameter | Source - # -------------------------|-------------------------------------------------------------------- - # P9K_GCLOUD_CONFIGURATION | gcloud config configurations list --format='value(name)' - # P9K_GCLOUD_ACCOUNT | gcloud config get-value account - # P9K_GCLOUD_PROJECT_ID | gcloud config get-value project - # P9K_GCLOUD_PROJECT_NAME | gcloud projects describe $P9K_GCLOUD_PROJECT_ID --format='value(name)' - # - # Note: ${VARIABLE//\%/%%} expands to ${VARIABLE} with all occurrences of '%' replaced with '%%'. - # - # Obtaining project name requires sending a request to Google servers. This can take a long time - # and even fail. When project name is unknown, P9K_GCLOUD_PROJECT_NAME is not set and gcloud - # prompt segment is in state PARTIAL. When project name gets known, P9K_GCLOUD_PROJECT_NAME gets - # set and gcloud prompt segment transitions to state COMPLETE. - # - # You can customize the format, icon and colors of gcloud segment separately for states PARTIAL - # and COMPLETE. You can also hide gcloud in state PARTIAL by setting - # POWERLEVEL9K_GCLOUD_PARTIAL_VISUAL_IDENTIFIER_EXPANSION and - # POWERLEVEL9K_GCLOUD_PARTIAL_CONTENT_EXPANSION to empty. - typeset -g POWERLEVEL9K_GCLOUD_PARTIAL_CONTENT_EXPANSION='${P9K_GCLOUD_PROJECT_ID//\%/%%}' - typeset -g POWERLEVEL9K_GCLOUD_COMPLETE_CONTENT_EXPANSION='${P9K_GCLOUD_PROJECT_NAME//\%/%%}' - - # Send a request to Google (by means of `gcloud projects describe ...`) to obtain project name - # this often. Negative value disables periodic polling. In this mode project name is retrieved - # only when the current configuration, account or project id changes. - typeset -g POWERLEVEL9K_GCLOUD_REFRESH_PROJECT_NAME_SECONDS=60 - - # Custom icon. - # typeset -g POWERLEVEL9K_GCLOUD_VISUAL_IDENTIFIER_EXPANSION='⭐' - - #[ google_app_cred: google application credentials (https://cloud.google.com/docs/authentication/production) ]# - # Show google_app_cred only when the command you are typing invokes one of these tools. - # Tip: Remove the next line to always show google_app_cred. - typeset -g POWERLEVEL9K_GOOGLE_APP_CRED_SHOW_ON_COMMAND='terraform|pulumi|terragrunt' - - # Google application credentials classes for the purpose of using different colors, icons and - # expansions with different credentials. - # - # POWERLEVEL9K_GOOGLE_APP_CRED_CLASSES is an array with even number of elements. The first - # element in each pair defines a pattern against which the current kubernetes context gets - # matched. More specifically, it's P9K_CONTENT prior to the application of context expansion - # (see below) that gets matched. If you unset all POWERLEVEL9K_GOOGLE_APP_CRED_*CONTENT_EXPANSION - # parameters, you'll see this value in your prompt. The second element of each pair in - # POWERLEVEL9K_GOOGLE_APP_CRED_CLASSES defines the context class. Patterns are tried in order. - # The first match wins. - # - # For example, given these settings: - # - # typeset -g POWERLEVEL9K_GOOGLE_APP_CRED_CLASSES=( - # '*:*prod*:*' PROD - # '*:*test*:*' TEST - # '*' DEFAULT) - # - # If your current Google application credentials is "service_account deathray-testing x@y.com", - # its class is TEST because it doesn't match the pattern '* *prod* *' but does match '* *test* *'. - # - # You can define different colors, icons and content expansions for different classes: - # - # typeset -g POWERLEVEL9K_GOOGLE_APP_CRED_TEST_FOREGROUND=28 - # typeset -g POWERLEVEL9K_GOOGLE_APP_CRED_TEST_VISUAL_IDENTIFIER_EXPANSION='⭐' - # typeset -g POWERLEVEL9K_GOOGLE_APP_CRED_TEST_CONTENT_EXPANSION='$P9K_GOOGLE_APP_CRED_PROJECT_ID' - typeset -g POWERLEVEL9K_GOOGLE_APP_CRED_CLASSES=( - # '*:*prod*:*' PROD # These values are examples that are unlikely - # '*:*test*:*' TEST # to match your needs. Customize them as needed. - '*' DEFAULT) - typeset -g POWERLEVEL9K_GOOGLE_APP_CRED_DEFAULT_FOREGROUND=7 - typeset -g POWERLEVEL9K_GOOGLE_APP_CRED_DEFAULT_BACKGROUND=4 - # typeset -g POWERLEVEL9K_GOOGLE_APP_CRED_DEFAULT_VISUAL_IDENTIFIER_EXPANSION='⭐' - - # Use POWERLEVEL9K_GOOGLE_APP_CRED_CONTENT_EXPANSION to specify the content displayed by - # google_app_cred segment. Parameter expansions are very flexible and fast, too. See reference: - # http://zsh.sourceforge.net/Doc/Release/Expansion.html#Parameter-Expansion. - # - # You can use the following parameters in the expansion. Each of them corresponds to one of the - # fields in the JSON file pointed to by GOOGLE_APPLICATION_CREDENTIALS. - # - # Parameter | JSON key file field - # ---------------------------------+--------------- - # P9K_GOOGLE_APP_CRED_TYPE | type - # P9K_GOOGLE_APP_CRED_PROJECT_ID | project_id - # P9K_GOOGLE_APP_CRED_CLIENT_EMAIL | client_email - # - # Note: ${VARIABLE//\%/%%} expands to ${VARIABLE} with all occurrences of '%' replaced by '%%'. - typeset -g POWERLEVEL9K_GOOGLE_APP_CRED_DEFAULT_CONTENT_EXPANSION='${P9K_GOOGLE_APP_CRED_PROJECT_ID//\%/%%}' - - ##############[ toolbox: toolbox name (https://github.com/containers/toolbox) ]############### - # Toolbox color. - typeset -g POWERLEVEL9K_TOOLBOX_FOREGROUND=0 - typeset -g POWERLEVEL9K_TOOLBOX_BACKGROUND=3 - # Don't display the name of the toolbox if it matches fedora-toolbox-*. - typeset -g POWERLEVEL9K_TOOLBOX_CONTENT_EXPANSION='${P9K_TOOLBOX_NAME:#fedora-toolbox-*}' - # Custom icon. - # typeset -g POWERLEVEL9K_TOOLBOX_VISUAL_IDENTIFIER_EXPANSION='⭐' - # Custom prefix. - # typeset -g POWERLEVEL9K_TOOLBOX_PREFIX='in ' - - ###############################[ public_ip: public IP address ]############################### - # Public IP color. - typeset -g POWERLEVEL9K_PUBLIC_IP_FOREGROUND=7 - typeset -g POWERLEVEL9K_PUBLIC_IP_BACKGROUND=0 - # Custom icon. - # typeset -g POWERLEVEL9K_PUBLIC_IP_VISUAL_IDENTIFIER_EXPANSION='⭐' - - ########################[ vpn_ip: virtual private network indicator ]######################### - # VPN IP color. - typeset -g POWERLEVEL9K_VPN_IP_FOREGROUND=0 - typeset -g POWERLEVEL9K_VPN_IP_BACKGROUND=6 - # When on VPN, show just an icon without the IP address. - # Tip: To display the private IP address when on VPN, remove the next line. - typeset -g POWERLEVEL9K_VPN_IP_CONTENT_EXPANSION= - # Regular expression for the VPN network interface. Run `ifconfig` or `ip -4 a show` while on VPN - # to see the name of the interface. - typeset -g POWERLEVEL9K_VPN_IP_INTERFACE='(gpd|wg|(.*tun)|tailscale)[0-9]*|(zt.*)' - # If set to true, show one segment per matching network interface. If set to false, show only - # one segment corresponding to the first matching network interface. - # Tip: If you set it to true, you'll probably want to unset POWERLEVEL9K_VPN_IP_CONTENT_EXPANSION. - typeset -g POWERLEVEL9K_VPN_IP_SHOW_ALL=false - # Custom icon. - # typeset -g POWERLEVEL9K_VPN_IP_VISUAL_IDENTIFIER_EXPANSION='⭐' - - ###########[ ip: ip address and bandwidth usage for a specified network interface ]########### - # IP color. - typeset -g POWERLEVEL9K_IP_BACKGROUND=4 - typeset -g POWERLEVEL9K_IP_FOREGROUND=0 - # The following parameters are accessible within the expansion: - # - # Parameter | Meaning - # ----------------------+------------------------------------------- - # P9K_IP_IP | IP address - # P9K_IP_INTERFACE | network interface - # P9K_IP_RX_BYTES | total number of bytes received - # P9K_IP_TX_BYTES | total number of bytes sent - # P9K_IP_RX_BYTES_DELTA | number of bytes received since last prompt - # P9K_IP_TX_BYTES_DELTA | number of bytes sent since last prompt - # P9K_IP_RX_RATE | receive rate (since last prompt) - # P9K_IP_TX_RATE | send rate (since last prompt) - typeset -g POWERLEVEL9K_IP_CONTENT_EXPANSION='${P9K_IP_RX_RATE:+⇣$P9K_IP_RX_RATE }${P9K_IP_TX_RATE:+⇡$P9K_IP_TX_RATE }$P9K_IP_IP' - # Show information for the first network interface whose name matches this regular expression. - # Run `ifconfig` or `ip -4 a show` to see the names of all network interfaces. - typeset -g POWERLEVEL9K_IP_INTERFACE='[ew].*' - # Custom icon. - # typeset -g POWERLEVEL9K_IP_VISUAL_IDENTIFIER_EXPANSION='⭐' - - #########################[ proxy: system-wide http/https/ftp proxy ]########################## - # Proxy color. - typeset -g POWERLEVEL9K_PROXY_FOREGROUND=4 - typeset -g POWERLEVEL9K_PROXY_BACKGROUND=0 - # Custom icon. - # typeset -g POWERLEVEL9K_PROXY_VISUAL_IDENTIFIER_EXPANSION='⭐' - - ################################[ battery: internal battery ]################################# - # Show battery in red when it's below this level and not connected to power supply. - typeset -g POWERLEVEL9K_BATTERY_LOW_THRESHOLD=20 - typeset -g POWERLEVEL9K_BATTERY_LOW_FOREGROUND=1 - # Show battery in green when it's charging or fully charged. - typeset -g POWERLEVEL9K_BATTERY_{CHARGING,CHARGED}_FOREGROUND=2 - # Show battery in yellow when it's discharging. - typeset -g POWERLEVEL9K_BATTERY_DISCONNECTED_FOREGROUND=3 - # Battery pictograms going from low to high level of charge. - typeset -g POWERLEVEL9K_BATTERY_STAGES=('%K{232}▁' '%K{232}▂' '%K{232}▃' '%K{232}▄' '%K{232}▅' '%K{232}▆' '%K{232}▇' '%K{232}█') - # Don't show the remaining time to charge/discharge. - typeset -g POWERLEVEL9K_BATTERY_VERBOSE=false - typeset -g POWERLEVEL9K_BATTERY_BACKGROUND=0 - - #####################################[ wifi: wifi speed ]##################################### - # WiFi color. - typeset -g POWERLEVEL9K_WIFI_FOREGROUND=0 - typeset -g POWERLEVEL9K_WIFI_BACKGROUND=4 - # Custom icon. - # typeset -g POWERLEVEL9K_WIFI_VISUAL_IDENTIFIER_EXPANSION='⭐' - - # Use different colors and icons depending on signal strength ($P9K_WIFI_BARS). - # - # # Wifi colors and icons for different signal strength levels (low to high). - # typeset -g my_wifi_fg=(0 0 0 0 0) # <-- change these values - # typeset -g my_wifi_icon=('WiFi' 'WiFi' 'WiFi' 'WiFi' 'WiFi') # <-- change these values - # - # typeset -g POWERLEVEL9K_WIFI_CONTENT_EXPANSION='%F{${my_wifi_fg[P9K_WIFI_BARS+1]}}$P9K_WIFI_LAST_TX_RATE Mbps' - # typeset -g POWERLEVEL9K_WIFI_VISUAL_IDENTIFIER_EXPANSION='%F{${my_wifi_fg[P9K_WIFI_BARS+1]}}${my_wifi_icon[P9K_WIFI_BARS+1]}' - # - # The following parameters are accessible within the expansions: - # - # Parameter | Meaning - # ----------------------+--------------- - # P9K_WIFI_SSID | service set identifier, a.k.a. network name - # P9K_WIFI_LINK_AUTH | authentication protocol such as "wpa2-psk" or "none"; empty if unknown - # P9K_WIFI_LAST_TX_RATE | wireless transmit rate in megabits per second - # P9K_WIFI_RSSI | signal strength in dBm, from -120 to 0 - # P9K_WIFI_NOISE | noise in dBm, from -120 to 0 - # P9K_WIFI_BARS | signal strength in bars, from 0 to 4 (derived from P9K_WIFI_RSSI and P9K_WIFI_NOISE) - - ####################################[ time: current time ]#################################### - # Current time color. - typeset -g POWERLEVEL9K_TIME_FOREGROUND=0 - typeset -g POWERLEVEL9K_TIME_BACKGROUND=7 - # Format for the current time: 09:51:02. See `man 3 strftime`. - typeset -g POWERLEVEL9K_TIME_FORMAT='%D{%H:%M:%S}' - # If set to true, time will update when you hit enter. This way prompts for the past - # commands will contain the start times of their commands as opposed to the default - # behavior where they contain the end times of their preceding commands. - typeset -g POWERLEVEL9K_TIME_UPDATE_ON_COMMAND=false - # Custom icon. - typeset -g POWERLEVEL9K_TIME_VISUAL_IDENTIFIER_EXPANSION= - # Custom prefix. - # typeset -g POWERLEVEL9K_TIME_PREFIX='at ' - - # Example of a user-defined prompt segment. Function prompt_example will be called on every - # prompt if `example` prompt segment is added to POWERLEVEL9K_LEFT_PROMPT_ELEMENTS or - # POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS. It displays an icon and yellow text on red background - # greeting the user. - # - # Type `p10k help segment` for documentation and a more sophisticated example. - function prompt_example() { - p10k segment -b 1 -f 3 -i '⭐' -t 'hello, %n' - } - - # User-defined prompt segments may optionally provide an instant_prompt_* function. Its job - # is to generate the prompt segment for display in instant prompt. See - # https://github.com/romkatv/powerlevel10k#instant-prompt. - # - # Powerlevel10k will call instant_prompt_* at the same time as the regular prompt_* function - # and will record all `p10k segment` calls it makes. When displaying instant prompt, Powerlevel10k - # will replay these calls without actually calling instant_prompt_*. It is imperative that - # instant_prompt_* always makes the same `p10k segment` calls regardless of environment. If this - # rule is not observed, the content of instant prompt will be incorrect. - # - # Usually, you should either not define instant_prompt_* or simply call prompt_* from it. If - # instant_prompt_* is not defined for a segment, the segment won't be shown in instant prompt. - function instant_prompt_example() { - # Since prompt_example always makes the same `p10k segment` calls, we can call it from - # instant_prompt_example. This will give us the same `example` prompt segment in the instant - # and regular prompts. - prompt_example - } - - # User-defined prompt segments can be customized the same way as built-in segments. - typeset -g POWERLEVEL9K_EXAMPLE_FOREGROUND=3 - typeset -g POWERLEVEL9K_EXAMPLE_BACKGROUND=1 - # typeset -g POWERLEVEL9K_EXAMPLE_VISUAL_IDENTIFIER_EXPANSION='⭐' - - # Transient prompt works similarly to the builtin transient_rprompt option. It trims down prompt - # when accepting a command line. Supported values: - # - # - off: Don't change prompt when accepting a command line. - # - always: Trim down prompt when accepting a command line. - # - same-dir: Trim down prompt when accepting a command line unless this is the first command - # typed after changing current working directory. - typeset -g POWERLEVEL9K_TRANSIENT_PROMPT=always - - # Instant prompt mode. - # - # - off: Disable instant prompt. Choose this if you've tried instant prompt and found - # it incompatible with your zsh configuration files. - # - quiet: Enable instant prompt and don't print warnings when detecting console output - # during zsh initialization. Choose this if you've read and understood - # https://github.com/romkatv/powerlevel10k#instant-prompt. - # - verbose: Enable instant prompt and print a warning when detecting console output during - # zsh initialization. Choose this if you've never tried instant prompt, haven't - # seen the warning, or if you are unsure what this all means. - typeset -g POWERLEVEL9K_INSTANT_PROMPT=verbose - - # Hot reload allows you to change POWERLEVEL9K options after Powerlevel10k has been initialized. - # For example, you can type POWERLEVEL9K_BACKGROUND=red and see your prompt turn red. Hot reload - # can slow down prompt by 1-2 milliseconds, so it's better to keep it turned off unless you - # really need it. - typeset -g POWERLEVEL9K_DISABLE_HOT_RELOAD=true - - # If p10k is already loaded, reload configuration. - # This works even with POWERLEVEL9K_DISABLE_HOT_RELOAD=true. - (( ! $+functions[p10k] )) || p10k reload -} - -# Tell `p10k configure` which file it should overwrite. -typeset -g POWERLEVEL9K_CONFIG_FILE=${${(%):-%x}:a} - -(( ${#p10k_config_opts} )) && setopt ${p10k_config_opts[@]} -'builtin' 'unset' 'p10k_config_opts' diff --git a/packer/ubuntu/scripts/check-image.sh b/packer/ubuntu/scripts/check-image.sh new file mode 100644 index 0000000..b554b6a --- /dev/null +++ b/packer/ubuntu/scripts/check-image.sh @@ -0,0 +1,104 @@ +#!/usr/bin/env bash +# Read-only artifact checks; never boot, modify or import the supplied disk. +set -euo pipefail +if [[ $# != 4 || ( "$2" != default && "$2" != custom ) || ( "$4" != candidate && "$4" != signed-repository ) ]]; then + printf '%s\n' 'Usage: check-image.sh ' >&2 + exit 2 +fi +image=$1 mode=$2 version=$3 expected_source=$4 +[[ -r "$image" ]] +qemu-img info --output=json "$image" | jq -e '(.format == "qcow2" or .format == "raw") and (has("backing-filename") | not)' >/dev/null +# Keep one read-only appliance alive for every assertion, including cleanup on failure. +session=$(guestfish --ro -a "$image" -i --listen) +if [[ "$session" =~ ^GUESTFISH_PID=([0-9]+)\; ]]; then + guestfish_pid=${BASH_REMATCH[1]} +else + printf '%s\n' 'libguestfs did not return a session PID.' >&2 + exit 1 +fi +trap 'guestfish --remote="$guestfish_pid" exit >/dev/null' EXIT +disk() { guestfish --remote="$guestfish_pid" "$@"; } +read_file() { disk cat "$1"; } +exists() { + local result + result=$(disk exists "$1") + [[ "$result" == true || "$result" == false ]] || return 2 + [[ "$result" == true ]] +} +require_absent() { + local result + result=$(disk exists "$1") + [[ "$result" == false ]] || { printf 'Unexpected or unreadable artifact path: %s\n' "$1" >&2; return 1; } +} +machine_id=$(read_file /etc/machine-id) +[[ -z "$machine_id" ]] +[[ "$(read_file /etc/hostname)" == localhost ]] +[[ "$(read_file /etc/shadow | awk -F: '$1 == "ubuntu" { print $2 }')" == '*' ]] +host_keys=$(disk glob-expand '/etc/ssh/ssh_host_*') +[[ -z "$host_keys" ]] +exists /etc/update-motd.d/90-pds +for path in /etc/skel/.zshrc /etc/skel/.p10k.zsh; do + shared_config=$(read_file "$path") + if grep -Eq '/root/|/home/ubuntu/' <<< "$shared_config"; then + printf 'Build-user path retained in shared configuration: %s\n' "$path" >&2 + exit 1 + fi +done +read_file /var/lib/builders/pds.json | + jq -e --arg version "$version" --arg source "$expected_source" '.package == "pds" and .version == $version and .source == $source' >/dev/null +for build_home in /root /home/ubuntu; do + entries=$(disk ls "$build_home") + while IFS= read -r entry; do + case "$entry" in + ''|.bashrc|.profile|.bash_logout) ;; + .sudo_as_admin_successful) + marker=$(read_file "$build_home/.sudo_as_admin_successful") + [[ -z "$marker" ]] + ;; + .cache) + cache_entries=$(disk ls "$build_home/.cache") + [[ -z "$cache_entries" || "$cache_entries" == motd.legal-displayed ]] + if [[ -n "$cache_entries" ]]; then + marker=$(read_file "$build_home/.cache/motd.legal-displayed") + [[ -z "$marker" ]] + fi + ;; + .zshrc) + loader=$(read_file "$build_home/.zshrc") + [[ "$loader" == 'source /etc/zshrc' ]] + ;; + .p10k.zsh) + preset=$(read_file "$build_home/.p10k.zsh") + shared_preset=$(read_file /etc/skel/.p10k.zsh) + [[ "$preset" == "$shared_preset" ]] + ;; + .ssh) + ssh_entries=$(disk ls "$build_home/.ssh") + [[ -z "$ssh_entries" ]] + ;; + *) printf 'Unexpected build-home residue: %s/%s\n' "$build_home" "$entry" >&2; exit 1 ;; + esac + done <<< "$entries" +done +for path in /root/.ssh/authorized_keys /home/ubuntu/.ssh/authorized_keys \ + /root/.bash_history /home/ubuntu/.bash_history /var/lib/cloud/seed \ + /etc/ssh/sshd_config.d/50-cloud-init.conf /etc/netplan/50-cloud-init.yaml \ + /var/lib/cloud/instance /var/lib/cloud/instances; do + require_absent "$path" +done +policy=/etc/ssh/sshd_config.d/00-pds-security.conf +job=/etc/cron.d/pds-update +if [[ "$mode" == default ]]; then + exists "$policy" + exists "$job" + effective=$(read_file "$policy") + for setting in 'PasswordAuthentication no' 'KbdInteractiveAuthentication no' \ + 'PubkeyAuthentication yes' 'PermitRootLogin no'; do + grep -Fxq "$setting" <<< "$effective" + done + read_file "$job" | grep -Fxq '0 0 * * * root /usr/local/sbin/pds-update >> /var/log/pds-update.log 2>&1' +else + require_absent "$policy" + require_absent "$job" +fi +printf 'PASS: read-only %s artifact checks; PDS %s (%s). Boot and authentication tests remain separate.\n' "$mode" "$version" "$expected_source" diff --git a/packer/ubuntu/scripts/check-instance.sh b/packer/ubuntu/scripts/check-instance.sh new file mode 100644 index 0000000..4844aa5 --- /dev/null +++ b/packer/ubuntu/scripts/check-instance.sh @@ -0,0 +1,33 @@ +#!/usr/bin/env bash +# Run as the deployed user inside an owned, fresh disposable validation instance. +set -euo pipefail +if [[ $# != 1 || ( "$1" != default && "$1" != custom ) ]]; then + printf '%s\n' 'Usage: check-instance.sh (inside a disposable clone)' >&2 + exit 2 +fi +mode=$1 +[[ "$(id -u)" != 0 ]] || { printf '%s\n' 'Run as the new deployment user, not root.' >&2; exit 1; } +login_shell=$(getent passwd "$(id -un)" | cut -d: -f7) +[[ "$login_shell" == */zsh ]] +sudo -n true +[[ -s "$HOME/.p10k.zsh" && -r /usr/local/share/zi/zi.zsh ]] +shell_check="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)/check-user-shell.zsh" +[[ -r "$shell_check" ]] || { printf '%s\n' 'Keep check-user-shell.zsh beside this check script.' >&2; exit 1; } +# First run may download the existing Zi plugins; the second must reuse the setup. +for startup in 1 2; do + printf 'Verify Zsh startup %s (the first may download Zi plugins).\n' "$startup" + zsh -lic 'source "$1" "$2"' builders-shell-check "$shell_check" "$mode" +done +if [[ "$mode" == default ]]; then + [[ ! -w /usr/local/share/pds/krew ]] + systemctl is-enabled cron + effective=$(sudo -n /usr/sbin/sshd -T) + for setting in 'passwordauthentication no' 'kbdinteractiveauthentication no' \ + 'pubkeyauthentication yes' 'permitrootlogin no'; do + grep -Fxq "$setting" <<< "$effective" + done +else + sudo -n test ! -e /etc/ssh/sshd_config.d/00-pds-security.conf + sudo -n test ! -e /etc/cron.d/pds-update +fi +printf 'PASS: %s fresh-user tooling, shell and selected policy checks.\n' "$mode" diff --git a/packer/ubuntu/scripts/check-user-shell.zsh b/packer/ubuntu/scripts/check-user-shell.zsh new file mode 100644 index 0000000..7eb5f38 --- /dev/null +++ b/packer/ubuntu/scripts/check-user-shell.zsh @@ -0,0 +1,20 @@ +#!/usr/bin/env zsh +# Sourced by a dedicated login Zsh so every fresh-user probe can fail the check. +setopt ERR_EXIT NO_UNSET PIPE_FAIL +(( $# == 1 )) || exit 2 +case "$1" in default|custom) ;; *) exit 2 ;; esac + +(( $+functions[zi] )) +(( $+functions[p10k] )) +[[ -s ~/.p10k.zsh ]] +if [[ "$1" == default ]]; then + [[ "$KREW_ROOT" == /usr/local/share/pds/krew ]] + alias k + [[ -n ${_comps[kubectl]:-} && ${_comps[k]:-} == ${_comps[kubectl]} ]] + whence "${_comps[k]}" + kubectl version --client + kubectl krew list + kubectl neat --help >/dev/null + kubectl view-secret --help >/dev/null + kubectl stern --version +fi diff --git a/packer/ubuntu/scripts/cleanup.sh b/packer/ubuntu/scripts/cleanup.sh deleted file mode 100644 index 4e57820..0000000 --- a/packer/ubuntu/scripts/cleanup.sh +++ /dev/null @@ -1,63 +0,0 @@ -#!/bin/bash -eux - -# -- Shell Config -- - -# Redirect stderr to stdout for the entire script, this will get rid of most of the red in my terminal because in Packer, -# the output from the script section (provisioners) is shown in red because it's directed to stderr, which Packer highlights in red. -exec 2>&1 - - -# -- Environment Variables -- - -# set var to log path -LOG="/var/log/cleanup.log" -# set to default ubuntu user -USER_NAME="ubuntu" - -# -- Main Script Section -- - -echo "==> remove SSH keys used for building" -rm -f /home/ubuntu/.ssh/authorized_keys -rm -f /root/.ssh/authorized_keys - -echo "==> Clear out machine id" -truncate -s 0 /etc/machine-id - -echo "==> Remove the contents of /tmp and /var/tmp" -rm -rf /tmp/* /var/tmp/* - -echo "==> Truncate any logs that have built up during the install" -find /var/log -type f -exec truncate --size=0 {} \; - -echo "==> Cleanup bash history" -rm -f ~/.bash_history - -echo "remove /usr/share/doc/" -rm -rf /usr/share/doc/* - -echo "==> remove /var/cache" -find /var/cache -type f -exec rm -rf {} \; - -echo "==> Cleanup apt" -apt-get -y autoremove -sudo apt-get clean -sudo rm -rf /var/lib/apt/lists/* - -echo "==> force a new random seed to be generated" -rm -f /var/lib/systemd/random-seed - -echo "==> Clear the history so our install isn't there" -rm -f /root/.wget-hsts - -# reconfigure password of default ubuntu install user -# Set the user password from Packer variable called on line 58 of the template -echo "Setting password for $USER_NAME..." -echo "${USER_NAME}:${USER_PASSWORD}" | sudo chpasswd - -# Log that password has been set, but do not log the password itself -echo "Password for $USER_NAME set." >> $LOG - -# Remove cloud init network configuration from netplan -sudo rm -rf /etc/netplan/50-cloud-init.yaml - -export HISTSIZE=0 \ No newline at end of file diff --git a/packer/ubuntu/scripts/create-base-template.sh b/packer/ubuntu/scripts/create-base-template.sh new file mode 100755 index 0000000..a9dd08f --- /dev/null +++ b/packer/ubuntu/scripts/create-base-template.sh @@ -0,0 +1,65 @@ +#!/usr/bin/env bash +# Prepare or reuse a local base-image bundle, then import it over SSH. +set -euo pipefail + +: "${BASE_VMID:?Set BASE_VMID to an unused Proxmox VM ID}" +: "${PVE_HOST:?Set PVE_HOST to your Proxmox SSH destination, such as root@pve}" +if [[ ! "$BASE_VMID" =~ ^[1-9][0-9]{2,8}$ ]] || (( BASE_VMID < 100 )); then + printf '%s\n' 'BASE_VMID must be an integer between 100 and 999999999.' >&2 + exit 1 +fi +[[ "$PVE_HOST" =~ ^[a-zA-Z0-9_][a-zA-Z0-9_.@:-]*$ ]] || { printf '%s\n' 'Invalid PVE_HOST.' >&2; exit 1; } + +UBUNTU_VERSION="${UBUNTU_VERSION:-noble}" +BASE_NAME="${BASE_NAME:-ubuntu-${UBUNTU_VERSION}-cloudimg}" +STORAGE="${STORAGE:-local-lvm}" +BRIDGE="${BRIDGE:-vmbr0}" +DISK_SIZE="${DISK_SIZE:-32G}" +for value in "$BASE_NAME" "$STORAGE" "$BRIDGE"; do + [[ "$value" =~ ^[a-zA-Z0-9][a-zA-Z0-9_.-]*$ ]] || { printf '%s\n' 'Invalid template name, storage or bridge.' >&2; exit 1; } +done +[[ "$DISK_SIZE" =~ ^[1-9][0-9]*[GM]$ ]] || { printf '%s\n' 'DISK_SIZE must be a positive size in G or M.' >&2; exit 1; } + +scripts_dir="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)" +ssh_options=(-o StrictHostKeyChecking=yes -o ConnectTimeout=15) +# Refuse occupied IDs before downloading, preparing or uploading an image. +ssh "${ssh_options[@]}" -- "$PVE_HOST" bash -s -- --check "$BASE_VMID" < "$scripts_dir/import-base-template.sh" + +work_dir="$(mktemp -d)" +remote_dir='' +cleanup() { + local status=$? + if [[ -n "$remote_dir" ]]; then + ssh "${ssh_options[@]}" -- "$PVE_HOST" "rm -rf -- '$remote_dir'" || { + printf 'Remove the temporary upload directory manually: %s:%s\n' "$PVE_HOST" "$remote_dir" >&2 + status=1 + } + fi + rm -rf -- "$work_dir" + exit "$status" +} +trap cleanup EXIT + +image_dir="${BASE_IMAGE_DIR:-$work_dir/base}" +if [[ -z "${BASE_IMAGE_DIR:-}" ]]; then + bash "$scripts_dir/prepare-base-image.sh" "$image_dir" +fi +checksum="$(cat -- "$image_dir/base-image.sha256")" +[[ "$checksum" =~ ^[a-fA-F0-9]{64}[[:blank:]]+base[.]qcow2$ ]] || { printf '%s\n' 'Invalid base-image checksum record.' >&2; exit 1; } +(cd -- "$image_dir" && sha256sum -c base-image.sha256) + +if ! allocated_dir="$(ssh "${ssh_options[@]}" -- "$PVE_HOST" mktemp -d /var/tmp/builders-base.XXXXXXXX)"; then + printf 'Remote staging failed; inspect the node before cleanup. Reply: %q\n' "$allocated_dir" >&2 + exit 1 +fi +if [[ ! "$allocated_dir" =~ ^/var/tmp/builders-base[.][a-zA-Z0-9]{8}$ ]]; then + printf 'Unexpected upload directory; no remote cleanup attempted. Reply: %q\n' "$allocated_dir" >&2 + exit 1 +fi +remote_dir="$allocated_dir" +for file in base.qcow2 base-image.sha256; do + ssh "${ssh_options[@]}" -- "$PVE_HOST" "cat > '$remote_dir/$file'" < "$image_dir/$file" +done +ssh "${ssh_options[@]}" -- "$PVE_HOST" bash -s -- --import "$BASE_VMID" "$remote_dir" \ + "$BASE_NAME" "$STORAGE" "$BRIDGE" "$DISK_SIZE" < "$scripts_dir/import-base-template.sh" +printf 'Base template created: %s (VM ID %s)\n' "$BASE_NAME" "$BASE_VMID" diff --git a/packer/ubuntu/scripts/export-raw.sh b/packer/ubuntu/scripts/export-raw.sh new file mode 100755 index 0000000..55c6272 --- /dev/null +++ b/packer/ubuntu/scripts/export-raw.sh @@ -0,0 +1,12 @@ +#!/usr/bin/env bash +set -euo pipefail + +[[ "${BUILD_OUTPUT_RAW:-false}" == true ]] || exit 0 +: "${BUILD_QEMU_IMAGE:?Set BUILD_QEMU_IMAGE to the qcow2 artifact}" +command -v qemu-img >/dev/null +raw_image="${BUILD_QEMU_IMAGE%.qcow2}.raw" +[[ "$raw_image" != "$BUILD_QEMU_IMAGE" && ! -e "$raw_image" ]] || { + printf '%s\n' 'Refusing to overwrite the raw output or convert an unexpected input path.' >&2 + exit 1 +} +qemu-img convert -f qcow2 -O raw "$BUILD_QEMU_IMAGE" "$raw_image" diff --git a/packer/ubuntu/scripts/import-base-template.sh b/packer/ubuntu/scripts/import-base-template.sh new file mode 100644 index 0000000..901d861 --- /dev/null +++ b/packer/ubuntu/scripts/import-base-template.sh @@ -0,0 +1,52 @@ +#!/usr/bin/env bash +# Runs on Proxmox through create-base-template.sh; needs only native node tools. +set -euo pipefail + +mode="${1:-}" +vmid="${2:-}" +if [[ ! "$vmid" =~ ^[1-9][0-9]{2,8}$ ]] || (( vmid < 100 )); then + printf '%s\n' 'Pass an unused Proxmox VM ID.' >&2 + exit 1 +fi +if [[ "$mode" == --check && $# == 2 ]]; then + : +elif [[ "$mode" == --import && $# == 7 ]]; then + image_dir="$3" + name="$4" + storage="$5" + bridge="$6" + disk_size="$7" + for value in "$name" "$storage" "$bridge"; do + [[ "$value" =~ ^[a-zA-Z0-9][a-zA-Z0-9_.-]*$ ]] || exit 1 + done + [[ "$disk_size" =~ ^[1-9][0-9]*[GM]$ ]] || exit 1 +else + printf '%s\n' 'Usage: import-base-template.sh --check | --import ' >&2 + exit 1 +fi +for tool in pvesh qm qemu-img; do + command -v "$tool" >/dev/null || { printf 'Missing Proxmox command: %s\n' "$tool" >&2; exit 1; } +done +if ! pvesh get /cluster/nextid --vmid "$vmid" >/dev/null; then + printf 'VM ID %s is unavailable or could not be checked; nothing was changed.\n' "$vmid" >&2 + exit 1 +fi +[[ "$mode" == --import ]] || exit 0 +checksum="$(cat -- "$image_dir/base-image.sha256")" +[[ "$checksum" =~ ^[a-fA-F0-9]{64}[[:blank:]]+base[.]qcow2$ ]] || exit 1 +(cd -- "$image_dir" && sha256sum -c base-image.sha256) +# Grow only the temporary upload. qemu-img refuses shrinking without --shrink, +# so an undersized request fails before a VM is created. The local bundle stays intact. +qemu-img resize -f qcow2 "$image_dir/base.qcow2" "$disk_size" + +# qm create also refuses an allocation racing the availability check. +# Keep a partial new VM for inspection if a later import/configuration fails. +qm create "$vmid" --name "$name" --memory 2048 --cores 2 \ + --net0 "virtio,bridge=$bridge" --scsihw virtio-scsi-pci --ostype l26 +qm importdisk "$vmid" "$image_dir/base.qcow2" "$storage" +imported_disk="$(qm config "$vmid" | sed -n 's/^unused0: //p')" +[[ -n "$imported_disk" ]] || { printf '%s\n' 'Imported disk was not found in the new VM configuration.' >&2; exit 1; } +qm set "$vmid" --scsi0 "$imported_disk" --ide2 "$storage:cloudinit" +qm set "$vmid" --boot order=scsi0 --serial0 socket --vga serial0 +qm set "$vmid" --ipconfig0 ip=dhcp --agent enabled=1 +qm template "$vmid" diff --git a/packer/ubuntu/scripts/install-pds.sh b/packer/ubuntu/scripts/install-pds.sh new file mode 100644 index 0000000..8f3871f --- /dev/null +++ b/packer/ubuntu/scripts/install-pds.sh @@ -0,0 +1,60 @@ +#!/usr/bin/env bash +# Install an exact PDS package and retain its signed source for later host updates. +set -euo pipefail + +[[ $# == 2 ]] || { printf '%s\n' 'Usage: install-pds.sh ' >&2; exit 2; } +settings=$1 inputs=$2 +for tool in jq dpkg dpkg-deb dpkg-query gpg sha256sum apt-get; do + command -v "$tool" >/dev/null || { printf 'Missing native PDS bootstrap prerequisite: %s\n' "$tool" >&2; exit 1; } +done +version=$(jq -er '.version | strings | select(test("^[0-9][A-Za-z0-9.+:~_-]*$"))' "$settings") +repository=$(jq -er '.repository | strings | select(test("^https://[^[:space:]]+/$"))' "$settings") +fingerprint=$(jq -er '.key_fingerprint | strings | select(test("^[A-F0-9]{40}$"))' "$settings") +candidate_sha256=$(jq -er '.candidate_sha256 | strings | select(. == "" or test("^[a-f0-9]{64}$"))' "$settings") +key="$inputs/repository-key.asc" +candidate="$inputs/candidate.deb" +architecture=$(dpkg --print-architecture) + +# Refuse malformed candidates before configuring repositories or installing packages. +source_kind=signed-repository +if [[ -n "$candidate_sha256" ]]; then + [[ -r "$candidate" ]] || { printf '%s\n' 'The explicit PDS candidate is missing.' >&2; exit 1; } + printf '%s %s\n' "$candidate_sha256" "$candidate" | sha256sum --check --status + [[ "$(dpkg-deb --field "$candidate" Package)" == pds ]] + [[ "$(dpkg-deb --field "$candidate" Version)" == "$version" ]] + candidate_arch=$(dpkg-deb --field "$candidate" Architecture) + [[ "$candidate_arch" == all || "$candidate_arch" == "$architecture" ]] + source_kind=candidate +elif [[ -e "$candidate" ]]; then + printf '%s\n' 'A candidate exists without an explicit SHA-256; refusing a repository fallback.' >&2 + exit 1 +fi + +work=$(mktemp -d) +trap 'rm -rf -- "$work"' EXIT +mkdir -m 0700 "$work/gnupg" +primary_fingerprints=$(gpg --no-options --homedir "$work/gnupg" --batch --with-colons --show-keys "$key" | + awk -F: '$1 == "pub" { primary=1; next } $1 == "sub" { primary=0 } $1 == "fpr" && primary { print $10; primary=0 }') +[[ "$primary_fingerprints" == "$fingerprint" ]] || { printf '%s\n' 'PDS signing key fingerprint mismatch.' >&2; exit 1; } +gpg --no-options --homedir "$work/gnupg" --batch --yes --dearmor --output "$work/key.gpg" "$key" +printf 'deb [signed-by=/usr/share/keyrings/pds-repo.gpg] %s stable main\n' "$repository" > "$work/pds.list" +install -d -m 0755 /usr/share/keyrings /etc/apt/sources.list.d /var/lib/builders +install -m 0644 "$work/key.gpg" /usr/share/keyrings/pds-repo.gpg +install -m 0644 "$work/pds.list" /etc/apt/sources.list.d/pds.list +apt-get update +if [[ "$source_kind" == candidate ]]; then + apt-get install -y --no-install-recommends "$candidate" +else + apt-get install -y --no-install-recommends "pds=$version" +fi +installed=$(dpkg-query -W -f='${Status}\t${Version}\t${Architecture}\n' pds) +IFS=$'\t' read -r status installed_version installed_arch <<< "$installed" +[[ "$status" == 'install ok installed' && "$installed_version" == "$version" ]] +[[ "$installed_arch" == all || "$installed_arch" == "$architecture" ]] +jq -n --arg version "$installed_version" --arg architecture "$installed_arch" \ + --arg source "$source_kind" --arg sha256 "$candidate_sha256" \ + --arg repository "$repository" --arg key_fingerprint "$fingerprint" \ + '{package: "pds", version: $version, architecture: $architecture, source: $source, + candidate_sha256: $sha256, repository: $repository, key_fingerprint: $key_fingerprint}' > "$work/provenance.json" +install -m 0644 "$work/provenance.json" /var/lib/builders/pds.json +printf 'Installed PDS %s (%s); provenance: /var/lib/builders/pds.json\n' "$installed_version" "$source_kind" diff --git a/packer/ubuntu/scripts/install.sh b/packer/ubuntu/scripts/install.sh index 382d6d4..890087b 100644 --- a/packer/ubuntu/scripts/install.sh +++ b/packer/ubuntu/scripts/install.sh @@ -1,229 +1,15 @@ -#!/bin/bash -eux -# Configuration Management Script: -# This script is used to configure the instance after the cloud-init process has completed. - -# -- Shell Config -- -# Redirect stderr to stdout for the entire script, this will get rid of most of the red in my terminal because in Packer, -# the output from the script section (provisioners) is shown in red because it's directed to stderr, which Packer highlights in red. -exec 2>&1 -# Enable extended globbing -shopt -s extglob - -# TODO: check for internet or provide some local way to pull the module. -# TODO: Add static ip configuration, maybe handle in cloud-init ? or check to handle on firewall/network level with static dhcp lease / dns. - - - -# Fetch PDS functions -# TODO: Rework fetching the functions to using the pds apt package - - - -# -- Environment Variables -- -# set var to log path -LOG="/var/log/bootstrap.log" -# Detect architecture (arm, x86, etc) used in hostname generation -ARCH=$(uname -m) -ARCH=${ARCH:0:3} # keep only the first 3 characters. -# fetch vars for hostname generation from file created during cloud-init -source /etc/profile.d/hostname_vars.sh -DOMAIN_NAME="mvha.local" # if you set tailscale domain name (main-x86-prd-01.tail6948f.ts.net) here rke2 will think tailscale is the internal network. -NEW_HOSTNAME="${ROLE}-${ARCH}-${ENV}-${COUNTER}.${DOMAIN_NAME}" - -#vars for user config -USER_NAME="sysadmin" # Replace with the admins username you want to create -# generate key on main tooling server with `ssh-keygen -t ed25519 -C sysadmin@whatever.com` " -SSH_PUBLIC_KEY="" # Replace with your actual public key -# zi env vars -#export HOME=/home/ubuntu -#export ZDOTDIR=$HOME -#export ZI_HOME=$HOME/.zi - -# -- Main Script Section -- -# wait until cloud-init config has been completed -echo "==> Waiting for Cloud-Init to finish..." -cloud-init status --wait -echo "Cloud-Init finished." - - -# Configure hostname via variables supplied in the user-data file during the cloud init process. -# TODO: Turn into function and move to PDS -if [ -n "$NEW_HOSTNAME" ]; then - echo "new hostname detected: $NEW_HOSTNAME" >> $LOG - # Set the hostname - hostnamectl set-hostname "$NEW_HOSTNAME" - # Update /etc/hosts - sed -i "s/default-hostname/$NEW_HOSTNAME/g" /etc/hosts - echo "Hostname set to: $NEW_HOSTNAME" >> $LOG -else - echo "The variable for hostname generation was empty. Cannot set hostname" >> $LOG +#!/usr/bin/env bash +set -euo pipefail + +# Apply this image's native Ubuntu settings after first boot has completed. +config_file="${1:?Usage: install.sh }" +if [[ ! -r "$config_file" ]]; then + printf 'Cannot read cloud config: %s\n' "$config_file" >&2 + exit 1 fi -# -- Configure Custom MOTD -- -# TODO: Turn into function and move to PDS -# vars for custom motd message -MOTD_DIR="/etc/update-motd.d" -BACKUP_DIR="/etc/update-motd.d/backup" -CUSTOM_SCRIPT="${MOTD_DIR}/00-mikeshop" -# Create a backup folder -sudo mkdir -p "$BACKUP_DIR" -# Check if there are files in the MOTD directory, excluding the backup directory, and move them -if ls -A "$MOTD_DIR" | grep -q -v 'backup'; then - echo "Backing up existing MOTD scripts to $BACKUP_DIR..." - sudo mv "$MOTD_DIR"/!(backup) "$BACKUP_DIR"/ -else - echo "No existing MOTD scripts to back up." -fi -# Create a custom neofetch MOTD script -echo "Setting up neofetch as the new MOTD..." -cat <> $LOG - -# ============================================ -# Section: Shell Configuration -# This section will configure ZSH and install required plugins. -# - Install Zi to configure: -# - `powerlevel10k` theme | A fast reimplementation of Powerlevel9k ZSH theme. -# - `zsh-syntax-highlighting` | Fish shell-like syntax highlighting for Zsh. -# - `zsh-autosuggestions` | Fish shell-like autosuggestions for Zsh. -# - `zsh-history-substring-search` | Fish shell-like history substring search for Zsh. -# - `zsh-z` | Jump quickly to directories that you have visited "frecently." -# - `ohmyzsh` | A delightful community-driven (with 1500+ contributors) framework for managing your Zsh configuration. -# - `zsh-autocomplete` | A fast and efficient autocomplete plugin for Zsh. -# - Set Zsh as the Default Shell for All New Users -# - Configure global .zshrc file in /etc/zshrc -# - Configure default file for new users in /etc/skel/.zshrc referencing /etc/zshrc. -# ============================================ - -install_zi -configure_zsh - -# Set Zsh as the Default Shell for All New Users -sudo sed -i 's|^SHELL=.*|SHELL=/bin/zsh|' /etc/default/useradd -# apply to all existing users -#for user in $(awk -F: '{if ($3 >= 1000) print $1}' /etc/passwd); do -# sudo chsh -s /bin/zsh "$user" -#done - -# ============================================ -# Section: Security Hardening -# This section contains various configurations related to security hardening. -# - Disable password authentication and root login -# - Fail2Ban -# - UFW -# - Create system-wide Crontab to auto update system every night at midnight. -# ============================================ -restricted_ssh_security_profile - -configure_admin (){ - # Create the user and set the public key for SSH authentication - echo "==> Creating user and setting up SSH public key..." - sudo useradd -m -s /bin/bash "$USER_NAME" #TODO: change to zsh ? - sudo mkdir -p /home/"$USER_NAME"/.ssh - echo "$SSH_PUBLIC_KEY" | sudo tee /home/"$USER_NAME"/.ssh/authorized_keys - sudo chown -R "$USER_NAME":"$USER_NAME" /home/"$USER_NAME"/.ssh - sudo chmod 700 /home/"$USER_NAME"/.ssh - sudo chmod 600 /home/"$USER_NAME"/.ssh/authorized_keys - # Add the user to the sudo group - echo "==> Adding $USER_NAME to the sudo group..." - sudo usermod -aG sudo "$USER_NAME" - echo "User $USER_NAME created, SSH key added, user added to sudo group." >> $LOG -} -configure_admin - -set_sudo_nopasswd $USER_NAME - -## TODO: Setup Fail2Ban, edit rules in `/etc/fail2ban/jail.local` -#sudo apt install fail2ban -#sudo systemctl enable --now fail2ban -# -## TODO: Enable UFW (Uncomplicated Firewall) -#sudo ufw default deny incoming -#sudo ufw default allow outgoing -#sudo ufw allow 22/tcp # Or custom SSH port -#sudo ufw enable - - -# Create system-wide Crontab to auto update system every night at midnight. imported from ``sysadmin.sh`` -update_system_cron_entry - -# ============================================ -# Section: Tools installation -# This section contains any extra tooling required. -# - kubectl -# ============================================ -install_kubectl - - -# add netplan config to set DHCP on all physical (starting with "en") interfaces ? -# https://www.reddit.com/r/linux4noobs/comments/bcamvx/how_to_use_wildcards_in_netplan_configuration_file/ -cat <&2; exit 1; } +UBUNTU_VERSION="${UBUNTU_VERSION:-noble}" +ARCH="${ARCH:-amd64}" +UBUNTU_IMAGE_RELEASE="${UBUNTU_IMAGE_RELEASE:-current}" +export LIBGUESTFS_BACKEND="${LIBGUESTFS_BACKEND:-direct}" +for value in "$UBUNTU_VERSION" "$ARCH" "$UBUNTU_IMAGE_RELEASE"; do + [[ "$value" =~ ^[a-zA-Z0-9][a-zA-Z0-9.-]*$ ]] || { printf '%s\n' 'Invalid Ubuntu release or architecture.' >&2; exit 1; } +done +for tool in curl sha256sum virt-customize; do + command -v "$tool" >/dev/null || { printf 'Missing required command: %s\n' "$tool" >&2; exit 1; } +done +# mkdir refuses an existing directory. A failed preparation is left for inspection. +mkdir -- "$output_dir" +image_name="${UBUNTU_VERSION}-server-cloudimg-${ARCH}.img" +image_url="https://cloud-images.ubuntu.com/${UBUNTU_VERSION}/${UBUNTU_IMAGE_RELEASE}" +curl -fL --connect-timeout 15 --max-time 300 --retry 2 -o "$output_dir/$image_name" "$image_url/$image_name" +curl -fsSL --connect-timeout 15 --max-time 60 --retry 2 -o "$output_dir/upstream-SHA256SUMS" "$image_url/SHA256SUMS" +awk -v image="$image_name" '$2 == image || $2 == "*" image { print }' "$output_dir/upstream-SHA256SUMS" > "$output_dir/upstream-image.sha256" +[[ -s "$output_dir/upstream-image.sha256" ]] || { printf '%s\n' 'Image checksum was not found.' >&2; exit 1; } +(cd -- "$output_dir" && sha256sum -c upstream-image.sha256) +{ + printf 'source_url=%s/%s\n' "$image_url" "$image_name" + printf 'architecture=%s\n' "$ARCH" + printf 'libguestfs_backend=%s\n' "$LIBGUESTFS_BACKEND" + virt-customize --version +} > "$output_dir/build-info.txt" + +# Customization can generate a machine-id. Clear it before any base is cloned. +virt-customize --network -a "$output_dir/$image_name" --install qemu-guest-agent \ + --run-command ' + set -e + truncate -s 0 /etc/machine-id + rm -f /var/lib/dbus/machine-id + ln -s /etc/machine-id /var/lib/dbus/machine-id + rm -f /etc/ssh/ssh_host_* + test -f /etc/machine-id && test ! -s /etc/machine-id + ' 2>&1 | tee "$output_dir/prepare.log" +mv -- "$output_dir/$image_name" "$output_dir/base.qcow2" +(cd -- "$output_dir" && sha256sum base.qcow2 > base-image.sha256) +printf 'Prepared base-image bundle: %s\n' "$output_dir" diff --git a/packer/ubuntu/scripts/run-recipe.sh b/packer/ubuntu/scripts/run-recipe.sh new file mode 100644 index 0000000..9878f97 --- /dev/null +++ b/packer/ubuntu/scripts/run-recipe.sh @@ -0,0 +1,24 @@ +#!/usr/bin/env bash +# The operator-selected Bash recipe owns PDS selections; cleanup remains separate. +set -euo pipefail + +[[ $# == 3 || $# == 4 ]] || { printf '%s\n' 'Usage: run-recipe.sh [runtime-directory]' >&2; exit 2; } +settings=$1 library=$2 recipe=$3 runtime=${4:-/run/builders} +[[ -r "$recipe" && -r "$library" ]] || { printf '%s\n' 'The recipe or installed PDS library is unreadable.' >&2; exit 1; } +bash -n "$recipe" +export BUILD_MOTD_PRESET BUILD_KUBECTL_CHANNEL +BUILD_MOTD_PRESET=$(jq -er '.motd_preset | strings | select(test("^[a-z0-9][a-z0-9_-]*$"))' "$settings") +BUILD_KUBECTL_CHANNEL=$(jq -er '.kubectl_channel | strings | select(test("^1\\.[0-9]+$"))' "$settings") +mkdir -p "$runtime" +chmod 0700 "$runtime" +rm -f -- "$runtime/ssh-policy.json" +# shellcheck source=ssh-policy-observer.sh +source "$(dirname -- "${BASH_SOURCE[0]}")/ssh-policy-observer.sh" +# shellcheck disable=SC1090 +source "$library" +pds_before_ssh_policy() { builders_capture_ssh_policy "$runtime"; } +policy_before=$(builders_ssh_policy_digest) +printf 'Applying recipe SHA256: %s\n' "$(sha256sum "$recipe" | cut -d ' ' -f1)" +# shellcheck disable=SC1090 +source "$recipe" +builders_check_ssh_policy "$runtime" "$policy_before" diff --git a/packer/ubuntu/scripts/seal-image.sh b/packer/ubuntu/scripts/seal-image.sh new file mode 100644 index 0000000..13a670e --- /dev/null +++ b/packer/ubuntu/scripts/seal-image.sh @@ -0,0 +1,44 @@ +#!/usr/bin/env bash +# Seal the image after all provisioning has finished. Fail if sealing fails. +set -euo pipefail + +if [[ $# -ne 1 || "${1:-}" != --image-build ]]; then + printf '%s\n' 'Usage: seal-image.sh --image-build (disposable build guest only).' >&2 + exit 2 +fi + +# shellcheck source=ssh-policy-observer.sh +source "$(dirname -- "${BASH_SOURCE[0]}")/ssh-policy-observer.sh" +builders_check_ssh_policy /run/builders + +# The build login must not survive in the exported disk. +usermod --password '*' ubuntu +rm -f /home/ubuntu/.ssh/authorized_keys /root/.ssh/authorized_keys +rm -f /etc/ssh/ssh_host_* +# Discard the build's SSH password override and generated network configuration. +# Clone-time cloud-init supplies the deployed machine's access and addressing. +cloud-init clean --logs --seed --configs ssh_config network + +# Early boot can leave a read-only transient ID bind-mounted over this file. +# Commit/unmount it through systemd before clearing the persistent image ID. +systemd-machine-id-setup --commit +truncate -s 0 /etc/machine-id +rm -f /var/lib/dbus/machine-id +ln -s /etc/machine-id /var/lib/dbus/machine-id +printf '%s\n' localhost > /etc/hostname +sed -i '/^127[.]0[.]1[.]1[[:space:]]/d' /etc/hosts + +apt-get clean +rm -rf /var/lib/apt/lists/* +rm -f /var/lib/systemd/random-seed +# Export the journal before truncating logs. No package operations run after policy. +builders_check_ssh_policy /run/builders +find /var/log -type f -exec truncate --size=0 {} \; +# Build homes are workspaces. Shared tools/assets belong in system and skel paths. +for build_home in /root /home/ubuntu; do + find "$build_home" -mindepth 1 -maxdepth 1 \ + ! -name .bashrc ! -name .profile ! -name .bash_logout \ + ! -name .zshrc ! -name .p10k.zsh -exec rm -rf -- {} + +done +rm -rf /tmp/* /var/tmp/* +rm -f /run/builders/ssh-policy.json diff --git a/packer/ubuntu/scripts/ssh-policy-observer.sh b/packer/ubuntu/scripts/ssh-policy-observer.sh new file mode 100644 index 0000000..b829b30 --- /dev/null +++ b/packer/ubuntu/scripts/ssh-policy-observer.sh @@ -0,0 +1,62 @@ +#!/usr/bin/env bash +# Observe the service only when the selected recipe calls the shared SSH policy. +builders_ssh_policy_digest() { + local policy=/etc/ssh/sshd_config.d/00-pds-security.conf digest + if digest=$(sha256sum "$policy" 2>/dev/null); then + printf '%s\n' "$digest" + elif [[ ! -e "$policy" ]]; then + printf '%s\n' absent + else + return 1 + fi +} + +builders_capture_ssh_policy() { + local runtime="$1" snapshot cursor headers directories + [[ ! -f "$runtime/ssh-policy.json" ]] || return 0 + systemctl is-active --quiet ssh.service || return 1 + snapshot=$(systemctl show ssh.service --property=MainPID --property=ActiveEnterTimestampMonotonic --property=ExecMainStartTimestampMonotonic) || return 1 + grep -Eq '^MainPID=[1-9][0-9]*$' <<< "$snapshot" || return 1 + cursor=$(journalctl -u ssh.service -n 1 --show-cursor --no-pager | sed -n 's/^-- cursor: //p') || return 1 + [[ -n "$cursor" ]] || { printf '%s\n' 'Cannot capture the SSH journal cursor.' >&2; return 1; } + # journalctl normally locates files using /etc/machine-id. Sealing clears + # that identity, so retain the actual directories before it changes. + headers=$(LC_ALL=C journalctl --header --no-pager) || return 1 + directories=$(sed -nE 's#^[[:space:]]*File path:[[:space:]]*(/(var|run)/log/journal/[a-f0-9]{32})/[^/]*$#\1#p' <<< "$headers" | + jq -Rsc 'split("\n") | map(select(length > 0)) | unique') || return 1 + jq -e 'length > 0' <<< "$directories" >/dev/null || { printf '%s\n' 'Cannot locate the SSH journal files.' >&2; return 1; } + jq -n --arg snapshot "$snapshot" --arg cursor "$cursor" --argjson directories "$directories" \ + '{snapshot: $snapshot, cursor: $cursor, directories: $directories}' > "$runtime/ssh-policy.json" +} + +builders_check_ssh_policy() { + local runtime="$1" expected actual cursor journal directories directory cursor_entry + local files=() + if [[ ! -f "$runtime/ssh-policy.json" ]]; then + if [[ $# == 2 && "$2" != "$(builders_ssh_policy_digest)" ]]; then + printf '%s\n' 'Selected policy changed without SSH service evidence.' >&2 + return 1 + fi + return 0 + fi + expected=$(jq -er '.snapshot' "$runtime/ssh-policy.json") || return 1 + actual=$(systemctl show ssh.service --property=MainPID --property=ActiveEnterTimestampMonotonic --property=ExecMainStartTimestampMonotonic) || return 1 + if [[ "$expected" != "$actual" ]]; then + printf '%s\n' 'SSH service restarted after the selected policy was configured.' >&2 + return 1 + fi + cursor=$(jq -er '.cursor' "$runtime/ssh-policy.json") || return 1 + directories=$(jq -er '.directories[]' "$runtime/ssh-policy.json") || return 1 + while IFS= read -r directory; do files+=("--file=$directory/*.journal*"); done <<< "$directories" + cursor_entry=$(LC_ALL=C journalctl "${files[@]}" -u ssh.service --cursor="$cursor" --reverse --lines=1 --show-cursor --no-pager) || return 1 + if ! grep -Fxq -- "-- cursor: $cursor" <<< "$cursor_entry"; then + printf '%s\n' 'The captured SSH journal entry is unavailable; cannot verify this interval.' >&2 + return 1 + fi + journal=$(LC_ALL=C journalctl "${files[@]}" -u ssh.service --after-cursor="$cursor" --no-pager) || return 1 + printf 'SSH service evidence since policy selection:\n%s\n%s\n' "$actual" "$journal" + if grep -Eiq 'reload|restart|Starting |Stopping |Stopped |Started ' <<< "$journal"; then + printf '%s\n' 'SSH service activation changed after policy selection; move service operations before that call.' >&2 + return 1 + fi +} diff --git a/packer/ubuntu/scripts/wait-cloud-init.sh b/packer/ubuntu/scripts/wait-cloud-init.sh new file mode 100644 index 0000000..c41e2e7 --- /dev/null +++ b/packer/ubuntu/scripts/wait-cloud-init.sh @@ -0,0 +1,29 @@ +#!/usr/bin/env bash +# Wait for first boot; accept completed boots with deprecation notices only. +set -euo pipefail + +command -v jq >/dev/null || { printf '%s\n' 'Missing required command: jq' >&2; exit 1; } + +status_code=0 +state=$(cloud-init status --wait --format=json) || status_code=$? +printf '%s\n' "$state" +case "$status_code" in + 0|2) ;; + *) exit "$status_code" ;; +esac + +if ! jq -e -s --argjson code "$status_code" ' + length == 1 and (.[0] | + .status == "done" + and (.errors | type == "array" and length == 0) + and (.recoverable_errors | type == "object") + and ((.recoverable_errors | keys) == ["DEPRECATED"] + or ($code == 0 and (.recoverable_errors | length) == 0))) +' >/dev/null <<<"$state"; then + printf '%s\n' 'cloud-init did not report a clean or deprecation-only completed boot.' >&2 + exit 1 +fi + +if (( status_code == 2 )); then + printf '%s\n' 'cloud-init completed with datasource deprecation notices; continuing.' +fi diff --git a/packer/ubuntu/scripts/zshrc b/packer/ubuntu/scripts/zshrc deleted file mode 100644 index f51f239..0000000 --- a/packer/ubuntu/scripts/zshrc +++ /dev/null @@ -1,53 +0,0 @@ -source /usr/local/share/zi/zi.zsh - -# --- Theme stuff --- -# Enable Powerlevel10k instant prompt. Should stay close to the top of ~/.zshrc. -# Initialization code that may require console input (password prompts, [y/n] -# confirmations, etc.) must go above this block; everything else may go below. -if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then - source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" -fi - -zi light romkatv/powerlevel10k - -# To customize prompt, run `p10k configure` or edit ~/.p10k.zsh. -[[ ! -f /etc/.p10k.zsh ]] || source /etc/.p10k.zsh - -### --- Plugins --- -zi light zsh-users/zsh-syntax-highlighting -zi light zsh-users/zsh-autosuggestions -zi light zsh-users/zsh-history-substring-search -zi light agkozak/zsh-z - -# Installs stuff in ~/zi/plugins that needs to be manually sourced. -zi light ohmyzsh/ohmyzsh -zi snippet OMZP::docker -zi snippet OMZP::history -source "$HOME/.zi/plugins/ohmyzsh---ohmyzsh/plugins/git/git.plugin.zsh" - -zi light marlonrichert/zsh-autocomplete -zstyle ':autocomplete:*' default-context history-incremental-search-backward -zstyle ':autocomplete:*' min-input 1 -setopt HIST_FIND_NO_DUPS - -# --- Enable kubectl autocompletion for zsh --- -#autoload -Uz compinit && compinit # zi enables this automatically. -if command -v kubectl >/dev/null 2>&1; then - # shellcheck disable=SC1090 - source <(kubectl completion zsh) 2>/dev/null || true - # alias + auto complete for alias - alias k='kubectl' - compdef __start_kubectl k - alias knr='kubectl get pods --field-selector=status.phase!=Running' -fi - - - - -# --- Various --- -# neofetch - - -# TODO: remove this once apt package is implemented -# auto source install scripts -source <(curl -fsSL https://raw.githubusercontent.com/michielvha/PDS/main/bash/module/install.sh) \ No newline at end of file diff --git a/packer/ubuntu/tests/test_artifact_checks.py b/packer/ubuntu/tests/test_artifact_checks.py new file mode 100644 index 0000000..cef860f --- /dev/null +++ b/packer/ubuntu/tests/test_artifact_checks.py @@ -0,0 +1,142 @@ +"""Negative image checks use read-only tool fixtures; never mount a real disk here.""" +import json +import os +from pathlib import Path +import subprocess +import tempfile +import unittest + +SCRIPTS = Path(__file__).resolve().parents[1] / 'scripts' + + +class ArtifactChecks(unittest.TestCase): + def check_image(self, *, mode='default', changed=None, present=(), missing=(), + residue=(), cache_entries=(), expected_source='candidate', launch_fails=False): + with tempfile.TemporaryDirectory() as tmp: + root = Path(tmp) + image = root / 'image.qcow2' + image.write_bytes(b'fixture') + files = { + '/etc/machine-id': '', '/etc/hostname': 'localhost\n', + '/etc/shadow': 'ubuntu:*:0:0:99999:7:::\n', + '/etc/skel/.zshrc': 'source /etc/zshrc\n', + '/etc/skel/.p10k.zsh': '# shared preset\n', + '/root/.sudo_as_admin_successful': '', + '/root/.cache/motd.legal-displayed': '', + '/var/lib/builders/pds.json': json.dumps(dict(package='pds', version='1.0.0', source='candidate')), + '/etc/ssh/sshd_config.d/00-pds-security.conf': + 'PasswordAuthentication no\nKbdInteractiveAuthentication no\nPubkeyAuthentication yes\nPermitRootLogin no\n', + '/etc/cron.d/pds-update': '0 0 * * * root /usr/local/sbin/pds-update >> /var/log/pds-update.log 2>&1\n', + } + exists = ['/etc/update-motd.d/90-pds', *present] + if mode == 'default': + exists += ['/etc/ssh/sshd_config.d/00-pds-security.conf', '/etc/cron.d/pds-update'] + files.update(changed or {}) + for path in missing: + files.pop(path, None) + fixture = root / 'fixture.json' + fixture.write_text(json.dumps(dict(files=files, exists=exists, residue=list(residue), + cache_entries=list(cache_entries)))) + stub = '''#!/usr/bin/env python3 +import json, os, sys +from pathlib import Path +with Path(os.environ['TEST_TOOL_LOG']).open('a') as log: log.write(json.dumps(sys.argv) + '\\n') +fixture=json.loads(Path(os.environ['TEST_FIXTURE']).read_text()) +name=Path(sys.argv[0]).name +if name == 'qemu-img': print('{"format":"qcow2"}') +elif name == 'guestfish': + if '--listen' in sys.argv: + if os.environ.get('TEST_LAUNCH_FAIL') == '1': sys.exit(74) + print('GUESTFISH_PID=12345; export GUESTFISH_PID') + elif sys.argv[-1] == 'exit': pass + elif 'cat' in sys.argv: + if sys.argv[-1] not in fixture['files']: sys.exit(1) + print(fixture['files'][sys.argv[-1]], end='') + elif 'ls' in sys.argv: + values = fixture['residue'] if sys.argv[-1] == '/root' else fixture['cache_entries'] if sys.argv[-1] == '/root/.cache' else [] + print('\\n'.join(values)) + elif 'glob-expand' in sys.argv: + print(' '.join(p for p in fixture['exists'] if p.startswith('/etc/ssh/ssh_host_'))) + else: print('true' if sys.argv[-1] in fixture['exists'] else 'false') +elif name == 'virt-cat': + if sys.argv[-1] not in fixture['files']: sys.exit(1) + print(fixture['files'][sys.argv[-1]], end='') +''' + for name in ('qemu-img', 'guestfish', 'virt-cat'): + command = root / name + command.write_text(stub) + command.chmod(0o755) + result = subprocess.run(['bash', str(SCRIPTS / 'check-image.sh'), str(image), mode, '1.0.0', expected_source], + text=True, capture_output=True, timeout=15, + env={**os.environ, 'PATH': f'{root}:/usr/bin:/bin', 'TEST_FIXTURE': str(fixture), + 'TEST_TOOL_LOG': str(root / 'tool-calls'), + 'TEST_LAUNCH_FAIL': '1' if launch_fails else '0'}) + result.tool_calls = [json.loads(line) for line in (root / 'tool-calls').read_text().splitlines()] + return result + + def test_default_and_custom_sealed_artifacts_pass(self): + for mode in ('default', 'custom'): + result = self.check_image(mode=mode) + self.assertEqual(result.returncode, 0, result.stderr) + result = self.check_image(residue=('.bashrc', '.profile', '.sudo_as_admin_successful', '.cache'), + cache_entries=('motd.legal-displayed',)) + self.assertEqual(result.returncode, 0, result.stderr) + + def test_machine_identity_build_access_and_wrong_package_fail(self): + for changed, present in [({'/etc/machine-id': 'baked-id'}, ()), + ({'/etc/shadow': 'ubuntu:build-password:0:0:99999:7:::\n'}, ()), + ({'/var/lib/builders/pds.json': '{"package":"pds","version":"wrong"}'}, ()), + ({}, ('/root/.ssh/authorized_keys',)), + ({}, ('/etc/ssh/ssh_host_ed25519_key',)), + ({'/etc/skel/.zshrc': 'source /root/.zshrc'}, ()), + ({}, ('/var/lib/cloud/seed',)), + ({}, ('/etc/ssh/sshd_config.d/50-cloud-init.conf',))]: + with self.subTest(changed=changed, present=present): + self.assertNotEqual(self.check_image(changed=changed, present=present).returncode, 0) + + def test_cloud_init_network_and_instance_state_fail_offline_inspection(self): + for path in ('/etc/netplan/50-cloud-init.yaml', '/var/lib/cloud/instance', + '/var/lib/cloud/instances'): + with self.subTest(path=path): + self.assertNotEqual(self.check_image(present=(path,)).returncode, 0) + + def test_wrong_policy_or_custom_policy_leak_fails(self): + self.assertNotEqual(self.check_image(changed={ + '/etc/ssh/sshd_config.d/00-pds-security.conf': 'PasswordAuthentication yes\n'}).returncode, 0) + self.assertNotEqual(self.check_image(mode='custom', present=('/etc/cron.d/pds-update',)).returncode, 0) + + def test_missing_identity_evidence_and_unexpected_home_state_fail(self): + self.assertNotEqual(self.check_image(missing=('/etc/machine-id',)).returncode, 0) + for residue in ('.config', '.kube', '.krew', '.zsh_history', '.gitconfig'): + with self.subTest(residue=residue): + self.assertNotEqual(self.check_image(residue=(residue,)).returncode, 0) + self.assertNotEqual(self.check_image(residue=('.cache',), cache_entries=('private-build-cache',)).returncode, 0) + + def test_candidate_cannot_pass_a_signed_release_check(self): + self.assertNotEqual(self.check_image(expected_source='signed-repository').returncode, 0) + metadata = json.dumps(dict(package='pds', version='1.0.0', source='signed-repository')) + result = self.check_image(expected_source='signed-repository', changed={ + '/var/lib/builders/pds.json': metadata}) + self.assertEqual(result.returncode, 0, result.stderr) + + def test_one_read_only_session_is_closed_on_success_and_failure(self): + for changed in (None, {'/etc/machine-id': 'baked-id'}): + result = self.check_image(changed=changed) + calls = [call for call in result.tool_calls if Path(call[0]).name == 'guestfish'] + self.assertEqual(sum('--listen' in call for call in calls), 1) + self.assertIn('--ro', calls[0]) + self.assertEqual(calls[-1][-1], 'exit') + self.assertTrue(all('--remote=12345' in call for call in calls[1:])) + self.assertFalse(any(Path(call[0]).name == 'virt-cat' for call in result.tool_calls)) + result = self.check_image(launch_fails=True) + self.assertEqual(result.returncode, 74) + self.assertFalse(any('--remote=12345' in call for call in result.tool_calls)) + + def test_fresh_instance_check_exists_and_rejects_unknown_recipe(self): + result = subprocess.run(['bash', str(SCRIPTS / 'check-instance.sh'), 'unknown'], + text=True, capture_output=True, timeout=15) + self.assertEqual(result.returncode, 2, result.stderr) + + +if __name__ == '__main__': + unittest.main() diff --git a/packer/ubuntu/tests/test_base_template.py b/packer/ubuntu/tests/test_base_template.py new file mode 100644 index 0000000..5b780e0 --- /dev/null +++ b/packer/ubuntu/tests/test_base_template.py @@ -0,0 +1,238 @@ +"""Exercise the bootstrap's refusal paths with command stubs; never access Proxmox.""" +import os +import hashlib +from pathlib import Path +import subprocess +import tempfile +import unittest + +SCRIPT = Path(__file__).resolve().parents[1] / 'scripts/create-base-template.sh' + + +class BaseTemplateSafety(unittest.TestCase): + def run_script(self, vmid=None, available=True, host='root@pve-test', image=None, + allocation='/var/tmp/builders-base.testing1', allocation_status=0, + upload_status=0, cleanup_status=0): + with tempfile.TemporaryDirectory() as tmp: + directory = Path(tmp) + calls = directory / 'calls' + for command in ('qm', 'curl', 'virt-customize', 'pvesh', 'ssh'): + stub = directory / command + stub.write_text('#!/bin/bash\n' + 'printf "%s %s\\n" "${0##*/}" "$*" >> "$CALLS"\n' + 'if [[ "$*" == *--check* || "${0##*/}" == pvesh ]]; then exit "$AVAILABLE"; fi\n' + 'if [[ "$*" == *mktemp* ]]; then printf "%s\\n" "$ALLOCATION"; exit "$ALLOCATION_STATUS"; fi\n' + 'if [[ "$*" == *"cat >"* ]]; then exit "$UPLOAD_STATUS"; fi\n' + 'if [[ "$*" == *"rm -rf"* ]]; then exit "$CLEANUP_STATUS"; fi\n') + stub.chmod(0o755) + env = {**os.environ, 'PATH': f'{directory}:/usr/bin:/bin', + 'CALLS': str(calls), 'AVAILABLE': '0' if available else '1', + 'ALLOCATION': allocation, 'ALLOCATION_STATUS': str(allocation_status), + 'UPLOAD_STATUS': str(upload_status), 'CLEANUP_STATUS': str(cleanup_status)} + env.pop('BASE_VMID', None) + env.pop('PVE_HOST', None) + env.pop('BASE_IMAGE_DIR', None) + if host is not None: + env['PVE_HOST'] = host + if image is not None: + env['BASE_IMAGE_DIR'] = str(image) + if vmid is not None: + env['BASE_VMID'] = str(vmid) + result = subprocess.run(['bash', str(SCRIPT)], env=env, + capture_output=True, text=True, timeout=10) + return result, calls.read_text() if calls.exists() else '' + + def test_requires_explicit_id(self): + result, calls = self.run_script() + self.assertNotEqual(result.returncode, 0) + self.assertEqual(calls, '') + + def test_rejects_invalid_id(self): + for vmid in ('0', '99', 'not-an-id', '100; echo unsafe'): + with self.subTest(vmid=vmid): + result, calls = self.run_script(vmid) + self.assertNotEqual(result.returncode, 0) + self.assertEqual(calls, '') + + def test_refuses_used_id_without_download_or_delete(self): + result, calls = self.run_script(100, available=False) + self.assertNotEqual(result.returncode, 0) + self.assertIn('--check 100', calls) + self.assertNotIn('qm ', calls) + self.assertNotIn('curl ', calls) + self.assertNotIn('virt-customize ', calls) + + def test_requires_remote_host(self): + result, calls = self.run_script(9000, host=None) + self.assertNotEqual(result.returncode, 0) + self.assertIn('PVE_HOST', result.stderr) + self.assertEqual(calls, '') + + def test_rejects_corrupt_recovery_bundle_before_upload(self): + with tempfile.TemporaryDirectory() as tmp: + directory = Path(tmp) + (directory / 'base.qcow2').write_bytes(b'changed image') + (directory / 'base-image.sha256').write_text('0' * 64 + ' base.qcow2\n') + result, calls = self.run_script(9000, image=directory) + self.assertNotEqual(result.returncode, 0) + self.assertNotIn('cat >', calls) + self.assertNotIn('--import', calls) + + def test_reuses_verified_bundle_without_preparing_an_image(self): + with tempfile.TemporaryDirectory(prefix='recovery bundle ') as tmp: + directory = Path(tmp) + image = b'verified recovery fixture' + (directory / 'base.qcow2').write_bytes(image) + (directory / 'base-image.sha256').write_text( + hashlib.sha256(image).hexdigest() + ' base.qcow2\n') + result, calls = self.run_script(9000, image=directory) + self.assertEqual(result.returncode, 0, result.stderr) + self.assertIn('--import 9000', calls) + self.assertNotIn('virt-customize ', calls) + self.assertNotIn('curl ', calls) + + def test_failed_allocation_never_cleans_an_unvalidated_path(self): + with tempfile.TemporaryDirectory() as tmp: + directory = Path(tmp) + image = b'verified fixture' + (directory / 'base.qcow2').write_bytes(image) + (directory / 'base-image.sha256').write_text( + hashlib.sha256(image).hexdigest() + ' base.qcow2\n') + result, calls = self.run_script(9000, image=directory, + allocation='/untrusted-output', allocation_status=1) + self.assertNotEqual(result.returncode, 0) + self.assertNotIn('rm -rf', calls) + self.assertNotIn('cat >', calls) + + def test_failed_upload_cleans_only_its_staging_directory(self): + with tempfile.TemporaryDirectory() as tmp: + directory = Path(tmp) + image = b'verified fixture' + (directory / 'base.qcow2').write_bytes(image) + (directory / 'base-image.sha256').write_text( + hashlib.sha256(image).hexdigest() + ' base.qcow2\n') + result, calls = self.run_script(9000, image=directory, upload_status=1) + self.assertNotEqual(result.returncode, 0) + self.assertIn("rm -rf -- '/var/tmp/builders-base.testing1'", calls) + self.assertNotIn('--import', calls) + + def test_reports_failed_cleanup_instead_of_succeeding(self): + with tempfile.TemporaryDirectory() as tmp: + directory = Path(tmp) + image = b'verified fixture' + (directory / 'base.qcow2').write_bytes(image) + (directory / 'base-image.sha256').write_text( + hashlib.sha256(image).hexdigest() + ' base.qcow2\n') + result, _ = self.run_script(9000, image=directory, cleanup_status=1) + self.assertNotEqual(result.returncode, 0) + self.assertIn('/var/tmp/builders-base.testing1', result.stderr) + + def test_refuses_a_partial_bundle_before_upload(self): + with tempfile.TemporaryDirectory() as tmp: + directory = Path(tmp) + (directory / 'base.qcow2').write_bytes(b'incomplete preparation') + result, calls = self.run_script(9000, image=directory) + self.assertNotEqual(result.returncode, 0) + self.assertNotIn('cat >', calls) + self.assertNotIn('--import', calls) + + +class RemoteImportSafety(unittest.TestCase): + def run_import(self, available=True, corrupt=False, disk_size='32G'): + with tempfile.TemporaryDirectory() as tmp: + directory = Path(tmp) + calls = directory / 'calls' + subprocess.run(['qemu-img', 'create', '-f', 'qcow2', + str(directory / 'base.qcow2'), '4M'], check=True, capture_output=True) + image = (directory / 'base.qcow2').read_bytes() + digest = '0' * 64 if corrupt else hashlib.sha256(image).hexdigest() + (directory / 'base-image.sha256').write_text(digest + ' base.qcow2\n') + for command in ('pvesh', 'qm'): + stub = directory / command + stub.write_text('#!/bin/bash\n' + 'printf "%s %s\\n" "${0##*/}" "$*" >> "$CALLS"\n' + 'if [[ "${0##*/}" == pvesh ]]; then exit "$AVAILABLE"; fi\n' + 'if [[ "$1" == config ]]; then echo "unused0: local-lvm:vm-9000-disk-0"; fi\n') + stub.chmod(0o755) + env = {**os.environ, 'PATH': f'{directory}:/usr/bin:/bin', + 'CALLS': str(calls), 'AVAILABLE': '0' if available else '1'} + result = subprocess.run( + ['bash', str(SCRIPT.with_name('import-base-template.sh')), '--import', + '9000', str(directory), 'base-fixture', 'local-lvm', 'vmbr0', disk_size], + env=env, capture_output=True, text=True, timeout=10, + ) + return result, calls.read_text() if calls.exists() else '' + + def test_rechecks_id_before_creating_any_vm(self): + result, calls = self.run_import(available=False) + self.assertNotEqual(result.returncode, 0) + self.assertNotIn('qm ', calls) + + def test_rejects_upload_corruption_before_creating_any_vm(self): + result, calls = self.run_import(corrupt=True) + self.assertNotEqual(result.returncode, 0) + self.assertNotIn('qm ', calls) + + def test_imports_verified_disk_as_a_cloud_init_template(self): + result, calls = self.run_import() + self.assertEqual(result.returncode, 0, result.stderr) + self.assertIn('qm create 9000', calls) + self.assertIn('--ide2 local-lvm:cloudinit', calls) + self.assertTrue(calls.endswith('qm template 9000\n')) + self.assertNotIn('destroy', calls) + + def test_refuses_disk_shrink_before_creating_any_vm(self): + result, calls = self.run_import(disk_size='1M') + self.assertNotEqual(result.returncode, 0) + self.assertNotIn('qm ', calls) + + +class BaseImagePreparationSafety(unittest.TestCase): + def run_prepare(self, existing): + with tempfile.TemporaryDirectory() as tmp: + directory = Path(tmp) + target = directory / 'base bundle' + calls = directory / 'calls' + if existing: + target.mkdir() + (target / 'sentinel').write_text('keep existing artifact') + curl = directory / 'curl' + curl.write_text('''#!/bin/bash +printf 'curl\\n' >> "$CALLS" +url="${!#}" +while [[ $# -gt 0 ]]; do + if [[ "$1" == -o ]]; then output="$2"; shift 2; else shift; fi +done +if [[ "$url" == */SHA256SUMS ]]; then + printf '%064d noble-server-cloudimg-amd64.img\\n' 0 > "$output" +else + printf 'download fixture' > "$output" +fi +''') + curl.chmod(0o755) + customize = directory / 'virt-customize' + customize.write_text('#!/bin/bash\nprintf "customize\\n" >> "$CALLS"\n') + customize.chmod(0o755) + env = {**os.environ, 'PATH': f'{directory}:/usr/bin:/bin', 'CALLS': str(calls)} + result = subprocess.run( + ['bash', str(SCRIPT.with_name('prepare-base-image.sh')), str(target)], + env=env, capture_output=True, text=True, timeout=10, + ) + logged = calls.read_text() if calls.exists() else '' + sentinel = (target / 'sentinel').read_text() if existing else None + return result, logged, sentinel + + def test_existing_bundle_is_never_overwritten(self): + result, calls, sentinel = self.run_prepare(existing=True) + self.assertNotEqual(result.returncode, 0) + self.assertEqual(calls, '') + self.assertEqual(sentinel, 'keep existing artifact') + + def test_upstream_checksum_failure_prevents_customization(self): + result, calls, _ = self.run_prepare(existing=False) + self.assertNotEqual(result.returncode, 0) + self.assertNotIn('customize', calls) + + +if __name__ == '__main__': + unittest.main(verbosity=2) diff --git a/packer/ubuntu/tests/test_cloud_init_status.py b/packer/ubuntu/tests/test_cloud_init_status.py new file mode 100644 index 0000000..7e42898 --- /dev/null +++ b/packer/ubuntu/tests/test_cloud_init_status.py @@ -0,0 +1,106 @@ +"""Do not confuse datasource deprecations with a failed first boot.""" +import json +import os +from pathlib import Path +import subprocess +import tempfile +import unittest + +SCRIPT = Path(__file__).resolve().parents[1] / 'scripts/wait-cloud-init.sh' + + +class CloudInitReadiness(unittest.TestCase): + def wait(self, code, state, raw=False): + with tempfile.TemporaryDirectory() as tmp: + stub = Path(tmp) / 'cloud-init' + calls = Path(tmp) / 'calls' + stub.write_text('''#!/usr/bin/env python3 +import json, os, sys +with open(os.environ['TEST_CALLS'], 'a') as log: + log.write(json.dumps(sys.argv[1:]) + '\\n') +if sys.argv[1] == 'status': + print(os.environ['TEST_STATE']) + sys.exit(int(os.environ['TEST_CODE'])) +''') + stub.chmod(0o755) + env = { + **os.environ, + 'PATH': f'{tmp}:/usr/bin:/bin', + 'TEST_CALLS': str(calls), + 'TEST_STATE': state if raw else json.dumps(state), + 'TEST_CODE': str(code), + } + result = subprocess.run( + ['bash', str(SCRIPT)], env=env, capture_output=True, + text=True, timeout=10, + ) + commands = [json.loads(line) for line in calls.read_text().splitlines()] + return result, commands + + def test_accepts_clean_boot(self): + result, calls = self.wait(0, { + 'status': 'done', 'errors': [], 'recoverable_errors': {}, + }) + self.assertEqual(result.returncode, 0, result.stderr) + self.assertEqual(len(calls), 1) + + def test_accepts_deprecation_only_boot(self): + result, calls = self.wait(2, { + 'status': 'done', 'errors': [], + 'recoverable_errors': {'DEPRECATED': ["Use 'users' list instead."]}, + }) + self.assertEqual(result.returncode, 0, result.stderr) + self.assertEqual(len(calls), 1) + self.assertIn('deprecation', result.stdout.lower()) + + def test_rejects_other_recoverable_errors(self): + for errors in ( + {'WARNING': ['Package installation failed.']}, + {'DEPRECATED': ['Old input.'], 'WARNING': ['Package installation failed.']}, + {}, + ): + with self.subTest(errors=errors): + result, calls = self.wait(2, { + 'status': 'done', 'errors': [], 'recoverable_errors': errors, + }) + self.assertNotEqual(result.returncode, 0) + self.assertEqual(len(calls), 1) + + def test_rejects_fatal_boot_error(self): + result, calls = self.wait(1, { + 'status': 'error', 'errors': ['Failed to configure the guest.'], + 'recoverable_errors': {}, + }) + self.assertNotEqual(result.returncode, 0) + self.assertEqual(len(calls), 1) + + def test_rejects_warnings_even_with_success_exit_code(self): + result, calls = self.wait(0, { + 'status': 'done', 'errors': [], + 'recoverable_errors': {'WARNING': ['Incomplete configuration.']}, + }) + self.assertNotEqual(result.returncode, 0) + self.assertEqual(len(calls), 1) + + def test_rejects_incomplete_or_invalid_result(self): + for state in ( + {'status': 'done'}, + {'status': 'running', 'errors': [], 'recoverable_errors': {}}, + {'status': 'done', 'errors': {}, 'recoverable_errors': {}}, + {'status': 'done', 'errors': [], 'recoverable_errors': []}, + 'invalid result', + ): + with self.subTest(state=state): + result, calls = self.wait(0, state) + self.assertNotEqual(result.returncode, 0) + self.assertEqual(len(calls), 1) + + def test_rejects_multiple_status_results(self): + state = {'status': 'done', 'errors': [], 'recoverable_errors': {}} + result, calls = self.wait(0, json.dumps(state) + '\n' + json.dumps(state), raw=True) + self.assertNotEqual(result.returncode, 0) + self.assertEqual(len(calls), 1) + + +if __name__ == '__main__': + unittest.main(verbosity=2) diff --git a/packer/ubuntu/tests/test_image_steps.py b/packer/ubuntu/tests/test_image_steps.py new file mode 100644 index 0000000..1dadd69 --- /dev/null +++ b/packer/ubuntu/tests/test_image_steps.py @@ -0,0 +1,91 @@ +"""Check image-step inputs and refusal of accidental sealing without host writes.""" +import json +import os +import shutil +from pathlib import Path +import subprocess +import tempfile +import unittest + +SCRIPTS = Path(__file__).resolve().parents[1] / 'scripts' + + +class ImageSteps(unittest.TestCase): + def test_unreadable_recipe_is_rejected_before_building(self): + if os.geteuid() == 0: + self.skipTest('Root can read a mode-000 fixture; use an unprivileged caller.') + packer = shutil.which(os.environ.get('PACKER', 'packer')) + if not packer: + self.skipTest('Packer is required for the real input-validation check.') + with tempfile.TemporaryDirectory() as tmp: + recipe = Path(tmp) / 'recipe.sh' + recipe.write_text('#!/usr/bin/env bash\n:\n') + recipe.chmod(0) + try: + result = subprocess.run( + [packer, 'validate', '-only=qemu.ubuntu', + '-var', f'provisioning_recipe={recipe}', '.'], + cwd=SCRIPTS.parent, text=True, capture_output=True, timeout=60, + ) + finally: + recipe.chmod(0o600) + self.assertNotEqual(result.returncode, 0) + self.assertIn('readable Bash recipe', result.stdout + result.stderr) + + def test_install_uses_the_supplied_config(self): + with tempfile.TemporaryDirectory() as tmp: + directory = Path(tmp) + config = directory / 'selected image.yaml' + config.write_text('#cloud-config\npackages: [git]\n') + calls = directory / 'calls' + stub = directory / 'cloud-init' + stub.write_text('''#!/usr/bin/env python3 +import json, os, sys +with open(os.environ['TEST_CALLS'], 'a') as log: + log.write(json.dumps(sys.argv[1:]) + '\\n') +''') + stub.chmod(0o755) + apt = directory / 'apt-get' + apt.write_text('#!/bin/bash\nexit 0\n') + apt.chmod(0o755) + env = {**os.environ, 'PATH': f'{directory}:/usr/bin:/bin', 'TEST_CALLS': str(calls)} + for args in ([], [str(directory / 'missing.yaml')]): + with self.subTest(args=args): + result = subprocess.run( + ['bash', str(SCRIPTS / 'install.sh'), *args], + env=env, capture_output=True, timeout=10, + ) + self.assertNotEqual(result.returncode, 0) + self.assertFalse(calls.exists()) + subprocess.run( + ['bash', str(SCRIPTS / 'install.sh'), str(config)], + env=env, check=True, capture_output=True, timeout=10, + ) + commands = [json.loads(line) for line in calls.read_text().splitlines()] + self.assertTrue(commands) + for command in commands: + self.assertEqual(command[0], 'single') + self.assertEqual(command[command.index('--file') + 1], str(config)) + + def test_sealing_requires_an_explicit_image_build_flag(self): + with tempfile.TemporaryDirectory() as tmp: + directory = Path(tmp) + calls = directory / 'calls' + # If the guard regresses, intercept mutations and fail immediately. + for name in ('usermod', 'rm', 'cloud-init', 'truncate', 'ln', 'sed', 'apt-get', 'find'): + stub = directory / name + stub.write_text('#!/bin/bash\nprintf "%s\\n" "$0" >> "$TEST_CALLS"\nexit 91\n') + stub.chmod(0o755) + env = {**os.environ, 'PATH': f'{directory}:/usr/bin:/bin', 'TEST_CALLS': str(calls)} + for args in ([], ['--normal-install'], ['--image-build', 'unexpected']): + with self.subTest(args=args): + result = subprocess.run( + ['bash', str(SCRIPTS / 'seal-image.sh'), *args], + env=env, capture_output=True, timeout=10, + ) + self.assertEqual(result.returncode, 2) + self.assertFalse(calls.exists()) + + +if __name__ == '__main__': + unittest.main(verbosity=2) diff --git a/packer/ubuntu/tests/test_pds_provisioning.py b/packer/ubuntu/tests/test_pds_provisioning.py new file mode 100644 index 0000000..6c8131a --- /dev/null +++ b/packer/ubuntu/tests/test_pds_provisioning.py @@ -0,0 +1,170 @@ +"""Exercise package refusals and recipe execution without host or VM mutations.""" +import hashlib +import json +import os +from pathlib import Path +import subprocess +import tempfile +import unittest + +UBUNTU = Path(__file__).resolve().parents[1] +SCRIPTS = UBUNTU / 'scripts' +FINGERPRINT = '37C7D029C0FE4DB0E66E5F72AFA1101D94CBF301' + + +class PdsProvisioning(unittest.TestCase): + def setUp(self): + self.tmp = tempfile.TemporaryDirectory() + self.addCleanup(self.tmp.cleanup) + self.root = Path(self.tmp.name) + self.calls = self.root / 'calls' + self.settings = self.root / 'settings.json' + self.inputs = self.root / 'inputs' + self.inputs.mkdir() + (self.inputs / 'repository-key.asc').write_text('fixture-public-key\n') + (self.inputs / 'candidate.deb').write_bytes(b'fixture-deb') + self.values = dict(version='1.0.0', repository='https://example.test/apt/', + key_fingerprint=FINGERPRINT, + candidate_sha256=hashlib.sha256(b'fixture-deb').hexdigest(), + motd_preset='vhco', kubectl_channel='1.37') + self.lib = self.root / 'init.sh' + self.lib.write_text('''record() { printf '%s\\n' "$*" >> "$TEST_CALLS"; } +install_zi() { record zi; } +configure_zsh() { record zsh; } +setup_motd_preset() { record "motd $*"; } +install_gh() { record gh; } +install_kubectl() { record "kubectl $*"; } +update_system_cron_entry() { record updates; } +restricted_ssh_security_profile() { pds_before_ssh_policy; record ssh; } +''') + self.env = {**os.environ, 'PATH': f'{self.root}:/usr/bin:/bin', + 'TEST_CALLS': str(self.calls), 'TEST_FINGERPRINT': FINGERPRINT, + 'TEST_PACKAGE': 'pds', 'TEST_VERSION': '1.0.0', + 'TEST_INSTALLED_VERSION': '1.0.0', 'TEST_PID': '123'} + self.stub('apt-get', 'printf "apt %s\\n" "$*" >> "$TEST_CALLS"') + self.stub('dpkg', 'echo amd64') + self.stub('install', 'printf "install %s\\n" "$*" >> "$TEST_CALLS"') + self.stub('dpkg-deb', '''case "${@: -1}" in +Package) echo "$TEST_PACKAGE";; Version) echo "$TEST_VERSION";; Architecture) echo all;; esac''') + self.stub('dpkg-query', '''printf 'install ok installed\\t%s\\tall\\n' "$TEST_INSTALLED_VERSION"''') + self.stub('gpg', '''if [[ "$*" == *--show-keys* ]]; then +printf 'pub::::::::::\\nfpr:::::::::%s:\\n' "$TEST_FINGERPRINT" +else while [[ $# -gt 0 ]]; do +if [[ "$1" == --output ]]; then touch "$2"; break; fi; shift +done; fi''') + self.stub('systemctl', '''if [[ "$1" == is-active ]]; then exit 0; fi +printf 'MainPID=%s\\nActiveEnterTimestampMonotonic=100\\nExecMainStartTimestampMonotonic=99\\n' "$TEST_PID"''') + self.stub('journalctl', '''if [[ "${TEST_JOURNAL_AVAILABLE:-1}" == 0 ]]; then +echo 'No journal files were found.' >&2; echo '-- No entries --'; exit 0 +fi +if [[ "$*" == *--header* ]]; then echo 'File path: /var/log/journal/0123456789abcdef0123456789abcdef/system.journal' +elif [[ "$*" == *--show-cursor* ]]; then echo '-- cursor: fixture-cursor' +else printf '%s' "${TEST_JOURNAL:-}"; fi''') + + def stub(self, name, body): + file = self.root / name + file.write_text('#!/bin/bash\nset -euo pipefail\n' + body + '\n') + file.chmod(0o755) + + def run_script(self, name, *args, env=None): + self.settings.write_text(json.dumps(self.values)) + return subprocess.run(['bash', str(SCRIPTS / name), *map(str, args)], + env={**self.env, **(env or {})}, text=True, + capture_output=True, timeout=15) + + def package(self, env=None): + return self.run_script('install-pds.sh', self.settings, self.inputs, env=env) + + def recipe(self, path, env=None): + return self.run_script('run-recipe.sh', self.settings, self.lib, path, + self.root / 'runtime', env=env) + + def test_candidate_identity_and_retained_signed_source(self): + result = self.package() + self.assertEqual(result.returncode, 0, result.stderr) + calls = self.calls.read_text() + self.assertIn(str(self.inputs / 'candidate.deb'), calls) + self.assertIn('/etc/apt/sources.list.d/pds.list', calls) + self.assertIn('candidate', result.stdout.lower()) + + def test_wrong_checksum_name_version_and_installed_identity_fail(self): + self.values['candidate_sha256'] = '0' * 64 + self.assertNotEqual(self.package().returncode, 0) + self.assertFalse(self.calls.exists()) + self.values['candidate_sha256'] = hashlib.sha256(b'fixture-deb').hexdigest() + for variable, value in [('TEST_PACKAGE', 'other'), ('TEST_VERSION', '2.0.0'), + ('TEST_INSTALLED_VERSION', '2.0.0')]: + with self.subTest(variable=variable): + self.assertNotEqual(self.package(env={variable: value}).returncode, 0) + + def test_trust_failure_and_missing_candidate_have_no_install_fallback(self): + result = self.package(env={'TEST_FINGERPRINT': '0' * 40}) + self.assertNotEqual(result.returncode, 0) + self.assertFalse(self.calls.exists()) + (self.inputs / 'candidate.deb').unlink() + result = self.package() + self.assertNotEqual(result.returncode, 0) + self.assertFalse(self.calls.exists()) + + def test_repository_route_requests_exact_version(self): + self.values['candidate_sha256'] = '' + (self.inputs / 'candidate.deb').unlink() + result = self.package() + self.assertEqual(result.returncode, 0, result.stderr) + self.assertIn('pds=1.0.0', self.calls.read_text()) + self.assertIn('signed-repository', result.stdout) + + def test_default_and_custom_recipe_select_different_functions(self): + default = self.recipe(UBUNTU / 'recipes/default.sh') + self.assertEqual(default.returncode, 0, default.stderr) + self.assertEqual(self.calls.read_text().splitlines(), + ['zi', 'zsh', 'motd vhco', 'gh', 'kubectl 1.37 --system', 'updates', 'ssh']) + self.calls.unlink() + custom = self.recipe(UBUNTU / 'recipes/custom.example.sh') + self.assertEqual(custom.returncode, 0, custom.stderr) + self.assertEqual(self.calls.read_text().splitlines(), ['zi', 'zsh', 'motd vhco']) + self.assertFalse((self.root / 'runtime/ssh-policy.json').exists()) + + def test_library_cannot_replace_the_builders_ssh_observer(self): + with self.lib.open('a') as library: + library.write('pds_before_ssh_policy() { :; }\n') + result = self.recipe(UBUNTU / 'recipes/default.sh') + self.assertEqual(result.returncode, 0, result.stderr) + self.assertTrue((self.root / 'runtime/ssh-policy.json').is_file()) + + def test_policy_change_without_observation_fails_but_unchanged_custom_passes(self): + self.stub('sha256sum', '''if [[ "${@: -1}" == /etc/ssh/sshd_config.d/00-pds-security.conf ]]; then +printf '%s %s\\n' "${TEST_POLICY_STATE:-absent}" "${@: -1}" +else exec /usr/bin/sha256sum "$@"; fi''') + with self.lib.open('a') as library: + library.write('restricted_ssh_security_profile() { export TEST_POLICY_STATE=changed; }\n') + custom = self.recipe(UBUNTU / 'recipes/custom.example.sh') + self.assertEqual(custom.returncode, 0, custom.stderr) + result = self.recipe(UBUNTU / 'recipes/default.sh') + self.assertNotEqual(result.returncode, 0) + self.assertIn('without SSH service evidence', result.stderr) + + def test_missing_recipe_library_and_selected_call_fail(self): + result = self.recipe(self.root / 'missing') + self.assertNotEqual(result.returncode, 0) + self.assertFalse(self.calls.exists()) + self.lib.write_text('return 7\n') + self.assertNotEqual(self.recipe(UBUNTU / 'recipes/default.sh').returncode, 0) + self.lib.write_text('install_zi() { return 43; }; configure_zsh() { touch "$TEST_CALLS"; }\n') + self.assertNotEqual(self.recipe(UBUNTU / 'recipes/default.sh').returncode, 0) + self.assertFalse(self.calls.exists()) + + def test_custom_recipe_cannot_hide_later_ssh_restart_or_reload(self): + recipe = self.root / 'late-service-operation.sh' + for action in ('export TEST_PID=456', "export TEST_JOURNAL='Reloaded OpenBSD Secure Shell server.'"): + recipe.write_text(f'restricted_ssh_security_profile\n{action}\nrestricted_ssh_security_profile\n') + self.assertNotEqual(self.recipe(recipe).returncode, 0) + + def test_missing_journal_evidence_cannot_pass_as_an_empty_interval(self): + recipe = self.root / 'lost-journal.sh' + recipe.write_text('restricted_ssh_security_profile\nexport TEST_JOURNAL_AVAILABLE=0\n') + self.assertNotEqual(self.recipe(recipe).returncode, 0) + + +if __name__ == '__main__': + unittest.main() diff --git a/packer/ubuntu/tests/test_raw_export.py b/packer/ubuntu/tests/test_raw_export.py new file mode 100644 index 0000000..0ef5cc0 --- /dev/null +++ b/packer/ubuntu/tests/test_raw_export.py @@ -0,0 +1,46 @@ +"""Verify the actual qemu-img export path with disposable tiny disk images.""" +import json +import os +from pathlib import Path +import subprocess +import tempfile +import unittest + +SCRIPT = Path(__file__).resolve().parents[1] / 'scripts/export-raw.sh' + + +class RawExport(unittest.TestCase): + def test_export_is_optional_and_does_not_overwrite(self): + with tempfile.TemporaryDirectory() as tmp: + qcow = Path(tmp) / 'disk.qcow2' + raw = qcow.with_suffix('.raw') + subprocess.run( + ['qemu-img', 'create', '-f', 'qcow2', str(qcow), '2M'], + check=True, capture_output=True, + ) + env = { + **os.environ, + 'BUILD_QEMU_IMAGE': str(qcow), + 'BUILD_OUTPUT_RAW': 'false', + } + subprocess.run([str(SCRIPT)], env=env, check=True) + self.assertFalse(raw.exists()) + + env['BUILD_OUTPUT_RAW'] = 'true' + subprocess.run([str(SCRIPT)], env=env, check=True) + info = json.loads(subprocess.check_output( + ['qemu-img', 'info', '--output=json', str(raw)], + )) + self.assertEqual(info['format'], 'raw') + self.assertEqual(info['virtual-size'], 2 * 1024 * 1024) + + raw.write_bytes(b'preserve existing artifact') + result = subprocess.run( + [str(SCRIPT)], env=env, capture_output=True, + ) + self.assertNotEqual(result.returncode, 0) + self.assertEqual(raw.read_bytes(), b'preserve existing artifact') + + +if __name__ == '__main__': + unittest.main(verbosity=2) diff --git a/packer/ubuntu/tests/test_sealing.sh b/packer/ubuntu/tests/test_sealing.sh new file mode 100644 index 0000000..a443395 --- /dev/null +++ b/packer/ubuntu/tests/test_sealing.sh @@ -0,0 +1,73 @@ +#!/usr/bin/env bash +# Destructive integration test: run only in a disposable Ubuntu container. +set -euo pipefail + +if [[ ! -f /.dockerenv ]]; then + printf '%s\n' 'Run this test in a disposable Docker container, never on a host.' >&2 + exit 2 +fi +scripts_dir="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")/../scripts" && pwd)" +seed_file="$scripts_dir/../cloud-init/user-data" +fixture_dir=/var/lib/builders-sealing-test +mkdir -p /run/sshd /etc/ssh/sshd_config.d /var/lib/dbus "$fixture_dir" +id ubuntu >/dev/null 2>&1 || useradd --create-home ubuntu +printf '%s\n' 'PasswordAuthentication no' > /etc/ssh/sshd_config.d/60-cloudimg-settings.conf + +cloud-init single --name set_passwords --frequency always --file "$seed_file" +ssh-keygen -q -t ed25519 -N '' -f "$fixture_dir/hostkey" +policy=$(sshd -T -h "$fixture_dir/hostkey") +grep -qx 'passwordauthentication yes' <<<"$policy" +printf '%s\n' 'Reproduced temporary build policy: passwordauthentication yes' + +for path in /home/ubuntu/.ssh/authorized_keys /root/.ssh/authorized_keys \ + /etc/netplan/50-cloud-init.yaml /var/lib/cloud/seed/nocloud/user-data; do + mkdir -p "$(dirname -- "$path")" + printf '%s\n' 'temporary build fixture' > "$path" +done +# A transient-ID regression bind-mounts this value read-only from tmpfs. +# Leave that mount intact so the real sealer must commit/unmount it first. +if mountpoint -q /etc/machine-id; then + test "$(cat /etc/machine-id)" = 0123456789abcdef0123456789abcdef +else + printf '%s\n' 0123456789abcdef0123456789abcdef > /etc/machine-id +fi +for residue in /root/.config/gh/hosts.yml /root/.kube/config /root/.zsh_history \ + /home/ubuntu/.gitconfig /home/ubuntu/.local/share/test-cache; do + mkdir -p "$(dirname -- "$residue")" + printf '%s\n' 'discard this build fixture' > "$residue" +done +printf '%s\n' '# public shell configuration' > /root/.profile + +# Docker bind-mounts /etc/hosts, preventing sed -i from renaming it. Keep the +# sealer's expression and adapt only the write to this Docker-managed file. +cat > /usr/local/bin/sed <<'ADAPTER' +#!/usr/bin/env bash +set -euo pipefail +if [[ $# == 3 && "$1" == -i && "$3" == /etc/hosts ]]; then + result=$(/usr/bin/sed "$2" "$3") + printf '%s\n' "$result" > "$3" +else + exec /usr/bin/sed "$@" +fi +ADAPTER +chmod +x /usr/local/bin/sed +bash "$scripts_dir/seal-image.sh" --image-build + +policy=$(sshd -T -h "$fixture_dir/hostkey") +grep -qx 'passwordauthentication no' <<<"$policy" +test "$(getent shadow ubuntu | cut -d: -f2)" = '*' +test -f /etc/machine-id && test ! -s /etc/machine-id +test "$(readlink /var/lib/dbus/machine-id)" = /etc/machine-id +test "$(cat /etc/hostname)" = localhost +test ! -e /etc/ssh/sshd_config.d/50-cloud-init.conf +for path in /home/ubuntu/.ssh/authorized_keys /root/.ssh/authorized_keys \ + /etc/netplan/50-cloud-init.yaml /var/lib/cloud/seed; do + test ! -e "$path" +done +compgen -G '/etc/ssh/ssh_host_*' >/dev/null && exit 1 +for residue in /root/.config /root/.kube /root/.zsh_history \ + /home/ubuntu/.gitconfig /home/ubuntu/.local; do + test ! -e "$residue" +done +test "$(cat /root/.profile)" = '# public shell configuration' +printf '%s\n' 'PASS: build password, SSH override, keys and identity removed.' diff --git a/packer/ubuntu/tests/test_user_shell.py b/packer/ubuntu/tests/test_user_shell.py new file mode 100644 index 0000000..bc65f8d --- /dev/null +++ b/packer/ubuntu/tests/test_user_shell.py @@ -0,0 +1,67 @@ +"""Every advertised fresh-user probe must affect the Zsh check's exit status.""" +import os +from pathlib import Path +import shlex +import shutil +import subprocess +import tempfile +import unittest + +SCRIPT = Path(__file__).resolve().parents[1] / 'scripts/check-user-shell.zsh' + + +class UserShell(unittest.TestCase): + @classmethod + def setUpClass(cls): + if not shutil.which('zsh'): + raise RuntimeError('Install Zsh to run the fresh-user probe regression checks.') + + def probe(self, mode='default', change='', fail=''): + with tempfile.TemporaryDirectory() as tmp: + home = Path(tmp) + (home / '.p10k.zsh').write_text('# preset\n') + log = home / 'calls' + setup = '''zi() { :; }; p10k() { :; } +alias k=kubectl +_kubectl() { :; } +typeset -A _comps=(kubectl _kubectl k _kubectl) +export KREW_ROOT=/usr/local/share/pds/krew +kubectl() { + print -r -- "$*" >> "$TEST_CALLS" + [[ "$*" != "$TEST_FAIL" ]] +} +''' + command = setup + change + '\nsource ' + shlex.quote(str(SCRIPT)) + ' ' + mode + result = subprocess.run(['zsh', '-dflic', command], text=True, capture_output=True, + timeout=10, env={**os.environ, 'HOME': tmp, + 'TEST_CALLS': str(log), 'TEST_FAIL': fail}) + return result, log.read_text().splitlines() if log.exists() else [] + + def test_default_requires_every_shell_and_tool_probe(self): + result, calls = self.probe() + self.assertEqual(result.returncode, 0, result.stderr) + self.assertEqual(calls, ['version --client', 'krew list', 'neat --help', + 'view-secret --help', 'stern --version']) + + def test_earlier_missing_capabilities_fail_the_whole_check(self): + for change in ('unfunction zi', 'unfunction p10k', 'unalias k', + 'unfunction _kubectl', 'unset \'_comps[k]\'', + '_comps[k]=wrong', 'export KREW_ROOT=/wrong', + 'rm "$HOME/.p10k.zsh"'): + with self.subTest(change=change): + result, _ = self.probe(change=change) + self.assertNotEqual(result.returncode, 0) + for fail in ('version --client', 'krew list', 'neat --help', + 'view-secret --help', 'stern --version'): + with self.subTest(fail=fail): + result, _ = self.probe(fail=fail) + self.assertNotEqual(result.returncode, 0) + + def test_custom_recipe_checks_its_selected_shell_only(self): + result, calls = self.probe(mode='custom') + self.assertEqual(result.returncode, 0, result.stderr) + self.assertEqual(calls, []) + + +if __name__ == '__main__': + unittest.main() diff --git a/packer/ubuntu/ubuntu.pkr.hcl b/packer/ubuntu/ubuntu.pkr.hcl index bb0737f..bf9aad6 100644 --- a/packer/ubuntu/ubuntu.pkr.hcl +++ b/packer/ubuntu/ubuntu.pkr.hcl @@ -1,27 +1,37 @@ packer { required_plugins { + proxmox = { + version = "= 1.2.4" + source = "github.com/hashicorp/proxmox" + } qemu = { + version = "= 1.1.8" source = "github.com/hashicorp/qemu" - version = "~> 1" } } } +# --------------------------------------------------------------------------- +# qemu builder -> portable local qcow2 artifact. +# Unvalidated arm64/HVF example; firmware and QEMU settings need separate verification: +# packer build -only='qemu.ubuntu' -var 'arch=arm64' -var 'qemu_accelerator=hvf' . +# --------------------------------------------------------------------------- source "qemu" "ubuntu" { accelerator = var.qemu_accelerator - cd_files = ["./cloud-init/*"] + cd_files = ["./cloud-init/user-data", "./cloud-init/meta-data"] cd_label = "cidata" disk_compression = true disk_image = true disk_size = "10G" headless = true iso_checksum = "file:https://cloud-images.ubuntu.com/${var.ubuntu_version}/current/SHA256SUMS" - iso_url = "https://cloud-images.ubuntu.com/${var.ubuntu_version}/current/${var.ubuntu_version}-server-cloudimg-amd64.img" - output_directory = "output-${var.ubuntu_version}" - shutdown_command = "echo 'packer' | sudo -S shutdown -P now" + iso_url = "https://cloud-images.ubuntu.com/${var.ubuntu_version}/current/${var.ubuntu_version}-server-cloudimg-${var.arch}.img" + output_directory = "output-${var.ubuntu_version}-${var.arch}" + shutdown_command = "sudo -n shutdown -P now" ssh_password = "ubuntu" ssh_username = "ubuntu" - vm_name = "ubuntu-${var.ubuntu_version}.img" + ssh_timeout = "20m" + vm_name = "ubuntu-${var.ubuntu_version}-${var.arch}.qcow2" qemuargs = [ ["-m", "2048M"], ["-smp", "2"], @@ -29,50 +39,111 @@ source "qemu" "ubuntu" { ] } +# --------------------------------------------------------------------------- +# proxmox-clone builder -> native Proxmox template. +# Clones the Stage-0 base cloud-init template (see scripts/create-base-template.sh), +# customizes it, and seals it as a generic golden template with an empty cloud-init +# drive for clone-time init. Build with: +# packer build -only='proxmox-clone.ubuntu' . +# --------------------------------------------------------------------------- +source "proxmox-clone" "ubuntu" { + # -- Proxmox API connection -- + proxmox_url = var.proxmox_url + username = var.proxmox_api_token_id + token = var.proxmox_api_token + node = var.proxmox_node + insecure_skip_tls_verify = var.proxmox_insecure + task_timeout = var.proxmox_task_timeout + + # -- base to clone (Stage 0) -- + clone_vm = var.base_template_name + full_clone = true + cpu_type = var.proxmox_cpu_type + scsi_controller = "virtio-scsi-pci" + qemu_agent = true + os = "l26" + memory = 2048 + cores = 2 + + # -- resulting golden template -- + vm_id = var.template_vmid + template_name = var.template_name + template_description = "Generic Ubuntu ${var.ubuntu_version} golden image. Built by Packer. No baked identity." + + # -- empty clone-time cloud-init drive (filled per-VM by the consumer) -- + cloud_init = true + cloud_init_storage_pool = var.proxmox_storage_pool + + # Packer generates a temporary SSH key and injects it via cloud-init for the build. + ssh_username = "ubuntu" + ssh_timeout = "20m" +} + build { - sources = ["source.qemu.ubuntu"] + sources = [ + "source.qemu.ubuntu", + "source.proxmox-clone.ubuntu", + ] - # try manual install first + # Both outputs share native settings, selected PDS functions, then sealing. provisioner "file" { - source = "scripts/.p10k.zsh" # Local path relative to Packer host - destination = "/tmp/.p10k.zsh" + source = "cloud-init/build-config.yaml" + destination = "/tmp/build-config.yaml" } - provisioner "file" { - source = "scripts/zshrc" - destination = "/tmp/zshrc" + provisioner "shell" { + timeout = "20m" + execute_command = "sudo -n bash '{{ .Path }}'" + script = "scripts/wait-cloud-init.sh" } provisioner "shell" { - inline = [ - "sudo mv /tmp/.p10k.zsh /etc/.p10k.zsh", - "sudo mv /tmp/zshrc /etc/zshrc", - "sudo chmod 644 /etc/.p10k.zsh", - "sudo chmod 644 /etc/zshrc" - ] + inline = ["mkdir -p /tmp/builders-scripts /tmp/builders-pds"] } - provisioner "shell" { - // run scripts with sudo, as the default cloud image user is unprivileged - execute_command = "echo 'packer' | sudo -S sh -c '{{ .Vars }} {{ .Path }}'" - // NOTE: cleanup.sh should always be run last, as this performs post-install cleanup tasks - scripts = [ - "scripts/install.sh", - "scripts/cleanup.sh" - ] + provisioner "file" { + source = "scripts/" + destination = "/tmp/builders-scripts" + } - environment_vars = [ - "USER_PASSWORD=${var.user_password}" - ] + provisioner "file" { + source = "${var.pds_input_directory}/" + destination = "/tmp/builders-pds" } - post-processor "shell-local" { + provisioner "file" { + source = var.provisioning_recipe + destination = "/tmp/provisioning-recipe.sh" + } + + provisioner "file" { + content = jsonencode({ + version = var.pds_version + repository = var.pds_repository + key_fingerprint = var.pds_key_fingerprint + candidate_sha256 = var.pds_candidate_sha256 + motd_preset = var.motd_preset + kubectl_channel = var.kubectl_channel + }) + destination = "/tmp/pds-settings.json" + } + + provisioner "shell" { + execute_command = "sudo -n bash -e '{{ .Path }}'" inline = [ - # Convert QCOW2 to RAW if enabled - "if [ \"${var.output_raw}\" = true ]; then qemu-img convert -f qcow2 -O raw output-${var.ubuntu_version}/ubuntu-${var.ubuntu_version}.img output-${var.ubuntu_version}/ubuntu-${var.ubuntu_version}.raw; fi", + "bash /tmp/builders-scripts/install.sh /tmp/build-config.yaml", + "bash /tmp/builders-scripts/install-pds.sh /tmp/pds-settings.json /tmp/builders-pds", + "bash /tmp/builders-scripts/run-recipe.sh /tmp/pds-settings.json /usr/share/pds/init.sh /tmp/provisioning-recipe.sh", + "bash /tmp/builders-scripts/seal-image.sh --image-build", + ] + } - # Compress the raw image using xz - # "if [ \"${var.output_raw}\" = true ]; then xz -9 output-${var.ubuntu_version}/ubuntu-${var.ubuntu_version}.raw -v; fi", + post-processor "shell-local" { + only = ["qemu.ubuntu"] + environment_vars = [ + "BUILD_QEMU_IMAGE=output-${var.ubuntu_version}-${var.arch}/ubuntu-${var.ubuntu_version}-${var.arch}.qcow2", + "BUILD_OUTPUT_RAW=${var.output_raw}", ] + script = "scripts/export-raw.sh" } } diff --git a/packer/ubuntu/variables.pkr.hcl b/packer/ubuntu/variables.pkr.hcl index 0a32078..256d605 100644 --- a/packer/ubuntu/variables.pkr.hcl +++ b/packer/ubuntu/variables.pkr.hcl @@ -1,23 +1,182 @@ -variable "output_raw" { - type = bool - default = true - description = "Set to true if you want the output in raw format." +# -- image -- +variable "ubuntu_version" { + type = string + default = "noble" + description = "Ubuntu codename (noble = 24.04, jammy = 22.04)." +} + +variable "arch" { + type = string + default = "amd64" + description = "Target architecture for QEMU. amd64 is verified; arm64/HVF needs separate runtime validation." } variable "qemu_accelerator" { type = string default = "kvm" - description = "Qemu accelerator to use. On Linux use kvm and macOS use hvf." + description = "QEMU accelerator. Linux/KVM: kvm. macOS same-arch: hvf. Software emulation: tcg (slow)." } -variable "ubuntu_version" { +variable "output_raw" { + type = bool + default = false + description = "Also export a raw disk after the portable qcow2 build." +} + +# -- shared PDS provisioning -- +variable "provisioning_recipe" { type = string - default = "noble" - description = "Ubuntu codename version (i.e. 20.04 is focal and 22.04 is jammy)" + default = "recipes/default.sh" + description = "Trusted Bash recipe selecting PDS functions. Native settings and sealing always run." + validation { + condition = can(file(var.provisioning_recipe)) + error_message = "Select an existing readable Bash recipe before starting a build." + } +} + +variable "pds_version" { + type = string + default = "0.20.0" + description = "Exact PDS Debian version. The default published release includes the shared image recipe helpers; explicit candidates remain available for development." + validation { + condition = can(regex("^[0-9][A-Za-z0-9.+:~_-]*$", var.pds_version)) + error_message = "Set an exact Debian package version." + } +} + +variable "pds_input_directory" { + type = string + default = "pds" + description = "Public signing key input directory, optionally containing candidate.deb for explicit pre-release validation." + validation { + condition = fileexists("${var.pds_input_directory}/repository-key.asc") + error_message = "The PDS input directory must contain repository-key.asc." + } +} + +variable "pds_repository" { + type = string + default = "https://michielvha.github.io/PDS/apt/" + description = "Signed PDS APT repository retained for updates after deployment." + validation { + condition = can(regex("^https://[^[:space:]]+/$", var.pds_repository)) + error_message = "Use an HTTPS repository URL ending in a slash." + } +} + +variable "pds_key_fingerprint" { + type = string + default = "37C7D029C0FE4DB0E66E5F72AFA1101D94CBF301" + description = "Expected primary fingerprint of the public PDS repository signing key." + validation { + condition = can(regex("^[A-F0-9]{40}$", var.pds_key_fingerprint)) + error_message = "Supply a full uppercase OpenPGP primary fingerprint." + } +} + +variable "pds_candidate_sha256" { + type = string + default = "" + description = "Explicit candidate.deb SHA-256. Empty selects the signed repository; no candidate fallback is allowed." + validation { + condition = var.pds_candidate_sha256 == "" || can(regex("^[a-f0-9]{64}$", var.pds_candidate_sha256)) + error_message = "Supply the candidate package's lowercase SHA-256, or leave empty for the repository route." + } +} + +variable "motd_preset" { + type = string + default = "vhco" + description = "MOTD selection exported to recipes as BUILD_MOTD_PRESET; default recipe accepts packaged PDS presets." + validation { + condition = can(regex("^[a-z0-9][a-z0-9_-]*$", var.motd_preset)) + error_message = "Use a PDS preset name such as vhco, stackweaver or edgeforge." + } +} + +variable "kubectl_channel" { + type = string + default = "1.37" + description = "Kubernetes minor APT channel exported as BUILD_KUBECTL_CHANNEL. Custom recipes decide whether to use it." + validation { + condition = can(regex("^1\\.[0-9]+$", var.kubectl_channel)) + error_message = "Use a Kubernetes minor channel such as 1.37." + } +} + +# -- proxmox api (proxmox-clone builder) -- +# Override connection placeholders in an untracked *.auto.pkrvars.hcl. +# Validation also requires a nonempty token; make check supplies a dummy value. +# NEVER commit a real token. +variable "proxmox_url" { + type = string + default = "https://proxmox.example.com:8006/api2/json" + description = "Proxmox API endpoint." +} + +variable "proxmox_api_token_id" { + type = string + default = "packer@pve!packer" + description = "Proxmox API token id, e.g. user@realm!tokenname." +} + +variable "proxmox_api_token" { + type = string + default = "" + sensitive = true + description = "Proxmox API token secret. Supply via PKR_VAR_proxmox_api_token or an untracked vars file. NEVER commit." +} + +variable "proxmox_node" { + type = string + default = "pve" + description = "Proxmox node to build on." +} + +variable "proxmox_insecure" { + type = bool + default = false + description = "Explicitly skip certificate verification for an isolated test host. Prefer a trusted certificate." } -variable "user_password" { - description = "For initial deployment we use the default user & pass, when cleaning up the deployment we need to change this password to a new value" +variable "proxmox_storage_pool" { type = string - default = "changeme" -} \ No newline at end of file + default = "local-lvm" + description = "Storage pool for the final cloud-init drive. The cloned OS disk inherits the base template storage." +} + +variable "proxmox_cpu_type" { + type = string + default = "host" + description = "Native Proxmox CPU model. host exposes the node CPU features; choose a shared supported model when live migration between different CPUs is required." + + validation { + condition = length(trimspace(var.proxmox_cpu_type)) > 0 && trimspace(var.proxmox_cpu_type) == var.proxmox_cpu_type + error_message = "The Proxmox CPU type must be a non-empty model name without surrounding whitespace, supported by the target node." + } +} + +variable "proxmox_task_timeout" { + type = string + default = "10m" + description = "Maximum wait for asynchronous Proxmox operations such as a full clone. Increase for larger disks or slower storage." +} + +variable "base_template_name" { + type = string + default = "ubuntu-noble-cloudimg" + description = "Name of the Stage-0 base cloud-init template to clone (see scripts/create-base-template.sh)." +} + +# -- resulting proxmox template -- +variable "template_name" { + type = string + default = "ubuntu-2404-base" + description = "Name of the golden template produced on Proxmox." +} + +variable "template_vmid" { + type = number + default = 0 + description = "Output VM ID. Zero lets Proxmox allocate a new ID; set an unused ID explicitly for reserved test ranges." +} diff --git a/packer/ubuntu/variables.pkrvars.hcl b/packer/ubuntu/variables.pkrvars.hcl index 96414c0..3b166a4 100644 --- a/packer/ubuntu/variables.pkrvars.hcl +++ b/packer/ubuntu/variables.pkrvars.hcl @@ -1,4 +1,6 @@ -user_password = "changeme" -output_raw = true +# Non-secret build vars (committed). Proxmox connection + token live in an +# untracked proxmox.auto.pkrvars.hcl (see proxmox.auto.pkrvars.hcl.example). +ubuntu_version = "noble" +arch = "amd64" qemu_accelerator = "kvm" -ubuntu_version = "noble" +output_raw = false diff --git a/readme.md b/readme.md index 43954ea..d03e183 100644 --- a/readme.md +++ b/readme.md @@ -1,74 +1,32 @@ # builders -**Packer templates** for building golden VM images with the tooling already installed. +Build generic OS images with Packer. Ubuntu supports local qcow2/raw disks and an optional native +Proxmox template path. Cloud-init supplies each deployed machine's identity and SSH access. -Build a native **Proxmox template** ready to clone, or a portable **qcow2/raw** image for bare metal or -another hypervisor. It's the same build either way, you pick the output format at build time. The images -ship **generic**, with no baked-in hostname, IP, or SSH keys, so cloud-init handles per-machine setup on -first boot wherever they run. +## Build an Ubuntu image -Provisioning is backed by **[PDS](https://github.com/michielvha/PDS)** (Portable Deploy Suite), a single -apt package of install and config functions, instead of copy-pasted scripts in every repo. Templates -**select and apply** the pieces they want, so images stay consistent and easy to maintain. +The [PDS recipe integration](docs/ubuntu/provisioning.md) installs an exact published package from +the signed repository. The recipe guide covers customization and explicit candidate testing. -## Highlights - -- **Batteries included**: tooling installed via the PDS package (zsh + Powerlevel10k, `kubectl`, SSH - hardening, a custom MOTD, and more), instead of per-repo script sprawl. -- **One template, multiple outputs**: a native Proxmox template or a portable qcow2/raw for bare metal - and other hypervisors, chosen at invocation. -- **Generic golden images**: identity (hostname, IP, SSH keys) is applied on first boot via cloud-init, - never baked in. -- **Clean for cloning**: `machine-id` and cloud-init state are reset, so every machine boots fresh and - unique. -- **Easy to extend**: add a new distro or role without reinventing the provisioning. - -## Templates - -| Path | What it builds | -| --- | --- | -| [`packer/ubuntu/`](packer/ubuntu/) | Ubuntu cloud image + PDS tooling, output as a Proxmox template or qcow2/raw. | -| [`armbian-build-framework/`](armbian-build-framework/) | ARM SBC images (Rock 5A, Raspberry Pi 4B). | - -## Quick start - -Prerequisites: [Packer](https://developer.hashicorp.com/packer), plus either a Proxmox host (for the -native template) or QEMU (for a local image). +Install the [local build prerequisites](docs/ubuntu/local-build.md#prerequisites), then run: ```bash cd packer/ubuntu packer init . - -# Build a clone-ready Proxmox template (cloud-init drive attached) -packer build -only='proxmox-clone.ubuntu' -var-file=variables.pkrvars.hcl . - -# ...or build a portable qcow2/raw image -packer build -only='qemu.ubuntu' -var-file=variables.pkrvars.hcl . +packer build -only='qemu.ubuntu' . ``` -For the Proxmox output, set your connection + storage variables first (see -[`packer/ubuntu/readme.md`](packer/ubuntu/readme.md)). **Never commit your Proxmox API token**, pass it -via an environment variable or an untracked vars file. - -## How it fits together - -From a build to a running machine: - -1. **Packer** builds a generic golden image with all your tooling already installed. -2. **Deploy it**: clone the Proxmox template, or write the qcow2/raw image to a disk or another - hypervisor. -3. **cloud-init** applies per-machine identity on first boot (hostname, IP, SSH keys). -4. *(optional)* **Terraform** ([bpg/proxmox](https://registry.terraform.io/providers/bpg/proxmox/latest)) - automates the Proxmox clone path when you want it. +This path needs no Proxmox server or credentials. For a native template, follow the optional +[Proxmox guide](docs/ubuntu/proxmox.md). -## Status +## Templates and guides -Ubuntu now, more distros to follow. - -## License - -GPLv3, see [LICENSE](LICENSE). Fork it, make it yours. +| Start here | What you get | +| --- | --- | +| [Ubuntu](packer/ubuntu/readme.md) | Choose an output and find build, SSH, debugging and recovery guides. | +| [Armbian](armbian-build-framework/) | Existing Rock 5A and Raspberry Pi 4B image customisations. | ---- +See [image recipes](docs/ubuntu/provisioning.md) for defaults, customization and deployment users. +For contributions, see [development checks](docs/development.md) and [feature documents](docs/specs/README.md). -Design notes and rationale for contributors live in [`docs/`](docs/). +GPLv3. See [LICENSE](LICENSE). diff --git a/renovate.json5 b/renovate.json5 new file mode 100644 index 0000000..5b4648b --- /dev/null +++ b/renovate.json5 @@ -0,0 +1,31 @@ +{ + "$schema": "https://docs.renovatebot.com/renovate-schema.json", + "extends": ["config:recommended", "helpers:pinGitHubActionDigests"], + "automerge": false, + "customManagers": [ + { + "customType": "regex", + "managerFilePatterns": ["/^packer/ubuntu/variables\\.pkr\\.hcl$/"], + "matchStrings": ["variable \"pds_version\" \\{\\s+type\\s*=\\s*string\\s+default\\s*=\\s*\"(?[^\"]+)\""], + "depNameTemplate": "michielvha/PDS", + "datasourceTemplate": "github-releases", + "extractVersionTemplate": "^v?(?.*)$" + }, + { + "customType": "regex", + "managerFilePatterns": ["/^packer/ubuntu/ubuntu\\.pkr\\.hcl$/"], + "matchStrings": ["version\\s*=\\s*\"= (?[^\"]+)\"\\s+source\\s*=\\s*\"github.com/hashicorp/(?[^\"]+)\""], + "packageNameTemplate": "hashicorp/packer-plugin-{{depName}}", + "datasourceTemplate": "github-releases", + "extractVersionTemplate": "^v(?.*)$" + }, + { + "customType": "regex", + "managerFilePatterns": ["/^\\.github/workflows/check\\.yaml$/"], + "matchStrings": ["version: (?[0-9]+\\.[0-9]+\\.[0-9]+)"], + "depNameTemplate": "hashicorp/packer", + "datasourceTemplate": "github-releases", + "extractVersionTemplate": "^v(?.*)$" + } + ] +}