Merge branch 'master' into epel7

i9ce
Orion Poplawski 11 years ago
commit e2fc2a5023

@ -0,0 +1,41 @@
commit b2a1032f5738575f1c368360ba93fc7da5991225
Author: Yaroslav Halchenko <debian@onerussian.com>
Date: Tue Aug 12 11:31:42 2014 -0400
ENH/BF(TST): making permissions restrictive is not sufficient -- really remove file to test
diff --git a/fail2ban/tests/filtertestcase.py b/fail2ban/tests/filtertestcase.py
index c02e861..1fa3116 100644
--- a/fail2ban/tests/filtertestcase.py
+++ b/fail2ban/tests/filtertestcase.py
@@ -24,6 +24,7 @@ __license__ = "GPL"
from __builtin__ import open as fopen
import unittest
+import getpass
import os
import sys
import time
@@ -349,10 +350,20 @@ class LogFileMonitor(LogCaptureTestCase):
# shorter wait time for not modified status
return not self.isModified(0.4)
- def testNoLogFile(self):
+ def testUnaccessibleLogFile(self):
os.chmod(self.name, 0)
self.filter.getFailures(self.name)
- self.assertTrue(self._is_logged('Unable to open %s' % self.name))
+ failure_was_logged = self._is_logged('Unable to open %s' % self.name)
+ is_root = getpass.getuser() == 'root'
+ # If ran as root, those restrictive permissions would not
+ # forbid log to be read.
+ self.assertTrue(failure_was_logged != is_root)
+
+ def testNoLogFile(self):
+ _killfile(self.file, self.name)
+ self.filter.getFailures(self.name)
+ failure_was_logged = self._is_logged('Unable to open %s' % self.name)
+ self.assertTrue(failure_was_logged)
def testRemovingFailRegex(self):
self.filter.delFailRegex(0)

@ -1,7 +1,7 @@
Summary: Daemon to ban hosts that cause multiple authentication errors
Name: fail2ban
Version: 0.9
Release: 8%{?dist}
Release: 9%{?dist}
License: GPLv2+
URL: http://fail2ban.sourceforge.net/
Source0: https://github.com/%{name}/%{name}/archive/%{version}.tar.gz#/%{name}-%{version}.tar.gz
@ -18,6 +18,9 @@ Patch2: fail2ban-tests-syslog.patch
# https://bugzilla.redhat.com/show_bug.cgi?id=1128152
# https://github.com/fail2ban/fail2ban/pull/780
Patch3: fail2ban-logpath.patch
# Fix test failure
# https://github.com/fail2ban/fail2ban/pull/784
Patch4: fail2ban-tests.patch
BuildRequires: python2-devel
# For testcases
@ -153,6 +156,7 @@ by default.
%patch1 -p1 -b .tests-nonet
%patch2 -p1 -b .tests-syslog
%patch3 -p1 -b .logpath
%patch4 -p1 -b .tests
# 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)
@ -279,6 +283,9 @@ fi
%changelog
* Fri Aug 15 2014 Orion Poplawski <orion@cora.nwra.com> - 0.9-8
- Add patch to fix tests
* Fri Aug 8 2014 Orion Poplawski <orion@cora.nwra.com> - 0.9-8
- Fix log paths for some jails (bug #1128152)

Loading…
Cancel
Save