mirror of
https://github.com/YunoHost/moulinette.git
synced 2024-09-03 20:06:31 +02:00
commit
408be5dfa6
3 changed files with 34 additions and 4 deletions
|
@ -491,6 +491,14 @@ firewall:
|
|||
action: store_true
|
||||
|
||||
|
||||
### firewall_installupnp()
|
||||
installupnp:
|
||||
action_help: Add upnp cron
|
||||
|
||||
|
||||
### firewall_removeupnp()
|
||||
removeupnp:
|
||||
action_help: Remove upnp cron
|
||||
#############################
|
||||
# Tools #
|
||||
#############################
|
||||
|
|
|
@ -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: [53]
|
||||
ipv6:
|
||||
TCP: [22]
|
||||
UDP: []
|
||||
TCP: [22]
|
||||
UDP: [53]
|
||||
|
|
|
@ -128,6 +128,7 @@ def firewall_reload(upnp=False):
|
|||
|
||||
os.system ("iptables -P INPUT DROP")
|
||||
os.system ("ip6tables -P INPUT DROP")
|
||||
os.system("service fail2ban restart")
|
||||
|
||||
win_msg(_("Firewall successfully reloaded"))
|
||||
|
||||
|
@ -217,3 +218,24 @@ 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")
|
||||
win_msg(_("UPNP cron installed"))
|
||||
|
||||
|
||||
def firewall_removeupnp():
|
||||
try:
|
||||
os.remove("/etc/cron.d/yunohost-firewall")
|
||||
except:
|
||||
raise YunoHostError(167,_("UPNP cron was not installed!"))
|
||||
|
||||
win_msg(_("UPNP cron removed"))
|
||||
|
|
Loading…
Reference in a new issue