From 1a340b280d50208ac5913c47783eb9fe3eb9af80 Mon Sep 17 00:00:00 2001 From: Orion Poplawski Date: Wed, 28 Aug 2013 12:01:35 -0600 Subject: [PATCH] Add upstream patch to fix mailx argument ordering (bug #998020) --- fail2ban-mailx.patch | 60 ++++++++++++++++++++++++++++++++++++++++++++ fail2ban.spec | 10 +++++++- 2 files changed, 69 insertions(+), 1 deletion(-) create mode 100644 fail2ban-mailx.patch diff --git a/fail2ban-mailx.patch b/fail2ban-mailx.patch new file mode 100644 index 0000000..9801c58 --- /dev/null +++ b/fail2ban-mailx.patch @@ -0,0 +1,60 @@ +diff -U0 fail2ban-0.8.10/ChangeLog.mailx fail2ban-0.8.10/ChangeLog +--- fail2ban-0.8.10/ChangeLog.mailx 2013-08-28 11:57:02.631137995 -0600 ++++ fail2ban-0.8.10/ChangeLog 2013-08-28 11:58:10.150945945 -0600 +@@ -23,0 +24,3 @@ ++ Rolf Fokkens ++ * action.d/dshield.conf and complain.conf -- reorder mailx arguements. ++ https://bugzilla.redhat.com/show_bug.cgi?id=998020 +diff -up fail2ban-0.8.10/config/action.d/complain.conf.mailx fail2ban-0.8.10/config/action.d/complain.conf +--- fail2ban-0.8.10/config/action.d/complain.conf.mailx 2013-06-12 11:21:12.000000000 -0600 ++++ fail2ban-0.8.10/config/action.d/complain.conf 2013-08-28 11:57:02.631137995 -0600 +@@ -58,7 +58,7 @@ actioncheck = + actionban = ADDRESSES=`whois | perl -e 'while () { next if /^changed|@(ripe|apnic)\.net/io; $m += (/abuse|trouble:|report|spam|security/io?3:0); if (/([a-z0-9_\-\.+]+@[a-z0-9\-]+(\.[[a-z0-9\-]+)+)/io) { while (s/([a-z0-9_\-\.+]+@[a-z0-9\-]+(\.[[a-z0-9\-]+)+)//io) { if ($m) { $a{lc($1)}=$m } else { $b{lc($1)}=$m } } $m=0 } else { $m && --$m } } if (%%a) {print join(",",keys(%%a))} else {print join(",",keys(%%b))}'` + IP= + if [ ! -z "$ADDRESSES" ]; then +- (printf %%b "\n"; date '+Note: Local timezone is %%z (%%Z)'; grep '' ) | "Abuse from " $ADDRESSES ++ (printf %%b "\n"; date '+Note: Local timezone is %%z (%%Z)'; grep '' ) | "Abuse from " $ADDRESSES + fi + + # Option: actionunban +diff -up fail2ban-0.8.10/config/action.d/dshield.conf.mailx fail2ban-0.8.10/config/action.d/dshield.conf +--- fail2ban-0.8.10/config/action.d/dshield.conf.mailx 2013-06-12 11:21:12.000000000 -0600 ++++ fail2ban-0.8.10/config/action.d/dshield.conf 2013-08-28 11:57:02.632137993 -0600 +@@ -39,7 +39,7 @@ actionstart = + # Values: CMD + # + actionstop = if [ -f .buffer ]; then +- cat .buffer | "FORMAT DSHIELD USERID TZ `date +%%z | sed 's/\([+-]..\)\(..\)/\1:\2/'` Fail2Ban" ++ cat .buffer | "FORMAT DSHIELD USERID TZ `date +%%z | sed 's/\([+-]..\)\(..\)/\1:\2/'` Fail2Ban" + date +%%s > .lastsent + fi + rm -f .buffer .first +@@ -80,7 +80,7 @@ actionban = TZONE=`date +%%z | sed 's/\( + LASTREPORT=$(($NOW - `cat .lastsent`)) + LINES=$( wc -l .buffer | awk '{ print $1 }' ) + if [ $LINES -ge && $LASTREPORT -gt ] || [ $LOGAGE -gt ]; then +- cat .buffer | "FORMAT DSHIELD USERID TZ $TZONE Fail2Ban" ++ cat .buffer | "FORMAT DSHIELD USERID TZ $TZONE Fail2Ban" + rm -f .buffer .first + echo $NOW > .lastsent + fi +@@ -95,7 +95,7 @@ actionunban = if [ -f .first ]; + NOW=`date +%%s` + LOGAGE=$(($NOW - `cat .first`)) + if [ $LOGAGE -gt ]; then +- cat .buffer | "FORMAT DSHIELD USERID TZ `date +%%z | sed 's/\([+-]..\)\(..\)/\1:\2/'` Fail2Ban" ++ cat .buffer | "FORMAT DSHIELD USERID TZ `date +%%z | sed 's/\([+-]..\)\(..\)/\1:\2/'` Fail2Ban" + rm -f .buffer .first + echo $NOW > .lastsent + fi +diff -up fail2ban-0.8.10/THANKS.mailx fail2ban-0.8.10/THANKS +--- fail2ban-0.8.10/THANKS.mailx 2013-08-28 11:57:02.631137995 -0600 ++++ fail2ban-0.8.10/THANKS 2013-08-28 11:58:34.542879375 -0600 +@@ -38,6 +38,7 @@ Patrick Börjesson + Raphaël Marichez + René Berber + Robert Edeker ++Rolf Fokkens + Russell Odom + Sireyessire + silviogarbes diff --git a/fail2ban.spec b/fail2ban.spec index da3978f..977830f 100644 --- a/fail2ban.spec +++ b/fail2ban.spec @@ -1,7 +1,7 @@ Summary: Ban IPs that make too many password failures Name: fail2ban Version: 0.8.10 -Release: 2%{?dist} +Release: 3%{?dist} License: GPLv2+ Group: System Environment/Daemons URL: http://fail2ban.sourceforge.net/ @@ -13,6 +13,10 @@ Patch1: fail2ban-0.8.7.1-sshd.patch # https://github.com/fail2ban/fail2ban/issues/266 # https://bugzilla.redhat.com/show_bug.cgi?id=997863 Patch2: fail2ban-hostsdeny.patch +# Upstream patch to fix mailx argument ordering +# https://github.com/fail2ban/fail2ban/issues/328 +# https://bugzilla.redhat.com/show_bug.cgi?id=998020 +Patch3: fail2ban-mailx.patch Patch6: fail2ban-log2syslog.patch Patch8: fail2ban-notmp.patch BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root @@ -50,6 +54,7 @@ and shorewall respectively. %patch0 -p1 -b .init %patch1 -p1 -b .sshd %patch2 -p1 -b .hostsdeny +%patch3 -p1 -b .mailx %patch6 -p1 -b .log2syslog %patch8 -p1 -b .notmp @@ -133,6 +138,9 @@ fi %dir %{_localstatedir}/lib/fail2ban/ %changelog +* Wed Aug 28 2013 Orion Poplawski - 0.8.10-3 +- Add upstream patch to fix mailx argument ordering (bug #998020) + * Fri Aug 16 2013 Orion Poplawski - 0.8.10-2 - Add upstream patch to fix hostsdeny permission issue