From 30bc782b186f941f85735cf0b8999e06ecd11873 Mon Sep 17 00:00:00 2001 From: Yaroslav Halchenko Date: Mon, 14 Apr 2014 15:40:21 -0400 Subject: [PATCH] BF: grep in mail*-whois-lines.conf also matches beginning/end of line to work with the recidive filter (Debian #744774) Thanks James Bottomley for the report and tentative solutions --- ChangeLog | 2 ++ config/action.d/mail-whois-lines.conf | 2 +- config/action.d/sendmail-whois-lines.conf | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index a1564828..ae3c23ba 100644 --- a/ChangeLog +++ b/ChangeLog @@ -12,6 +12,8 @@ ver. 0.8.14 (2014/??/??) - take-care-of-the-elderly - Fixes: - minor fixes for claimed Python 2.4 and 2.5 compatibility + - grep in mail*-whois-lines.conf now also matches end of line to work + with the recidive filter ver. 0.8.13 (2014/03/15) - maintenance-only-from-now-on diff --git a/config/action.d/mail-whois-lines.conf b/config/action.d/mail-whois-lines.conf index aa7d0950..5f760ac8 100644 --- a/config/action.d/mail-whois-lines.conf +++ b/config/action.d/mail-whois-lines.conf @@ -42,7 +42,7 @@ actionban = printf %%b "Hi,\n Here is more information about :\n `whois || echo missing whois program`\n\n Lines containing IP: in \n - `grep '[^0-9][^0-9]' `\n\n + `grep -E '(^|[^0-9])([^0-9]|$)' `\n\n Regards,\n Fail2Ban"|mail -s "[Fail2Ban] : banned from `uname -n`" diff --git a/config/action.d/sendmail-whois-lines.conf b/config/action.d/sendmail-whois-lines.conf index e97868bd..9d8b921c 100644 --- a/config/action.d/sendmail-whois-lines.conf +++ b/config/action.d/sendmail-whois-lines.conf @@ -58,7 +58,7 @@ actionban = printf %%b "Subject: [Fail2Ban] : banned from `uname -n` Here is more information about :\n `/usr/bin/whois || echo missing whois program`\n\n Lines containing IP: in \n - `grep '[^0-9][^0-9]' `\n\n + `grep -E '(^|[^0-9])([^0-9]|$)' `\n\n Regards,\n Fail2Ban" | /usr/sbin/sendmail -f