upnp cron

This commit is contained in:
Titoko 2013-03-11 23:07:16 +01:00
parent 0b024bdbf4
commit 80ff31022f
3 changed files with 26 additions and 4 deletions

View file

@ -491,6 +491,14 @@ firewall:
action: store_true
### firewall_upnpinstall()
upnpinstall:
action_help: Add upnp cron
### firewall_upnpremove()
upnpremove:
action_help: Remove upnp cron
#############################
# Tools #
#############################

View file

@ -1,6 +1,6 @@
ipv4:
TCP: [22, 25, 53, 80, 443, 5222, 5269, 5280]
UDP: []
TCP: [22, 25, 53, 80, 443, 5222, 5269, 5280]
UDP: []
ipv6:
TCP: [22]
UDP: []
TCP: [22]
UDP: []

View file

@ -217,3 +217,17 @@ def add_portmapping(protocol=None, upnp=False, ipv6=None):
upnp.addportmapping(port, protocol, upnp.lanaddr, port, 'yunohost firewall : port %u' % port, '')
os.system ("iptables -P INPUT DROP")
def firewall_installupnp():
"""
Add upnp cron
Keyword arguments:
None
Return
None
"""
os.system("touch /etc/cron.d/yunohost-firewall")
os.system("echo '*/50 * * * * root yunohost firewall reload -u>>/dev/null'>/etc/cron.d/yunohost-firewall")
def firewall_removeupnp():
os.system("rm /etc/cron.d/yunohost-firewall")