Skip to content

Commit de7e2bb

Browse files
committed
Uniformize vocabulary: LUKS TPM Disk Unlock Key & LUKS Disk Recovery Key
Signed-off-by: Thierry Laurion <insurgo@riseup.net>
1 parent c4bcf2e commit de7e2bb

File tree

10 files changed

+55
-55
lines changed

10 files changed

+55
-55
lines changed

FAQ.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ to deceive you and steal your login password? Maybe! It wouldn't get
110110
your disk password, which is perhaps an improvement.
111111

112112

113-
Disk key in TPM (TPM Disk Unlock Key) or user passphrase?
113+
Disk key in TPM (LUKS TPM Disk Unlock Key) or user passphrase?
114114
---
115115
Depends on your threat model. With the disk key in the TPM an attacker
116116
would need to have the entire machine (or a backdoor in the TPM)

initrd/bin/kexec-insert-key

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ if [ "$unseal_failed" = "y" ]; then
5959
confirm_boot="n"
6060
read \
6161
-n 1 \
62-
-p "Do you wish to boot and use the disk recovery key? [Y/n] " \
62+
-p "Do you wish to boot and use the LUKS Disk Recovery Key? [Y/n] " \
6363
confirm_boot
6464

6565
if [ "$confirm_boot" != 'y' \

initrd/bin/kexec-save-default

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -189,10 +189,10 @@ save_key="n"
189189

190190
if [ "$CONFIG_TPM" = "y" ] && [ "$CONFIG_TPM_NO_LUKS_DISK_UNLOCK" != "y" ] && [ "$CONFIG_BASIC" != y ]; then
191191
DEBUG "TPM is enabled and TPM_NO_LUKS_DISK_UNLOCK is not set"
192-
DEBUG "Checking if a a TPM Disk Unlock Key was previously set up from $KEY_DEVICES"
192+
DEBUG "Checking if a a LUKS TPM Disk Unlock Key was previously set up from $KEY_DEVICES"
193193
#check if $KEY_DEVICES file exists and is not empty
194194
if [ -r "$KEY_DEVICES" ] && [ -s "$KEY_DEVICES" ]; then
195-
DEBUG "TPM Disk Unlock Key was previously set up from $KEY_DEVICES"
195+
DEBUG "LUKS TPM Disk Unlock Key was previously set up from $KEY_DEVICES"
196196
read \
197197
-n 1 \
198198
-p "Do you want to reseal a disk key to the TPM [y/N]: " \
@@ -218,7 +218,7 @@ if [ "$CONFIG_TPM" = "y" ] && [ "$CONFIG_TPM_NO_LUKS_DISK_UNLOCK" != "y" ] && [
218218
save_key="y"
219219
fi
220220
else
221-
DEBUG "No previous TPM Disk Unlock Key was set up for LUKS devices, confirming to add a Disk Encryption Key to the TPM"
221+
DEBUG "No previous LUKS TPM Disk Unlock Key was set up, confirming to add a Disk Encryption Key to the TPM"
222222
read \
223223
-n 1 \
224224
-p "Do you wish to add a disk encryption to the TPM [y/N]: " \
@@ -234,7 +234,7 @@ if [ "$CONFIG_TPM" = "y" ] && [ "$CONFIG_TPM_NO_LUKS_DISK_UNLOCK" != "y" ] && [
234234

235235
if [ "$save_key" = "y" ]; then
236236
if [ -n "$old_key_devices" ] || [ -n "$old_lvm_volume_group" ]; then
237-
DEBUG "Previous TPM Disk Unlock Key was set up for LUKS devices $old_key_devices $old_lvm_volume_group"
237+
DEBUG "Previous LUKS TPM Disk Unlock Key was set up for $old_key_devices $old_lvm_volume_group"
238238
read \
239239
-n 1 \
240240
-p "Do you want to reuse configured Encrypted LVM groups/Block devices? (Y/n):" \
@@ -252,7 +252,7 @@ if [ "$CONFIG_TPM" = "y" ] && [ "$CONFIG_TPM_NO_LUKS_DISK_UNLOCK" != "y" ] && [
252252
prompt_for_existing_encrypted_lvms_or_disks
253253
fi
254254
else
255-
DEBUG "No previous TPM Disk Unlock Key was set up for LUKS devices, setting up new one"
255+
DEBUG "No previous LUKS TPM Disk Unlock Key was set up, setting up"
256256
prompt_for_existing_encrypted_lvms_or_disks
257257
fi
258258

@@ -263,7 +263,7 @@ if [ "$CONFIG_TPM" = "y" ] && [ "$CONFIG_TPM_NO_LUKS_DISK_UNLOCK" != "y" ] && [
263263
save_key_params="$save_key_params $key_devices"
264264
fi
265265
kexec-save-key $save_key_params ||
266-
die "Failed to save the TPM Disk Unlock Key"
266+
die "Failed to save the LUKS TPM Disk Unlock Key"
267267
fi
268268
fi
269269

initrd/bin/kexec-save-key

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ for dev in $key_devices; do
7272
done
7373

7474
kexec-seal-key $paramsdir ||
75-
die "Failed to save and generate TPM Disk Unlock Key"
75+
die "Failed to save and generate LUKS TPM Disk Unlock Key"
7676

7777
if [ "$skip_sign" != "y" ]; then
7878
extparam=

initrd/bin/kexec-seal-key

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -47,21 +47,21 @@ DEBUG "$(pcrs)"
4747
# LUKS Key slot 0 is the manual recovery pass phrase
4848
# that they user entered when they installed OS,
4949
# key slot 1 is the one that we've generated.
50-
read -s -p "Enter Disk Recovery Key/passphrase: " disk_password
50+
read -s -p "Enter LUKS Disk Recovery Key/passphrase: " disk_password
5151
echo -n "$disk_password" >"$RECOVERY_KEY"
5252
echo
5353

54-
read -s -p "New TPM Disk Unlock Key passphrase for booting: " key_password
54+
read -s -p "New LUKS TPM Disk Unlock Key passphrase for booting: " key_password
5555
echo
56-
read -s -p "Repeat TPM Disk Unlock Key passphrase for booting: " key_password2
56+
read -s -p "Repeat LUKS TPM Disk Unlock Key passphrase for booting: " key_password2
5757
echo
5858

5959
if [ "$key_password" != "$key_password2" ]; then
6060
die "Key passphrases do not match"
6161
fi
6262

6363
# Generate key file
64-
echo "++++++ Generating new randomized 128 bytes key file that will be sealed/unsealed by TPM Disk Unlock Key passphrase"
64+
echo "++++++ Generating new randomized 128 bytes key file that will be sealed/unsealed by LUKS TPM Disk Unlock Key passphrase"
6565
dd \
6666
if=/dev/urandom \
6767
of="$KEY_FILE" \
@@ -100,29 +100,29 @@ for dev in $(cat "$KEY_DEVICES" | cut -d\ -f1); do
100100
# Check if slot 1 is the only one existing
101101
if [ "$(cryptsetup luksDump "$dev" | grep -c "Slot 1: ENABLED")" -eq 1 ] || [ "$(cryptsetup luksDump "$dev" | grep -c "1: luks2")" -eq 1 ]; then
102102
warn "Slot 1 is the only one existing on $dev LUKS header. Heads cannot use it to store TPM sealed LUKS Disk Unlock Key"
103-
warn "Slot 1 should not be the only slot existing on $dev LUKS header. Slot 0 should be used to store Disk Recovery Key/passphrase"
103+
warn "Slot 1 should not be the only slot existing on $dev LUKS header. Slot 0 should be used to store LUKS Disk Recovery Key/passphrase"
104104
die "You can safely fix this before continuing through Heads recovery shell: cryptsetup luksAddKey $dev"
105105
fi
106106
else
107107
DEBUG "Slot 1 is not the only existing slot on $dev LUKS header."
108-
DEBUG "$dev LUKS header's slot 1 will store LUKS Disk Unlock Key that TPM will seal/unseal with TPM Disk Unlock Key passphrase"
108+
DEBUG "$dev LUKS header's slot 1 will store LUKS Disk Unlock Key that TPM will seal/unseal with LUKS TPM Disk Unlock Key passphrase"
109109
fi
110110
done
111111

112112
# Remove all the old keys from slot 1
113113
for dev in $(cat "$KEY_DEVICES" | cut -d\ -f1); do
114-
echo "++++++ $dev: Removing old TPM Disk Unlock Key in LUKS slot 1"
114+
echo "++++++ $dev: Removing old LUKS TPM Disk Unlock Key in LUKS slot 1"
115115
cryptsetup luksKillSlot \
116116
--key-file "$RECOVERY_KEY" \
117117
$dev 1 ||
118-
warn "$dev: removal of TPM Disk Unlock Key in LUKS slot 1 failed: might not exist. Continuing"
118+
warn "$dev: removal of LUKS TPM Disk Unlock Key in LUKS slot 1 failed: might not exist. Continuing"
119119

120-
echo "++++++ $dev: Adding TPM Disk Unlock Key to LUKS slot 1"
120+
echo "++++++ $dev: Adding LUKS TPM Disk Unlock Key to LUKS slot 1"
121121
cryptsetup luksAddKey \
122122
--key-file "$RECOVERY_KEY" \
123123
--key-slot 1 \
124124
$dev "$KEY_FILE" ||
125-
die "$dev: Unable to add TPM Disk Unlock Key to LUKS slot 1"
125+
die "$dev: Unable to add LUKS TPM Disk Unlock Key to LUKS slot 1"
126126
done
127127

128128
# Now that we have setup the new keys, measure the PCRs
@@ -140,23 +140,23 @@ tpmr pcrread -a 3 "$pcrf"
140140
# Note that PCR 4 needs to be set with the "normal-boot" path value, read it from event log.
141141
tpmr calcfuturepcr 4 >>"$pcrf"
142142
if [ "$CONFIG_USB_KEYBOARD" = "y" -o -r /lib/modules/libata.ko -o -x /bin/hotp_verification ]; then
143-
DEBUG "Sealing TPM Disk Unlock key with PCR5 involvement (additional kernel modules are loaded per board config)..."
143+
DEBUG "Sealing LUKS TPM Disk Unlock Key with PCR5 involvement (additional kernel modules are loaded per board config)..."
144144
# Here, we take pcr 5 into consideration if modules are expected to be measured+loaded
145145
tpmr pcrread -a 5 "$pcrf"
146146
else
147-
DEBUG "Sealing TPM Disk Unlock Key with PCR5=0 (NO additional kernel modules are loaded per board config)..."
147+
DEBUG "Sealing LUKS TPM Disk Unlock Key with PCR5=0 (NO additional kernel modules are loaded per board config)..."
148148
#no kernel modules are expected to be measured+loaded
149149
tpmr calcfuturepcr 5 >>"$pcrf"
150150
fi
151151
# Precompute the value for pcr 6
152-
DEBUG "Precomputing TPM future value for PCR6 sealing/unsealing of TPM Disk Unlock Key..."
152+
DEBUG "Precomputing TPM future value for PCR6 sealing/unsealing of LUKS TPM Disk Unlock Key..."
153153
tpmr calcfuturepcr 6 "/tmp/luksDump.txt" >>"$pcrf"
154154
# We take into consideration user files in cbfs
155155
tpmr pcrread -a 7 "$pcrf"
156156

157157
DO_WITH_DEBUG --mask-position 7 \
158158
tpmr seal "$KEY_FILE" "$TPM_INDEX" 0,1,2,3,4,5,6,7 "$pcrf" \
159-
"$TPM_SIZE" "$key_password" || die "Unable to write TPM Disk Unlock Key to NVRAM"
159+
"$TPM_SIZE" "$key_password" || die "Unable to write LUKS TPM Disk Unlock Key to NVRAM"
160160

161161
# should be okay if this fails
162162
shred -n 10 -z -u "$pcrf" 2>/dev/null ||

initrd/bin/kexec-unseal-key

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ DEBUG "$(pcrs)"
2727

2828
failed=0
2929
for tries in 1 2 3; do
30-
read -s -p "Enter LUKS TPM Disk Unlock Key passphrase (blank to abort): " tpm_password
30+
read -s -p "Enter LUKS LUKS TPM Disk Unlock Key passphrase (blank to abort): " tpm_password
3131
echo
3232
if [ -z "$tpm_password" ]; then
3333
die "Aborting unseal disk encryption key"

initrd/bin/oem-factory-reset

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -626,7 +626,7 @@ generate_checksums() {
626626
mount -o remount,rw /boot || whiptail_error_die "Unable to mount /boot"
627627
fi
628628

629-
#Check if previous TPM Disk unlock Key was set
629+
#Check if previous LUKS TPM Disk Unlock Key was set
630630
if [ -e /boot/kexec_key_devices.txt ]; then
631631
TPM_DISK_ENCRYPTION_KEY_SET=1
632632
fi
@@ -657,7 +657,7 @@ generate_checksums() {
657657
fi
658658
fi
659659

660-
# set default boot option only if no TPM Disk Unlock Key previously set
660+
# set default boot option only if no LUKS TPM Disk Unlock Key previously set
661661
if [ -z "$TPM_DISK_ENCRYPTION_KEY_SET" ]; then
662662
set_default_boot_option
663663
fi
@@ -903,7 +903,7 @@ if [ "$use_defaults" == "n" -o "$use_defaults" == "N" ]; then
903903
echo -e "\n"
904904
fi
905905

906-
echo -e -n "Would you like to re-encrypt LUKS encrypted container and generate new Disk Recovery key?\n (Highly recommended if you didn't install the operating system yourself: this would prevent any LUKS backed up header to be restored to access encrypted data) [y/N]: "
906+
echo -e -n "Would you like to re-encrypt LUKS encrypted container and generate new LUKS Disk Recovery Key?\n (Highly recommended if you didn't install the operating system yourself: this would prevent any LUKS backed up header to be restored to access encrypted data) [y/N]: "
907907
read -n 1 prompt_output
908908
echo
909909
if [ "$prompt_output" == "y" \
@@ -1022,13 +1022,13 @@ if [ "$use_defaults" == "n" -o "$use_defaults" == "N" ]; then
10221022
if [ -n "$luks_new_Disk_Recovery_Key_passphrase_desired" -a -z "$luks_new_Disk_Recovery_Key_passphrase" ]; then
10231023
# We catch here if changing LUKS Disk Recovery Key passphrase was desired
10241024
# but yet undone. This is if not being covered by the single password
1025-
echo -e "\nEnter desired replacement for current Disk Recovery Key passphrase (At least 8 characters long):"
1025+
echo -e "\nEnter desired replacement for current LUKS Disk Recovery Key passphrase (At least 8 characters long):"
10261026
while [[ ${#luks_new_Disk_Recovery_Key_passphrase} -lt 8 ]]; do
10271027
{
10281028
read -r luks_new_Disk_Recovery_Key_passphrase
10291029
}
10301030
done
1031-
#We test that current Disk Recovery Key passphrase is known prior of going further
1031+
#We test that current LUKS Disk Recovery Key passphrase is known prior of going further
10321032
test_luks_current_disk_recovery_key_passphrase
10331033
echo -e "\n"
10341034
fi
@@ -1147,7 +1147,7 @@ if [[ "$SKIP_BOOT" == "n" ]]; then
11471147
fi
11481148

11491149
if [ -n "$luks_new_Disk_Recovery_Key_desired" -a -n "$luks_new_Disk_Recovery_Key_passphrase_desired" ]; then
1150-
#Reencryption of disk, disk recovery key and Disk Recovery Key passphrase change is requested
1150+
#Reencryption of disk, LUKS Disk Recovery Key and LUKS Disk Recovery Key passphrase change is requested
11511151
luks_change_passphrase
11521152
luks_reencrypt
11531153
elif [ -n "$luks_new_Disk_Recovery_Key_desired" -a -z "$luks_new_Disk_Recovery_Key_passphrase_desired" ]; then

initrd/etc/functions

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -82,12 +82,12 @@ confirm_totp() {
8282

8383
reseal_tpm_disk_decryption_key() {
8484
TRACE "Under /etc/functions:reseal_tpm_disk_decryption_key"
85-
#For robustness, exit early if TPM Disk Unlock Key is prohibited in board configs
85+
#For robustness, exit early if LUKS TPM Disk Unlock Key is prohibited in board configs
8686
if [ "$CONFIG_TPM_DISK_UNLOCK_KEY" == "n" ]; then
87-
DEBUG "TPM Disk Unlock Key is prohibited in board configs"
87+
DEBUG "LUKS TPM Disk Unlock Key is prohibited in board configs"
8888
return
8989
else
90-
DEBUG "TPM Disk Unlock Key is allowed in board configs. Continuing"
90+
DEBUG "LUKS TPM Disk Unlock Key is allowed in board configs. Continuing"
9191
fi
9292

9393
if ! grep -q /boot /proc/mounts; then
@@ -96,8 +96,8 @@ reseal_tpm_disk_decryption_key() {
9696
fi
9797

9898
if [ -s /boot/kexec_key_devices.txt ] || [ -s /boot/kexec_key_lvm.txt ]; then
99-
warn "TPM sealed Disk Unlock Key secret needs to be resealed alongside TOTP/HOTP secret"
100-
echo "Resealing TPM LUKS Disk Unlock Key to be unsealed by TPM Disk Unlock Key passphrase"
99+
warn "LUKS TPM sealed Disk Unlock Key secret needs to be resealed alongside TOTP/HOTP secret"
100+
echo "Resealing LUKS TPM Disk Unlock Key to be unsealed by LUKS TPM Disk Unlock Key passphrase"
101101
while ! kexec-seal-key /boot; do
102102
warn "Recovery Disk Encryption key passphrase/TPM Owner Password may be invalid. Please try again"
103103
done

0 commit comments

Comments
 (0)