mirror of
https://github.com/ovh/debian-cis.git
synced 2024-11-22 13:37:02 +01:00
FIX(8.2.x): fix grep and find in audit scripts
This commit is contained in:
parent
d5d5a39109
commit
02673826a0
@ -31,7 +31,7 @@ audit () {
|
|||||||
warn "$FILE does not exist"
|
warn "$FILE does not exist"
|
||||||
else
|
else
|
||||||
FOUND_EXC=0
|
FOUND_EXC=0
|
||||||
if grep "$FILE" <(tr ' ' '\n' <<< "$EXCEPTIONS" | cut -d ":" -f 1); then
|
if grep -q "$FILE" <(tr ' ' '\n' <<< "$EXCEPTIONS" | cut -d ":" -f 1); then
|
||||||
debug "$FILE is found in exceptions"
|
debug "$FILE is found in exceptions"
|
||||||
debug "Setting special user:group:perm"
|
debug "Setting special user:group:perm"
|
||||||
FOUND_EXC=1
|
FOUND_EXC=1
|
||||||
@ -73,7 +73,7 @@ apply () {
|
|||||||
filedir=$(dirname "${FILE#/var/log/}")
|
filedir=$(dirname "${FILE#/var/log/}")
|
||||||
if [ ! "$filedir" = "." ] && [ ! -d /var/log/"$filedir" ]; then
|
if [ ! "$filedir" = "." ] && [ ! -d /var/log/"$filedir" ]; then
|
||||||
debug "Creating /var/log/$filedir for $FILE"
|
debug "Creating /var/log/$filedir for $FILE"
|
||||||
debug "mkdir -p /var/log/"$filedir""
|
debug "mkdir -p /var/log/$filedir"
|
||||||
mkdir -p /var/log/"$filedir"
|
mkdir -p /var/log/"$filedir"
|
||||||
fi
|
fi
|
||||||
touch "$FILE"
|
touch "$FILE"
|
||||||
|
@ -19,7 +19,7 @@ PATTERN='destination[[:alnum:][:space:]*{]+(tcp|udp)[[:space:]]*\(\"[[:alnum:].]
|
|||||||
# This function will be called if the script status is on enabled / audit mode
|
# This function will be called if the script status is on enabled / audit mode
|
||||||
audit () {
|
audit () {
|
||||||
FOUND=0
|
FOUND=0
|
||||||
FILES="$SYSLOG_BASEDIR/syslog-ng.conf $(find -L $SYSLOG_BASEDIR/conf.d/ -type f)"
|
FILES="$SYSLOG_BASEDIR/syslog-ng.conf $($SUDO_CMD find -L $SYSLOG_BASEDIR/conf.d/ -type f)"
|
||||||
for FILE in $FILES; do
|
for FILE in $FILES; do
|
||||||
does_pattern_exist_in_file_multiline "$FILE" "$PATTERN"
|
does_pattern_exist_in_file_multiline "$FILE" "$PATTERN"
|
||||||
if [ $FNRET = 0 ]; then
|
if [ $FNRET = 0 ]; then
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
# run-shellcheck
|
# run-shellcheck
|
||||||
test_audit() {
|
test_audit() {
|
||||||
#set -x
|
|
||||||
|
|
||||||
describe Running on blank host
|
describe Running on blank host
|
||||||
register_test retvalshouldbe 1
|
register_test retvalshouldbe 1
|
||||||
|
Loading…
Reference in New Issue
Block a user