mirror of
https://github.com/YunoHost/moulinette.git
synced 2024-09-03 20:06:31 +02:00
Check upnp before add rule in firewall.yml
This commit is contained in:
parent
5a66184f01
commit
1c1722e19f
1 changed files with 3 additions and 5 deletions
|
@ -32,6 +32,9 @@ def firewall_allow(protocol=None,port=None,ipv6=None,upnp=False):
|
||||||
|
|
||||||
"""
|
"""
|
||||||
port=int(port)
|
port=int(port)
|
||||||
|
if (upnp):
|
||||||
|
add_portmapping(protocol, upnp, ipv6)
|
||||||
|
|
||||||
if port<65536 and port>0:
|
if port<65536 and port>0:
|
||||||
if protocol == "Both":
|
if protocol == "Both":
|
||||||
update_yml(port,'TCP','a',ipv6)
|
update_yml(port,'TCP','a',ipv6)
|
||||||
|
@ -73,8 +76,6 @@ def firewall_disallow(protocol=None,port=None,ipv6=None,upnp=False):
|
||||||
|
|
||||||
return firewall_reload(upnp)
|
return firewall_reload(upnp)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def firewall_list():
|
def firewall_list():
|
||||||
"""
|
"""
|
||||||
Allow port in iptables
|
Allow port in iptables
|
||||||
|
@ -89,9 +90,6 @@ def firewall_list():
|
||||||
with open ('firewall.yml') as f:
|
with open ('firewall.yml') as f:
|
||||||
firewall = yaml.load(f)
|
firewall = yaml.load(f)
|
||||||
return firewall
|
return firewall
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def firewall_reload(upnp=False):
|
def firewall_reload(upnp=False):
|
||||||
'''
|
'''
|
||||||
Reload iptables configuration
|
Reload iptables configuration
|
||||||
|
|
Loading…
Add table
Reference in a new issue