Skip to content

Instantly share code, notes, and snippets.

@lukehinds
Last active February 22, 2022 21:38
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lukehinds/f7338fe3bd13687e2600fa70a2055e1c to your computer and use it in GitHub Desktop.
Save lukehinds/f7338fe3bd13687e2600fa70a2055e1c to your computer and use it in GitHub Desktop.
vtpm.md
# On the host
```
# dnf install libtpms swtpm swtpm-tools
# modprobe tpm_vtpm_proxy
# mkdir /tmp/my_vtpm
# swtpm chardev --tpm2 --vtpm-proxy --tpmstate dir=/tmp/my_vtpm -d
New TPM device: /dev/tpm1 (major/minor = 253/1)
# container_id=$(mktemp)
# docker run -td --privileged -v /dev/tpm1:/dev/tpm0 $image-name > ${container_id}
# docker exec -u 0 -it --tty "$(cat ${container_id})" /bin/bash
```
# Inside the container
```
# dnf install tpm2-tools tpm2-tss
# export TPM2TOOLS_TCTI=device:/dev/tpmrm0
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment