lowercase variable
This commit is contained in:
parent
e04f686651
commit
3e2bbe8de5
26
shellpki
26
shellpki
|
@ -503,15 +503,15 @@ create() {
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# generate private key
|
# generate private key
|
||||||
PASS_ARGS=""
|
pass_args=""
|
||||||
if [ -n "${password_file}" ]; then
|
if [ -n "${password_file}" ]; then
|
||||||
PASS_ARGS="-aes256 -passout file:${password_file}"
|
pass_args="-aes256 -passout file:${password_file}"
|
||||||
elif [ -n "${PASSWORD}" ]; then
|
elif [ -n "${PASSWORD}" ]; then
|
||||||
PASS_ARGS="-aes256 -passout pass:${PASSWORD}"
|
pass_args="-aes256 -passout pass:${PASSWORD}"
|
||||||
fi
|
fi
|
||||||
"${OPENSSL_BIN}" genrsa \
|
"${OPENSSL_BIN}" genrsa \
|
||||||
-out "${key_file}" \
|
-out "${key_file}" \
|
||||||
${PASS_ARGS} \
|
${pass_args} \
|
||||||
${KEY_LENGTH} \
|
${KEY_LENGTH} \
|
||||||
>/dev/null 2>&1
|
>/dev/null 2>&1
|
||||||
if [ "$?" -ne 0 ]; then
|
if [ "$?" -ne 0 ]; then
|
||||||
|
@ -519,18 +519,18 @@ create() {
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# generate csr req
|
# generate csr req
|
||||||
PASS_ARGS=""
|
pass_args=""
|
||||||
if [ -n "${password_file}" ]; then
|
if [ -n "${password_file}" ]; then
|
||||||
PASS_ARGS="-passin file:${password_file}"
|
pass_args="-passin file:${password_file}"
|
||||||
elif [ -n "${PASSWORD}" ]; then
|
elif [ -n "${PASSWORD}" ]; then
|
||||||
PASS_ARGS="-passin pass:${PASSWORD}"
|
pass_args="-passin pass:${PASSWORD}"
|
||||||
fi
|
fi
|
||||||
"${OPENSSL_BIN}" req \
|
"${OPENSSL_BIN}" req \
|
||||||
-batch \
|
-batch \
|
||||||
-new \
|
-new \
|
||||||
-key "${key_file}" \
|
-key "${key_file}" \
|
||||||
-out "${csr_file}" \
|
-out "${csr_file}" \
|
||||||
${PASS_ARGS} \
|
${pass_args} \
|
||||||
-config /dev/stdin <<EOF
|
-config /dev/stdin <<EOF
|
||||||
$(cat "${CONF_FILE}")
|
$(cat "${CONF_FILE}")
|
||||||
commonName_default = ${cn}
|
commonName_default = ${cn}
|
||||||
|
@ -569,18 +569,18 @@ EOF
|
||||||
echo "The CRT file is available in ${crt_file}"
|
echo "The CRT file is available in ${crt_file}"
|
||||||
|
|
||||||
# generate pkcs12 format
|
# generate pkcs12 format
|
||||||
PASS_ARGS=""
|
pass_args=""
|
||||||
if [ -n "${password_file}" ]; then
|
if [ -n "${password_file}" ]; then
|
||||||
# Hack for pkcs12 :
|
# Hack for pkcs12 :
|
||||||
# If passin and passout files are the same path, it expects 2 lines
|
# If passin and passout files are the same path, it expects 2 lines
|
||||||
# so we make a temporary copy of the password file
|
# so we make a temporary copy of the password file
|
||||||
password_file_out=$(mktemp)
|
password_file_out=$(mktemp)
|
||||||
cp "${password_file}" "${password_file_out}"
|
cp "${password_file}" "${password_file_out}"
|
||||||
PASS_ARGS="-passin file:${password_file} -passout file:${password_file_out}"
|
pass_args="-passin file:${password_file} -passout file:${password_file_out}"
|
||||||
elif [ -n "${PASSWORD}" ]; then
|
elif [ -n "${PASSWORD}" ]; then
|
||||||
PASS_ARGS="-passin pass:${PASSWORD} -passout pass:${PASSWORD}"
|
pass_args="-passin pass:${PASSWORD} -passout pass:${PASSWORD}"
|
||||||
else
|
else
|
||||||
PASS_ARGS="-passout pass:"
|
pass_args="-passout pass:"
|
||||||
fi
|
fi
|
||||||
"${OPENSSL_BIN}" pkcs12 \
|
"${OPENSSL_BIN}" pkcs12 \
|
||||||
-export \
|
-export \
|
||||||
|
@ -588,7 +588,7 @@ EOF
|
||||||
-inkey "${key_file}" \
|
-inkey "${key_file}" \
|
||||||
-in "${crt_file}" \
|
-in "${crt_file}" \
|
||||||
-out "${pkcs12_file}" \
|
-out "${pkcs12_file}" \
|
||||||
${PASS_ARGS}
|
${pass_args}
|
||||||
if [ "$?" -ne 0 ]; then
|
if [ "$?" -ne 0 ]; then
|
||||||
error "Error generating the pkcs12 file"
|
error "Error generating the pkcs12 file"
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in a new issue