- 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 6930f5c0c3
commit 01a53b045b

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

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