From c70d6120f87753d90ac60c9e85a33c865fb4cd79 Mon Sep 17 00:00:00 2001 From: Charles Herlin Date: Wed, 25 Oct 2017 14:48:54 +0200 Subject: [PATCH] Changing CIS_ROOT_DIR management in env in bin/hardening.sh --- bin/hardening.sh | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/bin/hardening.sh b/bin/hardening.sh index d6291a0..c351e6e 100755 --- a/bin/hardening.sh +++ b/bin/hardening.sh @@ -22,7 +22,7 @@ AUDIT_ALL=0 AUDIT_ALL_ENABLE_PASSED=0 ALLOW_SERVICE_LIST=0 SET_HARDENING_LEVEL=0 -CIS_ROOT_DIR='' +#CIS_ROOT_DIR='' usage() { cat << EOF @@ -136,16 +136,14 @@ while [[ $# > 0 ]]; do done # Source Root Dir Parameter -if [ ! -r /etc/default/cis-hardening ]; then - echo "There is no /etc/default/cis-hardening file, cannot source CIS_ROOT_DIR variable, aborting" - exit 128 -else +if [ -r /etc/default/cis-hardening ]; then . /etc/default/cis-hardening - if [ -z $CIS_ROOT_DIR ]; then - echo "No CIS_ROOT_DIR variable, aborting" - exit 128 - fi -fi +fi +if [ -z "$CIS_ROOT_DIR" ]; then + echo "There is no /etc/default/cis-hardening file nor cis-hardening directory in current environment." + echo "Cannot source CIS_ROOT_DIR variable, aborting." + exit 128 +fi [ -r $CIS_ROOT_DIR/lib/constants.sh ] && . $CIS_ROOT_DIR/lib/constants.sh [ -r $CIS_ROOT_DIR/etc/hardening.cfg ] && . $CIS_ROOT_DIR/etc/hardening.cfg