From ddd2b279feceda58549619c82d04a43dc4252e7a Mon Sep 17 00:00:00 2001 From: lostcontrol Date: Fri, 1 Jul 2005 09:30:52 +0000 Subject: [PATCH] - Added an initd script for RedHat/Fedora. Thanks to Andrey G. Grozin git-svn-id: https://fail2ban.svn.sourceforge.net/svnroot/fail2ban/trunk@113 a942ae1a-1317-0410-a47c-b1dcaea8d605 --- CHANGELOG | 7 +++- config/redhat-initd | 78 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 84 insertions(+), 1 deletion(-) create mode 100644 config/redhat-initd diff --git a/CHANGELOG b/CHANGELOG index 6cbe1675..a05b6cbd 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -4,9 +4,14 @@ |_| \__,_|_|_/___|_.__/\__,_|_||_| ============================================================= -Fail2Ban (version 0.4.1) 06/30/2005 +Fail2Ban (version 0.?.?) ??/??/2005 ============================================================= +ver. 0.?.? (??/??/2005) - ??? +---------- +- Added an initd script for RedHat/Fedora. Thanks to Andrey + G. Grozin + ver. 0.4.1 (06/30/2005) - stable ---------- - Fixed textToDNS method which generated wrong matches for diff --git a/config/redhat-initd b/config/redhat-initd new file mode 100644 index 00000000..27369962 --- /dev/null +++ b/config/redhat-initd @@ -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