summaryrefslogtreecommitdiffstats
path: root/test/units/TEST-70-TPM2.pcrlock.sh (follow)
Commit message (Collapse)AuthorAgeFilesLines
* pcrlock: be more careful when preparing credential name for pcrlock policyLennart Poettering2024-09-061-1/+12
| | | | | | | | The .cred suffix is stripped from a credential as it is imported from the ESP, hence it should not be included in the credential name embedded in the credential. Fixes: #33497
* cryptenroll/cryptsetup: allow combined signed TPM2 PCR policy + pcrlock policyLennart Poettering2024-09-061-2/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | So far you had to pick: 1. Use a signed PCR TPM2 policy to lock your disk to (i.e. UKI vendor blesses your setup via signature) or 2. Use a pcrlock policy (i.e. local system blesses your setup via dynamic local policy stored in NV index) It was not possible combine these two, because TPM2 access policies do not allow the combination of PolicyAuthorize (used to implement #1 above) and PolicyAuthorizeNV (used to implement #2) in a single policy, unless one is "further upstream" (and can simply remove the other from the policy freely). This is quite limiting of course, since we actually do want to enforce on each TPM object that both the OS vendor policy and the local policy must be fulfilled, without the chance for the vendor or the local system to disable the other. This patch addresses this: instead of trying to find a way to come up with some adventurous scheme to combine both policy into one TPM2 policy, we simply shard the symmetric LUKS decryption key: one half we protect via the signed PCR policy, and the other we protect via the pcrlock policy. Only if both halves can be acquired the disk can be decrypted. This means: 1. we simply double the unlock key in length in case both policies shall be used. 2. We store two resulting TPM policy hashes in the LUKS token JSON, one for each policy 3. We store two sealed TPM policy key blobs in the LUKS token JSON, for both halves of the LUKS unlock key. This patch keeps the "sharding" logic relatively generic (i.e. the low level logic is actually fine with more than 2 shards), because I figure sooner or later we might have to encode more shards, for example if we add further TPM2-based access policies, for example when combining FIDO2 with TPM2, or implementing TOTP for this.
* src/pcrlock/pcrlock.c: Handle empty pcrlock.d directoriesArnaud Patard2024-08-051-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Running the following commands: # mkdir -p /var/lib/pcrlock.d/123-empty.pcrlock.d # /usr/lib/systemd/systemd-pcrlock predict --pcr=1+2+3+4+5+16 Will result in: ... Floating point exception Running the following commands: # mkdir -p /var/lib/pcrlock.d/123-empty.pcrlock.d # /usr/lib/systemd/systemd-pcrlock make-policy --pcr=1+2+3+4+5+16 Will result to this (partial) log: ... Predicted future PCRs in 133us. [] ... Written policy digest 0000000000000000000000000000000000000000000000000000000000000000 to NV index 0x1921da6 ... So, add missing checks to handle gracefully cases where there's no variant inside the component. Signed-off-by: Arnaud Patard <arnaud.patard@collabora.com>
* test: Rename testsuite-XX units to match test nameDaan De Meyer2024-05-141-0/+179
Having these named differently than the test itself mostly creates unecessary confusion and makes writing logic against the tests harder so let's rename the testsuite-xx units and scripts to just use the test name itself.