From 963e4623dd57ebeb5ebaa0bb11af8f8e43bb296a Mon Sep 17 00:00:00 2001 From: Th4nat0s Date: Sun, 17 Jun 2012 10:55:15 +0200 Subject: [PATCH] clean f2b-ipt --- config/fail2ban.conf | 7 +++++++ fail2ban-iptables | 15 ++++++++------- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/config/fail2ban.conf b/config/fail2ban.conf index a8e2eb9a..fb544397 100644 --- a/config/fail2ban.conf +++ b/config/fail2ban.conf @@ -36,3 +36,10 @@ logtarget = /var/log/fail2ban.log # socket = /var/run/fail2ban/fail2ban.sock +# Option: ipv6 +# Notes.: Activate IPv6 support +# Warning : only with iptables action supported +# Values: BOOLEAN Default: disabled +# +ipv6 = enabled + diff --git a/fail2ban-iptables b/fail2ban-iptables index 74672f97..7326ec74 100755 --- a/fail2ban-iptables +++ b/fail2ban-iptables @@ -23,21 +23,22 @@ import sys, re, subprocess def main(argv): regv4 = re.compile('([0-9]{1,3}\.){3}[0-9]{1,3}') - if regv4.search(str(argv)): + print "-" + argv + "-" + if regv4.search(argv): # we are facing to a ipv4 - subprocess.call(["iptables", " ".join(argv)]) + subprocess.call(["iptables", argv]) sys.exit else: # if not, maybe it's a ipv6 regv6 = re.compile('::[A-Fa-f0-9]{1,4}|(:[A-Fa-f0-9]{1,4}){2,}') - if regv6.search(str(argv)): - subprocess.call(["ip6tables", " ".join(argv)]) + if regv6.search(argv): + subprocess.call(["ip6tables", argv]) sys.exit else: # if it's not a ipv6 either, we call both iptables - subprocess.call(["iptables", " ".join(argv)]) - subprocess.call(["ip6tables", " ".join(argv)]) + subprocess.call(["iptables", argv]) + subprocess.call(["ip6tables", argv]) # Main call, pass all variables if __name__ == "__main__": - main(sys.argv[1:]) + main(" ".join(sys.argv[1:]))