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
TEXT="Would you like to update your checksums now?"
119
+
TEXT="${CHANGED_FILES_COUNT} files failed the verification process.\n\nThis could indicate a compromise!\n\nWould you like to investigate discrepancies or update your checksums now?"
119
120
else
120
-
TEXT="The following files failed the verification process:\n\n${CHANGED_FILES}\n\nThis could indicate a compromise!\n\nWould you like to update your checksums now?"
121
+
TEXT="The following files failed the verification process:\n\n${CHANGED_FILES}\n\nThis could indicate a compromise!\n\nWould you like to investigate discrepancies or update your checksums now?"
--msgbox "Cannot proceed with sealing new secrets because /boot/kexec.sig could not be verified with your current keyring.\n\nTreat /boot as untrusted and recover ownership first." 0 80
198
+
return 1
199
+
fi
200
+
else
201
+
DEBUG "gate_reseal_with_integrity_report: integrity is OK, skipping investigation and detached signature verification"
--menu "ERROR: $CONFIG_BRAND_NAME couldn't validate the HOTP code.\n\nIf you just reflashed your BIOS, you should generate a new TOTP/HOTP secret.\n\nIf you have not just reflashed your BIOS, THIS COULD INDICATE TAMPERING!\n\nHow would you like to proceed?" 0 80 4 \
316
393
'g'' Generate new TOTP/HOTP secret' \
@@ -321,9 +398,11 @@ update_hotp() {
321
398
option=$(cat /tmp/whiptail)
322
399
case"$option"in
323
400
g)
324
-
if (whiptail_warning --title 'Generate new TOTP/HOTP secret' \
401
+
ifgate_reseal_with_integrity_report &&(whiptail_warning --title 'Generate new TOTP/HOTP secret' \
325
402
--yesno "This will erase your old secret and replace it with a new one!\n\nDo you want to proceed?" 0 80);then
326
-
if generate_totp_hotp && BG_COLOR_MAIN_MENU="normal";then
--yesno "Would you like to update the checksums and sign all of the files in /boot?\n\nYou will need your GPG key to continue and this will modify your disk.\n\nOtherwise the system will reboot immediately." 0 80);then
704
+
else
705
+
DEBUG "TPM reset successful: updating checksums/signatures without additional confirmation"
Copy file name to clipboardExpand all lines: initrd/bin/unseal-hotp
+17-8Lines changed: 17 additions & 8 deletions
Original file line number
Diff line number
Diff line change
@@ -6,6 +6,15 @@
6
6
HOTP_SECRET="/tmp/secret/hotp.key"
7
7
HOTP_COUNTER="/boot/kexec_hotp_counter"
8
8
9
+
fail_unseal() {
10
+
TRACE_FUNC
11
+
if [ "$HEADS_NONFATAL_UNSEAL"="y" ];then
12
+
DEBUG "nonfatal unseal-hotp failure: $*"
13
+
return 1
14
+
fi
15
+
die "$*"
16
+
}
17
+
9
18
mount_boot_or_die() {
10
19
TRACE_FUNC
11
20
# Mount local disk if it is not already mounted
@@ -31,14 +40,14 @@ mount_boot_or_die
31
40
32
41
#if HOTP_COUNTER is not present, bail out
33
42
if [ !-f$HOTP_COUNTER ];then
34
-
die"HOTP counter file not found. If you just reinstalled an OS, you need to reseal the HOTP secret"
43
+
fail_unseal"HOTP counter file not found. If you just reinstalled an OS, you need to reseal the HOTP secret"||exit 1
35
44
fi
36
45
37
46
# Read the counter from the file
38
47
counter_value=$(cat $HOTP_COUNTER2>/dev/null)
39
48
40
49
if [ "$counter_value"=="" ];then
41
-
die"Unable to read HOTP counter"
50
+
fail_unseal"Unable to read HOTP counter"||exit 1
42
51
fi
43
52
44
53
#counter_value=$(printf "%d" 0x${counter_value})
@@ -47,29 +56,29 @@ if [ "$CONFIG_TPM" = "y" ]; then
47
56
# ensure primary handle exists before any TPM2 operation, to keep
48
57
# messaging consistent with unseal-totp
49
58
if [ !-f"/tmp/secret/primary.handle" ];then
50
-
die"Unable to unseal HOTP secret from TPM; no TPM primary handle. Reset the TPM (Options -> TPM/TOTP/HOTP Options -> Reset the TPM in the GUI)."
59
+
fail_unseal"Unable to unseal HOTP secret from TPM; no TPM primary handle. Reset the TPM (Options -> TPM/TOTP/HOTP Options -> Reset the TPM in the GUI)."||exit 1
die"Unable to unseal HOTP secret from TPM; TPM rollback counter intact. Use the GUI menu (Options -> TPM/TOTP/HOTP Options -> Generate new TOTP/HOTP secret) to reseal."
66
+
fail_unseal"Unable to unseal HOTP secret from TPM; TPM rollback counter intact. Use the GUI menu (Options -> TPM/TOTP/HOTP Options -> Generate new TOTP/HOTP secret) to reseal."||exit 1
58
67
else
59
-
die"Unable to unseal HOTP secret from TPM; TPM rollback counter broken or missing, reset TPM (see Options -> TPM/TOTP/HOTP Options -> Reset the TPM) and then generate a new secret."
68
+
fail_unseal"Unable to unseal HOTP secret from TPM; TPM rollback counter broken or missing, reset TPM (see Options -> TPM/TOTP/HOTP Options -> Reset the TPM) and then generate a new secret."||exit 1
60
69
fi
61
70
fi
62
71
else
63
72
# without a TPM, generate a secret based on the SHA-256 of the ROM
64
-
secret_from_rom_hash >"$HOTP_SECRET"||die"Reading ROM failed"
73
+
secret_from_rom_hash >"$HOTP_SECRET"||fail_unseal"Reading ROM failed"||exit 1
65
74
fi
66
75
67
76
# Truncate the secret if it is longer than the maximum HOTP secret
68
77
truncate_max_bytes 20 "$HOTP_SECRET"
69
78
70
79
if! hotp $counter_value<"$HOTP_SECRET";then
71
80
shred -n 10 -z -u "$HOTP_SECRET"2>/dev/null
72
-
die'Unable to compute HOTP hash?'
81
+
fail_unseal'Unable to compute HOTP hash?'||exit 1
73
82
fi
74
83
75
84
shred -n 10 -z -u "$HOTP_SECRET"2>/dev/null
@@ -85,7 +94,7 @@ mount -o remount,rw /boot
85
94
DEBUG "Incrementing HOTP counter under $HOTP_COUNTER"
86
95
counter_value=$(expr $counter_value + 1)
87
96
echo$counter_value>$HOTP_COUNTER||
88
-
die"Unable to create hotp counter file"
97
+
fail_unseal"Unable to create hotp counter file"||exit 1
0 commit comments