Modify 8.5 8.6 to be compatible with CentOS.

This commit is contained in:
Samson-W 2019-08-17 23:31:47 +08:00
parent 4df1ad9f1e
commit 1d77dbee83
2 changed files with 8 additions and 2 deletions

View File

@ -1,7 +1,7 @@
#!/bin/bash #!/bin/bash
# #
# harbian audit 9 Hardening # harbian audit 9/10 or CentOS Hardening
# #
# #
@ -15,17 +15,21 @@ set -u # One variable unset, it's over
HARDENING_LEVEL=3 HARDENING_LEVEL=3
LOGDIR='/var/log' LOGDIR='/var/log'
ERRPERFILELIST='/dev/shm/8.5-filelist'
PERMISS_MODE='/7137' PERMISS_MODE='/7137'
PERMISS_SET='0640' PERMISS_SET='0640'
# 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 () {
countnum=$(find $LOGDIR -type f -perm $PERMISS_MODE -ls | wc -l) find $LOGDIR -type f -perm $PERMISS_MODE -ls > $ERRPERFILELIST
countnum=$(cat $ERRPERFILELIST | wc -l)
if [ $countnum -gt 0 ]; then if [ $countnum -gt 0 ]; then
crit "Permissions of all log files are not correctly configured!" crit "Permissions of all log files are not correctly configured!"
cat $ERRPERFILELIST
FNRET=1 FNRET=1
else else
ok "Permissions of all log files have correctly configured!" ok "Permissions of all log files have correctly configured!"
rm $ERRPERFILELIST
FNRET=0 FNRET=0
fi fi
} }
@ -37,6 +41,7 @@ apply () {
else else
warn "Permissions of all log files are not correctly configured! Set it" warn "Permissions of all log files are not correctly configured! Set it"
chmod -R $PERMISS_SET $LOGDIR/* chmod -R $PERMISS_SET $LOGDIR/*
rm $ERRPERFILELIST
fi fi
} }

View File

@ -6,6 +6,7 @@
# #
# 8.6 Configure logrotate (Not Scored) # 8.6 Configure logrotate (Not Scored)
# todo delete this or ...
# #
set -e # One error, it's over set -e # One error, it's over