From 4298c0c0c671e6f3b521da1f062b9bbc00893404 Mon Sep 17 00:00:00 2001 From: Asif Bacchus Date: Sat, 14 Mar 2020 19:16:15 -0600 Subject: [PATCH] move TLS file existance check --- ab-openldap/ab-openldap.sh | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/ab-openldap/ab-openldap.sh b/ab-openldap/ab-openldap.sh index ccee111..ecb897c 100755 --- a/ab-openldap/ab-openldap.sh +++ b/ab-openldap/ab-openldap.sh @@ -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" \