Fix SOC-28, add test if file exist, if not issue error

This commit is contained in:
Charles Herlin 2018-02-09 13:49:38 +01:00
parent b41df080cf
commit 47857774b4

View File

@ -21,6 +21,11 @@ FILES='/etc/motd /etc/issue /etc/issue.net'
# 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 () {
for FILE in $FILES; do for FILE in $FILES; do
does_file_exist $FILE
if [ $FNRET != 0 ]; then
crit "$FILE does not exist"
continue
fi
has_file_correct_ownership $FILE $USER $GROUP has_file_correct_ownership $FILE $USER $GROUP
if [ $FNRET = 0 ]; then if [ $FNRET = 0 ]; then
ok "$FILE has correct ownership" ok "$FILE has correct ownership"