Apply check_audit_is_immutable_mode method for auditd rules check item.

This commit is contained in:
Samson-W 2019-05-18 04:53:05 +08:00
parent 8856f64d16
commit e3a7b267d5
29 changed files with 31 additions and 31 deletions

View File

@ -58,7 +58,7 @@ apply () {
if [ $FNRET != 0 ]; then
warn "$AUDIT_VALUE is not in file $FILE, adding it"
add_end_of_file $FILE $AUDIT_VALUE
eval $(pkill -HUP -P 1 auditd)
check_auditd_is_immutable_mode
else
ok "$AUDIT_VALUE is present in $FILE"
fi

View File

@ -55,7 +55,7 @@ apply () {
if [ $FNRET != 0 ]; then
warn "$AUDIT_VALUE is not in file $FILE, adding it"
add_end_of_file $FILE $AUDIT_VALUE
eval $(pkill -HUP -P 1 auditd)
check_auditd_is_immutable_mode
else
ok "$AUDIT_VALUE is present in $FILE"
fi

View File

@ -48,7 +48,7 @@ apply () {
if [ $FNRET != 0 ]; then
warn "$AUDIT_VALUE is not in file $FILE, adding it"
add_end_of_file $FILE $AUDIT_VALUE
eval $(pkill -HUP -P 1 auditd)
check_auditd_is_immutable_mode
else
ok "$AUDIT_VALUE is present in $FILE"
fi

View File

@ -53,7 +53,7 @@ apply () {
if [ $FNRET != 0 ]; then
warn "$AUDIT_VALUE is not in file $FILE, adding it"
add_end_of_file $FILE $AUDIT_VALUE
eval $(pkill -HUP -P 1 auditd)
check_auditd_is_immutable_mode
else
ok "$AUDIT_VALUE is present in $FILE"
fi

View File

@ -53,7 +53,7 @@ apply () {
if [ $FNRET != 0 ]; then
warn "$AUDIT_VALUE is not in file $FILE, adding it"
add_end_of_file $FILE $AUDIT_VALUE
eval $(pkill -HUP -P 1 auditd)
check_auditd_is_immutable_mode
else
ok "$AUDIT_VALUE is present in $FILE"
fi

View File

@ -44,7 +44,7 @@ apply () {
if [ $FNRET != 0 ]; then
warn "$AUDIT_VALUE is not in file $FILE, adding it"
add_end_of_file $FILE $AUDIT_VALUE
eval $(pkill -HUP -P 1 auditd)
check_auditd_is_immutable_mode
else
ok "$AUDIT_VALUE is present in $FILE"
fi

View File

@ -51,12 +51,12 @@ apply () {
if [ $FNRET != 0 ]; then
warn "$AUDIT_VALUE is not in file $FILE, adding it"
add_end_of_file $FILE $AUDIT_VALUE
eval $(pkill -HUP -P 1 auditd)
check_auditd_is_immutable_mode
fi
elif [ $FNRET = 2 ]; then
warn "$AUDIT_VALUE is not in file $FILE, adding it"
add_end_of_file $FILE $AUDIT_VALUE
eval $(pkill -HUP -P 1 auditd)
check_auditd_is_immutable_mode
else
ok "$AUDIT_VALUE is present in $FILE"
fi

View File

@ -61,7 +61,7 @@ apply () {
if [ $FNRET != 0 ]; then
warn "$AUDIT_VALUE is not in file $FILE, adding it"
add_end_of_file $FILE $AUDIT_VALUE
eval $(pkill -HUP -P 1 auditd)
check_auditd_is_immutable_mode
else
ok "$AUDIT_VALUE is present in $FILE"
fi

View File

@ -44,7 +44,7 @@ apply () {
if [ $FNRET != 0 ]; then
warn "$AUDIT_VALUE is not in file $FILE, adding it"
add_end_of_file $FILE $AUDIT_VALUE
eval $(pkill -HUP -P 1 auditd)
check_auditd_is_immutable_mode
else
ok "$AUDIT_VALUE is present in $FILE"
fi

View File

@ -48,7 +48,7 @@ apply () {
if [ $FNRET != 0 ]; then
warn "$AUDIT_VALUE is not in file $FILE, adding it"
add_end_of_file $FILE $AUDIT_VALUE
eval $(pkill -HUP -P 1 auditd)
check_auditd_is_immutable_mode
else
ok "$AUDIT_VALUE is present in $FILE"
fi

View File

@ -47,7 +47,7 @@ apply () {
if [ $FNRET != 0 ]; then
warn "$AUDIT_VALUE is not in file $FILE, adding it"
add_end_of_file $FILE $AUDIT_VALUE
eval $(pkill -HUP -P 1 auditd)
check_auditd_is_immutable_mode
else
ok "$AUDIT_VALUE is present in $FILE"
fi

View File

@ -50,7 +50,7 @@ apply () {
if [ $FNRET != 0 ]; then
warn "$AUDIT_VALUE is not in file $FILE, adding it"
add_end_of_file $FILE $AUDIT_VALUE
eval $(pkill -HUP -P 1 auditd)
check_auditd_is_immutable_mode
else
ok "$AUDIT_VALUE is present in $FILE"
fi

View File

@ -52,7 +52,7 @@ apply () {
if [ $FNRET != 0 ]; then
warn "$AUDIT_VALUE is not in file $FILE, adding it"
add_end_of_file $FILE $AUDIT_VALUE
eval $(pkill -HUP -P 1 auditd)
check_auditd_is_immutable_mode
else
ok "$AUDIT_VALUE is present in $FILE"
fi

View File

@ -48,7 +48,7 @@ apply () {
if [ $FNRET != 0 ]; then
warn "$AUDIT_VALUE is not in file $FILE, adding it"
add_end_of_file $FILE $AUDIT_VALUE
eval $(pkill -HUP -P 1 auditd)
check_auditd_is_immutable_mode
else
ok "$AUDIT_VALUE is present in $FILE"
fi

View File

@ -46,7 +46,7 @@ apply () {
if [ $FNRET != 0 ]; then
warn "$AUDIT_VALUE is not in file $FILE, adding it"
add_end_of_file $FILE $AUDIT_VALUE
eval $(pkill -HUP -P 1 auditd)
check_auditd_is_immutable_mode
else
ok "$AUDIT_VALUE is present in $FILE"
fi

View File

@ -46,7 +46,7 @@ apply () {
if [ $FNRET != 0 ]; then
warn "$AUDIT_VALUE is not in file $FILE, adding it"
add_end_of_file $FILE $AUDIT_VALUE
eval $(pkill -HUP -P 1 auditd)
check_auditd_is_immutable_mode
else
ok "$AUDIT_VALUE is present in $FILE"
fi

View File

@ -47,7 +47,7 @@ apply () {
if [ $FNRET != 0 ]; then
warn "$AUDIT_VALUE is not in file $FILE, adding it"
add_end_of_file $FILE $AUDIT_VALUE
eval $(pkill -HUP -P 1 auditd)
check_auditd_is_immutable_mode
else
ok "$AUDIT_VALUE is present in $FILE"
fi

View File

@ -59,7 +59,7 @@ apply () {
if [ $FNRET != 0 ]; then
warn "$AUDIT_VALUE is not in file $FILE, adding it"
add_end_of_file $FILE $AUDIT_VALUE
#eval $(pkill -HUP -P 1 auditd)
check_auditd_is_immutable_mode
else
ok "$AUDIT_VALUE is present in $FILE"
fi

View File

@ -48,7 +48,7 @@ apply () {
if [ $FNRET != 0 ]; then
warn "$AUDIT_VALUE is not in file $FILE, adding it"
add_end_of_file $FILE $AUDIT_VALUE
eval $(pkill -HUP -P 1 auditd)
check_auditd_is_immutable_mode
else
ok "$AUDIT_VALUE is present in $FILE"
fi

View File

@ -47,7 +47,7 @@ apply () {
if [ $FNRET != 0 ]; then
warn "$AUDIT_VALUE is not in file $FILE, adding it"
add_end_of_file $FILE $AUDIT_VALUE
eval $(pkill -HUP -P 1 auditd)
check_auditd_is_immutable_mode
else
ok "$AUDIT_VALUE is present in $FILE"
fi

View File

@ -47,7 +47,7 @@ apply () {
if [ $FNRET != 0 ]; then
warn "$AUDIT_VALUE is not in file $FILE, adding it"
add_end_of_file $FILE $AUDIT_VALUE
eval $(pkill -HUP -P 1 auditd)
check_auditd_is_immutable_mode
else
ok "$AUDIT_VALUE is present in $FILE"
fi

View File

@ -55,7 +55,7 @@ apply () {
if [ $FNRET != 0 ]; then
warn "$AUDIT_VALUE is not in file $FILE, adding it"
add_end_of_file $FILE $AUDIT_VALUE
eval $(pkill -HUP -P 1 auditd)
check_auditd_is_immutable_mode
else
ok "$AUDIT_VALUE is present in $FILE"
fi

View File

@ -59,7 +59,7 @@ apply () {
if [ $FNRET != 0 ]; then
warn "$AUDIT_VALUE is not in file $FILE, adding it"
add_end_of_file $FILE $AUDIT_VALUE
check_audit_is_immutable_mode
check_auditd_is_immutable_mode
else
ok "$AUDIT_VALUE is present in $FILE"
fi

View File

@ -47,7 +47,7 @@ apply () {
if [ $FNRET != 0 ]; then
warn "$AUDIT_VALUE is not in file $FILE, adding it"
add_end_of_file $FILE $AUDIT_VALUE
eval $(pkill -HUP -P 1 auditd)
check_auditd_is_immutable_mode
else
ok "$AUDIT_VALUE is present in $FILE"
fi

View File

@ -60,7 +60,7 @@ apply () {
if [ $FNRET != 0 ]; then
warn "$AUDIT_VALUE is not in file $FILE, adding it"
add_end_of_file $FILE $AUDIT_VALUE
eval $(pkill -HUP -P 1 auditd)
check_auditd_is_immutable_mode
else
ok "$AUDIT_VALUE is present in $FILE"
fi

View File

@ -77,7 +77,7 @@ apply () {
if [ $FNRET != 0 ]; then
warn "$AUDIT_VALUE is not in file $FILE, adding it"
add_end_of_file $FILE $AUDIT_VALUE
eval $(pkill -HUP -P 1 auditd)
check_auditd_is_immutable_mode
else
ok "$AUDIT_VALUE is present in $FILE"
fi

View File

@ -45,7 +45,7 @@ apply () {
if [ $FNRET != 0 ]; then
warn "$AUDIT_VALUE is not in file $FILE, adding it"
add_end_of_file $FILE $AUDIT_VALUE
eval $(pkill -HUP -P 1 auditd)
check_auditd_is_immutable_mode
else
ok "$AUDIT_VALUE is present in $FILE"
fi

View File

@ -45,7 +45,7 @@ apply () {
if [ $FNRET != 0 ]; then
warn "$AUDIT_VALUE is not in file $FILE, adding it"
add_end_of_file $FILE $AUDIT_VALUE
eval $(pkill -HUP -P 1 auditd)
check_auditd_is_immutable_mode
else
ok "$AUDIT_VALUE is present in $FILE"
fi

View File

@ -872,10 +872,10 @@ check_ipv6_is_enable()
fi
}
check_audit_is_immutable_mode()
check_auditd_is_immutable_mode()
{
if [ $(auditctl -s | head -n 1 | awk '{print $2}') -eq 2 ]; then
warn "The audit system is in immutable mode, no rule changes allowed. So must need reboot after adding/modifying the auditd rule!"
warn "The auditd system is in immutable mode, no rule changes allowed. So must need reboot after adding/modifying the auditd rule!"
else
eval $(pkill -HUP -P 1 auditd)
fi