1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/yunorunner_ynh.git synced 2024-09-03 20:36:13 +02:00

Close not needed port

This commit is contained in:
yalh76 2019-02-14 20:21:06 +01:00
parent 479a6c02d4
commit 38e1fc106d
2 changed files with 11 additions and 1 deletions

View file

@ -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
#=================================================

View file

@ -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
#=================================================