mirror of
https://github.com/YunoHost/moulinette.git
synced 2024-09-03 20:06:31 +02:00
Fix IPV6 problem
This commit is contained in:
parent
c750706b37
commit
fb323134d0
1 changed files with 9 additions and 2 deletions
|
@ -185,7 +185,11 @@ def add_portmapping(protocol=None, upnp=False, ipv6=None):
|
|||
Return
|
||||
None
|
||||
"""
|
||||
os.system ("iptables -P INPUT ACCEPT")
|
||||
if ipv6:
|
||||
os.system ("ip6tables -P INPUT ACCEPT")
|
||||
else:
|
||||
os.system ("iptables -P INPUT ACCEPT")
|
||||
|
||||
if upnp:
|
||||
upnp = miniupnpc.UPnP()
|
||||
upnp.discoverdelay = 200
|
||||
|
@ -213,7 +217,10 @@ def add_portmapping(protocol=None, upnp=False, ipv6=None):
|
|||
firewall = yaml.load(f)
|
||||
|
||||
for i,port in enumerate (firewall[ip][protocol]):
|
||||
os.system ("iptables -A INPUT -p "+ protocol +" -i eth0 --dport "+ str(port) +" -j ACCEPT")
|
||||
if ipv6:
|
||||
os.system ("ip6tables -A INPUT -p "+ protocol +" -i eth0 --dport "+ str(port) +" -j ACCEPT")
|
||||
else:
|
||||
os.system ("iptables -A INPUT -p "+ protocol +" -i eth0 --dport "+ str(port) +" -j ACCEPT")
|
||||
if upnp:
|
||||
upnp.addportmapping(port, protocol, upnp.lanaddr, port, 'yunohost firewall : port %u' % port, '')
|
||||
|
||||
|
|
Loading…
Reference in a new issue