From 881404932b3133fce8ecea4b79d02914afe1cd0a Mon Sep 17 00:00:00 2001 From: Richard Bonhomme <25598447+TinCanTech@users.noreply.github.com> Date: Mon, 24 Sep 2018 23:39:08 +0100 Subject: [PATCH 1/2] Function to hide password input --- easyrsa3/easyrsa | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/easyrsa3/easyrsa b/easyrsa3/easyrsa index 3a6ba78..e0e96e8 100755 --- a/easyrsa3/easyrsa +++ b/easyrsa3/easyrsa @@ -444,6 +444,21 @@ Your newly created PKI dir is: $EASYRSA_PKI return 0 } # => init_pki() +hide_read_pass() +{ + test_file="bin/sh.exe" + if [ -f "$test_file" ] + then + set +o echo + read -r "$@" + set -o echo + else + stty -echo + read -r "$@" + stty echo + fi +} # => hide_read_pass() + # build-ca backend: build_ca() { opts="" @@ -503,15 +518,12 @@ current CA keypair. If you intended to start a new CA, run init-pki first." # Get password from user if necessary if [ ! $nopass ]; then out_key_pass_tmp="$(mktemp)"; EASYRSA_TEMP_FILE_3="$out_key_pass_tmp" + echo printf "Enter New CA Key Passphrase: " - stty -echo - read -r kpass - stty echo + hide_read_pass kpass echo printf "Re-Enter New CA Key Passphrase: " - stty -echo - read -r kpass2 - stty echo + hide_read_pass kpass2 echo if [ "$kpass" = "$kpass2" ]; then From d065ee34321d0716cdd399e1778ab4053b340496 Mon Sep 17 00:00:00 2001 From: Richard Bonhomme <25598447+TinCanTech@users.noreply.github.com> Date: Tue, 25 Sep 2018 01:10:15 +0100 Subject: [PATCH 2/2] Correct path to sh.exe --- easyrsa3/easyrsa | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/easyrsa3/easyrsa b/easyrsa3/easyrsa index e0e96e8..68aaf3c 100755 --- a/easyrsa3/easyrsa +++ b/easyrsa3/easyrsa @@ -446,7 +446,7 @@ Your newly created PKI dir is: $EASYRSA_PKI hide_read_pass() { - test_file="bin/sh.exe" + test_file="$EASYRSA/bin/sh.exe" if [ -f "$test_file" ] then set +o echo