From b1b96cf4e3410bd386b65b6c6b78143e6aae6b96 Mon Sep 17 00:00:00 2001 From: "thibault.dewailly" Date: Mon, 18 Apr 2016 14:01:03 +0200 Subject: [PATCH] log format correction, loglevel defaults to info --- bin/hardening.sh | 6 +++--- etc/conf.d/7.5.4_disable_tipc.cfg | 2 ++ etc/hardening.cfg | 2 +- lib/common.sh | 10 +++++----- 4 files changed, 11 insertions(+), 9 deletions(-) create mode 100644 etc/conf.d/7.5.4_disable_tipc.cfg diff --git a/bin/hardening.sh b/bin/hardening.sh index 27c2b8b..15c561e 100755 --- a/bin/hardening.sh +++ b/bin/hardening.sh @@ -70,15 +70,15 @@ fi [ -r $CIS_ROOT_DIR/lib/utils.sh ] && . $CIS_ROOT_DIR/lib/utils.sh # Parse every scripts and execute them in the required mode -for SCRIPT in $(ls $CIS_ROOT_DIR/bin/hardening | sort -V); do +for SCRIPT in $(ls $CIS_ROOT_DIR/bin/hardening/*.sh | sort -V); do info "Treating $SCRIPT" if [ $AUDIT = 1 ]; then debug "$CIS_ROOT_DIR/bin/hardening/$SCRIPT --audit" - $CIS_ROOT_DIR/bin/hardening/$SCRIPT --audit + $SCRIPT --audit elif [ $APPLY = 1 ]; then debug "$CIS_ROOT_DIR/bin/hardening/$SCRIPT" - $CIS_ROOT_DIR/bin/hardening/$SCRIPT + $SCRIPT fi SCRIPT_EXITCODE=$? diff --git a/etc/conf.d/7.5.4_disable_tipc.cfg b/etc/conf.d/7.5.4_disable_tipc.cfg new file mode 100644 index 0000000..acee522 --- /dev/null +++ b/etc/conf.d/7.5.4_disable_tipc.cfg @@ -0,0 +1,2 @@ +# Configuration for script of same name +status=disabled diff --git a/etc/hardening.cfg b/etc/hardening.cfg index 2697cd8..d77f231 100644 --- a/etc/hardening.cfg +++ b/etc/hardening.cfg @@ -2,7 +2,7 @@ # Main Configuration File, put here global variables # Valid values are debug info ok warning error -LOGLEVEL=debug +LOGLEVEL=info # Backup directory, every file modified by hardening will be backuped here, with versionning # Means that if a file is modified more than once during the process, you will have hardening step diffs in the folder diff --git a/lib/common.sh b/lib/common.sh index f4dc0d6..d846ab9 100644 --- a/lib/common.sh +++ b/lib/common.sh @@ -57,23 +57,23 @@ cecho () { } crit () { - [ $MACHINE_LOG_LEVEL -ge 1 ] && _logger $BRED "[ KO ] $*" + if [ $MACHINE_LOG_LEVEL -ge 1 ]; then _logger $BRED "[ KO ] $*"; fi # This variable incrementation is used to measure failure or success in tests CRITICAL_ERRORS_NUMBER=$((CRITICAL_ERRORS_NUMBER+1)) } warn () { - [ $MACHINE_LOG_LEVEL -ge 2 ] && _logger $BYELLOW "[WARN] $*" + if [ $MACHINE_LOG_LEVEL -ge 2 ]; then _logger $BYELLOW "[WARN] $*"; fi } ok () { - [ $MACHINE_LOG_LEVEL -ge 3 ] && _logger $BGREEN "[ OK ] $*" + if [ $MACHINE_LOG_LEVEL -ge 3 ]; then _logger $BGREEN "[ OK ] $*"; fi } info () { - [ $MACHINE_LOG_LEVEL -ge 4 ] && _logger $BWHITE "[INFO] $*" + if [ $MACHINE_LOG_LEVEL -ge 4 ]; then _logger $BWHITE "[INFO] $*"; fi } debug () { - [ $MACHINE_LOG_LEVEL -ge 5 ] && _logger $GRAY "[DBG ] $*" + if [ $MACHINE_LOG_LEVEL -ge 5 ]; then _logger $GRAY "[DBG ] $*"; fi }