Skip to content

Commit f93c739

Browse files
committed
LUKS header change validation at both sealing and unsealing of TPM Disk Unlock Key.
Fixes linuxboot#1092. Supersedes linuxboot#1093 - Cherry-picks ed1c23a (credit to @hardened-vault) thank you!) - Addresses and correct self-review under linuxboot#1093 (@hardened-vault: you don't answer often here!) - kexec-unseal-key: Warn a user who attempts to default boot while his Disk Unlock Key passphrase fails to unseal because LUKS headers changed. (linuxboot#1093 (comment)) - kexec-seal-key: Identical as in ed1c23a - kexec-add-key: Tell the user that the Headers did not change when changing TPM released Disk Unlock Key (Through changing default boot at Options->Boot Options -> Show OS boot options: select a new boot option and set a Disk Unlock Key in TPM, accept to modify disk and sign /boot options) - Here, we cancel the diff output shown on screen linuxboot#1093 (comment) - And we change the warning given to the user to past tense "Headers of LUKS containers to be unlocked via TPM Disk Unlock Key passphrase did not change." Signed-off-by: Thierry Laurion <insurgo@riseup.net>
1 parent 05289c0 commit f93c739

2 files changed

Lines changed: 11 additions & 0 deletions

File tree

initrd/bin/kexec-insert-key

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,9 @@ tpmr extend -ix 4 -ic generic ||
5757
# Check to continue
5858
if [ "$unseal_failed" = "y" ]; then
5959
confirm_boot="n"
60+
if diff "$(dirname $INITRD)/kexec_lukshdr_hash.txt" /tmp/luksDump.txt > /dev/null 2>&1; then
61+
echo "Headers of LUKS containers to be unlocked via TPM Disk Unlock Key passphrase did not change."
62+
fi
6063
read \
6164
-n 1 \
6265
-p "Do you wish to boot and use the LUKS Disk Recovery Key? [Y/n] " \

initrd/bin/kexec-unseal-key

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,14 @@ for tries in 1 2 3; do
4040

4141
DEBUG $(pcrs)
4242
warn "Unable to unseal disk encryption key"
43+
if [ -e /boot/kexec_lukshdr_hash.txt -a -e /tmp/luksDump.txt ]; then
44+
if ! diff /boot/kexec_lukshdr_hash.txt /tmp/luksDump.txt > /dev/null 2>&1; then
45+
warn "Encrypted LUKS(es) container(s) headers changed since they were measured and sealed in TPM for Disk Unlock key. You might want to investigate."
46+
fi
47+
else
48+
warn "No encrypted LUKS container(s) headers were found/comparable under /boot/kexec_lukshdr_hash.txt"
49+
warn "You might need to setup a new boot default and Disk Unlock Key from Options->Boot Options->Show OS boot menu."
50+
fi
4351
done
4452

4553
die "Retry count exceeded..."

0 commit comments

Comments
 (0)