Change start/stop script for fail2ban.

This commit is contained in:
Christoph 2017-11-27 16:23:03 +01:00
parent 72cda40dab
commit b2dbf5c6f5
4 changed files with 20 additions and 11 deletions

View File

@ -12,6 +12,10 @@
CONFIG_FILE=/etc/ipt-firewall/ip6t-firewall-server.conf
if [[ -z "$fail2ban_client" ]]; then
fail2ban_client="$(which fail2ban-client)"
fi
# ------------- Load Kernel Modules -------------
#
@ -98,9 +102,9 @@ fi # if ! $host_is_vm
# ------------- Stop Fail2Ban if installed -------------
#
if [ -x "$fail2ban_init_script" ]; then
if [ -x "$fail2ban_client" ]; then
echononl "\tStopping fail2ban.."
$fail2ban_init_script stop > /dev/null 2>&1
$fail2ban_client stop > /dev/null 2>&1
if [ "$?" = "0" ];then
echo_done
else
@ -1360,10 +1364,10 @@ echo_done
# ------------- Start Fail2Ban if installed
# -------------
if [ -x "$fail2ban_init_script" ]; then
if [ -x "$fail2ban_client" ]; then
echo
echononl "\tStarting fail2ban.."
$fail2ban_init_script start > /dev/null 2>&1
$fail2ban_client start > /dev/null 2>&1
if [ "$?" = "0" ];then
echo_done
else

View File

@ -13,7 +13,7 @@
# -------------
ip6t="/sbin/ip6tables"
fail2ban_init_script=""
fail2ban_client="$(which fail2ban-client)"
# -------------

View File

@ -12,6 +12,10 @@
CONFIG_FILE=/etc/ipt-firewall/ipt-firewall-server.conf
if [[ -z "$fail2ban_client" ]]; then
fail2ban_client="$(which fail2ban-client)"
fi
# ------------- Load Kernel Modules -------------
#
@ -177,9 +181,9 @@ fi
# ------------- Stop Fail2Ban if installed -------------
#
if [ -x "$fail2ban_init_script" ]; then
if [ -x "$fail2ban_client" ]; then
echononl "\tStopping fail2ban.."
$fail2ban_init_script stop > /dev/null 2>&1
$fail2ban_client stop > /dev/null 2>&1
if [ "$?" = "0" ];then
echo_done
else
@ -1551,13 +1555,14 @@ echo_done
# -------------
# ------------- Start Fail2Ban if installed
# -------------
if [ -x "$fail2ban_init_script" ]; then
if [ -x "$fail2ban_client" ]; then
echo
echononl "\tStarting fail2ban.."
$fail2ban_init_script start > /dev/null 2>&1
$fail2ban_client start > /dev/null 2>&1
if [ "$?" = "0" ];then
echo_done
elif [ "$?" = "255" ]; then
echo_skipped
else
echo_failed
fi

View File

@ -13,7 +13,7 @@
# -------------
ipt="/sbin/iptables"
fail2ban_init_script="/etc/init.d/fail2ban"
fail2ban_client="$(which fail2ban-client)"
# -------------