From 80ff31022f22a9d823cc480c40945cc1e932a0ad Mon Sep 17 00:00:00 2001 From: Titoko Date: Mon, 11 Mar 2013 23:07:16 +0100 Subject: [PATCH] upnp cron --- action_map.yml | 8 ++++++++ firewall.yml | 8 ++++---- yunohost_firewall.py | 14 ++++++++++++++ 3 files changed, 26 insertions(+), 4 deletions(-) diff --git a/action_map.yml b/action_map.yml index 30a53018..4cae9976 100644 --- a/action_map.yml +++ b/action_map.yml @@ -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 # ############################# diff --git a/firewall.yml b/firewall.yml index 688c1da7..ff6ebc99 100644 --- a/firewall.yml +++ b/firewall.yml @@ -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: [] diff --git a/yunohost_firewall.py b/yunohost_firewall.py index 6674d588..d810939d 100644 --- a/yunohost_firewall.py +++ b/yunohost_firewall.py @@ -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")