This commit is contained in:
thibault.dewailly
2016-04-01 16:48:31 +02:00
parent 08da17be24
commit 1a41e2f592
10 changed files with 145 additions and 124 deletions

46
bin/hardening/1.1_Install_Updates.sh Normal file → Executable file
View File

@ -5,7 +5,7 @@
#
#
# Hardening script skeleton replace this line with proper point treated
# 1.1 Install Updates, Patches and Additional Security Software (Not Scored)
#
set -e # One error, it's over
@ -21,11 +21,12 @@ apply () {
:
}
# Environment Sanitizing
export PATH='/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin'
# This function will check config parameters required
check_config() {
:
}
# Source Root Dir Parameter
if [ ! -r /etc/default/cis-hardenning ]; then
echo "There is no /etc/default/cis-hardenning file, cannot source CIS_ROOT_DIR variable, aborting"
exit 128
@ -36,39 +37,4 @@ else
fi
fi
LONG_SCRIPT_NAME=$(basename $0)
SCRIPT_NAME=${LONG_SCRIPT_NAME%.sh}
# Variable initialization, to avoid crash
status=""
params=""
[ -r $CIS_ROOT_DIR/lib/constants.sh ] && . $CIS_ROOT_DIR/lib/constants.sh
[ -r $CIS_ROOT_DIR/lib/utils.sh ] && . $CIS_ROOT_DIR/lib/utils.sh
[ -r $CIS_ROOT_DIR/lib/common.sh ] && . $CIS_ROOT_DIR/lib/common.sh
# Source general configuration file and Specific configuration file if exist
[ -r $CIS_ROOT_DIR/etc/conf.d/$SCRIPT_NAME.cfg ] && . $CIS_ROOT_DIR/etc/conf.d/$SCRIPT_NAME.cfg
logger "Working on $SCRIPT_NAME"
if [ -z $status ]; then
logger "Could not find status variable for $SCRIPT_NAME, considered as disabled"
exit 0
fi
case $status in
enabled | true )
audit $params # Perform audit
apply $params # Perform hardening
;;
audit )
audit $params # Perform audit
;;
disabled | false )
logger "$SCRIPT_NAME is disabled, ignoring"
;;
*)
logger "Wrong value for status : $status. Must be [ enabled | true | audit | disabled | false ]"
;;
esac
[ -r $CIS_ROOT_DIR/lib/main.sh ] && . $CIS_ROOT_DIR/lib/main.sh