You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
msg=$(echo -e "This will replace the encrypted container content and its LUKS Disk Recovery Key.\n\nThe passphrase associated with this key will be asked from the user under the 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/modified by the user\n\nThis process requires you to type the current LUKS Disk Recovery Key passphrase and will delete the LUKS TPM Disk Unlock Key slot, if set up, by setting a default boot LUKS key slot (1) if present.\n\nAt the next prompt, you may be asked to select which file corresponds to the LUKS device container.\n\nHit Enter to continue."| fold -w 70 -s)
msg=$(echo -e "This will replace the encrypted container content and its LUKS Disk Recovery Key.\n\nThe passphrase associated with this key will be asked from the user under the 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/modified by the user\n\nThis process requires you to type the current LUKS Disk Recovery Key passphrase and will delete the LUKS TPM Disk Unlock Key slot, if set up, by setting a default boot LUKS key slot (1) if present.\n\nAt the next prompt, you may be asked to select which file corresponds to the LUKS device container.\n\nHit Enter to continue."| fold -w 70 -s)
DEBUG "$luks_container: Test unlocking of LUKS encrypted drive content with current LUKS Disk Recovery Key passphrase..."
439
438
if! DO_WITH_DEBUG cryptsetup open --test-passphrase "$luks_container" --key-file /tmp/secret/luks_current_Disk_Recovery_Key_passphrase >/dev/null 2>&1;then
440
439
whiptail_error --title "$luks_container: Wrong current LUKS Disk Recovery Key passphrase?" --msgbox \
@@ -449,70 +448,61 @@ luks_reencrypt() {
449
448
continue
450
449
fi
451
450
452
-
DEBUG "Test opening ${luks_containers[@]} successful. Now testing key slots to determine which holds master key"
453
-
forluks_containerin"${luks_containers[@]}";do
454
-
DRK_KEYSLOT=-1
455
-
DEBUG "$luks_container: Test unlocking of LUKS encrypted drive content with current LUKS Disk Recovery Key passphrase..."
456
-
foriin$(seq 0 31);do
457
-
DEBUG "Testing key slot $i on $luks_container"
458
-
if DO_WITH_DEBUG cryptsetup open --test-passphrase $luks_container --key-slot $i --key-file /tmp/secret/luks_current_Disk_Recovery_Key_passphrase >/dev/null 2>&1;then
459
-
DRK_KEYSLOT=$i
460
-
DEBUG "$luks_container: Found key-slot $DRK_KEYSLOT that can be unlocked with the current passphrase. breaking loop"
461
-
break
462
-
else
463
-
DEBUG "Key slot $i on $luks_container cannot be unlocked with the current passphrase"
464
-
fi
465
-
done
466
-
467
-
if [ $DRK_KEYSLOT-eq -1 ];then
468
-
whiptail_error --title "$luks_container: Wrong current LUKS Disk Recovery Key passphrase?" --msgbox \
469
-
"If you previously changed it and do not remember it, you will have to reinstall the OS from an external drive.\n\nTo do so, place the ISO file and its signature file on root of an external drive, and select Options-> Boot from USB \n\nHit Enter to retry." 0 80
470
-
TRACE_FUNC
471
-
detect_boot_device
472
-
mount -o remount,rw /boot
473
-
rm -f /boot/kexec_key_devices.txt
474
-
mount -o remount,ro /boot
475
-
luks_secrets_cleanup
476
-
unset LUKS
477
-
continue
478
-
fi
479
-
480
-
# Now reencrypt the LUKS container with the same key slot
481
-
# Warn and launch actual reencryption
482
-
echo -e "\nReencrypting $luks_container LUKS encrypted drive content with current Recovery Disk Key passphrase..."
483
-
warn "DO NOT POWER DOWN MACHINE, UNPLUG AC OR REMOVE BATTERY DURING REENCRYPTION PROCESS"
484
-
485
-
# --perf-no_read_workqueue and/or --perf-no_write_workqueue improve encryption/reencrypton performance on kernel 5.10.9+
whiptail_error --title "$luks_container: Wrong current LUKS Disk Recovery Key passphrase?" --msgbox \
498
-
"If you previously changed it and do not remember it, you will have to reinstall the OS from an external drive.\n\nTo do so, place the ISO file and its signature file on root of an external drive, and select Options-> Boot from USB \n\nHit Enter to retry." 0 80
499
-
TRACE_FUNC
500
-
501
-
#remove "known good" selected LUKS container so that next pass asks again user to select LUKS container.
502
-
#maybe the container was not the right one
503
-
detect_boot_device
504
-
mount -o remount,rw /boot
505
-
rm -f /boot/kexec_key_devices.txt
506
-
mount -o remount,ro /boot
507
-
luks_secrets_cleanup
508
-
unset LUKS
451
+
DEBUG "Test opening ${luks_container} successful. Now testing key slots to determine which holds master key"
452
+
DRK_KEYSLOT=-1
453
+
DEBUG "$luks_container: Test unlocking of LUKS encrypted drive content with current LUKS Disk Recovery Key passphrase..."
454
+
foriin$(seq 0 31);do
455
+
DEBUG "Testing key slot $i on $luks_container"
456
+
if DO_WITH_DEBUG cryptsetup open --test-passphrase $luks_container --key-slot $i --key-file /tmp/secret/luks_current_Disk_Recovery_Key_passphrase >/dev/null 2>&1;then
457
+
DRK_KEYSLOT=$i
458
+
DEBUG "$luks_container: Found key-slot $DRK_KEYSLOT that can be unlocked with the current passphrase. breaking loop"
459
+
break
509
460
else
510
-
#Reencryption was successful. Cleanup should be called only when done
511
-
#Exporting successfully used passphrase possibly reused by oem-factory-reset
512
-
export luks_current_Disk_Recovery_Key_passphrase
513
-
export LUKS
461
+
DEBUG "Key slot $i on $luks_container cannot be unlocked with the current passphrase"
514
462
fi
515
463
done
464
+
465
+
if [ $DRK_KEYSLOT-eq -1 ];then
466
+
whiptail_error --title "$luks_container: Wrong current LUKS Disk Recovery Key passphrase?" --msgbox \
467
+
"If you previously changed it and do not remember it, you will have to reinstall the OS from an external drive.\n\nTo do so, place the ISO file and its signature file on root of an external drive, and select Options-> Boot from USB \n\nHit Enter to retry." 0 80
468
+
TRACE_FUNC
469
+
detect_boot_device
470
+
mount -o remount,rw /boot
471
+
rm -f /boot/kexec_key_devices.txt
472
+
mount -o remount,ro /boot
473
+
luks_secrets_cleanup
474
+
unset LUKS
475
+
continue
476
+
fi
477
+
478
+
# --perf-no_read_workqueue and/or --perf-no_write_workqueue improve encryption/reencrypton performance on kernel 5.10.9+
whiptail_error --title "$luks_container: Wrong current LUKS Disk Recovery Key passphrase?" --msgbox \
494
+
"If you previously changed it and do not remember it, you will have to reinstall the OS from an external drive.\n\nTo do so, place the ISO file and its signature file on root of an external drive, and select Options-> Boot from USB \n\nHit Enter to retry." 0 80
0 commit comments