Skip to content

ephemeral: Add a TPM 2.0 emulated by swtpm - #411

Open
yeetypete wants to merge 2 commits into
bootc-dev:mainfrom
yeetypete:feat/ephemeral-tpm-state
Open

yeetypete wants to merge 2 commits into
bootc-dev:mainfrom
yeetypete:feat/ephemeral-tpm-state

Conversation

@yeetypete

@yeetypete yeetypete commented Oct 26, 2026 •

Copy link
Copy Markdown

Allow adding a TPM 2.0 to ephemeral bcvk VMs, emulated by swtpm:

  • --tpm attaches an ephemeral TPM. Its state is discarded with the container.

swtpm runs inside the container from the host's /usr, just like virtiofsd. QEMU attaches it as a tpm-tis device (tpm-tis-device on aarch64). This is the same tpm model bcvk libvirt run uses.

Added test_run_ephemeral_tpm which checks if the emulated TPM shows up under /dev/tpmrm0.

Assisted-by: AI

own helper.

Signed-off-by: Peter Siegel <psiegel2000@icloud.com>
@yeetypete

yeetypete commented Oct 26, 2026 •

Copy link
Copy Markdown
Author

Just for some more context on how this can be used for some e2e verified boot testing:

  1. You create an "installer vm" with bcvk ephemeral --tpm-state DIR with a mounted empty disk.
  2. Inside you set up the disk with LUKS and TPM and call bootc install to-filesystem on it.
  3. After creating a disk in the installer VM a 2nd vm can boot it reusing the previous TPM's state and unlock the disk unattended. This can be a systemd-vmspawn vm, etc.

The idea is that this emulates how you might set up a bare-metal device where the installer and the booted system post-install see the same TPM.

cgwalters
cgwalters previously approved these changes Oct 26, 2026

/// Wait until the process `name` creates `socket_path`. Fails if
/// `process` exits first or `timeout` passes.
async fn wait_for_socket(

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For virtiofsd at least we should have always been using --fd to avoid any polling at all.

Something to improve in a followup


Mount disk file as virtio-blk device at /dev/disk/by-id/virtio-<name>

**--tpm**

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While this is the conservative default, I would argue to turn this on by default on supported architectures in the future

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah it'll depend on swtpm being installed on the host but that should be easy to check.

Comment thread docs/src/man/bcvk-ephemeral-run.md Outdated
--tpm attaches a TPM 2.0 emulated by swtpm, whose state is discarded with
the container.

Signed-off-by: Peter Siegel <psiegel2000@icloud.com>
Assisted-by: AI

This branch has not been deployed

No deployments
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