Commit Graph
16 Commits
Author SHA1 Message Date
Lennart Poettering 48d67957d5 creds-util: add a concept of "user-scoped" credentials
So far credentials are a concept for system services only: to encrypt or
decrypt credential you must be privileged, as only then you can access
the TPM and the host key.

Let's break this up a bit: let's add a "user-scoped" credential, that
are specific to users. Internally this works by adding another step to
the acquisition of the symmetric encryption key for the credential: if a
"user-scoped" credential is used we'll generate an symmetric encryption
key K as usual, but then we'll use it to calculate

    K' = HMAC(K, flags || uid || machine-id || username)

and then use the resulting K' as encryption key instead. This basically
includes the (public) user's identity in the encryption key, ensuring
that only if the right user credentials are specified the correct key
can be acquired.
2024-01-30 17:07:47 +01:00
Lennart Poettering 985a261701 pcrlock: also write pcrlock policy as unencrypted credential to XBOOTLDR/ESP 2024-01-22 14:40:10 +01:00
Alberto Planas 4054e8128e Measure empty PK and KEK EFI vars
The OVMF UEFI firmware is measuring PK and KEK when secure boot is
disabled, and those variables are absent.  This can be checked via the
event log to see that there are extensions for PCR 7 associated with PK
and KEK events of type EV_EFI_VARIABLE_DRIVER_CONFIG.

When running the "lock-secureboot-policy" verb, pcrlock complains that
those variables are not found and refuse to generate the
240-secureboot-policy.pcrlock.d/generated.pcrlock file.

The "TCG PC Client Platform Firmware Profile Specification Version 1.05
Revision 23"[1] from May 7, 2021, in section "3.3.4.8 PCR[7] - Secure
Boot Policy Measurements", point 10.b:

If reading a UEFI variable returns UEFI_NOT_FOUND, platform firmware
SHALL measure the absence of the variable. The
UEFI_VARIABLE_DATA.VariableDataLength field MUST be set to zero and
UEFI_VARIABLE_DATA.VariableData field will have a size of zero.

This patch mark those variables to be marked as "synthesize empty",
generating the correct hash for those variables.

Signed-off-by: Alberto Planas <aplanas@suse.com>
2024-01-19 00:18:20 +00:00
Lennart Poettering 35a7dd4834 Merge pull request #30728 from polarina/noda
Assign noDA attribute to TPM2 objects not dependant on a PIN
2024-01-05 11:04:11 +01:00
Alberto Planas ef949448ec Use .d path for PCRLOCK_KERNEL_*_PATH
Fix the path for the generated.pcrlock files for the cmdline and initrd
cases.  Without it the tool complains with:

    Failed to parse component file /var/lib/pcrlock.d/720-kernel-initrd.pcrlock, ignoring: Is a directory

Signed-off-by: Alberto Planas <aplanas@suse.com>
2024-01-05 10:00:42 +01:00
Alberto Planas 59fe7e6ef1 Fix typo in verb_make_policy explanation
Signed-off-by: Alberto Planas <aplanas@suse.com>
2024-01-04 13:46:04 +01:00
Gabríel Arthúr Pétursson ab39d29606 pcrlock: Print correct NV index when writing new policy 2024-01-04 12:42:57 +00:00
Mike Yuan 2413a0fab4 format-table: introduce table_isempty and use it where appropriate 2023-12-25 17:47:18 +08:00
Lennart Poettering eee799fa86 color-util: split out HSV color conversion into color-util.[ch] 2023-12-21 19:15:01 +01:00
Frantisek Sumsal e80c6ea740 pcrlock: use empty_or_dash() more 2023-12-18 17:26:19 +01:00
Lennart Poettering c7da9e9a65 pcrlock: check for embedded NUL bytes 2023-11-20 14:27:38 +01:00
Lennart Poettering 8c8d2cfd4b pcrlock: make sure we don't choke on empty records
Follow-up for a434270139

CID#1523832
2023-11-20 14:27:27 +01:00
Lennart Poettering c5d77694eb pcrlock: show emojis for each PCR line
I am sorry, I totally forgot adding emojis reflecting the state of each
PCR. I hope I can do better in future, and hereby I'd like to rectify
the situation a bit.
2023-11-06 14:42:20 +00:00
Yu Watanabe e423b40d35 tree-wide: fix typo 2023-11-04 11:58:12 +09:00
Lennart Poettering 8e35338d09 pcrlock: add pre-defined pcrlock files
These cover well-known measurements done by the UEFI firmware or
systemd.
2023-11-03 11:24:31 +01:00
Lennart Poettering a434270139 pcrlock: add new pcrlock tool 2023-11-03 11:23:54 +01:00