Skip to content

sync(feat/swtpm-ci): merge fork main updates#7

Open
foil-copy-overrate wants to merge 9 commits into
mainfrom
feat/swtpm-ci
Open

sync(feat/swtpm-ci): merge fork main updates#7
foil-copy-overrate wants to merge 9 commits into
mainfrom
feat/swtpm-ci

Conversation

@foil-copy-overrate

Copy link
Copy Markdown
Member

Summary

  • Merge current yubi-OS/bcvk main into feat/swtpm-ci so this branch carries the 9 upstream commits now present on the fork main branch.
  • Resolve the crates/kit/src/run_ephemeral.rs CommonVmOpts conflict by keeping the branch's --swtpm and --swu2f test options while adding upstream's --output and --log-dir fields.

Testing

  • cargo fmt --check
  • cargo test --workspace --lib --bins

Assisted-by: AI

foil-copy-overrate and others added 9 commits June 26, 2026 02:12
Attach a swtpm-backed QEMU emulator TPM so /dev/tpm0 is present in bcvk
ephemeral VMs, enabling TPM2 test coverage (PCR, LUKS2 PCR binding,
ConditionSecurity=measured-os) without physical hardware. Test-only;
yubiOS production RoT stays YubiKey FIDO2.

- crates/bcvk-qemu/src/swtpm.rs: pure builders (swtpm argv + QEMU tpm
  args, arch-aware tpm-crb/tpm-tis-device) + table-driven unit tests
- qemu.rs: QemuConfig.swtpm field, enable_swtpm(), device emission in
  spawn(), host swtpm process spawn (spawn_swtpm) wired into RunningQemu
- run_ephemeral.rs: --swtpm flag on CommonVmOpts
- docs/swtpm.md: usage + rationale (QEMU emulator device vs guest
  systemd-tpm2-swtpm.service under direct boot)

Refs: #3
Assisted-by: Sauna (claude-sonnet-4-6)
Adds a --swu2f flag to bcvk ephemeral run. Because QEMU only emulates
CTAP1 (u2f-emulated, no hmac-secret) and systemd-cryptenroll/LUKS2 FIDO2
unlock require CTAP2 hmac-secret, the authenticator runs inside the guest
over /dev/uhid (e.g. fidorium/passless). bcvk only ensures the uhid module
is loaded via modules-load=uhid; the authenticator binary ships in the
test image (image side, like swtpm/swtpm-tools).

New module crates/bcvk-qemu/src/swu2f.rs (Swu2fConfig + uhid karg builders,
table-driven unit tests), wired through CommonVmOpts and the ephemeral run
cmdline. Docs in docs/swu2f.md.

For yubiOS issue bootc-dev#25 (post-launch software FIDO2 emulator). Test-only;
production trust stays on the YubiKey FIDO2 device (ADR-003).

Assisted-by: Sauna (claude-opus-4.8)
Mirror the swtpm split for FIDO2/U2F so yubiOS can test pam-u2f and
systemd-cryptenroll FIDO2 paths without a physical YubiKey.

- crates/bcvk-qemu/src/swu2f.rs: pure builder for the QEMU `u2f-emulated`
  (libu2f-emu) USB HID U2F/CTAP1 token (-usb -device u2f-emulated[,dir=]),
  ephemeral or setup-dir identity + table tests
- lib.rs: expose `swu2f` module + re-export `Swu2fConfig`
- docs/swu2f.md: spec. Layer 1 = QEMU u2f-emulated (CTAP1, covers pam-u2f);
  Layer 2 = in-guest /dev/uhid CTAP2 authenticator (FIDO2 hmac-secret) for
  systemd-cryptenroll --fido2, staged as a separate guest-image PR.

Test-only; yubiOS production RoT stays YubiKey FIDO2 (ADR-003).
Not compiled here — needs cargo build + nextest + human Signed-off-by.

Refs: yubi-OS/yubiOS#25
Assisted-by: Sauna (FOLLOWER_2)
HEAD be5f385 rewrote swu2f.rs to the host QEMU u2f-emulated (CTAP1)
route and dropped push_uhid_kargs, but run_ephemeral.rs:1420 still
calls bcvk_qemu::swu2f::push_uhid_kargs -> dangling symbol, kit fails
to build. QEMU u2f-emulated is CTAP1/U2F-only (no hmac-secret) and
cannot drive systemd-cryptenroll --fido2 for the LUKS2 FIDO2 e2e test
(bootc-dev#33/bootc-dev#20); the --swu2f flag help already says it exposes /dev/uhid.

Restore the in-guest uhid module (push_uhid_kargs + uhid Swu2fConfig,
per 66fbf13) so run_ephemeral resolves and cargo check passes, and
reconcile docs/swu2f.md to match (Layer 2 uhid implemented; Layer 1
QEMU u2f-emulated documented as a not-yet-wired pam-u2f-only option).

Test-only; prod RoT stays YubiKey (ADR-003). Refs bootc-dev#25. No merge.
…on feat/swtpm-ci

HEAD be5f385 rewrote swu2f.rs to the host-QEMU u2f-emulated route
(qemu_u2f_args/Swu2fConfig) and dropped push_uhid_kargs, but
crates/kit/src/run_ephemeral.rs:1420 still calls
bcvk_qemu::swu2f::push_uhid_kargs(&mut kernel_cmdline) -> dangling symbol,
crate fails to compile.

Canonical route is in-guest /dev/uhid CTAP2 (per cult-leader decision):
QEMU u2f-emulated is CTAP1/U2F-only (no hmac-secret) so it cannot drive
systemd-cryptenroll --fido2 that the LUKS2 e2e (bootc-dev#33) needs. Restore the
original in-guest swu2f.rs (push_uhid_kargs + uhid_karg + Swu2fConfig +
table tests) so the --swu2f flag (modules-load=uhid) and run_ephemeral
call site line up again. lib.rs re-export of Swu2fConfig stays valid.

Refs yubi-OS/yubiOS#25, unblocks bootc-dev#33. bcvk feature branch, no merge.

Assisted-by: Sauna (claude)
# Conflicts:
#	crates/kit/src/run_ephemeral.rs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants