Skip to content

Commit

Permalink
Upgraded to fresh upstream 0.5.2
Browse files Browse the repository at this point in the history
  • Loading branch information
yarikoptic committed Oct 16, 2007
1 parent 7e0e005 commit 9ad46bb
Show file tree
Hide file tree
Showing 25 changed files with 163 additions and 720 deletions.
27 changes: 0 additions & 27 deletions MANIFEST

This file was deleted.

15 changes: 15 additions & 0 deletions PKG-INFO
@@ -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
2 changes: 1 addition & 1 deletion config/fail2ban.conf.default
@@ -1,6 +1,6 @@
# Fail2Ban configuration file # Fail2Ban configuration file
# #
# $Revision$ # $Revision: 1.8.2.9 $
# #
# 2005.06.21 modified for readability Iain Lea iain@bricbrac.de # 2005.06.21 modified for readability Iain Lea iain@bricbrac.de


Expand Down
2 changes: 1 addition & 1 deletion config/gentoo-confd
Expand Up @@ -16,7 +16,7 @@
# #
# Author: Cyril Jaquier # Author: Cyril Jaquier
# #
# $Revision$ # $Revision: 1.1 $


# Command line options for Fail2Ban. Refer to "fail2ban.py -h" for # Command line options for Fail2Ban. Refer to "fail2ban.py -h" for
# valid options. # valid options.
Expand Down
2 changes: 1 addition & 1 deletion config/gentoo-initd
Expand Up @@ -17,7 +17,7 @@
# #
# Author: Sireyessire, Cyril Jaquier # Author: Sireyessire, Cyril Jaquier
# #
# $Revision$ # $Revision: 1.1.2.2 $


opts="start stop restart showlog" opts="start stop restart showlog"


Expand Down
156 changes: 78 additions & 78 deletions config/redhat-initd
@@ -1,78 +1,78 @@
#!/bin/bash #!/bin/bash
# #
# fail2ban # fail2ban
# #
# chkconfig: 345 91 9 # chkconfig: 345 91 9
# description: if many unsuccessfull login attempts from some ip address \ # description: if many unsuccessfull login attempts from some ip address \
# during a short period happen, this address is banned \ # during a short period happen, this address is banned \
# by the firewall # by the firewall
# #
# Author: Andrey G. Grozin # Author: Andrey G. Grozin
# #
# $Revision$ # $Revision: 1.1.2.2 $


# Source function library. # Source function library.
. /etc/init.d/functions . /etc/init.d/functions


# Get config. # Get config.
. /etc/sysconfig/network . /etc/sysconfig/network


# Check that networking is up. # Check that networking is up.
[ "${NETWORKING}" = "no" ] && exit 0 [ "${NETWORKING}" = "no" ] && exit 0
[ -f /etc/fail2ban.conf ] || exit 0 [ -f /etc/fail2ban.conf ] || exit 0


FAIL2BAN="/usr/bin/fail2ban" FAIL2BAN="/usr/bin/fail2ban"
PIDFILE="/var/run/fail2ban.pid" PIDFILE="/var/run/fail2ban.pid"


RETVAL=0 RETVAL=0


start() { start() {
echo -n $"Starting fail2ban: " echo -n $"Starting fail2ban: "
"${FAIL2BAN}" -b > /dev/null "${FAIL2BAN}" -b > /dev/null
RETVAL=$? RETVAL=$?
echo echo
} }


stop() { stop() {
if [ -f "${PIDFILE}" ]; then if [ -f "${PIDFILE}" ]; then
echo -n $"Stopping fail2ban: " echo -n $"Stopping fail2ban: "
"${FAIL2BAN}" -k > /dev/null "${FAIL2BAN}" -k > /dev/null
echo echo
fi fi
} }


restart() { restart() {
stop stop
start start
} }


# See how we were called. # See how we were called.
case "$1" in case "$1" in
start) start)
start start
;; ;;
stop) stop)
stop stop
;; ;;
status) status)
status fail2ban status fail2ban
RETVAL=$? RETVAL=$?
;; ;;
reload) reload)
restart restart
;; ;;
restart) restart)
restart restart
;; ;;
condrestart) condrestart)
if [ -f "${PIDFILE}" ]; then if [ -f "${PIDFILE}" ]; then
restart restart
fi fi
;; ;;
*) *)
echo $"Usage: $0 {start|stop|status|restart|condrestart}" echo $"Usage: $0 {start|stop|status|restart|condrestart}"
exit 1 exit 1
;; ;;
esac esac


exit $RETVAL exit $RETVAL
6 changes: 3 additions & 3 deletions confreader/__init__.py
Expand Up @@ -16,10 +16,10 @@


# Author: Cyril Jaquier # Author: Cyril Jaquier
# #
# $Revision$ # $Revision: 1.1 $


__author__ = "Cyril Jaquier" __author__ = "Cyril Jaquier"
__version__ = "$Revision$" __version__ = "$Revision: 1.1 $"
__date__ = "$Date$" __date__ = "$Date: 2005/02/18 13:26:41 $"
__copyright__ = "Copyright (c) 2004 Cyril Jaquier" __copyright__ = "Copyright (c) 2004 Cyril Jaquier"
__license__ = "GPL" __license__ = "GPL"
6 changes: 3 additions & 3 deletions confreader/configreader.py
Expand Up @@ -16,11 +16,11 @@


# Author: Cyril Jaquier # Author: Cyril Jaquier
# #
# $Revision$ # $Revision: 1.5.2.5 $


__author__ = "Cyril Jaquier" __author__ = "Cyril Jaquier"
__version__ = "$Revision$" __version__ = "$Revision: 1.5.2.5 $"
__date__ = "$Date$" __date__ = "$Date: 2005/08/01 16:31:13 $"
__copyright__ = "Copyright (c) 2004 Cyril Jaquier" __copyright__ = "Copyright (c) 2004 Cyril Jaquier"
__license__ = "GPL" __license__ = "GPL"


Expand Down
6 changes: 3 additions & 3 deletions fail2ban
Expand Up @@ -18,11 +18,11 @@


# Author: Cyril Jaquier # Author: Cyril Jaquier
# #
# $Revision$ # $Revision: 1.4.2.5 $


__author__ = "Cyril Jaquier" __author__ = "Cyril Jaquier"
__version__ = "$Revision$" __version__ = "$Revision: 1.4.2.5 $"
__date__ = "$Date$" __date__ = "$Date: 2005/08/04 20:51:14 $"
__copyright__ = "Copyright (c) 2004 Cyril Jaquier" __copyright__ = "Copyright (c) 2004 Cyril Jaquier"
__license__ = "GPL" __license__ = "GPL"


Expand Down
35 changes: 21 additions & 14 deletions fail2ban.py
Expand Up @@ -16,11 +16,11 @@


# Author: Cyril Jaquier # Author: Cyril Jaquier
# #
# $Revision$ # $Revision: 1.20.2.13 $


__author__ = "Cyril Jaquier" __author__ = "Cyril Jaquier"
__version__ = "$Revision$" __version__ = "$Revision: 1.20.2.13 $"
__date__ = "$Date$" __date__ = "$Date: 2005/08/06 18:44:06 $"
__copyright__ = "Copyright (c) 2004 Cyril Jaquier" __copyright__ = "Copyright (c) 2004 Cyril Jaquier"
__license__ = "GPL" __license__ = "GPL"


Expand Down Expand Up @@ -137,14 +137,7 @@ def getCmdLineOptions(optList):
if opt[0] == "-p": if opt[0] == "-p":
conf["pidlock"] = opt[1] conf["pidlock"] = opt[1]
if opt[0] == "-k": if opt[0] == "-k":
pid = checkForPID(conf["pidlock"]) conf["kill"] = True
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)


def main(): def main():
""" Fail2Ban main function """ Fail2Ban main function
Expand Down Expand Up @@ -196,6 +189,23 @@ def main():


# Gets command line options # Gets command line options
getCmdLineOptions(optList) 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 # Start Fail2Ban in daemon mode
if conf["background"]: if conf["background"]:
Expand Down Expand Up @@ -244,9 +254,6 @@ def main():
hdlr.setFormatter(formatter) hdlr.setFormatter(formatter)
logSys.addHandler(hdlr) logSys.addHandler(hdlr)


# PID lock
pidLock.setPath(conf["pidlock"])

# Ignores IP list # Ignores IP list
ignoreIPList = conf["ignoreip"].split(' ') ignoreIPList = conf["ignoreip"].split(' ')


Expand Down
6 changes: 3 additions & 3 deletions firewall/__init__.py
Expand Up @@ -16,10 +16,10 @@


# Author: Cyril Jaquier # Author: Cyril Jaquier
# #
# $Revision$ # $Revision: 1.1 $


__author__ = "Cyril Jaquier" __author__ = "Cyril Jaquier"
__version__ = "$Revision$" __version__ = "$Revision: 1.1 $"
__date__ = "$Date$" __date__ = "$Date: 2004/10/09 15:33:33 $"
__copyright__ = "Copyright (c) 2004 Cyril Jaquier" __copyright__ = "Copyright (c) 2004 Cyril Jaquier"
__license__ = "GPL" __license__ = "GPL"
6 changes: 3 additions & 3 deletions firewall/firewall.py
Expand Up @@ -16,11 +16,11 @@


# Author: Cyril Jaquier # Author: Cyril Jaquier
# #
# $Revision$ # $Revision: 1.8.2.6 $


__author__ = "Cyril Jaquier" __author__ = "Cyril Jaquier"
__version__ = "$Revision$" __version__ = "$Revision: 1.8.2.6 $"
__date__ = "$Date$" __date__ = "$Date: 2005/08/01 16:31:42 $"
__copyright__ = "Copyright (c) 2004 Cyril Jaquier" __copyright__ = "Copyright (c) 2004 Cyril Jaquier"
__license__ = "GPL" __license__ = "GPL"


Expand Down

0 comments on commit 9ad46bb

Please sign in to comment.