Modified 4.5 to be compatible with CentOS.

This commit is contained in:
Samson-W 2019-08-03 04:49:42 +08:00
parent 74db39a3ae
commit f8aa395b6e
2 changed files with 39 additions and 8 deletions

View File

@ -98,7 +98,6 @@ apply () {
apply_redhat apply_redhat
else else
crit "Current OS is not support!" crit "Current OS is not support!"
FNRET=44
fi fi
} }

View File

@ -1,11 +1,12 @@
#!/bin/bash #!/bin/bash
# #
# harbian audit 7/8/9 Hardening # harbian audit 7/8/9/10 or CentOS Hardening
# # Modify by: Samson-W (samson@hardenedlinux.org)
# todo: SELinux
# #
# 4.5 Activate AppArmor (Scored) # 4.5 Activate AppArmor/SELinux (Scored)
# Add by Author : Samson wen, Samson <sccxboy@gmail.com> # Add by Author : Samson wen, Samson <sccxboy@gmail.com>
# #
@ -20,8 +21,7 @@ PATTERN="apparmor=1[[:space:]]*security=apparmor"
SETSTRING="apparmor=1 security=apparmor" SETSTRING="apparmor=1 security=apparmor"
GRUBFILE='/etc/default/grub' GRUBFILE='/etc/default/grub'
# This function will be called if the script status is on enabled / audit mode audit_debian () {
audit () {
for PACKAGE in ${PACKAGES} for PACKAGE in ${PACKAGES}
do do
is_pkg_installed $PACKAGE is_pkg_installed $PACKAGE
@ -49,8 +49,24 @@ audit () {
fi fi
} }
# This function will be called if the script status is on enabled mode # Todo
apply () { audit_redhat () {
:
}
# This function will be called if the script status is on enabled / audit mode
audit () {
if [ $OS_RELEASE -eq 1 ]; then
audit_debian
elif [ $OS_RELEASE -eq 2 ]; then
audit_redhat
else
crit "Current OS is not support!"
FNRET=44
fi
}
apply_debian () {
if [ $FNRET = 0 ]; then if [ $FNRET = 0 ]; then
ok "AppArmor profiles is enable in the system " ok "AppArmor profiles is enable in the system "
elif [ $FNRET = 1 ]; then elif [ $FNRET = 1 ]; then
@ -69,6 +85,22 @@ apply () {
fi fi
} }
# Todo
apply_redhat () {
:
}
# This function will be called if the script status is on enabled mode
apply () {
if [ $OS_RELEASE -eq 1 ]; then
apply_debian
elif [ $OS_RELEASE -eq 2 ]; then
apply_redhat
else
crit "Current OS is not support!"
fi
}
# This function will check config parameters required # This function will check config parameters required
check_config() { check_config() {
: :