Skip to content
Closed
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions initrd/bin/gui-init
Original file line number Diff line number Diff line change
Expand Up @@ -464,10 +464,12 @@ show_options_menu()
;;
C )
luks_reencrypt
[[ -n "$luks_current_Disk_Recovery_Key_passphrase" ]] && whiptail --title 'Reencryption successful!' --msgbox "Your LUKS volume was successfully reencrypted!\n\nNote that before booting the next time you should update your checksums.\nIf you are using a TPM Disk Unlock Key you also need to reseal that key." 0 80
luks_secrets_cleanup
;;
P )
luks_change_passphrase
[[ -n "$luks_new_Disk_Recovery_Key_passphrase" ]] && whiptail --title 'Passphrase change successful!' --msgbox "Your LUKS volume passphrase was successfully changed!\n\nNote that before booting the next time you should update your checksums.\nIf you are using a TPM Disk Unlock Key you also need to reseal that key." 0 80
luks_secrets_cleanup
;;
R )
Expand Down
13 changes: 6 additions & 7 deletions initrd/etc/luks-functions
Original file line number Diff line number Diff line change
Expand Up @@ -349,14 +349,13 @@ luks_reencrypt() {
--msgbox "This will replace the encrypted container content and its Disk Recovery Key.\n\nThe passphrase associated with this key will be asked from the user under\nthe following conditions:\n 1-Every boot if no Disk Unlock Key was added to the TPM\n 2-If the TPM fails (hardware failure)\n 3-If the firmware has been tampered with/upgraded/modified by the user\n\nThis process requires you to type the current Disk Recovery Key passphrase\nand will delete the TPM Disk Unlock Key slot, if set up, by setting a default\n boot LUKS key slot (1) if present.\n\nAt the next prompt, you may be asked to select which file corresponds to\nthe LUKS device container.\n\nHit Enter to continue." 0 80
echo -e "\nEnter the current Disk Recovery Key passphrase:"
read -r luks_current_Disk_Recovery_Key_passphrase
echo -n "$luks_current_Disk_Recovery_Key_passphrase" >/tmp/luks_current_Disk_Recovery_Key_passphrase
warn "Reencrypting "$LUKS" LUKS encrypted drive content with a new Disk Recovery Key. Do NOT shut down or reboot!"
cryptsetup-reencrypt -B 64 --use-directio "$LUKS" --key-slot 0 --key-file /tmp/luks_current_Disk_Recovery_Key_passphrase
else
echo -n "$luks_current_Disk_Recovery_Key_passphrase" >/tmp/luks_current_Disk_Recovery_Key_passphrase
warn "Reencrypting "$LUKS" LUKS encrypted drive content with a new Disk Recovery Key. Do NOT shut down or reboot!"
cryptsetup-reencrypt -B 64 --use-directio "$LUKS" --key-slot 0 --key-file /tmp/luks_current_Disk_Recovery_Key_passphrase
fi
echo -n "$luks_current_Disk_Recovery_Key_passphrase" >/tmp/luks_current_Disk_Recovery_Key_passphrase
#make secrets disappear from screen as reencryption can take a long time (we show these to the user again later in whiptail anyway)
clear
warn "Reencrypting "$LUKS" LUKS encrypted drive content with a new Disk Recovery Key. Do NOT shut down or reboot!"
cryptsetup-reencrypt -B 64 --use-directio "$LUKS" --key-slot 0 --key-file /tmp/luks_current_Disk_Recovery_Key_passphrase

#Validate past cryptsetup-reencrypt attempts
if [ $(echo $?) -ne 0 ]; then
whiptail --title 'Invalid Actual LUKS Disk Recovery Key passphrase?' --msgbox \
Expand Down