Hi,
A VM backup includes the virtual TPM’s swtpm state, because it lives on the instance volume:
backup/virtual-machine/<instance>/tpm.<device>/tpm2-00.permall
That file holds the TPM’s SRK and NV state. So anyone with a backup can run swtpm on that state and unseal the systemd credentials the guest sealed (systemd-creds --with-key=tpm2). The TPM seal gives no protection against a backup holder.
What I want: the TPM should only work if a secret I keep in OpenBao is available when the instance starts. Without it, the TPM shouldn’t function.
swtpm can encrypt its state files (–keyfile/–pwdfile in swtpm_setup, --key file= / --migration-key file= in newer swtpm), so if incusd gave swtpm a key from OpenBao, the state on the instance volume would be encrypted at rest and a backup would carry an unusable TPM.
Two questions:
-
Is there an existing way to hand a secret to incusd at instance start (exec hook, scriptlet, device option)? instances.placement.scriptlet and authorization.scriptlet don’t seem to fit.
-
If not, what shape would work best: a tpm device option that runs a command, a server config key, or something else?
Thanks, Chuck