fixes
This commit is contained in:
parent
86e662e286
commit
5fd26378ef
29
gencert.sh
29
gencert.sh
@ -70,19 +70,9 @@ function print_help() {
|
||||
# A POSIX variable
|
||||
OPTIND=1 # Reset in case getopts has been used previously in the shell.
|
||||
|
||||
ARGUMENT_LIST=(
|
||||
"cn"
|
||||
"key"
|
||||
"cert"
|
||||
"days"
|
||||
"cakey"
|
||||
"ca"
|
||||
"cadays"
|
||||
)
|
||||
|
||||
# read arguments
|
||||
opts=$(getopt \
|
||||
--longoptions "help,$(printf "%s:," "${ARGUMENT_LIST[@]}")" \
|
||||
--longoptions "help,cn:,key:,cert:,days:,cakey:,ca:,cadays:," \
|
||||
--name "$(basename "$0")" \
|
||||
--options "" \
|
||||
-- "$@"
|
||||
@ -206,9 +196,26 @@ function gen_server_x509() {
|
||||
-extensions v3_req_server -extfile "${OPENSSL_CONFIG}" 2>/dev/null
|
||||
}
|
||||
|
||||
function install_openssl() {
|
||||
if type -p openssl >/dev/null; then
|
||||
return;
|
||||
fi
|
||||
|
||||
if [ -f /etc/alpine-release ]; then
|
||||
apk add --update openssl
|
||||
elif [ -f /etc/centos-release ]; then
|
||||
yum -y install openssl
|
||||
elif grep -q Ubuntu /etc/lsb-release; then
|
||||
export DEBIAN_FRONTEND=noninteractive
|
||||
apt-get update
|
||||
apt-get -y install openssl
|
||||
fi
|
||||
}
|
||||
|
||||
function start() {
|
||||
echo "[${ME}] Started in ${PWD} directory."
|
||||
|
||||
install_openssl;
|
||||
gen_openssl_config;
|
||||
|
||||
if [ ! -f "${CA_KEY}" ]; then
|
||||
|
Loading…
Reference in New Issue
Block a user