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
|
* verify_ca_password() looks for a previously set password and verifies it
|
||||||
* Extract cert_end_date() function
|
* Extract cert_end_date() function
|
||||||
* Extract is_user() and is_group() functions
|
* Extract is_user() and is_group() functions
|
||||||
|
* Extract ask_user_password() function
|
||||||
* Extract variables for files
|
* Extract variables for files
|
||||||
* Use inline pass phrase arguments
|
* Use inline pass phrase arguments
|
||||||
|
|
||||||
|
|
24
shellpki
24
shellpki
|
@ -225,6 +225,19 @@ ask_ca_password() {
|
||||||
ask_ca_password "${attempt}"
|
ask_ca_password "${attempt}"
|
||||||
fi
|
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() {
|
create() {
|
||||||
from_csr=0
|
from_csr=0
|
||||||
|
@ -435,16 +448,7 @@ create() {
|
||||||
ask_ca_password 0
|
ask_ca_password 0
|
||||||
|
|
||||||
if [ "${ask_pass}" -eq 1 ]; then
|
if [ "${ask_pass}" -eq 1 ]; then
|
||||||
trap 'unset PASSWORD' 0
|
ask_user_password
|
||||||
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
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# generate private key
|
# generate private key
|
||||||
|
|
Loading…
Reference in a new issue