mirror of https://github.com/fail2ban/fail2ban
- Code comments
git-svn-id: https://fail2ban.svn.sourceforge.net/svnroot/fail2ban/trunk@29 a942ae1a-1317-0410-a47c-b1dcaea8d6050.6
parent
3331c9dccb
commit
1070273151
|
@ -27,11 +27,22 @@ __license__ = "GPL"
|
||||||
from firewall import Firewall
|
from firewall import Firewall
|
||||||
|
|
||||||
class Iptables(Firewall):
|
class Iptables(Firewall):
|
||||||
|
""" This class contains specific methods and variables for the
|
||||||
|
iptables firewall. Must implements the 'abstracts' methods
|
||||||
|
banIP(ip) and unBanIP(ip).
|
||||||
|
|
||||||
|
Must adds abstract methods definition:
|
||||||
|
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/266468
|
||||||
|
"""
|
||||||
|
|
||||||
def banIP(self, ip):
|
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 eth0 -s "+ip+" -j DROP"
|
||||||
return query
|
return query
|
||||||
|
|
||||||
def unBanIP(self, ip):
|
def unBanIP(self, ip):
|
||||||
|
""" Returns query to unban IP.
|
||||||
|
"""
|
||||||
query = "iptables -D INPUT -i eth0 -s "+ip+" -j DROP"
|
query = "iptables -D INPUT -i eth0 -s "+ip+" -j DROP"
|
||||||
return query
|
return query
|
||||||
|
|
Loading…
Reference in New Issue