From 3929195fe477457faeae94c80fd2ec45f708d10c Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Fri, 10 Feb 2017 09:33:14 +0000 Subject: [PATCH 1/4] - Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild --- fail2ban.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/fail2ban.spec b/fail2ban.spec index 217157e..d972f0f 100644 --- a/fail2ban.spec +++ b/fail2ban.spec @@ -1,7 +1,7 @@ Summary: Daemon to ban hosts that cause multiple authentication errors Name: fail2ban Version: 0.9.6 -Release: 2%{?dist} +Release: 3%{?dist} License: GPLv2+ URL: http://fail2ban.sourceforge.net/ Source0: https://github.com/%{name}/%{name}/archive/%{version}.tar.gz#/%{name}-%{version}.tar.gz @@ -301,6 +301,9 @@ fi %changelog +* Fri Feb 10 2017 Fedora Release Engineering - 0.9.6-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild + * Tue Jan 10 2017 Orion Poplawski - 0.9.6-2 - Add upstream patch to fix fail2ban-regex with journal From 0335adcbb9337e0224b800ef47c76938c9ce8ad2 Mon Sep 17 00:00:00 2001 From: Orion Poplawski Date: Wed, 15 Feb 2017 11:18:40 -0700 Subject: [PATCH 2/4] Properly handle /run/fail2ban (bug #1422500) --- fail2ban.spec | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/fail2ban.spec b/fail2ban.spec index d972f0f..89944c2 100644 --- a/fail2ban.spec +++ b/fail2ban.spec @@ -1,7 +1,7 @@ Summary: Daemon to ban hosts that cause multiple authentication errors Name: fail2ban Version: 0.9.6 -Release: 3%{?dist} +Release: 4%{?dist} License: GPLv2+ URL: http://fail2ban.sourceforge.net/ Source0: https://github.com/%{name}/%{name}/archive/%{version}.tar.gz#/%{name}-%{version}.tar.gz @@ -187,6 +187,7 @@ install -p -m 644 man/*.5 %{buildroot}%{_mandir}/man5 mkdir -p %{buildroot}%{_sysconfdir}/logrotate.d install -p -m 644 files/fail2ban-logrotate %{buildroot}%{_sysconfdir}/logrotate.d/fail2ban install -d -m 0755 %{buildroot}/run/fail2ban/ +install -m 0600 /dev/null %{buildroot}/run/fail2ban/fail2ban.pid install -d -m 0755 %{buildroot}%{_localstatedir}/lib/fail2ban/ mkdir -p %{buildroot}%{_tmpfilesdir} install -p -m 0644 files/fail2ban-tmpfiles.conf %{buildroot}%{_tmpfilesdir}/fail2ban.conf @@ -271,7 +272,8 @@ fi %config(noreplace) %{_sysconfdir}/logrotate.d/fail2ban %{_tmpfilesdir}/fail2ban.conf %dir %{_localstatedir}/lib/fail2ban/ -%ghost %dir /run/fail2ban/ +%dir /run/%{name}/ +%verify(not size mtime md5) /run/%{name}.pid %files all @@ -301,6 +303,9 @@ fi %changelog +* Wed Feb 15 2017 Orion Poplawski - 0.9.6-4 +- Properly handle /run/fail2ban (bug #1422500) + * Fri Feb 10 2017 Fedora Release Engineering - 0.9.6-3 - Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild From 3613474772763769d19667db49c466d737be0eb3 Mon Sep 17 00:00:00 2001 From: Orion Poplawski Date: Wed, 15 Feb 2017 11:34:46 -0700 Subject: [PATCH 3/4] %ghost pid file and fix path --- fail2ban.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fail2ban.spec b/fail2ban.spec index 89944c2..5122774 100644 --- a/fail2ban.spec +++ b/fail2ban.spec @@ -273,7 +273,7 @@ fi %{_tmpfilesdir}/fail2ban.conf %dir %{_localstatedir}/lib/fail2ban/ %dir /run/%{name}/ -%verify(not size mtime md5) /run/%{name}.pid +%ghost %verify(not size mtime md5) /run/%{name}/%{name}.pid %files all From af59184fdac73f7051ed38490d46101ec73f6b63 Mon Sep 17 00:00:00 2001 From: Orion Poplawski Date: Wed, 12 Jul 2017 22:50:49 -0600 Subject: [PATCH 4/4] Update to 0.9.7 --- .gitignore | 1 + ...f1c4346597dcc4fd27151d220ea4a7806fdd.patch | 102 ------------------ fail2ban.spec | 11 +- sources | 2 +- 4 files changed, 7 insertions(+), 109 deletions(-) delete mode 100644 2009f1c4346597dcc4fd27151d220ea4a7806fdd.patch diff --git a/.gitignore b/.gitignore index 8e54753..f255fa8 100644 --- a/.gitignore +++ b/.gitignore @@ -12,3 +12,4 @@ fail2ban-0.8.4.tar.bz2 /fail2ban-0.9.4.tar.gz /fail2ban-0.9.5.tar.gz /fail2ban-0.9.6.tar.gz +/fail2ban-0.9.7.tar.gz diff --git a/2009f1c4346597dcc4fd27151d220ea4a7806fdd.patch b/2009f1c4346597dcc4fd27151d220ea4a7806fdd.patch deleted file mode 100644 index 73023fe..0000000 --- a/2009f1c4346597dcc4fd27151d220ea4a7806fdd.patch +++ /dev/null @@ -1,102 +0,0 @@ -From 2009f1c4346597dcc4fd27151d220ea4a7806fdd Mon Sep 17 00:00:00 2001 -From: sebres -Date: Tue, 10 Jan 2017 10:59:53 +0100 -Subject: [PATCH] fail2ban-regex: fix for systemd-journal (see gh-1657) - ---- - fail2ban/client/fail2banregex.py | 31 ++++++++++++++----------------- - fail2ban/server/filtersystemd.py | 8 ++++++++ - 2 files changed, 22 insertions(+), 17 deletions(-) - -diff --git a/fail2ban/client/fail2banregex.py b/fail2ban/client/fail2banregex.py -index 71f5095..13fa35d 100755 ---- a/fail2ban/client/fail2banregex.py -+++ b/fail2ban/client/fail2banregex.py -@@ -43,12 +43,12 @@ - from ConfigParser import NoOptionError, NoSectionError, MissingSectionHeaderError - - try: -- from systemd import journal - from ..server.filtersystemd import FilterSystemd - except ImportError: -- journal = None -+ FilterSystemd = None - - from ..version import version -+from .jailreader import JailReader - from .filterreader import FilterReader - from ..server.filter import Filter, FileContainer - from ..server.failregex import RegexException -@@ -82,7 +82,7 @@ def pprint_list(l, header=None): - s = '' - output( s + "| " + "\n| ".join(l) + '\n`-' ) - --def journal_lines_gen(myjournal): -+def journal_lines_gen(flt, myjournal): # pragma: no cover - while True: - try: - entry = myjournal.get_next() -@@ -90,7 +90,7 @@ def journal_lines_gen(myjournal): - continue - if not entry: - break -- yield FilterSystemd.formatJournalEntry(entry) -+ yield flt.formatJournalEntry(entry) - - def get_opt_parser(): - # use module docstring for help output -@@ -513,25 +513,22 @@ def start(self, opts, args): - except IOError as e: - output( e ) - return False -- elif cmd_log == "systemd-journal": # pragma: no cover -- if not journal: -+ elif cmd_log.startswith("systemd-journal"): # pragma: no cover -+ if not FilterSystemd: - output( "Error: systemd library not found. Exiting..." ) - return False -- myjournal = journal.Reader(converters={'__CURSOR': lambda x: x}) -+ output( "Use systemd journal" ) -+ output( "Use encoding : %s" % self.encoding ) -+ backend, beArgs = JailReader.extractOptions(cmd_log) -+ flt = FilterSystemd(None, **beArgs) -+ flt.setLogEncoding(self.encoding) -+ myjournal = flt.getJournalReader() - journalmatch = self._journalmatch - self.setDatePattern(None) - if journalmatch: -- try: -- for element in journalmatch: -- if element == "+": -- myjournal.add_disjunction() -- else: -- myjournal.add_match(element) -- except ValueError: -- output( "Error: Invalid journalmatch: %s" % shortstr(" ".join(journalmatch)) ) -- return False -+ flt.addJournalMatch(journalmatch) - output( "Use journal match : %s" % " ".join(journalmatch) ) -- test_lines = journal_lines_gen(myjournal) -+ test_lines = journal_lines_gen(flt, myjournal) - else: - output( "Use single line : %s" % shortstr(cmd_log) ) - test_lines = [ cmd_log ] -diff --git a/fail2ban/server/filtersystemd.py b/fail2ban/server/filtersystemd.py -index 3023155..908112a 100644 ---- a/fail2ban/server/filtersystemd.py -+++ b/fail2ban/server/filtersystemd.py -@@ -175,6 +175,14 @@ def uni_decode(self, x): - return v - - ## -+ # Get journal reader -+ # -+ # @return journal reader -+ -+ def getJournalReader(self): -+ return self.__journal -+ -+ ## - # Format journal log entry into syslog style - # - # @param entry systemd journal entry dict diff --git a/fail2ban.spec b/fail2ban.spec index 5122774..7fab29b 100644 --- a/fail2ban.spec +++ b/fail2ban.spec @@ -1,14 +1,11 @@ Summary: Daemon to ban hosts that cause multiple authentication errors Name: fail2ban -Version: 0.9.6 -Release: 4%{?dist} +Version: 0.9.7 +Release: 1%{?dist} License: GPLv2+ URL: http://fail2ban.sourceforge.net/ Source0: https://github.com/%{name}/%{name}/archive/%{version}.tar.gz#/%{name}-%{version}.tar.gz #Source0: https://github.com/sebres/%{name}/archive/f2b-perfom-prepare-716-cs.tar.gz#/%{name}-test.tar.gz -# fail2ban-regex: fix for systemd-journal -# https://github.com/fail2ban/fail2ban/issues/1657 -Patch0: https://github.com/fail2ban/fail2ban/commit/2009f1c4346597dcc4fd27151d220ea4a7806fdd.patch # Give up being PartOf iptables for now # https://bugzilla.redhat.com/show_bug.cgi?id=1379141 Patch2: fail2ban-partof.patch @@ -160,7 +157,6 @@ by default. %prep %setup -q -%patch0 -p1 -b .journal %patch2 -p1 -b .partof %patch3 -p1 -b .sendmail # Use Fedora paths @@ -303,6 +299,9 @@ fi %changelog +* Wed Jul 12 2017 Orion Poplawski - 0.9.7-1 +- Update to 0.9.7 + * Wed Feb 15 2017 Orion Poplawski - 0.9.6-4 - Properly handle /run/fail2ban (bug #1422500) diff --git a/sources b/sources index b9708c4..4c7af9a 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (fail2ban-0.9.6.tar.gz) = 4a0c09451409f81882664c2316867aa1c45572018b7f4647f8dc356f9115c9c2ff4a17098ef249bcc6712acfed6b5c99518b1c069ef1bf253d96c900d29be1d2 +SHA512 (fail2ban-0.9.7.tar.gz) = 2c28f892e882f1c7d9bc33d16e1f469f65aa198a1dd9fe409367cd857006d7b7e6e4c88f1075f726f8b3e268da5a422d9fae0ebe12457016d814e2b8eea2465a