mirror of
https://github.com/ovh/debian-cis.git
synced 2024-11-22 05:27:01 +01:00
FIX: add becho to send batch output to syslog too
becho stands for batch echo formats the log line for syslog Also logs audit summary into syslog (in batch mode only)
This commit is contained in:
parent
6cea326921
commit
d014405e1f
@ -272,7 +272,7 @@ if [ $BATCH_MODE ]; then
|
||||
else
|
||||
BATCH_SUMMARY+=" CONFORMITY_PERCENTAGE:N.A" # No check runned, avoid division by 0
|
||||
fi
|
||||
echo $BATCH_SUMMARY
|
||||
becho $BATCH_SUMMARY
|
||||
else
|
||||
printf "%40s\n" "################### SUMMARY ###################"
|
||||
printf "%30s %s\n" "Total Available Checks :" "$TOTAL_CHECKS"
|
||||
|
@ -46,11 +46,16 @@ _logger() {
|
||||
COLOR=$1
|
||||
shift
|
||||
test -z "$SCRIPT_NAME" && SCRIPT_NAME=$(basename $0)
|
||||
builtin echo "$*" | /usr/bin/logger -t "[CIS_Hardening] $SCRIPT_NAME" -p "user.info"
|
||||
builtin echo "$*" | /usr/bin/logger -t "CIS_Hardening[$$] $SCRIPT_NAME" -p "user.info"
|
||||
SCRIPT_NAME_FIXEDLEN=$(printf "%-25.25s" "$SCRIPT_NAME")
|
||||
cecho $COLOR "$SCRIPT_NAME_FIXEDLEN $*"
|
||||
}
|
||||
|
||||
becho() {
|
||||
builtin echo "$*" | /usr/bin/logger -t "CIS_Hardening[$$]" -p "user.info"
|
||||
builtin echo "$*"
|
||||
}
|
||||
|
||||
cecho () {
|
||||
COLOR=$1
|
||||
shift
|
||||
|
@ -113,7 +113,7 @@ esac
|
||||
if [ $CRITICAL_ERRORS_NUMBER -eq 0 ]; then
|
||||
if [ $BATCH_MODE -eq 1 ]; then
|
||||
BATCH_OUTPUT="OK $SCRIPT_NAME $BATCH_OUTPUT"
|
||||
echo $BATCH_OUTPUT
|
||||
becho $BATCH_OUTPUT
|
||||
else
|
||||
ok "Check Passed"
|
||||
fi
|
||||
@ -121,7 +121,7 @@ if [ $CRITICAL_ERRORS_NUMBER -eq 0 ]; then
|
||||
else
|
||||
if [ $BATCH_MODE -eq 1 ]; then
|
||||
BATCH_OUTPUT="KO $SCRIPT_NAME $BATCH_OUTPUT"
|
||||
echo $BATCH_OUTPUT
|
||||
becho $BATCH_OUTPUT
|
||||
else
|
||||
crit "Check Failed"
|
||||
fi
|
||||
|
Loading…
Reference in New Issue
Block a user