From 73e99b323527c75a2dca22358c65032b04507d2b Mon Sep 17 00:00:00 2001 From: Andrew Gunnerson Date: Sun, 21 Apr 2024 16:52:43 -0400 Subject: [PATCH] {encrypt,decrypt}_keys.sh: Prompt for passwords with read -r Without `-r`, bash interprets backslash-escaped characters inside the password by default. Signed-off-by: Andrew Gunnerson --- decrypt_keys.sh | 2 +- encrypt_keys.sh | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/decrypt_keys.sh b/decrypt_keys.sh index b270d3e9..7633de26 100755 --- a/decrypt_keys.sh +++ b/decrypt_keys.sh @@ -8,7 +8,7 @@ source "$(dirname ${BASH_SOURCE[0]})/common.sh" cd $1 -[[ "${password+defined}" = defined ]] || read -p "Enter key passphrase (empty if none): " -s password +[[ "${password+defined}" = defined ]] || read -r -p "Enter key passphrase (empty if none): " -s password echo tmp="$(mktemp -d /dev/shm/decrypt_keys.XXXXXXXXXX)" diff --git a/encrypt_keys.sh b/encrypt_keys.sh index e112bc48..79c79d5b 100755 --- a/encrypt_keys.sh +++ b/encrypt_keys.sh @@ -8,12 +8,12 @@ source "$(dirname ${BASH_SOURCE[0]})/common.sh" cd $1 -read -p "Enter old key passphrase (empty if none): " -s password +read -r -p "Enter old key passphrase (empty if none): " -s password echo -read -p "Enter new key passphrase: " -s new_password +read -r -p "Enter new key passphrase: " -s new_password echo -read -p "Confirm new key passphrase: " -s confirm_new_password +read -r -p "Confirm new key passphrase: " -s confirm_new_password echo if [[ $new_password != $confirm_new_password ]]; then