Function to hide password input
This commit is contained in:
parent
f6d8a9903b
commit
162b8a278c
@ -444,6 +444,21 @@ Your newly created PKI dir is: $EASYRSA_PKI
|
|||||||
return 0
|
return 0
|
||||||
} # => init_pki()
|
} # => 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 backend:
|
||||||
build_ca() {
|
build_ca() {
|
||||||
opts=""
|
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
|
# Get password from user if necessary
|
||||||
if [ ! $nopass ]; then
|
if [ ! $nopass ]; then
|
||||||
out_key_pass_tmp="$(mktemp)"; EASYRSA_TEMP_FILE_3="$out_key_pass_tmp"
|
out_key_pass_tmp="$(mktemp)"; EASYRSA_TEMP_FILE_3="$out_key_pass_tmp"
|
||||||
|
echo
|
||||||
printf "Enter New CA Key Passphrase: "
|
printf "Enter New CA Key Passphrase: "
|
||||||
stty -echo
|
hide_read_pass kpass
|
||||||
read -r kpass
|
|
||||||
stty echo
|
|
||||||
echo
|
echo
|
||||||
printf "Re-Enter New CA Key Passphrase: "
|
printf "Re-Enter New CA Key Passphrase: "
|
||||||
stty -echo
|
hide_read_pass kpass2
|
||||||
read -r kpass2
|
|
||||||
stty echo
|
|
||||||
echo
|
echo
|
||||||
if [ "$kpass" = "$kpass2" ];
|
if [ "$kpass" = "$kpass2" ];
|
||||||
then
|
then
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user