]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemu: Run swtpm_setup in unprivileged mode for a TPM 2.0
authorStefan Berger <stefanb@linux.vnet.ibm.com>
Wed, 23 May 2018 20:53:09 +0000 (16:53 -0400)
committerStefan Berger <stefanb@linux.vnet.ibm.com>
Wed, 6 Jun 2018 14:48:41 +0000 (10:48 -0400)
swtpm_setup can be run for a TPM 2 in unprivileged mode assuming
XDG_CONFIG_HOME has been set and the necessary configuration files
have been put into that directory.

For current reference also see this link:

https://github.com/stefanberger/swtpm/pull/63

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
src/qemu/qemu_tpm.c

index 15a966f80fd2650a6fb4e92842f56de3b9a4ebce..2349fa92d9cfd81f1a5639ea70c616ff69be799f 100644 (file)
@@ -475,11 +475,11 @@ qemuTPMEmulatorRunSetup(const char *storagepath,
     char uuid[VIR_UUID_STRING_BUFLEN];
     char *vmid = NULL;
 
-    if (!privileged)
+    if (!privileged && tpmversion == VIR_DOMAIN_TPM_VERSION_1_2)
         return virFileWriteStr(logfile,
                                _("Did not create EK and certificates since "
-                               "this requires privileged mode\n"),
-                               0600);
+                                 "this requires privileged mode for a "
+                                 "TPM 1.2\n"), 0600);
 
     cmd = virCommandNew(swtpm_setup);
     if (!cmd)