mirror of https://github.com/fail2ban/fail2ban
git-svn-id: https://fail2ban.svn.sourceforge.net/svnroot/fail2ban/trunk@113 a942ae1a-1317-0410-a47c-b1dcaea8d6050.6
parent
73ff1540e8
commit
07d127bebd
@ -0,0 +1,78 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# fail2ban
|
||||
#
|
||||
# chkconfig: 345 91 9
|
||||
# description: if many unsuccessfull login attempts from some ip address \
|
||||
# during a short period happen, this address is banned \
|
||||
# by the firewall
|
||||
#
|
||||
# Author: Andrey G. Grozin
|
||||
#
|
||||
# $Revision$
|
||||
|
||||
# Source function library.
|
||||
. /etc/init.d/functions
|
||||
|
||||
# Get config.
|
||||
. /etc/sysconfig/network
|
||||
|
||||
# Check that networking is up.
|
||||
[ "${NETWORKING}" = "no" ] && exit 0
|
||||
[ -f /etc/fail2ban.conf ] || exit 0
|
||||
|
||||
FAIL2BAN="/usr/bin/fail2ban.py"
|
||||
PIDFILE="/var/run/fail2ban.pid"
|
||||
|
||||
RETVAL=0
|
||||
|
||||
start() {
|
||||
echo -n $"Starting fail2ban: "
|
||||
"${FAIL2BAN}" -b
|
||||
RETVAL=$?
|
||||
echo
|
||||
}
|
||||
|
||||
stop() {
|
||||
if [ -f "${PIDFILE}" ]; then
|
||||
echo -n $"Stopping fail2ban: "
|
||||
"${FAIL2BAN}" -k
|
||||
echo
|
||||
fi
|
||||
}
|
||||
|
||||
restart() {
|
||||
stop
|
||||
start
|
||||
}
|
||||
|
||||
# See how we were called.
|
||||
case "$1" in
|
||||
start)
|
||||
start
|
||||
;;
|
||||
stop)
|
||||
stop
|
||||
;;
|
||||
status)
|
||||
status fail2ban.py
|
||||
RETVAL=$?
|
||||
;;
|
||||
reload)
|
||||
restart
|
||||
;;
|
||||
restart)
|
||||
restart
|
||||
;;
|
||||
condrestart)
|
||||
if [ -f "${PIDFILE}" ]; then
|
||||
restart
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
echo $"Usage: $0 {start|stop|status|restart|condrestart}"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
exit $RETVAL
|
Loading…
Reference in new issue