From 38e1fc106dc517e04b8cf70f85d5754a8bab4996 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Thu, 14 Feb 2019 20:21:06 +0100 Subject: [PATCH] Close not needed port --- scripts/install | 2 +- scripts/upgrade | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/scripts/install b/scripts/install index f10f800..7314611 100644 --- a/scripts/install +++ b/scripts/install @@ -61,7 +61,7 @@ ynh_print_info "Configuring firewall..." # Find a free port port=$(ynh_find_port 4242) # Open this port -ynh_exec_warn_less yunohost firewall allow --no-upnp TCP $port +#ynh_exec_warn_less yunohost firewall allow --no-upnp TCP $port ynh_app_setting_set $app port $port #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 8df02ad..355b760 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -38,6 +38,16 @@ if [ -z "$port" ]; then ynh_app_setting_set $app port $port fi +#================================================= +# CLOSE A PORT +#================================================= + +if yunohost firewall list | grep -q "\- $port$" +then + ynh_print_info "Closing port $port" + ynh_exec_warn_less yunohost firewall disallow TCP $port +fi + #================================================= # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP #=================================================