You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
fail2ban/fail2ban-mailx.patch

61 lines
3.9 KiB

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