From 1896da93864db1828151bb8a891b7f6b45f54181 Mon Sep 17 00:00:00 2001 From: Orion Poplawski Date: Sep 12 2015 21:05:16 +0000 Subject: Update to 0.9.3 - Cleanup spec, use new python macros --- diff --git a/.gitignore b/.gitignore index f5dfe4d..d3132d5 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,4 @@ fail2ban-0.8.4.tar.bz2 /fail2ban-0.9.tar.gz /fail2ban-0.9.1.tar.gz /fail2ban-0.9.2.tar.gz +/fail2ban-0.9.3.tar.gz diff --git a/3187de29336b4a01e4dcd20f98253e1db913ee7a.patch b/3187de29336b4a01e4dcd20f98253e1db913ee7a.patch new file mode 100644 index 0000000..e516462 --- /dev/null +++ b/3187de29336b4a01e4dcd20f98253e1db913ee7a.patch @@ -0,0 +1,50 @@ +From 3187de29336b4a01e4dcd20f98253e1db913ee7a Mon Sep 17 00:00:00 2001 +From: Yaroslav Halchenko +Date: Sat, 12 Sep 2015 14:15:10 -0400 +Subject: [PATCH] BF(TST): allow exception and False for executeCmd due to + inconsistent behavior across bash/dash + +Temporary minimalistic fix to the test +--- + fail2ban/tests/actiontestcase.py | 23 +++++++++++++++++------ + 1 file changed, 17 insertions(+), 6 deletions(-) + +diff --git a/fail2ban/tests/actiontestcase.py b/fail2ban/tests/actiontestcase.py +index febbc61..73dee12 100644 +--- a/fail2ban/tests/actiontestcase.py ++++ b/fail2ban/tests/actiontestcase.py +@@ -222,17 +222,28 @@ def getnastypid(): + return int(f.read()) + + # First test if can kill the bastard +- self.assertRaises( +- RuntimeError, CommandAction.executeCmd, 'bash %s' % tmpFilename, timeout=.1) ++ try: ++ self.assertFalse( ++ CommandAction.executeCmd('bash %s' % tmpFilename, timeout=.1)) ++ except RuntimeError: ++ # this one is expected behavior, see ++ # https://github.com/fail2ban/fail2ban/issues/1155#issuecomment-139799958 ++ pass + # Verify that the proccess itself got killed + self.assertFalse(pid_exists(getnastypid())) # process should have been killed + self.assertTrue(self._is_logged('timed out')) +- self.assertTrue(self._is_logged('killed with SIGTERM')) ++ self.assertTrue(self._is_logged('Terminated')) + + # A bit evolved case even though, previous test already tests killing children processes +- self.assertRaises( +- RuntimeError, CommandAction.executeCmd, 'out=`bash %s`; echo ALRIGHT' % tmpFilename, +- timeout=.2) ++ try: ++ self.assertFalse( ++ CommandAction.executeCmd('out=`bash %s`; echo ALRIGHT' % tmpFilename, ++ timeout=.2)) ++ except RuntimeError: ++ # this one is expected behavior, see ++ # https://github.com/fail2ban/fail2ban/issues/1155#issuecomment-139799958 ++ pass ++ + # Verify that the proccess itself got killed + self.assertFalse(pid_exists(getnastypid())) + self.assertTrue(self._is_logged('timed out')) diff --git a/fail2ban.spec b/fail2ban.spec index ef87085..2b069d6 100644 --- a/fail2ban.spec +++ b/fail2ban.spec @@ -1,23 +1,26 @@ Summary: Daemon to ban hosts that cause multiple authentication errors Name: fail2ban -Version: 0.9.2 -Release: 2%{?dist} +Version: 0.9.3 +Release: 1%{?dist} License: GPLv2+ URL: http://fail2ban.sourceforge.net/ Source0: https://github.com/%{name}/%{name}/archive/%{version}.tar.gz#/%{name}-%{version}.tar.gz +# Fix failing test +# https://github.com/fail2ban/fail2ban/issues/1155 +Patch0: https://github.com/yarikoptic/fail2ban/commit/3187de29336b4a01e4dcd20f98253e1db913ee7a.patch -BuildRequires: python2-devel +BuildRequires: python-devel # For testcases BuildRequires: python-inotify BuildArch: noarch -%if 0%{?fedora} >= 19 || 0%{?rhel} >= 7 +%if 0%{?fedora} || 0%{?rhel} >= 7 BuildRequires: systemd %endif # Default components Requires: %{name}-firewalld = %{version}-%{release} Requires: %{name}-sendmail = %{version}-%{release} Requires: %{name}-server = %{version}-%{release} -# Currently this breaks jaila that don't log to the journal +# Currently this breaks jails that don't log to the journal #Requires: %{name}-systemd = %{version}-%{release} %description @@ -38,7 +41,7 @@ configurations. %package server Summary: Core server component for Fail2Ban -%if 0%{?fedora} >= 19 || 0%{?rhel} >= 7 +%if 0%{?fedora} || 0%{?rhel} >= 7 Requires: systemd-python Requires(post): systemd Requires(preun): systemd @@ -137,22 +140,19 @@ by default. %prep %setup -q +%patch0 -p1 -b .test # 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) sed -i -e '/^After=/s/$/ firewalld.service/' files/fail2ban.service %build -python setup.py build +%py_build %install -python setup.py install -O1 --root %{buildroot} +%py_install -# Do not load user paths -# https://bugzilla.redhat.com/show_bug.cgi?id=1202151 -sed -i -e '1s/python$/python -Es/' %{buildroot}%{_bindir}/fail2ban-{client,server} - -%if 0%{?fedora} >= 19 || 0%{?rhel} >= 7 +%if 0%{?fedora} || 0%{?rhel} >= 7 mkdir -p %{buildroot}%{_unitdir} cp -p files/fail2ban.service %{buildroot}%{_unitdir}/ %else @@ -198,14 +198,14 @@ export LANG=en_US.UTF-8 ./fail2ban-testcases-all --no-network %post server -%if 0%{?fedora} >= 19 || 0%{?rhel} >= 7 +%if 0%{?fedora} || 0%{?rhel} >= 7 %systemd_post fail2ban.service %else /sbin/chkconfig --add %{name} %endif %preun server -%if 0%{?fedora} >= 19 || 0%{?rhel} >= 7 +%if 0%{?fedora} || 0%{?rhel} >= 7 %systemd_preun fail2ban.service %else if [ $1 = 0 ]; then @@ -214,7 +214,7 @@ if [ $1 = 0 ]; then fi %endif -%if 0%{?fedora} >= 19 || 0%{?rhel} >= 7 +%if 0%{?fedora} || 0%{?rhel} >= 7 %postun server %systemd_postun_with_restart fail2ban.service %endif @@ -228,7 +228,7 @@ fi %{_bindir}/fail2ban-regex %{_bindir}/fail2ban-testcases %{python_sitelib}/* -%if 0%{?fedora} >= 19 || 0%{?rhel} >= 7 +%if 0%{?fedora} || 0%{?rhel} >= 7 %{_unitdir}/fail2ban.service %else %{_initddir}/fail2ban @@ -270,6 +270,10 @@ fi %changelog +* Sat Sep 12 2015 Orion Poplawski - 0.9.3-1 +- Update to 0.9.3 +- Cleanup spec, use new python macros + * Wed Jun 17 2015 Fedora Release Engineering - 0.9.2-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild diff --git a/sources b/sources index 1b1b49e..29e969c 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -bcdc9ef9f02c6fe8e43bb391835c65d6 fail2ban-0.9.2.tar.gz +73c87c545cc6474de984b5a05e64ecab fail2ban-0.9.3.tar.gz