Skip to content

Commit 21adb0d

Browse files
committed
codebase: fix console echo needed accordingly to previous read changes
Signed-off-by: Thierry Laurion <[email protected]>
1 parent f475296 commit 21adb0d

File tree

4 files changed

+12
-10
lines changed

4 files changed

+12
-10
lines changed

initrd/bin/kexec-boot

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ DO_WITH_DEBUG eval "$kexeccmd" 2>/dev/null \
158158

159159
if [ "$CONFIG_DEBUG_OUTPUT" = "y" ];then
160160
#Ask user if they want to continue booting without echoing back the input (-s)
161-
read -r -s -n 1 -p "[DEBUG] Continue booting? [Y/n]: " debug_boot_confirm
161+
read -s -n 1 -p "[DEBUG] Continue booting? [Y/n]: " debug_boot_confirm
162162
echo
163163
if [ "${debug_boot_confirm^^}" = N ]; then
164164
# abort

initrd/bin/kexec-seal-key

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ attempts=0
7070
# Ask for the DRK passphrase first, before testing any devices
7171
while [ $attempts -lt 3 ] && [ $luks_drk_passphrase_valid -eq 0 ]; do
7272
read -r -s -p $'\nEnter LUKS Disk Recovery Key (DRK) passphrase that can unlock '"$key_devices"': ' disk_recovery_key_passphrase
73+
echo
7374
echo -n "$disk_recovery_key_passphrase" >"$DISK_RECOVERY_KEY_FILE"
7475

7576
# Test the passphrase against ALL devices before deciding if it's valid
@@ -103,13 +104,15 @@ MIN_PASSPHRASE_LENGTH=12
103104
attempts=0
104105
while [ $attempts -lt 3 ]; do
105106
read -r -s -p $'\nNew LUKS TPM Disk Unlock Key (DUK) passphrase for booting (minimum '"$MIN_PASSPHRASE_LENGTH"' characters): ' key_password
107+
echo
106108
if [ ${#key_password} -lt $MIN_PASSPHRASE_LENGTH ]; then
107109
attempts=$((attempts + 1))
108110
warn "Disk Unlock Key (DUK) passphrase is too short. Please try again."
109111
continue
110112
fi
111113

112114
read -r -s -p $'\nRepeat LUKS TPM Disk Unlock Key (DUK) passphrase for booting: ' key_password2
115+
echo
113116
if [ "$key_password" != "$key_password2" ]; then
114117
attempts=$((attempts + 1))
115118
warn "Disk Unlock Key (DUK) passphrases do not match. Please try again."
@@ -123,6 +126,7 @@ if [ $attempts -ge 3 ]; then
123126
fi
124127

125128
# Generate key file
129+
echo
126130
echo "++++++ Generating new randomized 128 bytes key file that will be sealed/unsealed by LUKS TPM Disk Unlock Key passphrase"
127131
dd \
128132
if=/dev/urandom \

initrd/bin/seal-hotpkey

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,10 +145,11 @@ if [ "$admin_pin_status" -ne 0 ]; then
145145

146146
# prompt user for PIN and retry
147147
read -r -s -p $'\nEnter your '"$HOTPKEY_BRANDING $prompt_message"' PIN: ' admin_pin
148-
148+
echo
149149
hotp_initialize "$admin_pin" $HOTP_SECRET $counter_value "$HOTPKEY_BRANDING"
150150
if [ $? -ne 0 ]; then
151151
read -r -s -p $'\nError setting HOTP secret, re-enter '"$prompt_message"' PIN and try again: ' admin_pin
152+
echo
152153
if ! hotp_initialize "$admin_pin" $HOTP_SECRET $counter_value "$HOTPKEY_BRANDING"; then
153154
# don't leak key on failure
154155
shred -n 10 -z -u "$HOTP_SECRET" 2>/dev/null

initrd/etc/functions

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -142,10 +142,7 @@ confirm_gpg_card() {
142142
message="Please confirm that your GPG card is inserted [Y/n]: "
143143
fi
144144

145-
read \
146-
-n 1 \
147-
-p "$message" \
148-
card_confirm
145+
read -r -n 1 -p $'\n'"$message" card_confirm
149146
echo
150147

151148
if [ "$card_confirm" != "y" \
@@ -167,10 +164,10 @@ confirm_gpg_card() {
167164
shred -n 10 -z -u "$CR_NONCE" "$CR_SIG" >/dev/null 2>&1 || true
168165

169166
#Prompt user for configured GPG Admin PIN that will be passed along to mount-usb and to import gpg subkeys
170-
echo
171167
gpg_admin_pin=""
172168
while [ -z "$gpg_admin_pin" ]; do
173169
read -r -s -p $'\nPlease enter GPG Admin PIN needed to use the GPG backup thumb drive: ' gpg_admin_pin
170+
echo
174171
done
175172
#prompt user to select the proper encrypted partition, which should the first one on next prompt
176173
warn "Please select encrypted LUKS on GPG key material backup thumb drive (not public labeled one)"
@@ -789,6 +786,7 @@ prompt_tpm_owner_password() {
789786
fi
790787

791788
read -r -s -p $'\nTPM Owner Password: ' tpm_owner_password
789+
echo
792790

793791
# Cache the password externally to be reused by who needs it
794792
DEBUG "Caching TPM Owner Password to /tmp/secret/tpm_owner_password"
@@ -807,14 +805,13 @@ prompt_new_owner_password() {
807805
tpm_owner_password2=2
808806
while [ "$tpm_owner_password" != "$tpm_owner_password2" ] || [ "${#tpm_owner_password}" -gt 32 ] || [ -z "$tpm_owner_password" ]; do
809807
read -r -s -p $'\nNew TPM Owner Password (2 words suggested, 1-32 characters max): ' tpm_owner_password
810-
811808
read -r -s -p $'\nRepeat chosen TPM Owner Password: ' tpm_owner_password2
812-
echo
813809

814810
if [ "$tpm_owner_password" != "$tpm_owner_password2" ]; then
815-
echo "Passphrases entered do not match. Try again!"
816811
echo
812+
echo "Passphrases entered do not match. Try again!"
817813
fi
814+
echo
818815
done
819816

820817
# Cache the password externally to be reused by who needs it

0 commit comments

Comments
 (0)