Add check ownership method for 12.1
This commit is contained in:
parent
a1f02aaabf
commit
b629896e82
|
@ -15,19 +15,34 @@ HARDENING_LEVEL=1
|
||||||
|
|
||||||
FILE='/etc/passwd'
|
FILE='/etc/passwd'
|
||||||
PERMISSIONS='644'
|
PERMISSIONS='644'
|
||||||
|
USER='root'
|
||||||
|
GROUP='root'
|
||||||
|
|
||||||
# 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 () {
|
||||||
has_file_correct_permissions $FILE $PERMISSIONS
|
has_file_correct_ownership $FILE $USER $GROUP
|
||||||
if [ $FNRET = 0 ]; then
|
if [ $FNRET = 0 ]; then
|
||||||
ok "$FILE has correct permissions"
|
ok "$FILE has correct ownership"
|
||||||
else
|
else
|
||||||
|
crit "$FILE ownership was not set to $USER:$GROUP"
|
||||||
|
fi
|
||||||
|
has_file_correct_permissions $FILE $PERMISSIONS
|
||||||
|
if [ $FNRET = 0 ]; then
|
||||||
|
ok "$FILE has correct permissions"
|
||||||
|
else
|
||||||
crit "$FILE permissions were not set to $PERMISSIONS"
|
crit "$FILE permissions were not set to $PERMISSIONS"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# This function will be called if the script status is on enabled mode
|
# This function will be called if the script status is on enabled mode
|
||||||
apply () {
|
apply () {
|
||||||
|
has_file_correct_ownership $FILE $USER $GROUP
|
||||||
|
if [ $FNRET = 0 ]; then
|
||||||
|
ok "$FILE has correct ownership"
|
||||||
|
else
|
||||||
|
warn "fixing $FILE ownership to $USER:$GROUP"
|
||||||
|
chown $USER:$GROUP $FILE
|
||||||
|
fi
|
||||||
has_file_correct_permissions $FILE $PERMISSIONS
|
has_file_correct_permissions $FILE $PERMISSIONS
|
||||||
if [ $FNRET = 0 ]; then
|
if [ $FNRET = 0 ]; then
|
||||||
ok "$FILE has correct permissions"
|
ok "$FILE has correct permissions"
|
||||||
|
|
Loading…
Reference in New Issue