Skip to content

Commit

Permalink
Modify methods name: *_redhat to *_centos.
Browse files Browse the repository at this point in the history
  • Loading branch information
Samson-W committed Mar 5, 2020
1 parent 4bb01e5 commit 3b61a0e
Show file tree
Hide file tree
Showing 26 changed files with 99 additions and 99 deletions.
8 changes: 4 additions & 4 deletions bin/hardening/1.1_install_updates.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ audit_debian ()
fi
}

audit_redhat ()
audit_centos ()
{
info "Checking if yum needs an update"
info "Fetching upgrades ..."
Expand All @@ -50,7 +50,7 @@ audit ()
if [ $OS_RELEASE -eq 1 ]; then
audit_debian
elif [ $OS_RELEASE -eq 2 ]; then
audit_redhat
audit_centos
else
crit "Current OS is not support!"
FNRET=44
Expand All @@ -67,7 +67,7 @@ apply_debian ()
fi
}

apply_redhat ()
apply_centos ()
{
if [ $FNRET -eq 100 ]; then
info "Applying Upgrades..."
Expand All @@ -85,7 +85,7 @@ apply ()
if [ $OS_RELEASE -eq 1 ]; then
apply_debian
elif [ $OS_RELEASE -eq 2 ]; then
apply_redhat
apply_centos
else
crit "Current OS is not support!"
fi
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ audit_debian ()
fi
}

audit_redhat ()
audit_centos ()
{
if [ $(grep -c "^$YUM_OPTION" $YUM_CONF) -gt 0 ]; then
if [ $(grep "^$YUM_OPTION" $YUM_CONF | awk -F"=" '{print $2}') -eq 1 ]; then
Expand All @@ -50,7 +50,7 @@ audit ()
if [ $OS_RELEASE -eq 1 ]; then
audit_debian
elif [ $OS_RELEASE -eq 2 ]; then
audit_redhat
audit_centos
else
crit "Current OS is not support!"
FNRET=44
Expand All @@ -70,7 +70,7 @@ apply_debian () {
done
fi
}
apply_redhat () {
apply_centos () {
if [ $FNRET = 0 ]; then
ok "The signature of packages option is enable "
elif [ $FNRET = 1 ]; then
Expand All @@ -87,7 +87,7 @@ apply () {
if [ $OS_RELEASE -eq 1 ]; then
apply_debian
elif [ $OS_RELEASE -eq 2 ]; then
apply_redhat
apply_centos
else
crit "Current OS is not support!"
fi
Expand Down
8 changes: 4 additions & 4 deletions bin/hardening/1.3_enable_verify_sign_of_local_packages.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ audit_debian () {
fi
}

audit_redhat ()
audit_centos ()
{
if [ $(grep -c "^$YUM_OPTION" $YUM_CONFFILE) -gt 0 ]; then
if [ $(grep "^$YUM_OPTION" $YUM_CONFFILE | awk -F"=" '{print $2}') -eq 1 ]; then
Expand All @@ -51,7 +51,7 @@ audit()
if [ $OS_RELEASE -eq 1 ]; then
audit_debian
elif [ $OS_RELEASE -eq 2 ]; then
audit_redhat
audit_centos
else
crit "Current OS is not support!"
FNRET=44
Expand All @@ -68,7 +68,7 @@ apply_debian () {
fi
}

apply_redhat () {
apply_centos () {
if [ $FNRET = 0 ]; then
ok "The signature of packages option is enable "
elif [ $FNRET = 1 ]; then
Expand All @@ -86,7 +86,7 @@ apply () {
if [ $OS_RELEASE -eq 1 ]; then
apply_debian
elif [ $OS_RELEASE -eq 2 ]; then
apply_redhat
apply_centos
else
crit "Current OS is not support!"
fi
Expand Down
8 changes: 4 additions & 4 deletions bin/hardening/1.4_set_no_allow_insecure_repository_by_apt.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ audit_debian () {
fi
}

audit_redhat ()
audit_centos ()
{
if [ $(grep -c "^$YUM_OPTION" $YUM_CONFFILE) -gt 0 ]; then
if [ $(grep "^$YUM_OPTION" $YUM_CONFFILE | awk -F"=" '{print $2}') -eq 1 ]; then
Expand All @@ -49,7 +49,7 @@ audit () {
if [ $OS_RELEASE -eq 1 ]; then
audit_debian
elif [ $OS_RELEASE -eq 2 ]; then
audit_redhat
audit_centos
else
crit "Current OS is not support!"
FNRET=44
Expand All @@ -68,7 +68,7 @@ apply_debian () {
fi
}

apply_redhat () {
apply_centos () {
if [ $FNRET = 0 ]; then
ok "The signature of repodata option is enable "
elif [ $FNRET = 1 ]; then
Expand All @@ -85,7 +85,7 @@ apply () {
if [ $OS_RELEASE -eq 1 ]; then
apply_debian
elif [ $OS_RELEASE -eq 2 ]; then
apply_redhat
apply_centos
else
crit "Current OS is not support!"
fi
Expand Down
8 changes: 4 additions & 4 deletions bin/hardening/10.1.5_set_password_lock_inactive_user.sh
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ audit_debian () {
fi
}

audit_redhat () {
audit_centos () {
SSH_PARAM=$(echo $OPTIONS | cut -d= -f 1)
SSH_VALUE=$(echo $OPTIONS | cut -d= -f 2)
INACTIVE_V=$(useradd -D | grep $SSH_PARAM | awk -F= '{print $2}')
Expand All @@ -64,7 +64,7 @@ audit () {
if [ $OS_RELEASE -eq 1 ]; then
audit_debian
elif [ $OS_RELEASE -eq 2 ]; then
audit_redhat
audit_centos
else
warn "Current OS is not support!"
fi
Expand Down Expand Up @@ -106,7 +106,7 @@ apply_debian () {
fi
}

apply_redhat () {
apply_centos () {
SSH_PARAM=$(echo $OPTIONS | cut -d= -f 1)
SSH_VALUE=$(echo $OPTIONS | cut -d= -f 2)
PATTERN="^$SSH_PARAM=$SSH_VALUE"
Expand Down Expand Up @@ -147,7 +147,7 @@ apply () {
if [ $OS_RELEASE -eq 1 ]; then
apply_debian
elif [ $OS_RELEASE -eq 2 ]; then
apply_redhat
apply_centos
else
warn "Current OS is not support!"
fi
Expand Down
8 changes: 4 additions & 4 deletions bin/hardening/10.1.8_set_fail_delay_seconds.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ audit_debian () {
fi
}

audit_redhat () {
audit_centos () {
SSH_PARAM=$(echo $OPTION | cut -d= -f 1)
SSH_VALUE=$(echo $OPTION | cut -d= -f 2)
PATTERN="^$SSH_PARAM[[:space:]]*[[:digit:]]*"
Expand All @@ -60,7 +60,7 @@ audit_redhat () {
# This function will be called if the script status is on enabled / audit mode
audit () {
if [ $OS_RELEASE -eq 2 ]; then
audit_redhat
audit_centos
else
audit_debian
fi
Expand All @@ -86,7 +86,7 @@ apply_debian () {
fi
}

apply_redhat () {
apply_centos () {
if [ $FNRET = 0 ]; then
ok "$SSH_PARAM is set least four seconds between logon prompts following a failed console logon attempt"
elif [ $FNRET = 1 ]; then
Expand All @@ -103,7 +103,7 @@ apply_redhat () {
# This function will be called if the script status is on enabled mode
apply () {
if [ $OS_RELEASE -eq 2 ]; then
apply_redhat
apply_centos
else
apply_debian
fi
Expand Down
8 changes: 4 additions & 4 deletions bin/hardening/4.1_restrict_core_dumps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ audit_debian () {
fi
}

audit_redhat () {
audit_centos () {
is_service_active $SERVICE_NAME
if [ $FNRET -eq 0 ]; then
crit "$SERVICE_NAME is actived"
Expand All @@ -53,7 +53,7 @@ audit () {
if [ $OS_RELEASE -eq 1 ]; then
audit_debian
elif [ $OS_RELEASE -eq 2 ]; then
audit_redhat
audit_centos
else
crit "Current OS is not support!"
FNRET=44
Expand All @@ -80,7 +80,7 @@ apply_debian () {

}

apply_redhat () {
apply_centos () {
if [ $FNRET -eq 1 ]; then
info "Disabling $SERVICE_NAME"
systemctl stop $SERVICE_NAME
Expand All @@ -95,7 +95,7 @@ apply () {
if [ $OS_RELEASE -eq 1 ]; then
apply_debian
elif [ $OS_RELEASE -eq 2 ]; then
apply_redhat
apply_centos
else
crit "Current OS is not support!"
fi
Expand Down
8 changes: 4 additions & 4 deletions bin/hardening/4.5_enable_apparmor.sh
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ audit_debian () {
}

# Todo
audit_redhat () {
audit_centos () {
:
}

Expand All @@ -59,7 +59,7 @@ audit () {
if [ $OS_RELEASE -eq 1 ]; then
audit_debian
elif [ $OS_RELEASE -eq 2 ]; then
audit_redhat
audit_centos
else
crit "Current OS is not support!"
FNRET=44
Expand All @@ -86,7 +86,7 @@ apply_debian () {
}

# Todo
apply_redhat () {
apply_centos () {
:
}

Expand All @@ -95,7 +95,7 @@ apply () {
if [ $OS_RELEASE -eq 1 ]; then
apply_debian
elif [ $OS_RELEASE -eq 2 ]; then
apply_redhat
apply_centos
else
crit "Current OS is not support!"
fi
Expand Down
4 changes: 2 additions & 2 deletions bin/hardening/4.6_disable_usb_devices.sh
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ audit_debian () {
fi
}

audit_redhat () {
audit_centos () {
:
}

Expand All @@ -64,7 +64,7 @@ audit () {
if [ $OS_RELEASE -eq 1 ]; then
audit_debian
elif [ $OS_RELEASE -eq 2 ]; then
audit_redhat
audit_centos
else
crit "Current OS is not support!"
FNRET=44
Expand Down
8 changes: 4 additions & 4 deletions bin/hardening/5.1.2_disable_rsh.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ audit_debian () {
done
}

audit_redhat () {
audit_centos () {
is_pkg_installed $PACKAGE_REDHAT
if [ $FNRET = 0 ]; then
crit "$PACKAGE_REDHAT is installed!"
Expand All @@ -55,7 +55,7 @@ audit () {
if [ $OS_RELEASE -eq 1 ]; then
audit_debian
elif [ $OS_RELEASE -eq 2 ]; then
audit_redhat
audit_centos
else
crit "Current OS is not support!"
FNRET=44
Expand Down Expand Up @@ -90,7 +90,7 @@ apply_debian () {
done
}

apply_redhat () {
apply_centos () {
is_pkg_installed $PACKAGE_REDHAT
if [ $FNRET = 0 ]; then
crit "$PACKAGE_REDHAT is installed, purging it"
Expand All @@ -105,7 +105,7 @@ apply () {
if [ $OS_RELEASE -eq 1 ]; then
apply_debian
elif [ $OS_RELEASE -eq 2 ]; then
apply_redhat
apply_centos
else
crit "Current OS is not support!"
fi
Expand Down
8 changes: 4 additions & 4 deletions bin/hardening/5.1.4_disable_talk.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ audit_debian () {
done
}

audit_redhat () {
audit_centos () {
for PACKAGE in $PACKAGES_REDHAT; do
is_pkg_installed $PACKAGE
if [ $FNRET = 0 ]; then
Expand All @@ -57,7 +57,7 @@ audit () {
if [ $OS_RELEASE -eq 1 ]; then
audit_debian
elif [ $OS_RELEASE -eq 2 ]; then
audit_redhat
audit_centos
else
crit "Current OS is not support!"
FNRET=44
Expand Down Expand Up @@ -92,7 +92,7 @@ apply_debian () {
done
}

apply_redhat () {
apply_centos () {
for PACKAGE in $PACKAGES_REDHAT; do
is_pkg_installed $PACKAGE
if [ $FNRET = 0 ]; then
Expand All @@ -109,7 +109,7 @@ apply () {
if [ $OS_RELEASE -eq 1 ]; then
apply_debian
elif [ $OS_RELEASE -eq 2 ]; then
apply_redhat
apply_centos
else
crit "Current OS is not support!"
fi
Expand Down
Loading

0 comments on commit 3b61a0e

Please sign in to comment.