-
My overall goal is to sniff on TPM communication of a guest OS to the software TPM. In cygwin I launch the swtpm with: swtpm socket --tpmstate dir=. --tpm2 --ctrl type=tcp,port=2321 --server type=tcp,port=2322 --log fd=1,level=20 and I tell the guest about this swtpm process with: .\VBoxManage.exe modifyvm "Ubuntu 24.04" --tpm-type=swtpm --tpm-location=127.0.0.1:2321 Ubuntu boots fine, but in dmesg it is logging:
However, this control communication to the swtpm works. Output of swtpm process:
When I set the Ubuntu guest in VirtualBox to EFI, the machine doesn't boot with
But I guess that is unrelated. Nevertheless, with EFI enabled, there happens command communication, not only control communication. A part from the start of the logs of swtpm:
My gut feelings says that the firmware can access the TPM, but the operating system cannot do it anymore, somehow. I think it should work somehow, though. Since VirtualBox itself uses swtpm as well, and there it works. I pretty much just want to setup swtpm myself instead of letting VirtualBox doing it, such that I have full control about the logging process. Am I missing something obvious? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
I am unfortunately not familiar with VirtualBox and how they enable swtpm/vTPM. Inside the OS ACPI tables enable automatic activation of TPM drivers, so maybe something along those lines is missing there, but I am not sure. The TPM commands get all success responses, so that at least is good. I haven't heared complaints from VirtualBox so far so maybe something is amiss in your setup. It looks like though I should indented the 'Tested' lines a bit further to not be at the same level as the Read/Write ones. |
Beta Was this translation helpful? Give feedback.
-
I figured it out! It indeed had to do with the configuration of VirtualBox and nothing with SWTPM itself. I wrote a bit more about it here: https://forums.virtualbox.org/viewtopic.php?p=552039#p552039 In short, you can get it working by telling VirtualBox to still announce the TPM via ACPI even if it is set to use an external SWTPM process with: # Set VM to use an external SWTPM process
.\VBoxManage.exe modifyvm "VMname" --tpm-type=swtpm --tpm-location=127.0.0.1:2321
# Tell it to still announce it via ACPI
.\VBoxManage.exe setextradata "VMname" "VBoxInternal/Devices/acpi/0/Config/TpmMode" "fifo2.0" |
Beta Was this translation helpful? Give feedback.
I figured it out! It indeed had to do with the configuration of VirtualBox and nothing with SWTPM itself. I wrote a bit more about it here: https://forums.virtualbox.org/viewtopic.php?p=552039#p552039
In short, you can get it working by telling VirtualBox to still announce the TPM via ACPI even if it is set to use an external SWTPM process with: