Feature add VTPM support for runc container

Open
#4,843 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
25/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Stale
Tech stack
go

Research direction

Start by reviewing the linked vTPM configuration proposals for runc and runtime-spec, then inspect the external swtpm_cuse and go-tpm bug reports listed in the checklist. The work is complete when those prerequisites are resolved and runc can bind the vTPM device lifecycle to container creation under the stated root, AppArmor, and cgroup constraints.

Written by the indexing model from the issue text.

Description

This issue is to bind the creation of virtual TPM devices with container creation. The virtual TPM devices can be used to perform attestation (e.g using the Direct Anonymous Attestation protocol).
The virtual TPM devices are simulated by swtpm_cuse binary (vTPM device is created by CUSE) and independent from a container namespace.
The initial state of vTPM device can be prepopulated by swtpm_setup binary (e.g create EK key pair, EK + platform certs).
After the vTPM devices are created, the /dev/tpm + vTPMName will be passed to the container. In order to pass different vTPM devices with the same container path to the different containers, the initial device host path is generated.

This feature requires root rights so it can not be performed with rootless containers. However, the generated device host path can be passed to the unshared user namespace with mapped root user.
Because the swtpm_cuse binary is running always with the life a container, then it is restricted by apparmor profile.

Also, there is a restriction to run runc in a container because all vTPM device major and minor should be predefined (and they should be passed to the container cgroup device allow list).

The steps to implement before merging the feature:

  • Merge vTPM config to runc
  • Merge vTPM config to runtime-spec
  • Fix a bug with swtpm_cuse to acquire file lock after forking the main process.
  • Fix a bug with google/go-tpm to read EK cert from a vTPM device version 1.2.
Dominant language
Go
Stars
13.5k
Forks
2.3k
Avg merge
2d 8h
Merged PRs (30d)
30

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from opencontainers/runc

All issues in opencontainers/runc

Similar issues

More Go issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.