clean f2b-ipt

pull/88/head
Th4nat0s 2012-06-17 10:55:15 +02:00
parent 33c2059d1d
commit 963e4623dd
2 changed files with 15 additions and 7 deletions

View File

@ -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

View File

@ -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:]))