move TLS file existance check

This commit is contained in:
Asif Bacchus 2020-03-14 19:16:15 -06:00
parent c23c60e16b
commit 4298c0c0c6

View File

@ -120,19 +120,6 @@ fi
# read .params file
. ./ab-openldap.params
# check for certs if using TLS
if [ "$TLS_CERT" ]; then
if [ ! -f "$TLS_CERT" ]; then
consoleError '5' 'Cannot find specified TLS certificate file.'
fi
if [ ! -f "$TLS_KEY" ]; then
consoleError '5' 'Cannot find specified TLS private key file.'
fi
if [ ! -f "$TLS_CHAIN" ]; then
consoleError '5' 'Cannot find specified TLS certificate chain file.'
fi
fi
# process startup parameters
while [ $# -gt 0 ]; do
case "$1" in
@ -294,6 +281,19 @@ elif [ -z "$TLS_CERT" ]; then
fi
# run with TLS
elif [ "$TLS_CERT" ] && [ "$TLS_KEY" ] && [ "$TLS_CHAIN" ]; then
# verify certificate files exist
if [ "$TLS_CERT" ]; then
if [ ! -f "$TLS_CERT" ]; then
consoleError '5' 'Cannot find specified TLS certificate file.'
fi
if [ ! -f "$TLS_KEY" ]; then
consoleError '5' 'Cannot find specified TLS private key file.'
fi
if [ ! -f "$TLS_CHAIN" ]; then
consoleError '5' 'Cannot find specified TLS certificate chain file.'
fi
fi
if [ $shell = true ]; then
# exec shell
printf "%s\nRunning SHELL on %s (TLS)...%s\n" \