Permalink
Browse files

Upgraded to fresh upstream 0.5.2

  • Loading branch information...
1 parent 7e0e005 commit 9ad46bb82fca6d7a090571f250589ff7f49b7757 @yarikoptic yarikoptic committed Oct 16, 2007
View
@@ -1,27 +0,0 @@
-README
-CHANGELOG
-TODO
-setup.cfg
-setup.py
-version.py
-fail2ban
-fail2ban.py
-firewall/__init__.py
-firewall/firewall.py
-logreader/__init__.py
-logreader/logreader.py
-confreader/__init__.py
-confreader/configreader.py
-utils/__init__.py
-utils/dns.py
-utils/process.py
-utils/mail.py
-utils/strings.py
-utils/pidlock.py
-config/fail2ban.conf.default
-config/gentoo-initd
-config/gentoo-confd
-config/redhat-initd
-config/debian-initd
-man/fail2ban.8
-man/fail2ban.conf.5
View
@@ -0,0 +1,15 @@
+Metadata-Version: 1.0
+Name: fail2ban
+Version: 0.5.2
+Summary: Ban IPs that make too many password failure
+Home-page: http://fail2ban.sourceforge.net
+Author: Cyril Jaquier
+Author-email: lostcontrol@users.sourceforge.net
+License: GPL
+Description:
+ Fail2Ban scans log files like /var/log/pwdfail or
+ /var/log/apache/error_log and bans IP that makes
+ too many password failures. It updates firewall rules
+ to reject the IP address or executes user defined
+ commands. It needs log4py.
+Platform: Posix
@@ -1,6 +1,6 @@
# Fail2Ban configuration file
#
-# $Revision$
+# $Revision: 1.8.2.9 $
#
# 2005.06.21 modified for readability Iain Lea iain@bricbrac.de
View
@@ -16,7 +16,7 @@
#
# Author: Cyril Jaquier
#
-# $Revision$
+# $Revision: 1.1 $
# Command line options for Fail2Ban. Refer to "fail2ban.py -h" for
# valid options.
View
@@ -17,7 +17,7 @@
#
# Author: Sireyessire, Cyril Jaquier
#
-# $Revision$
+# $Revision: 1.1.2.2 $
opts="start stop restart showlog"
View
@@ -1,78 +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"
-PIDFILE="/var/run/fail2ban.pid"
-
-RETVAL=0
-
-start() {
- echo -n $"Starting fail2ban: "
- "${FAIL2BAN}" -b > /dev/null
- RETVAL=$?
- echo
-}
-
-stop() {
- if [ -f "${PIDFILE}" ]; then
- echo -n $"Stopping fail2ban: "
- "${FAIL2BAN}" -k > /dev/null
- echo
- fi
-}
-
-restart() {
- stop
- start
-}
-
-# See how we were called.
-case "$1" in
- start)
- start
- ;;
- stop)
- stop
- ;;
- status)
- status fail2ban
- 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
+#!/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: 1.1.2.2 $
+
+# 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"
+PIDFILE="/var/run/fail2ban.pid"
+
+RETVAL=0
+
+start() {
+ echo -n $"Starting fail2ban: "
+ "${FAIL2BAN}" -b > /dev/null
+ RETVAL=$?
+ echo
+}
+
+stop() {
+ if [ -f "${PIDFILE}" ]; then
+ echo -n $"Stopping fail2ban: "
+ "${FAIL2BAN}" -k > /dev/null
+ echo
+ fi
+}
+
+restart() {
+ stop
+ start
+}
+
+# See how we were called.
+case "$1" in
+ start)
+ start
+ ;;
+ stop)
+ stop
+ ;;
+ status)
+ status fail2ban
+ 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
View
@@ -16,10 +16,10 @@
# Author: Cyril Jaquier
#
-# $Revision$
+# $Revision: 1.1 $
__author__ = "Cyril Jaquier"
-__version__ = "$Revision$"
-__date__ = "$Date$"
+__version__ = "$Revision: 1.1 $"
+__date__ = "$Date: 2005/02/18 13:26:41 $"
__copyright__ = "Copyright (c) 2004 Cyril Jaquier"
__license__ = "GPL"
@@ -16,11 +16,11 @@
# Author: Cyril Jaquier
#
-# $Revision$
+# $Revision: 1.5.2.5 $
__author__ = "Cyril Jaquier"
-__version__ = "$Revision$"
-__date__ = "$Date$"
+__version__ = "$Revision: 1.5.2.5 $"
+__date__ = "$Date: 2005/08/01 16:31:13 $"
__copyright__ = "Copyright (c) 2004 Cyril Jaquier"
__license__ = "GPL"
View
@@ -18,11 +18,11 @@
# Author: Cyril Jaquier
#
-# $Revision$
+# $Revision: 1.4.2.5 $
__author__ = "Cyril Jaquier"
-__version__ = "$Revision$"
-__date__ = "$Date$"
+__version__ = "$Revision: 1.4.2.5 $"
+__date__ = "$Date: 2005/08/04 20:51:14 $"
__copyright__ = "Copyright (c) 2004 Cyril Jaquier"
__license__ = "GPL"
View
@@ -16,11 +16,11 @@
# Author: Cyril Jaquier
#
-# $Revision$
+# $Revision: 1.20.2.13 $
__author__ = "Cyril Jaquier"
-__version__ = "$Revision$"
-__date__ = "$Date$"
+__version__ = "$Revision: 1.20.2.13 $"
+__date__ = "$Date: 2005/08/06 18:44:06 $"
__copyright__ = "Copyright (c) 2004 Cyril Jaquier"
__license__ = "GPL"
@@ -137,14 +137,7 @@ def getCmdLineOptions(optList):
if opt[0] == "-p":
conf["pidlock"] = opt[1]
if opt[0] == "-k":
- pid = checkForPID(conf["pidlock"])
- if pid:
- killPID(int(pid))
- logSys.warn("Killed Fail2Ban with PID "+pid)
- sys.exit(0)
- else:
- logSys.error("No running Fail2Ban found")
- sys.exit(-1)
+ conf["kill"] = True
def main():
""" Fail2Ban main function
@@ -196,6 +189,23 @@ def main():
# Gets command line options
getCmdLineOptions(optList)
+
+ # PID lock
+ pidLock.setPath(conf["pidlock"])
+
+ # Now we can kill properly a running instance if needed
+ try:
+ conf["kill"]
+ pid = pidLock.exists()
+ if pid:
+ killPID(int(pid))
+ logSys.warn("Killed Fail2Ban with PID "+pid)
+ sys.exit(0)
+ else:
+ logSys.error("No running Fail2Ban found")
+ sys.exit(-1)
+ except KeyError:
+ pass
# Start Fail2Ban in daemon mode
if conf["background"]:
@@ -244,9 +254,6 @@ def main():
hdlr.setFormatter(formatter)
logSys.addHandler(hdlr)
- # PID lock
- pidLock.setPath(conf["pidlock"])
-
# Ignores IP list
ignoreIPList = conf["ignoreip"].split(' ')
View
@@ -16,10 +16,10 @@
# Author: Cyril Jaquier
#
-# $Revision$
+# $Revision: 1.1 $
__author__ = "Cyril Jaquier"
-__version__ = "$Revision$"
-__date__ = "$Date$"
+__version__ = "$Revision: 1.1 $"
+__date__ = "$Date: 2004/10/09 15:33:33 $"
__copyright__ = "Copyright (c) 2004 Cyril Jaquier"
__license__ = "GPL"
View
@@ -16,11 +16,11 @@
# Author: Cyril Jaquier
#
-# $Revision$
+# $Revision: 1.8.2.6 $
__author__ = "Cyril Jaquier"
-__version__ = "$Revision$"
-__date__ = "$Date$"
+__version__ = "$Revision: 1.8.2.6 $"
+__date__ = "$Date: 2005/08/01 16:31:42 $"
__copyright__ = "Copyright (c) 2004 Cyril Jaquier"
__license__ = "GPL"
Oops, something went wrong.

0 comments on commit 9ad46bb

Please sign in to comment.