diff --git a/scripts/install b/scripts/install index 6d9c871..244dc09 100755 --- a/scripts/install +++ b/scripts/install @@ -89,8 +89,6 @@ ynh_app_setting_set $app random_key $random_key # Find a free port port=$(ynh_find_port 8095) -# Open this port -yunohost firewall allow --no-upnp TCP $port 2>&1 ynh_app_setting_set $app port $port #================================================= diff --git a/scripts/restore b/scripts/restore index 2cbf2e3..778611c 100755 --- a/scripts/restore +++ b/scripts/restore @@ -70,8 +70,15 @@ ynh_restore_file "/etc/nginx/conf.d/$domain.d/$app.conf" ynh_restore_file "$final_path" -# open port -yunohost firewall allow --no-upnp TCP $port 2>&1 +#================================================= +# CLOSE A PORT +#================================================= + +if yunohost firewall list | grep -q "\- $port$" +then + echo "Close port $port" >&2 + yunohost firewall disallow TCP $port 2>&1 +fi #================================================= # RESTORE THE PostgreSQL DATABASE diff --git a/scripts/upgrade b/scripts/upgrade index b2e8110..760db84 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -66,8 +66,15 @@ systemctl stop "$app" # Normalize the URL path syntax path_url=$(ynh_normalize_url_path $path_url) -# Open this port -yunohost firewall allow --no-upnp TCP $port 2>&1 +#================================================= +# CLOSE A PORT +#================================================= + +if yunohost firewall list | grep -q "\- $port$" +then + echo "Close port $port" >&2 + yunohost firewall disallow TCP $port 2>&1 +fi #================================================= # CREATE DEDICATED USER