mirror of https://github.com/fail2ban/fail2ban
commit
b6e07f1f3a
10
CHANGELOG
10
CHANGELOG
|
@ -4,9 +4,17 @@
|
|||
|_| \__,_|_|_/___|_.__/\__,_|_||_|
|
||||
|
||||
=============================================================
|
||||
Fail2Ban (version 0.7.8) 2007/03/21
|
||||
Fail2Ban (version 0.7.9) 2007/04/19
|
||||
=============================================================
|
||||
|
||||
ver. 0.7.9 (2007/04/19) - release candidate
|
||||
----------
|
||||
- Close opened handlers. Thanks to Yaroslav Halchenko
|
||||
- Fixed "reload" bug. Many many thanks to Yaroslav Halchenko
|
||||
- Added date format for asctime without year
|
||||
- Modified filters config. Thanks to Michael C. Haller
|
||||
- Fixed a small bug in mail-buffered.conf
|
||||
|
||||
ver. 0.7.8 (2007/03/21) - release candidate
|
||||
----------
|
||||
- Fixed asctime pattern in datedetector.py
|
||||
|
|
2
PKG-INFO
2
PKG-INFO
|
@ -1,6 +1,6 @@
|
|||
Metadata-Version: 1.0
|
||||
Name: fail2ban
|
||||
Version: 0.7.8
|
||||
Version: 0.7.9
|
||||
Summary: Ban IPs that make too many password failure
|
||||
Home-page: http://fail2ban.sourceforge.net
|
||||
Author: Cyril Jaquier
|
||||
|
|
9
README
9
README
|
@ -4,7 +4,7 @@
|
|||
|_| \__,_|_|_/___|_.__/\__,_|_||_|
|
||||
|
||||
=============================================================
|
||||
Fail2Ban (version 0.7.8) 2007/03/21
|
||||
Fail2Ban (version 0.7.9) 2007/04/19
|
||||
=============================================================
|
||||
|
||||
Fail2Ban scans log files like /var/log/pwdfail and bans IP
|
||||
|
@ -28,8 +28,8 @@ Optional:
|
|||
|
||||
To install, just do:
|
||||
|
||||
> tar xvfj fail2ban-0.7.8.tar.bz2
|
||||
> cd fail2ban-0.7.8
|
||||
> tar xvfj fail2ban-0.7.9.tar.bz2
|
||||
> cd fail2ban-0.7.9
|
||||
> python setup.py install
|
||||
|
||||
This will install Fail2Ban into /usr/share/fail2ban. The
|
||||
|
@ -73,7 +73,8 @@ Tom Pike, Iain Lea, Andrey G. Grozin, Yaroslav Halchenko,
|
|||
Jonathan Kamens, Stephen Gildea, Markus Hoffmann, Mark
|
||||
Edgington, Patrick Börjesson, kojiro, zugeschmiert, Tyler,
|
||||
Nick Munger, Christoph Haas, Justin Shore, Joël Bertrand,
|
||||
René Berber, mEDI, Axel Thimm, Eric Gerbier, Christian Rauch
|
||||
René Berber, mEDI, Axel Thimm, Eric Gerbier, Christian Rauch,
|
||||
Michael C. Haller
|
||||
|
||||
License:
|
||||
--------
|
||||
|
|
|
@ -16,12 +16,12 @@
|
|||
|
||||
# Author: Cyril Jaquier
|
||||
#
|
||||
# $Revision: 561 $
|
||||
# $Revision: 571 $
|
||||
|
||||
__author__ = "Cyril Jaquier"
|
||||
__version__ = "$Revision: 561 $"
|
||||
__date__ = "$Date: 2007-03-21 22:44:07 +0100 (Wed, 21 Mar 2007) $"
|
||||
__version__ = "$Revision: 571 $"
|
||||
__date__ = "$Date: 2007-04-19 23:57:27 +0200 (Thu, 19 Apr 2007) $"
|
||||
__copyright__ = "Copyright (c) 2004 Cyril Jaquier"
|
||||
__license__ = "GPL"
|
||||
|
||||
version = "0.7.8"
|
||||
version = "0.7.9"
|
||||
|
|
|
@ -21,7 +21,7 @@ actionstart = echo -en "Hi,\n
|
|||
# Notes.: command executed once at the end of Fail2Ban
|
||||
# Values: CMD
|
||||
#
|
||||
actionstop = if [ -d <tmpfile> ]; then
|
||||
actionstop = if [ -f <tmpfile> ]; then
|
||||
echo -en "Hi,\n
|
||||
These hosts have been banned by Fail2Ban.\n
|
||||
`cat <tmpfile>`
|
||||
|
@ -54,7 +54,7 @@ actionban = echo `date`": <ip> (<failures> failures)" >> <tmpfile>
|
|||
echo -en "Hi,\n
|
||||
These hosts have been banned by Fail2Ban.\n
|
||||
`cat <tmpfile>`
|
||||
Regards,\n
|
||||
\nRegards,\n
|
||||
Fail2Ban"|mail -s "[Fail2Ban] <name>: Summary" <dest>
|
||||
rm <tmpfile>
|
||||
fi
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
#
|
||||
# Author: Cyril Jaquier
|
||||
#
|
||||
# $Revision: 495 $
|
||||
# $Revision: 569 $
|
||||
#
|
||||
|
||||
[Definition]
|
||||
|
@ -14,7 +14,9 @@
|
|||
# (?:::f{4,6}:)?(?P<host>\S+)
|
||||
# Values: TEXT
|
||||
#
|
||||
failregex = [[]client <HOST>[]] user .*(?:: authentication failure|not found)
|
||||
failregex = [[]client <HOST>[]] user .* authentication failure
|
||||
[[]client <HOST>[]] user .* not found
|
||||
[[]client <HOST>[]] user .* password mismatch
|
||||
|
||||
# Option: ignoreregex
|
||||
# Notes.: regex to ignore. If this regex matches, the line is ignored.
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.36.
|
||||
.TH FAIL2BAN-CLIENT "1" "February 2007" "fail2ban-client v0.7.7" "User Commands"
|
||||
.TH FAIL2BAN-CLIENT "1" "April 2007" "fail2ban-client v0.7.9" "User Commands"
|
||||
.SH NAME
|
||||
fail2ban-client \- configure and control the server
|
||||
.SH DESCRIPTION
|
||||
[?1034hUsage: ../fail2ban\-client [OPTIONS] <COMMAND>
|
||||
.PP
|
||||
Fail2Ban v0.7.7 reads log file that contains password failure report
|
||||
Fail2Ban v0.7.9 reads log file that contains password failure report
|
||||
and bans the corresponding IP addresses using firewall rules.
|
||||
.SH OPTIONS
|
||||
.TP
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.36.
|
||||
.TH FAIL2BAN-REGEX "1" "February 2007" "fail2ban-regex v0.7.7" "User Commands"
|
||||
.TH FAIL2BAN-REGEX "1" "April 2007" "fail2ban-regex v0.7.9" "User Commands"
|
||||
.SH NAME
|
||||
fail2ban-regex \- test Fail2ban "failregex" option
|
||||
.SH SYNOPSIS
|
||||
.B fail2ban-regex
|
||||
[\fIOPTIONS\fR] \fI<LOG> <REGEX>\fR
|
||||
.SH DESCRIPTION
|
||||
Fail2Ban v0.7.7 reads log file that contains password failure report
|
||||
Fail2Ban v0.7.9 reads log file that contains password failure report
|
||||
and bans the corresponding IP addresses using firewall rules.
|
||||
.PP
|
||||
This tools can test regular expressions for "fail2ban".
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.36.
|
||||
.TH FAIL2BAN-SERVER "1" "February 2007" "fail2ban-server v0.7.7" "User Commands"
|
||||
.TH FAIL2BAN-SERVER "1" "April 2007" "fail2ban-server v0.7.9" "User Commands"
|
||||
.SH NAME
|
||||
fail2ban-server \- start the server
|
||||
.SH SYNOPSIS
|
||||
.B fail2ban-server
|
||||
[\fIOPTIONS\fR]
|
||||
.SH DESCRIPTION
|
||||
Fail2Ban v0.7.7 reads log file that contains password failure report
|
||||
Fail2Ban v0.7.9 reads log file that contains password failure report
|
||||
and bans the corresponding IP addresses using firewall rules.
|
||||
.PP
|
||||
Only use this command for debugging purpose. Start the server with
|
||||
|
|
|
@ -16,11 +16,11 @@
|
|||
|
||||
# Author: Cyril Jaquier
|
||||
#
|
||||
# $Revision: 556 $
|
||||
# $Revision: 567 $
|
||||
|
||||
__author__ = "Cyril Jaquier"
|
||||
__version__ = "$Revision: 556 $"
|
||||
__date__ = "$Date: 2007-03-07 21:54:32 +0100 (Wed, 07 Mar 2007) $"
|
||||
__version__ = "$Revision: 567 $"
|
||||
__date__ = "$Date: 2007-03-26 23:17:31 +0200 (Mon, 26 Mar 2007) $"
|
||||
__copyright__ = "Copyright (c) 2004 Cyril Jaquier"
|
||||
__license__ = "GPL"
|
||||
|
||||
|
@ -125,10 +125,10 @@ class Actions(JailThread):
|
|||
# @return True when the thread exits nicely
|
||||
|
||||
def run(self):
|
||||
self.setActive(True)
|
||||
for action in self.__actions:
|
||||
action.execActionStart()
|
||||
self.setActive(True)
|
||||
while self.isActive():
|
||||
while self._isActive():
|
||||
if not self.getIdle():
|
||||
#logSys.debug(self.jail.getName() + ": action")
|
||||
ret = self.__checkBan()
|
||||
|
|
|
@ -16,11 +16,11 @@
|
|||
|
||||
# Author: Cyril Jaquier
|
||||
#
|
||||
# $Revision: 553 $
|
||||
# $Revision: 568 $
|
||||
|
||||
__author__ = "Cyril Jaquier"
|
||||
__version__ = "$Revision: 553 $"
|
||||
__date__ = "$Date: 2007-02-26 00:53:22 +0100 (Mon, 26 Feb 2007) $"
|
||||
__version__ = "$Revision: 568 $"
|
||||
__date__ = "$Date: 2007-04-01 22:42:05 +0200 (Sun, 01 Apr 2007) $"
|
||||
__copyright__ = "Copyright (c) 2004 Cyril Jaquier"
|
||||
__license__ = "GPL"
|
||||
|
||||
|
@ -56,6 +56,12 @@ class DateDetector:
|
|||
template.setRegex("\S{3} \S{3}\s{1,2}\d{1,2} \d{2}:\d{2}:\d{2} \d{4}")
|
||||
template.setPattern("%a %b %d %H:%M:%S %Y")
|
||||
self.__templates.append(template)
|
||||
# asctime without year
|
||||
template = DateStrptime()
|
||||
template.setName("Weekday Month Day Hour:Minute:Second")
|
||||
template.setRegex("\S{3} \S{3}\s{1,2}\d{1,2} \d{2}:\d{2}:\d{2}")
|
||||
template.setPattern("%a %b %d %H:%M:%S")
|
||||
self.__templates.append(template)
|
||||
# simple date
|
||||
template = DateStrptime()
|
||||
template.setName("Year/Month/Day Hour:Minute:Second")
|
||||
|
|
|
@ -16,11 +16,11 @@
|
|||
|
||||
# Author: Cyril Jaquier
|
||||
#
|
||||
# $Revision: 537 $
|
||||
# $Revision: 567 $
|
||||
|
||||
__author__ = "Cyril Jaquier"
|
||||
__version__ = "$Revision: 537 $"
|
||||
__date__ = "$Date: 2007-02-01 21:50:12 +0100 (Thu, 01 Feb 2007) $"
|
||||
__version__ = "$Revision: 567 $"
|
||||
__date__ = "$Date: 2007-03-26 23:17:31 +0200 (Mon, 26 Mar 2007) $"
|
||||
__copyright__ = "Copyright (c) 2004 Cyril Jaquier"
|
||||
__license__ = "GPL"
|
||||
|
||||
|
@ -385,7 +385,7 @@ class Filter(JailThread):
|
|||
self.__setFilePos()
|
||||
lastLine = None
|
||||
for line in self.__crtHandler:
|
||||
if not self.isActive():
|
||||
if not self._isActive():
|
||||
# The jail has been stopped
|
||||
break
|
||||
try:
|
||||
|
|
|
@ -16,11 +16,11 @@
|
|||
|
||||
# Author: Cyril Jaquier
|
||||
#
|
||||
# $Revision: 451 $
|
||||
# $Revision: 567 $
|
||||
|
||||
__author__ = "Cyril Jaquier"
|
||||
__version__ = "$Revision: 451 $"
|
||||
__date__ = "$Date: 2006-11-06 23:47:24 +0100 (Mon, 06 Nov 2006) $"
|
||||
__version__ = "$Revision: 567 $"
|
||||
__date__ = "$Date: 2007-03-26 23:17:31 +0200 (Mon, 26 Mar 2007) $"
|
||||
__copyright__ = "Copyright (c) 2004 Cyril Jaquier"
|
||||
__license__ = "GPL"
|
||||
|
||||
|
@ -99,7 +99,7 @@ class FilterGamin(Filter):
|
|||
|
||||
def run(self):
|
||||
self.setActive(True)
|
||||
while self.isActive():
|
||||
while self._isActive():
|
||||
if not self.getIdle():
|
||||
# We cannot block here because we want to be able to
|
||||
# exit.
|
||||
|
@ -117,5 +117,15 @@ class FilterGamin(Filter):
|
|||
time.sleep(self.getSleepTime())
|
||||
else:
|
||||
time.sleep(self.getSleepTime())
|
||||
# Cleanup Gamin
|
||||
self.__cleanup()
|
||||
logSys.debug(self.jail.getName() + ": filter terminated")
|
||||
return True
|
||||
|
||||
##
|
||||
# Desallocates the resources used by Gamin.
|
||||
|
||||
def __cleanup(self):
|
||||
for path in Filter.getLogPath(self):
|
||||
self.monitor.stop_watch(path)
|
||||
del self.monitor
|
||||
|
|
|
@ -16,11 +16,11 @@
|
|||
|
||||
# Author: Cyril Jaquier
|
||||
#
|
||||
# $Revision: 504 $
|
||||
# $Revision: 567 $
|
||||
|
||||
__author__ = "Cyril Jaquier"
|
||||
__version__ = "$Revision: 504 $"
|
||||
__date__ = "$Date: 2006-12-23 17:37:17 +0100 (Sat, 23 Dec 2006) $"
|
||||
__version__ = "$Revision: 567 $"
|
||||
__date__ = "$Date: 2007-03-26 23:17:31 +0200 (Mon, 26 Mar 2007) $"
|
||||
__copyright__ = "Copyright (c) 2004 Cyril Jaquier"
|
||||
__license__ = "GPL"
|
||||
|
||||
|
@ -93,7 +93,7 @@ class FilterPoll(Filter):
|
|||
|
||||
def run(self):
|
||||
self.setActive(True)
|
||||
while self.isActive():
|
||||
while self._isActive():
|
||||
if not self.getIdle():
|
||||
# Get file modification
|
||||
for f in self.getLogPath():
|
||||
|
|
|
@ -16,11 +16,11 @@
|
|||
|
||||
# Author: Cyril Jaquier
|
||||
#
|
||||
# $Revision: 452 $
|
||||
# $Revision: 567 $
|
||||
|
||||
__author__ = "Cyril Jaquier"
|
||||
__version__ = "$Revision: 452 $"
|
||||
__date__ = "$Date: 2006-11-06 23:48:46 +0100 (Mon, 06 Nov 2006) $"
|
||||
__version__ = "$Revision: 567 $"
|
||||
__date__ = "$Date: 2007-03-26 23:17:31 +0200 (Mon, 26 Mar 2007) $"
|
||||
__copyright__ = "Copyright (c) 2004 Cyril Jaquier"
|
||||
__license__ = "GPL"
|
||||
|
||||
|
@ -89,10 +89,10 @@ class Jail:
|
|||
self.__filter.join()
|
||||
self.__action.join()
|
||||
|
||||
def isActive(self):
|
||||
isActive0 = self.__filter.isActive()
|
||||
isActive1 = self.__action.isActive()
|
||||
return isActive0 or isActive1
|
||||
def isAlive(self):
|
||||
isAlive0 = self.__filter.isAlive()
|
||||
isAlive1 = self.__action.isAlive()
|
||||
return isAlive0 or isAlive1
|
||||
|
||||
def setIdle(self, value):
|
||||
self.__filter.setIdle(value)
|
||||
|
|
|
@ -16,11 +16,11 @@
|
|||
|
||||
# Author: Cyril Jaquier
|
||||
#
|
||||
# $Revision: 433 $
|
||||
# $Revision: 567 $
|
||||
|
||||
__author__ = "Cyril Jaquier"
|
||||
__version__ = "$Revision: 433 $"
|
||||
__date__ = "$Date: 2006-10-24 21:40:51 +0200 (Tue, 24 Oct 2006) $"
|
||||
__version__ = "$Revision: 567 $"
|
||||
__date__ = "$Date: 2007-03-26 23:17:31 +0200 (Mon, 26 Mar 2007) $"
|
||||
__copyright__ = "Copyright (c) 2004 Cyril Jaquier"
|
||||
__license__ = "GPL"
|
||||
|
||||
|
@ -105,7 +105,7 @@ class JailThread(Thread):
|
|||
# Check if the filter thread is running.
|
||||
# @return True if the thread is running
|
||||
|
||||
def isActive(self):
|
||||
def _isActive(self):
|
||||
return self.__isRunning
|
||||
|
||||
##
|
||||
|
|
|
@ -16,11 +16,11 @@
|
|||
|
||||
# Author: Cyril Jaquier
|
||||
#
|
||||
# $Revision: 503 $
|
||||
# $Revision: 567 $
|
||||
|
||||
__author__ = "Cyril Jaquier"
|
||||
__version__ = "$Revision: 503 $"
|
||||
__date__ = "$Date: 2006-12-23 17:31:00 +0100 (Sat, 23 Dec 2006) $"
|
||||
__version__ = "$Revision: 567 $"
|
||||
__date__ = "$Date: 2007-03-26 23:17:31 +0200 (Mon, 26 Mar 2007) $"
|
||||
__copyright__ = "Copyright (c) 2004 Cyril Jaquier"
|
||||
__license__ = "GPL"
|
||||
|
||||
|
@ -96,7 +96,7 @@ class Server:
|
|||
def startJail(self, name):
|
||||
try:
|
||||
self.__lock.acquire()
|
||||
if not self.isActive(name):
|
||||
if not self.isAlive(name):
|
||||
self.__jails.get(name).start()
|
||||
finally:
|
||||
self.__lock.release()
|
||||
|
@ -104,7 +104,7 @@ class Server:
|
|||
def stopJail(self, name):
|
||||
try:
|
||||
self.__lock.acquire()
|
||||
if self.isActive(name):
|
||||
if self.isAlive(name):
|
||||
self.__jails.get(name).stop()
|
||||
self.delJail(name)
|
||||
finally:
|
||||
|
@ -118,8 +118,8 @@ class Server:
|
|||
finally:
|
||||
self.__lock.release()
|
||||
|
||||
def isActive(self, name):
|
||||
return self.__jails.get(name).isActive()
|
||||
def isAlive(self, name):
|
||||
return self.__jails.get(name).isAlive()
|
||||
|
||||
def setIdleJail(self, name, value):
|
||||
self.__jails.get(name).setIdle(value)
|
||||
|
@ -326,15 +326,18 @@ class Server:
|
|||
else:
|
||||
# Target should be a file
|
||||
try:
|
||||
open(target, "a")
|
||||
open(target, "a").close()
|
||||
hdlr = logging.FileHandler(target)
|
||||
except IOError:
|
||||
logSys.error("Unable to log to " + target)
|
||||
logSys.info("Logging to previous target " + self.__logTarget)
|
||||
return False
|
||||
self.__logTarget = target
|
||||
# Remove previous handler
|
||||
logging.getLogger("fail2ban").handlers = []
|
||||
# Removes previous handlers
|
||||
for handler in logging.getLogger("fail2ban").handlers:
|
||||
# Closes the handler.
|
||||
handler.close()
|
||||
logging.getLogger("fail2ban").removeHandler(handler)
|
||||
# set a format which is simpler for console use
|
||||
formatter = logging.Formatter("%(asctime)s %(name)-16s: %(levelname)-6s %(message)s")
|
||||
# tell the handler to use this format
|
||||
|
|
Loading…
Reference in New Issue