2
0
mirror of https://github.com/mozilla/cipherscan.git synced 2024-11-22 14:23:41 +01:00

Fallback to default openssl when supplied openssl can't be executed

This commit is contained in:
Peter Mosmans 2015-09-22 19:25:27 +10:00
parent 5a10991008
commit c00474805d

View File

@ -1881,17 +1881,22 @@ if [[ -z $OPENSSLBIN ]]; then
exit 1 exit 1
fi fi
OPENSSLBIN="${REALPATH}/${opensslbin_name}" OPENSSLBIN="${REALPATH}/${opensslbin_name}"
if ! [[ -x "${OPENSSLBIN}" ]]; then
OPENSSLBIN="$(which openssl)" # fallback to generic openssl
fi
fi fi
# use custom config file to enable GOST ciphers # use custom config file to enable GOST ciphers
if [[ -e $DIRNAMEPATH/openssl.cnf ]]; then if [[ -e $DIRNAMEPATH/openssl.cnf ]]; then
export OPENSSL_CONF="$DIRNAMEPATH/openssl.cnf" export OPENSSL_CONF="$DIRNAMEPATH/openssl.cnf"
fi fi
OPENSSLBINHELP="$($OPENSSLBIN s_client -help 2>&1)" OPENSSLBINHELP="$($OPENSSLBIN s_client -help 2>&1)"
if [[ $OPENSSLBINHELP =~ :error: ]]; then if [[ $OPENSSLBINHELP =~ :error: ]]; then
verbose "$OPENSSLBIN can't handle GOST config, disabling" verbose "$OPENSSLBIN can't handle GOST config, disabling"
unset OPENSSL_CONF unset OPENSSL_CONF
OPENSSLBINHELP="$($OPENSSLBIN s_client -help 2>&1)" OPENSSLBINHELP="$($OPENSSLBIN s_client -help 2>&1)"
fi fi
if ! [[ $OPENSSLBINHELP =~ -connect ]]; then if ! [[ $OPENSSLBINHELP =~ -connect ]]; then
echo "$OPENSSLBIN s_client doesn't accept the -connect parameter, which is extremely strange; refusing to proceed." 1>&2 echo "$OPENSSLBIN s_client doesn't accept the -connect parameter, which is extremely strange; refusing to proceed." 1>&2
exit 1 exit 1