From 123791c94c3a6ef6f3c871d4b749586ec08e964c Mon Sep 17 00:00:00 2001 From: Daniel Black Date: Sat, 15 Mar 2014 18:52:18 +1100 Subject: [PATCH 1/8] DOC/ENH: update man pages for release --- man/fail2ban-client.1 | 4 ++-- man/fail2ban-regex.1 | 12 +++++++++--- man/fail2ban-server.1 | 4 ++-- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/man/fail2ban-client.1 b/man/fail2ban-client.1 index 7542d5be..ff929ad6 100644 --- a/man/fail2ban-client.1 +++ b/man/fail2ban-client.1 @@ -1,12 +1,12 @@ .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.41.2. -.TH FAIL2BAN-CLIENT "1" "January 2014" "fail2ban-client v0.8.12" "User Commands" +.TH FAIL2BAN-CLIENT "1" "March 2014" "fail2ban-client v0.8.13" "User Commands" .SH NAME fail2ban-client \- configure and control the server .SH SYNOPSIS .B fail2ban-client [\fIOPTIONS\fR] \fI\fR .SH DESCRIPTION -Fail2Ban v0.8.12 reads log file that contains password failure report +Fail2Ban v0.8.13 reads log file that contains password failure report and bans the corresponding IP addresses using firewall rules. .SH OPTIONS .TP diff --git a/man/fail2ban-regex.1 b/man/fail2ban-regex.1 index 1dec0860..96d6ecbf 100644 --- a/man/fail2ban-regex.1 +++ b/man/fail2ban-regex.1 @@ -1,5 +1,5 @@ .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.41.2. -.TH FAIL2BAN-REGEX "1" "January 2014" "fail2ban-regex 0.8.12" "User Commands" +.TH FAIL2BAN-REGEX "1" "March 2014" "fail2ban-regex 0.8.13" "User Commands" .SH NAME fail2ban-regex \- test Fail2ban "failregex" option .SH SYNOPSIS @@ -48,11 +48,17 @@ Be verbose in output \fB\-D\fR, \fB\-\-debuggex\fR Produce debuggex.com urls for debugging there .TP +\fB\-\-print\-no\-missed\fR +Do not print any missed lines +.TP +\fB\-\-print\-no\-ignored\fR +Do not print any ignored lines +.TP \fB\-\-print\-all\-missed\fR -Either to print all missed lines +Print all missed lines, no matter how many .TP \fB\-\-print\-all\-ignored\fR -Either to print all ignored lines +Print all ignored lines, no matter how many .TP \fB\-t\fR, \fB\-\-log\-traceback\fR Enrich log\-messages with compressed tracebacks diff --git a/man/fail2ban-server.1 b/man/fail2ban-server.1 index d2c7cf6f..e92dab2b 100644 --- a/man/fail2ban-server.1 +++ b/man/fail2ban-server.1 @@ -1,12 +1,12 @@ .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.41.2. -.TH FAIL2BAN-SERVER "1" "January 2014" "fail2ban-server v0.8.12" "User Commands" +.TH FAIL2BAN-SERVER "1" "March 2014" "fail2ban-server v0.8.13" "User Commands" .SH NAME fail2ban-server \- start the server .SH SYNOPSIS .B fail2ban-server [\fIOPTIONS\fR] .SH DESCRIPTION -Fail2Ban v0.8.12 reads log file that contains password failure report +Fail2Ban v0.8.13 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 From 0601a07961367627ebc1916abe35175a9308564f Mon Sep 17 00:00:00 2001 From: Daniel Black Date: Sat, 15 Mar 2014 19:06:18 +1100 Subject: [PATCH 2/8] PKG: include nagios filter/log --- MANIFEST | 2 ++ 1 file changed, 2 insertions(+) diff --git a/MANIFEST b/MANIFEST index af3f564c..7757f88b 100644 --- a/MANIFEST +++ b/MANIFEST @@ -67,6 +67,7 @@ testcases/files/logs/horde testcases/files/logs/suhosin testcases/files/logs/mysqld-auth testcases/files/logs/named-refused +testcases/files/logs/nagios testcases/files/logs/nginx-http-auth testcases/files/logs/nsd testcases/files/logs/openwebmail @@ -164,6 +165,7 @@ config/filter.d/freeswitch.conf config/filter.d/gssftpd.conf config/filter.d/horde.conf config/filter.d/suhosin.conf +config/filter.d/nagios.conf config/filter.d/named-refused.conf config/filter.d/nsd.conf config/filter.d/openwebmail.conf From cee341402990b8dc2f9e2544ba44185bce7922af Mon Sep 17 00:00:00 2001 From: Daniel Black Date: Sat, 15 Mar 2014 19:06:37 +1100 Subject: [PATCH 3/8] PKG: version release --- ChangeLog | 4 ++-- common/version.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index df121e07..44f9a624 100644 --- a/ChangeLog +++ b/ChangeLog @@ -4,10 +4,10 @@ |_| \__,_|_|_/___|_.__/\__,_|_||_| ================================================================================ -Fail2Ban (version 0.8.12.dev) 2014/01/22 +Fail2Ban (version 0.8.13) 2014/03/15 ================================================================================ -ver. 0.8.13 (2014/XX/XXX) - maintenance-only-from-now-on +ver. 0.8.13 (2014/03/15) - maintenance-only-from-now-on ----------- - Fixes: diff --git a/common/version.py b/common/version.py index f0ce8877..5dc2cc88 100644 --- a/common/version.py +++ b/common/version.py @@ -24,4 +24,4 @@ __author__ = "Cyril Jaquier, Yaroslav Halchenko" __copyright__ = "Copyright (c) 2004 Cyril Jaquier, 2011-2013 Yaroslav Halchenko" __license__ = "GPL" -version = "0.8.12.dev" +version = "0.8.13" From eb66edd3389d1e0a1f14e5fcad6cd7d287c6ce73 Mon Sep 17 00:00:00 2001 From: Daniel Black Date: Sat, 15 Mar 2014 19:14:36 +1100 Subject: [PATCH 4/8] DOC: DEVELOP release note changes --- DEVELOP | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/DEVELOP b/DEVELOP index 18d29ad4..39ee60df 100644 --- a/DEVELOP +++ b/DEVELOP @@ -316,23 +316,23 @@ Look for errors like: Which indicates that testcases/files/logs/mysqld.log has been moved or is a directory - tar -C /tmp -jxf dist/fail2ban-0.8.12.tar.bz2 + tar -C /tmp -jxf dist/fail2ban-0.8.14.tar.bz2 # clean up current direcory - diff -rul --exclude \*.pyc . /tmp/fail2ban-0.8.12/ + diff -rul --exclude \*.pyc . /tmp/fail2ban-0.8.14/ # Only differences should be files that you don't want distributed. # Ensure the tests work from the tarball - cd /tmp/fail2ban-0.8.12/ && ./fail2ban-testcases-all + cd /tmp/fail2ban-0.8.14/ && ./fail2ban-testcases-all # Add/finalize the corresponding entry in the ChangeLog To generate a list of committers use e.g. - git shortlog -sn 0.8.11.. | sed -e 's,^[ 0-9\t]*,,g' | tr '\n' '\|' | sed -e 's:|:, :g' + git shortlog -sn 0.8.13.. | sed -e 's,^[ 0-9\t]*,,g' | tr '\n' '\|' | sed -e 's:|:, :g' Ensure the top of the ChangeLog has the right version and current date. From a8d0cc9af8d889d548cb255cb0636e173a393ea5 Mon Sep 17 00:00:00 2001 From: Daniel Black Date: Sat, 15 Mar 2014 21:59:22 +1100 Subject: [PATCH 5/8] DOC: remove duplicate update of Fail2ban_Version --- DEVELOP | 1 - 1 file changed, 1 deletion(-) diff --git a/DEVELOP b/DEVELOP index 39ee60df..c4a5cf62 100644 --- a/DEVELOP +++ b/DEVELOP @@ -393,7 +393,6 @@ Which indicates that testcases/files/logs/mysqld.log has been moved or is a dire move old bits to: http://www.fail2ban.org/wiki/index.php?title=Template:Fail2ban_OldNews&action=edit - http://www.fail2ban.org/wiki/index.php?title=Template:Fail2ban_Versions&action=edit http://www.fail2ban.org/wiki/index.php/ChangeLog http://www.fail2ban.org/wiki/index.php/Requirements (Check requirement) http://www.fail2ban.org/wiki/index.php/Features From 9cbb472478feca7eba33c8c00a7533036f87d3e7 Mon Sep 17 00:00:00 2001 From: Yaroslav Halchenko Date: Sun, 16 Mar 2014 10:35:58 -0400 Subject: [PATCH 6/8] BF: python 2.4 and 2.5 compatibility -- no "except ... as ..." yet --- server/filterpyinotify.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/filterpyinotify.py b/server/filterpyinotify.py index 42243552..d293b171 100644 --- a/server/filterpyinotify.py +++ b/server/filterpyinotify.py @@ -211,6 +211,6 @@ class ProcessPyinotify(pyinotify.ProcessEvent): def process_default(self, event): try: self.__FileFilter.callback(event, origin='Default ') - except Exception as e: + except Exception, e: logSys.error("Error in FilterPyinotify callback: %s", e, exc_info=logSys.getEffectiveLevel() <= logging.DEBUG) From 18b476a93ef53e186a6bdc8da4520e03408ec9a8 Mon Sep 17 00:00:00 2001 From: Yaroslav Halchenko Date: Sun, 16 Mar 2014 11:12:14 -0400 Subject: [PATCH 7/8] BF(PY2.4,2.5): provide bin() function (introduced in 2.6) --- server/filter.py | 36 ++++++++++++++++++++++++++++++++++++ testcases/filtertestcase.py | 14 ++++++++++++++ 2 files changed, 50 insertions(+) diff --git a/server/filter.py b/server/filter.py index 0e5f9ecb..27156e7a 100644 --- a/server/filter.py +++ b/server/filter.py @@ -37,6 +37,42 @@ import logging, re, os, fcntl, time, shlex, subprocess # Gets the instance of the logger. logSys = logging.getLogger("fail2ban.filter") + +# For compatibility with elderly Pythons, left defined regardless of +# the version for testing against stock version + +hexDict = { + '0':'0000', '1':'0001', '2':'0010', '3':'0011', '4':'0100', '5':'0101', + '6':'0110', '7':'0111', '8':'1000', '9':'1001', 'a':'1010', 'b':'1011', + 'c':'1100', 'd':'1101', 'e':'1110', 'f':'1111', 'l':''} + +def _bin(n): + """ + A foolishly simple look-up method of getting binary string from an integer + This happens to be faster than all other ways!!! + + Copyright: 2009, Vishal Sapre + License: MIT + Origin: http://code.activestate.com/recipes/576847/ + """ + # ========================================================= + # create hex of int, remove '0x'. now for each hex char, + # look up binary string, append in list and join at the end. + # ========================================================= + # yoh: added 0b prefix and .lower() for when converting from long + # We know how to deal only with positives here + assert(n >= 0) + nbin = ''.join([hexDict[hstr] for hstr in hex(n)[2:].lower()]) + # to unify appearance with stock bin() + nbin = nbin.lstrip('0') + if not nbin: # got empty + nbin = '0' + return '0b' + nbin + +if sys.version_info < (2, 6): + bin = _bin + + ## # Log reader class. # diff --git a/testcases/filtertestcase.py b/testcases/filtertestcase.py index f1a9bcd2..5f926783 100644 --- a/testcases/filtertestcase.py +++ b/testcases/filtertestcase.py @@ -158,6 +158,20 @@ class BasicFilter(unittest.TestCase): self.filter.setUseDns(False) self.assertEqual(self.filter.getUseDns(), 'no') + def testBin(self): + # compare custom _bin against stock bin + from server.filter import _bin + if sys.version_info >= (2, 6): + from __builtin__ import bin + for n in (0, 1, 10, long(1), long(4294967168)): + self.assertEqual(_bin(n), bin(n)) + else: + from server.filter import bin + self.assertEqual(bin(1), '0b1') + self.assertEqual(bin(0), '0b0') + self.assertEqual(bin(long(10)), '0b1010') + + class IgnoreIP(LogCaptureTestCase): From bb2d981bf8b505fd0d9500eecfcba34ce60406a8 Mon Sep 17 00:00:00 2001 From: Yaroslav Halchenko Date: Sun, 16 Mar 2014 11:25:12 -0400 Subject: [PATCH 8/8] Changelog entry --- ChangeLog | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 44f9a624..a1564828 100644 --- a/ChangeLog +++ b/ChangeLog @@ -4,9 +4,16 @@ |_| \__,_|_|_/___|_.__/\__,_|_||_| ================================================================================ -Fail2Ban (version 0.8.13) 2014/03/15 +Fail2Ban (version 0.8.13.dev) 2014/??/?? ================================================================================ +ver. 0.8.14 (2014/??/??) - take-care-of-the-elderly +----------- + +- Fixes: + - minor fixes for claimed Python 2.4 and 2.5 compatibility + + ver. 0.8.13 (2014/03/15) - maintenance-only-from-now-on -----------