Browse Source

- Add interface parameter

git-svn-id: https://fail2ban.svn.sourceforge.net/svnroot/fail2ban/trunk@41 a942ae1a-1317-0410-a47c-b1dcaea8d605
0.6
Cyril Jaquier 20 years ago
parent
commit
01a53b045b
  1. 3
      firewall/firewall.py
  2. 4
      firewall/iptables.py

3
firewall/firewall.py

@ -33,9 +33,10 @@ class Firewall:
banList = dict()
def __init__(self, banTime, logSys):
def __init__(self, banTime, logSys, interface):
self.banTime = banTime
self.logSys = logSys
self.interface = interface
def addBanIP(self, ip, debug):
""" Bans an IP.

4
firewall/iptables.py

@ -38,11 +38,11 @@ class Iptables(Firewall):
def banIP(self, ip):
""" Returns query to ban IP.
"""
query = "iptables -I INPUT 1 -i eth0 -s "+ip+" -j DROP"
query = "iptables -I INPUT 1 -i "+self.interface+" -s "+ip+" -j DROP"
return query
def unBanIP(self, ip):
""" Returns query to unban IP.
"""
query = "iptables -D INPUT -i eth0 -s "+ip+" -j DROP"
query = "iptables -D INPUT -i "+self.interface+" -s "+ip+" -j DROP"
return query

Loading…
Cancel
Save