r/openstack • u/Dabloo0oo • Dec 13 '24
vTPM for VMs [Kolla-ansible Openstack]
Hello Everyone,
I'm currently trying to configure vTPM (virtual TPM) for my VMs, but nothing seems to work. I've tried multiple approaches, including using swTPM, but I keep hitting roadblocks.
I'm using kvm and need vTPM functionality for compliance/security requirements.
Does anyone have a working configuration or guide they can share? Any tips or advice would be greatly appreciated.
5
Upvotes
5
u/ednnz Dec 13 '24
Hey, we currently have this available for our clients, I can't remember the setup being complicated ?
From what I recall, you need
in nova.conf
in the nova-libvirt containers
swtpm, swtpm-libs, swtpm-tools
I just checked they are installed (at least for 2024.2 containers, earlier versions you might need to double check)
this should enable the swtpm trait on compute nodes that have
swtpm_enabled = True.Next you need the following properties on your images (or flavors, but I would recommend images so you can deploy any flavor with vtpm enabled)
The doc for it is fairly straight forward also
https://docs.openstack.org/nova/latest/admin/emulated-tpm.html
I'm not the one who made the images so I'm not 100% sure, but I believe you NEED q35 (uefi bios) in order to use vtpm.
3
u/przemekkuczynski Dec 16 '24
https://docs.openstack.org/nova/latest/admin/emulated-tpm.html#enabling-vtpm
The following are required on each compute host wishing to support the vTPM feature:
libvirt.virt_typeofkvmorqemu.libvirt.swtpm_enabledconfig option toTrue. This will enable support for both TPM version 1.2 and 2.0.Limitations
Security
With a hardware TPM, the root of trust is a secret known only to the TPM user. In contrast, an emulated TPM comprises a file on disk which the libvirt daemon must be able to present to the guest. At rest, this file is encrypted using a passphrase stored in a key manager service. The passphrase in the key manager is associated with the credentials of the owner of the server (the user who initially created it). The passphrase is retrieved and used by libvirt to unlock the emulated TPM data any time the server is booted.
Although the above mechanism uses a libvirt secret that is both
private(can’t be displayed via the libvirt API orvirsh) andephemeral(exists only in memory, never on disk), it is theoretically possible for a sufficiently privileged user to retrieve the secret and/or vTPM data from memory.A full analysis and discussion of security issues related to emulated TPM is beyond the scope of this document