Extend the DAC and SELinux modules with support for the tpm-emulator.
We label the Unix socket that QEMU connects to after starting swtmp
with DAC and SELinux labels. We do not have to restore the labels in
this case since the tpm-emulator will remove the Unix socket when it
terminates.
Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
false);
break;
case VIR_DOMAIN_TPM_TYPE_EMULATOR:
+ ret = virSecurityDACSetChardevLabel(mgr, def,
+ &tpm->data.emulator.source,
+ false);
+ break;
case VIR_DOMAIN_TPM_TYPE_LAST:
break;
}
false);
break;
case VIR_DOMAIN_TPM_TYPE_EMULATOR:
+ /* swtpm will have removed the Unix socket upon termination */
case VIR_DOMAIN_TPM_TYPE_LAST:
break;
}
}
break;
case VIR_DOMAIN_TPM_TYPE_EMULATOR:
+ tpmdev = tpm->data.emulator.source.data.nix.path;
+ rc = virSecuritySELinuxSetFilecon(mgr, tpmdev, seclabel->imagelabel);
+ if (rc < 0)
+ return -1;
+ break;
case VIR_DOMAIN_TPM_TYPE_LAST:
break;
}
}
break;
case VIR_DOMAIN_TPM_TYPE_EMULATOR:
+ /* swtpm will have removed the Unix socket upon termination */
case VIR_DOMAIN_TPM_TYPE_LAST:
break;
}