From cd82d799fcc7dd105bef91a6a234f04f4e70dac8 Mon Sep 17 00:00:00 2001 From: Samson-W Date: Wed, 15 Jan 2020 20:13:54 +0800 Subject: [PATCH] Modify audit and apply methods for redhat/CentOS to 10.1.9 10.1.10 --- .../10.1.10_set_maxlogins_for_all_accounts.sh | 10 +++++++--- bin/hardening/10.1.9_set_create_home_bool.sh | 16 +--------------- 2 files changed, 8 insertions(+), 18 deletions(-) diff --git a/bin/hardening/10.1.10_set_maxlogins_for_all_accounts.sh b/bin/hardening/10.1.10_set_maxlogins_for_all_accounts.sh index ed5acb1..ae563ad 100755 --- a/bin/hardening/10.1.10_set_maxlogins_for_all_accounts.sh +++ b/bin/hardening/10.1.10_set_maxlogins_for_all_accounts.sh @@ -1,7 +1,7 @@ #!/bin/bash # -# harbian audit 7/8/9 Hardening +# harbian audit debian 7/8/9 or CentOS8 Hardening # # @@ -56,7 +56,7 @@ audit () { # This function will be called if the script status is on enabled mode apply () { if [ $FNRET = 0 ]; then - ok "$PACKAGE is installed" + ok "$OPTIONS value is correct in $FILE" elif [ $FNRET = 1 ]; then warn "$PACKAGE is not installed, need install." install_package $PACKAGE @@ -73,7 +73,11 @@ apply () { # This function will check config parameters required check_config() { - : + if [ $OS_RELEASE -eq 2 ]; then + PACKAGE='pam' + else + : + fi } # Source Root Dir Parameter diff --git a/bin/hardening/10.1.9_set_create_home_bool.sh b/bin/hardening/10.1.9_set_create_home_bool.sh index e3afe71..4349e28 100755 --- a/bin/hardening/10.1.9_set_create_home_bool.sh +++ b/bin/hardening/10.1.9_set_create_home_bool.sh @@ -1,7 +1,7 @@ #!/bin/bash # -# harbian audit 7/8/9 Hardening +# harbian audit debian 7/8/9 or CentOS8 Hardening # # @@ -14,17 +14,11 @@ set -u # One variable unset, it's over HARDENING_LEVEL=3 -PACKAGE='login' OPTIONS='CREATE_HOME=yes' FILE='/etc/login.defs' # This function will be called if the script status is on enabled / audit mode audit () { - is_pkg_installed $PACKAGE - if [ $FNRET != 0 ]; then - crit "$PACKAGE is not installed!" - else - ok "$PACKAGE is installed" for SSH_OPTION in $OPTIONS; do SSH_PARAM=$(echo $SSH_OPTION | cut -d= -f 1) SSH_VALUE=$(echo $SSH_OPTION | cut -d= -f 2) @@ -36,18 +30,10 @@ audit () { crit "$PATTERN is not present in $FILE" fi done - fi } # This function will be called if the script status is on enabled mode apply () { - is_pkg_installed $PACKAGE - if [ $FNRET = 0 ]; then - ok "$PACKAGE is installed" - else - crit "$PACKAGE is absent, installing it" - install_package $PACKAGE - fi for SSH_OPTION in $OPTIONS; do SSH_PARAM=$(echo $SSH_OPTION | cut -d= -f 1) SSH_VALUE=$(echo $SSH_OPTION | cut -d= -f 2)