diff --git a/fail2ban-loglevel.patch b/fail2ban-loglevel.patch new file mode 100644 index 0000000..f41fb87 --- /dev/null +++ b/fail2ban-loglevel.patch @@ -0,0 +1,21 @@ +commit 1470e3c01d49841335e11ed7ca7898516d1b8be8 +Author: Steven Hiscocks +Date: Wed Mar 19 19:09:07 2014 +0000 + + BF: fail2ban.conf reader expected "int" type for `loglevel` + + Closes #657 + +diff --git a/fail2ban/client/fail2banreader.py b/fail2ban/client/fail2banreader.py +index f17ff92..251c698 100644 +--- a/fail2ban/client/fail2banreader.py ++++ b/fail2ban/client/fail2banreader.py +@@ -45,7 +45,7 @@ class Fail2banReader(ConfigReader): + return ConfigReader.getOptions(self, "Definition", opts) + + def getOptions(self): +- opts = [["int", "loglevel", "INFO" ], ++ opts = [["string", "loglevel", "INFO" ], + ["string", "logtarget", "STDERR"], + ["string", "dbfile", "/var/lib/fail2ban/fail2ban.sqlite3"], + ["int", "dbpurgeage", 86400]] diff --git a/fail2ban-tests-nonet.patch b/fail2ban-tests-nonet.patch new file mode 100644 index 0000000..57e1c1c --- /dev/null +++ b/fail2ban-tests-nonet.patch @@ -0,0 +1,20 @@ +commit 175c5934620adb600fe4435732a3887855320669 +Author: Steven Hiscocks +Date: Wed Mar 19 19:30:48 2014 +0000 + + TST: Skip badips.py test is no network option set + +diff --git a/fail2ban/tests/utils.py b/fail2ban/tests/utils.py +index 456a829..85c1d92 100644 +--- a/fail2ban/tests/utils.py ++++ b/fail2ban/tests/utils.py +@@ -209,6 +209,9 @@ def gatherTests(regexps=None, no_network=False): + for file_ in os.listdir( + os.path.abspath(os.path.dirname(action_d.__file__))): + if file_.startswith("test_") and file_.endswith(".py"): ++ if no_network and file_ in ['test_badips.py']: #pragma: no cover ++ # Test required network ++ continue + tests.addTest(testloader.loadTestsFromName( + "%s.%s" % (action_d.__name__, os.path.splitext(file_)[0]))) + diff --git a/fail2ban-tests-syslog.patch b/fail2ban-tests-syslog.patch new file mode 100644 index 0000000..0541367 --- /dev/null +++ b/fail2ban-tests-syslog.patch @@ -0,0 +1,23 @@ +commit 75325da09091f3ae800a2efbcde1a016617e5f1a +Author: Steven Hiscocks +Date: Wed Mar 19 19:21:23 2014 +0000 + + TST: Skip SYSLOG log target test if '/dev/log' not present + +diff --git a/fail2ban/tests/servertestcase.py b/fail2ban/tests/servertestcase.py +index 231aecd..c4163db 100644 +--- a/fail2ban/tests/servertestcase.py ++++ b/fail2ban/tests/servertestcase.py +@@ -678,6 +678,12 @@ class TransmitterLogging(TransmitterBase): + + self.setGetTest("logtarget", "STDOUT") + self.setGetTest("logtarget", "STDERR") ++ ++ def testLogTargetSYSLOG(self): ++ if not os.path.exists("/dev/log") and sys.version_info >= (2, 7): ++ raise unittest.SkipTest("'/dev/log' not present") ++ elif not os.path.exists("/dev/log"): ++ return + self.setGetTest("logtarget", "SYSLOG") + + def testLogLevel(self): diff --git a/fail2ban.spec b/fail2ban.spec index 3272e19..6eed81d 100644 --- a/fail2ban.spec +++ b/fail2ban.spec @@ -5,6 +5,16 @@ Release: 3%{?dist} License: GPLv2+ URL: http://fail2ban.sourceforge.net/ Source0: https://github.com/%{name}/%{name}/archive/%{version}.tar.gz#/%{name}-%{version}.tar.gz +# Upstream patch to fix setting loglevel +# https://github.com/fail2ban/fail2ban/issues/657 +Patch0: fail2ban-loglevel.patch +# Upstream patch to skip tests with no-network +# https://github.com/fail2ban/fail2ban/issues/110 +Patch1: fail2ban-tests-nonet.patch +# Upstream patch to skip syslog tests without /dev/log +# https://github.com/fail2ban/fail2ban/issues/110 +Patch2: fail2ban-tests-syslog.patch + BuildRequires: python2-devel # For testcases BuildRequires: python-inotify @@ -135,6 +145,9 @@ by default. %prep %setup -q +%patch0 -p1 -b .loglevel +%patch1 -p1 -b .tests-nonet +%patch2 -p1 -b .tests-syslog # Use Fedora paths sed -i -e 's/^before = paths-.*/before = paths-fedora.conf/' config/jail.conf # Start after firewalld (https://bugzilla.redhat.com/show_bug.cgi?id=1067147) @@ -179,8 +192,7 @@ EOF rm -r %{buildroot}%{_docdir}/%{name} %check -# Testcases still pulling in network tests, wants /dev/log -#./fail2ban-testcases-all --no-network +./fail2ban-testcases-all --no-network %post server %if 0%{?fedora} >= 19 @@ -255,6 +267,8 @@ fi - Split into sub-packages for different components - Enable journal filter by default (bug #985567) - Enable firewalld action by default (bug #1046816) +- Add upstream patch to fix setting loglevel in fail2ban.conf +- Add upstream patches to fix tests in mock, run tests * Tue Mar 18 2014 Orion Poplawski - 0.9-2 - Use Fedora paths