From 74db39a3ae9c805150b8e36be4132b62984cda37 Mon Sep 17 00:00:00 2001 From: Samson-W Date: Sat, 3 Aug 2019 04:40:48 +0800 Subject: [PATCH] Modified 4.4 to be compatible with CentOS. --- bin/hardening/4.4_disable_prelink.sh | 33 ++++++++++++++++++---------- 1 file changed, 22 insertions(+), 11 deletions(-) diff --git a/bin/hardening/4.4_disable_prelink.sh b/bin/hardening/4.4_disable_prelink.sh index 38c97fd..284860e 100755 --- a/bin/hardening/4.4_disable_prelink.sh +++ b/bin/hardening/4.4_disable_prelink.sh @@ -1,7 +1,8 @@ #!/bin/bash # -# harbian audit 7/8/9 Hardening +# harbian audit 7/8/9/10 or CentOS Hardening +# Modify by: Samson-W (samson@hardenedlinux.org) # # @@ -28,16 +29,26 @@ audit () { # This function will be called if the script status is on enabled mode apply () { - is_pkg_installed $PACKAGE - if [ $FNRET = 0 ]; then - crit "$PACKAGE is installed, purging it" - /usr/sbin/prelink -ua - apt-get purge $PACKAGE -y - apt-get autoremove - else - ok "$PACKAGE is absent" - fi - : + if [ $OS_RELEASE -eq 2 ]; then + if [ $FNRET = 0 ]; then + crit "$PACKAGE is installed, purging it" + "$(which $PACKAGE)" -ua + yum autoremove $PACKAGE -y + else + ok "$PACKAGE is absent" + fi + elif [ $OS_RELEASE -eq 1 ]; then + if [ $FNRET = 0 ]; then + crit "$PACKAGE is installed, purging it" + /usr/sbin/prelink -ua + apt-get purge $PACKAGE -y + apt-get autoremove + else + ok "$PACKAGE is absent" + fi + else + crit "Current OS is not support!" + fi } # This function will check config parameters required