core: introduce ConditionSecurity=measured-os

So far we always conditioned our TPM magic on the UKI having detected
TPM support in the firmware. This is a bit limiting when we want to
support a software TPM that is not visible to the firmware. Hence let's
split this up, and add a separate control that can be set via the kernel
command line.  However, as before, let's by default inherit the firmare
TPM discovery state into it, to retain the current behaviour unless
overriden.

With this in place, boot with "systemd.tpm2_measured_os=1
systemd.tpm2_software_fallback=1" on the kernel cmdline to get the swtpm
fallback and then a measured OS based on it.
This commit is contained in:
Lennart Poettering
2026-03-26 16:11:34 +01:00
parent ca03d178a0
commit cd911bec6e
25 changed files with 86 additions and 30 deletions
+10
View File
@@ -477,6 +477,16 @@ int verb_status(int argc, char *argv[], uintptr_t _data, void *userdata) {
printf(" Measured UKI: %sfailed%s (%m)\n", ansi_highlight_red(), ansi_normal());
}
k = efi_measured_os(LOG_DEBUG);
if (k > 0)
printf(" Measured OS: %syes%s\n", ansi_highlight_green(), ansi_normal());
else if (k == 0)
printf(" Measured OS: no\n");
else {
errno = -k;
printf(" Measured OS: %sfailed%s (%m)\n", ansi_highlight_red(), ansi_normal());
}
k = efi_get_reboot_to_firmware();
if (k > 0)
printf(" Boot into FW: %sactive%s\n", ansi_highlight_yellow(), ansi_normal());