verify_ssl_lib(): short-circuit overload check; un-indent by one tab
Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
This commit is contained in:
parent
aa85739b2e
commit
9266caaf33
@ -873,54 +873,53 @@ easyrsa_openssl() {
|
|||||||
|
|
||||||
# Verify the SSL library is functional and establish version dependencies
|
# Verify the SSL library is functional and establish version dependencies
|
||||||
verify_ssl_lib() {
|
verify_ssl_lib() {
|
||||||
if [ -z "$EASYRSA_SSL_OK" ]; then
|
# Run once only
|
||||||
# redirect std-err to ignore missing etc/ssl/openssl.cnf file
|
[ "$EASYRSA_SSL_OK" ] && die "verify_ssl_lib - Overloaded"
|
||||||
val="$("$EASYRSA_OPENSSL" version 2>/dev/null)"
|
|
||||||
|
|
||||||
# SSL lib name
|
# redirect std-err to ignore missing etc/ssl/openssl.cnf file
|
||||||
case "${val%% *}" in
|
val="$("$EASYRSA_OPENSSL" version 2>/dev/null)"
|
||||||
# OpenSSL does require a safe config-file for ampersand
|
|
||||||
OpenSSL)
|
# SSL lib name
|
||||||
ssl_lib=openssl
|
case "${val%% *}" in
|
||||||
[ "$EASYRSA_NO_SAFE_SSL" ] || require_safe_ssl_conf=1
|
# OpenSSL does require a safe config-file for ampersand
|
||||||
;;
|
OpenSSL)
|
||||||
LibreSSL)
|
ssl_lib=openssl
|
||||||
ssl_lib=libressl
|
[ "$EASYRSA_NO_SAFE_SSL" ] || require_safe_ssl_conf=1
|
||||||
require_safe_ssl_conf=1
|
;;
|
||||||
;;
|
LibreSSL)
|
||||||
*)
|
ssl_lib=libressl
|
||||||
error_msg="$("$EASYRSA_OPENSSL" version 2>&1)"
|
require_safe_ssl_conf=1
|
||||||
die "\
|
;;
|
||||||
|
*)
|
||||||
|
error_msg="$("$EASYRSA_OPENSSL" version 2>&1)"
|
||||||
|
die "\
|
||||||
Invalid SSL output for 'version':
|
Invalid SSL output for 'version':
|
||||||
|
|
||||||
$error_msg"
|
$error_msg"
|
||||||
esac
|
esac
|
||||||
|
|
||||||
# Set SSL version dependent $no_password option
|
# Set SSL version dependent $no_password option
|
||||||
osslv_major="${val#* }"
|
osslv_major="${val#* }"
|
||||||
osslv_major="${osslv_major%%.*}"
|
osslv_major="${osslv_major%%.*}"
|
||||||
case "$osslv_major" in
|
case "$osslv_major" in
|
||||||
1) no_password='-nodes' ;;
|
1) no_password='-nodes' ;;
|
||||||
2) no_password='-nodes' ;;
|
2) no_password='-nodes' ;;
|
||||||
3)
|
3)
|
||||||
case "$ssl_lib" in
|
case "$ssl_lib" in
|
||||||
openssl) no_password='-noenc' ;;
|
openssl) no_password='-noenc' ;;
|
||||||
libressl) no_password='-nodes' ;;
|
libressl) no_password='-nodes' ;;
|
||||||
*) die "Unsupported SSL library: $ssl_lib"
|
*) die "Unsupported SSL library: $ssl_lib"
|
||||||
esac
|
esac
|
||||||
;;
|
;;
|
||||||
*) die "Unsupported SSL library: $osslv_major"
|
*) die "Unsupported SSL library: $osslv_major"
|
||||||
esac
|
esac
|
||||||
information "Using SSL: $EASYRSA_OPENSSL ${val}"
|
information "Using SSL: $EASYRSA_OPENSSL ${val}"
|
||||||
EASYRSA_SSL_OK=1
|
EASYRSA_SSL_OK=1
|
||||||
|
|
||||||
# Verify EASYRSA_SSL_CONF file exists
|
# Verify EASYRSA_SSL_CONF file exists
|
||||||
[ -f "$EASYRSA_SSL_CONF" ] || die "\
|
[ -f "$EASYRSA_SSL_CONF" ] || die "\
|
||||||
The OpenSSL config file cannot be found.
|
The OpenSSL config file cannot be found.
|
||||||
Expected location: $EASYRSA_SSL_CONF"
|
Expected location: $EASYRSA_SSL_CONF"
|
||||||
else
|
|
||||||
die "verify_ssl_lib - Overloaded"
|
|
||||||
fi
|
|
||||||
} # => verify_ssl_lib()
|
} # => verify_ssl_lib()
|
||||||
|
|
||||||
# Basic sanity-check of PKI init and complain if missing
|
# Basic sanity-check of PKI init and complain if missing
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user