feat(swtpm): software TPM 2.0 for ephemeral CI VMs (#3)#4
feat(swtpm): software TPM 2.0 for ephemeral CI VMs (#3)#4foil-copy-overrate wants to merge 1 commit into
Conversation
Adds a `--feature tpm2-swtpm` path to `bcvk run` that launches an swtpm (IBM software TPM 2.0) process on the QEMU side and wires an emulated TPM 2.0 into the guest via -tpmdev emulator + an arch-aware tpm-tis device, so /dev/tpm0 is available inside ephemeral CI VMs without hardware. New: crates/bcvk-qemu/src/swtpm.rs (config, arg generation, arch device selection, socket wait, table-driven tests). Wired through QemuConfig (enable_swtpm + swtpm field), RunningQemu (spawn swtpm before QEMU, kill on wait), and CommonVmOpts (--feature flag), mirroring the --yubikey passthrough pattern in PR #2. For yubiOS ADR-016 Feature 1 / BLOCKER-006; pairs with yubiOS PR bootc-dev#34 (guest-side systemd-tpm2-swtpm.service drop-in). swtpm is test coverage only; production trust anchor remains YubiKey FIDO2 (ADR-003). Assisted-by: Sauna (claude-opus-4.8)
|
Closing as the duplicate of the canonical swtpm branch. Two parallel runs produced competing approaches for #3: this PR ( |
|
Superseded by the canonical swtpm branch |
Software TPM 2.0 for ephemeral CI VMs
Implements the bcvk side of issue #3 / yubiOS ADR-016 §Feature 1 / BLOCKER-006.
Pairs with yubiOS PR bootc-dev#34 (guest-side
systemd-tpm2-swtpm.servicedrop-in).What this does
bcvk run --feature tpm2-swtpmlaunches answtpmprocess and wires an emulatedTPM 2.0 into the guest (
-tpmdev emulator+ arch-awaretpm-tis/tpm-tis-device),so
/dev/tpm0is present inside CI VMs without hardware. Exercises TPM2 code paths(PCR measurements, LUKS2 PCR binding,
ConditionSecurity=measured-os).Changes
crates/bcvk-qemu/src/swtpm.rs—SwtpmConfig, QEMU arg generation, arch device selection, socket wait, table-driven unit tests.crates/bcvk-qemu/src/lib.rs— export module.crates/bcvk-qemu/src/qemu.rs—QemuConfig::enable_swtpm()+swtpmfield; spawn swtpm before QEMU and kill it onwait(); emit TPM device args.crates/kit/src/run_ephemeral.rs—--feature tpm2-swtpmonCommonVmOpts, wired into the qemu config build.docs/swtpm-tpm2.md.Mirrors the
--yubikeyUSB-passthrough pattern (PR #2).cargo build+cargo nextest run -p bcvk-qemuon a dev box before merge.swtpm/swtpm-toolsare present where QEMU runs (the test image / runner); a clear error is surfaced if missing.enable_swtpm()is called inrun_impl(container-entrypoint stage) so swtpm + QEMU share a namespace.AGENTS.md/DCO: an LLM must not addSigned-off-by; a human must add it after review.