Extract ask_user_password() function
This commit is contained in:
parent
706608ca4a
commit
dfeaf77b9f
|
@ -21,6 +21,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
* verify_ca_password() looks for a previously set password and verifies it
|
||||
* Extract cert_end_date() function
|
||||
* Extract is_user() and is_group() functions
|
||||
* Extract ask_user_password() function
|
||||
* Extract variables for files
|
||||
* Use inline pass phrase arguments
|
||||
|
||||
|
|
26
shellpki
26
shellpki
|
@ -214,7 +214,7 @@ ask_ca_password() {
|
|||
fi
|
||||
if [ -z "${CA_PASSWORD}" ]; then
|
||||
stty -echo
|
||||
printf "Password for CA key : "
|
||||
printf "Password for CA key: "
|
||||
read -r CA_PASSWORD
|
||||
stty echo
|
||||
printf "\n"
|
||||
|
@ -225,6 +225,19 @@ ask_ca_password() {
|
|||
ask_ca_password "${attempt}"
|
||||
fi
|
||||
}
|
||||
ask_user_password() {
|
||||
trap 'unset PASSWORD' 0
|
||||
|
||||
stty -echo
|
||||
printf "Password for user key: "
|
||||
read -r PASSWORD
|
||||
stty echo
|
||||
printf "\n"
|
||||
|
||||
if [ -z "${PASSWORD}" ]; then
|
||||
warning "Warning: empty password from input"
|
||||
fi
|
||||
}
|
||||
|
||||
create() {
|
||||
from_csr=0
|
||||
|
@ -435,16 +448,7 @@ create() {
|
|||
ask_ca_password 0
|
||||
|
||||
if [ "${ask_pass}" -eq 1 ]; then
|
||||
trap 'unset PASSWORD' 0
|
||||
stty -echo
|
||||
printf "Password for user key : "
|
||||
read -r PASSWORD
|
||||
stty echo
|
||||
printf "\n"
|
||||
|
||||
if [ -z "${PASSWORD}" ]; then
|
||||
warning "Warning: empty password from input"
|
||||
fi
|
||||
ask_user_password
|
||||
fi
|
||||
|
||||
# generate private key
|
||||
|
|
Loading…
Reference in a new issue