[fail2ban/f19] Add upstream patch to fix mailx argument ordering (bug #998020)

Orion Poplawski orion at fedoraproject.org
Wed Aug 28 18:01:44 UTC 2013


commit 1a340b280d50208ac5913c47783eb9fe3eb9af80
Author: Orion Poplawski <orion at nwra.com>
Date:   Wed Aug 28 12:01:35 2013 -0600

    Add upstream patch to fix mailx argument ordering (bug #998020)

 fail2ban-mailx.patch |   60 ++++++++++++++++++++++++++++++++++++++++++++++++++
 fail2ban.spec        |   10 +++++++-
 2 files changed, 69 insertions(+), 1 deletions(-)
---
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 <ip> | perl -e 'while (<STDIN>) { 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=<ip>
+             if [ ! -z "$ADDRESSES" ]; then
+-                (printf %%b "<message>\n"; date '+Note: Local timezone is %%z (%%Z)'; grep '<ip>' <logpath>) | <mailcmd> "Abuse from <ip>" $ADDRESSES <mailargs>
++                (printf %%b "<message>\n"; date '+Note: Local timezone is %%z (%%Z)'; grep '<ip>' <logpath>) | <mailcmd> "Abuse from <ip>" <mailargs> $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 <tmpfile>.buffer ]; then
+-                 cat <tmpfile>.buffer | <mailcmd> "FORMAT DSHIELD USERID <userid> TZ `date +%%z | sed 's/\([+-]..\)\(..\)/\1:\2/'` Fail2Ban" <dest> <mailargs>
++                 cat <tmpfile>.buffer | <mailcmd> "FORMAT DSHIELD USERID <userid> TZ `date +%%z | sed 's/\([+-]..\)\(..\)/\1:\2/'` Fail2Ban" <mailargs> <dest>
+                  date +%%s > <tmpfile>.lastsent
+              fi
+              rm -f <tmpfile>.buffer <tmpfile>.first
+@@ -80,7 +80,7 @@ actionban = TZONE=`date +%%z | sed 's/\(
+             LASTREPORT=$(($NOW - `cat <tmpfile>.lastsent`))
+             LINES=$( wc -l <tmpfile>.buffer | awk '{ print $1 }' )
+             if [ $LINES -ge <lines> && $LASTREPORT -gt <minreportinterval> ] || [ $LOGAGE -gt <maxbufferage> ]; then
+-                cat <tmpfile>.buffer | <mailcmd> "FORMAT DSHIELD USERID <userid> TZ $TZONE Fail2Ban" <dest> <mailargs>
++                cat <tmpfile>.buffer | <mailcmd> "FORMAT DSHIELD USERID <userid> TZ $TZONE Fail2Ban" <mailargs> <dest>
+                 rm -f <tmpfile>.buffer <tmpfile>.first
+                 echo $NOW > <tmpfile>.lastsent
+             fi
+@@ -95,7 +95,7 @@ actionunban = if [ -f <tmpfile>.first ];
+                   NOW=`date +%%s`
+                   LOGAGE=$(($NOW - `cat <tmpfile>.first`))
+                   if [ $LOGAGE -gt <maxbufferage> ]; then
+-                      cat <tmpfile>.buffer | <mailcmd> "FORMAT DSHIELD USERID <userid> TZ `date +%%z | sed 's/\([+-]..\)\(..\)/\1:\2/'` Fail2Ban" <dest> <mailargs>
++                      cat <tmpfile>.buffer | <mailcmd> "FORMAT DSHIELD USERID <userid> TZ `date +%%z | sed 's/\([+-]..\)\(..\)/\1:\2/'` Fail2Ban" <mailargs> <dest>
+                       rm -f <tmpfile>.buffer <tmpfile>.first
+                       echo $NOW > <tmpfile>.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 <orion at cora.nwra.com> - 0.8.10-3
+- Add upstream patch to fix mailx argument ordering (bug #998020)
+
 * Fri Aug 16 2013 Orion Poplawski <orion at cora.nwra.com> - 0.8.10-2
 - Add upstream patch to fix hostsdeny permission issue
 


More information about the scm-commits mailing list