From 61097d17bba3500b1155dd8047b7a9646aa52a2d Mon Sep 17 00:00:00 2001 From: Yaroslav Halchenko Date: Thu, 8 Nov 2012 21:55:54 -0500 Subject: [PATCH] RF: adjusted all iptables/shorewall rules to use fail2ban-46 dispatcher + fixed its name in setup.py also introduced action.d/common.conf to contain some common definitions to be used in other action files. Similar setup to filter.d/ --- config/action.d/common.conf | 12 +++++++ config/action.d/iptables-allports.conf | 25 ++++++++------- config/action.d/iptables-multiport-log.conf | 35 +++++++++++---------- config/action.d/iptables-multiport.conf | 24 ++++++++------ config/action.d/iptables-new.conf | 27 +++++++++------- config/action.d/iptables.conf | 26 ++++++++------- config/action.d/shorewall.conf | 13 +++++--- setup.py | 2 +- 8 files changed, 98 insertions(+), 66 deletions(-) create mode 100644 config/action.d/common.conf diff --git a/config/action.d/common.conf b/config/action.d/common.conf new file mode 100644 index 00000000..b98029f6 --- /dev/null +++ b/config/action.d/common.conf @@ -0,0 +1,12 @@ +[INCLUDES] + +# Load customizations if any available +after = common.local + +[DEFAULT] + +# Use ip v4/v6 dispatcher for iptables +iptables = fail2ban-46 iptables ip6tables + +# for shorewall +shorewall = fail2ban-46 shorewall shorewall6 diff --git a/config/action.d/iptables-allports.conf b/config/action.d/iptables-allports.conf index 3ca4797d..eb4d2329 100644 --- a/config/action.d/iptables-allports.conf +++ b/config/action.d/iptables-allports.conf @@ -5,8 +5,11 @@ # made active on all ports from original fail2ban-iptables.conf # Modified by Paul J aka Thanat0s for ipv6 support # -# $Revision$ -# + +[INCLUDES] + +# Read common definitions, e.g. for %(iptables)s. +before = common.conf [Definition] @@ -14,23 +17,23 @@ # Notes.: command executed once at the start of Fail2Ban. # Values: CMD # -actionstart = fail2ban-iptables -N fail2ban- - fail2ban-iptables -A fail2ban- -j RETURN - fail2ban-iptables -I -p -j fail2ban- +actionstart = %(iptables)s -N fail2ban- + %(iptables)s -A fail2ban- -j RETURN + %(iptables)s -I -p -j fail2ban- # Option: actionstop # Notes.: command executed once at the end of Fail2Ban # Values: CMD # -actionstop = fail2ban-iptables -D -p -j fail2ban- - fail2ban-iptables -F fail2ban- - fail2ban-iptables -X fail2ban- +actionstop = %(iptables)s -D -p -j fail2ban- + %(iptables)s -F fail2ban- + %(iptables)s -X fail2ban- # Option: actioncheck # Notes.: command executed once before each actionban command # Values: CMD # -actioncheck = fail2ban-iptables -n -L | grep -q 'fail2ban-[ \t]' +actioncheck = %(iptables)s -n -L | grep -q 'fail2ban-[ \t]' # Option: actionban # Notes.: command executed when banning an IP. Take care that the @@ -40,7 +43,7 @@ actioncheck = fail2ban-iptables -n -L | grep -q 'fail2ban-[ \t]' #