1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/uptime-kuma_ynh.git synced 2024-10-01 13:34:58 +02:00

disable opening port

This commit is contained in:
Hadrien 2021-11-01 22:47:52 +03:00
parent 8afd96663a
commit fcae1866f9
2 changed files with 15 additions and 15 deletions

View file

@ -79,24 +79,24 @@ ynh_app_setting_set --app=$app --key=admin --value=$admin
#================================================= #=================================================
# FIND AND OPEN A PORT # FIND AND OPEN A PORT
#================================================= #=================================================
ynh_script_progression --message="Finding an available port..." --time --weight=1 # ynh_script_progression --message="Finding an available port..." --time --weight=1
### Use these lines if you have to open a port for the application ### Use these lines if you have to open a port for the application
### `ynh_find_port` will find the first available port starting from the given port. ### `ynh_find_port` will find the first available port starting from the given port.
### If you're not using these lines: ### If you're not using these lines:
### - Remove the section "CLOSE A PORT" in the remove script ### - Remove the section "CLOSE A PORT" in the remove script
# Find an available port # # Find an available port
port=$(ynh_find_port --port=3001) # port=$(ynh_find_port --port=3001)
ynh_app_setting_set --app=$app --key=port --value=$port # ynh_app_setting_set --app=$app --key=port --value=$port
# Optional: Expose this port publicly # # Optional: Expose this port publicly
# (N.B.: you only need to do this if the app actually needs to expose the port publicly. # # (N.B.: you only need to do this if the app actually needs to expose the port publicly.
# If you do this and the app doesn't actually need you are CREATING SECURITY HOLES IN THE SERVER !) # # If you do this and the app doesn't actually need you are CREATING SECURITY HOLES IN THE SERVER !)
# Open the port # # Open the port
ynh_script_progression --message="Configuring firewall..." --time --weight=1 # ynh_script_progression --message="Configuring firewall..." --time --weight=1
ynh_exec_warn_less yunohost firewall allow --no-upnp TCP $port # ynh_exec_warn_less yunohost firewall allow --no-upnp TCP $port
#================================================= #=================================================
# INSTALL DEPENDENCIES # INSTALL DEPENDENCIES

View file

@ -107,11 +107,11 @@ ynh_remove_nginx_config
# CLOSE A PORT # CLOSE A PORT
#================================================= #=================================================
if yunohost firewall list | grep -q "\- $port$" # if yunohost firewall list | grep -q "\- $port$"
then # then
ynh_script_progression --message="Closing port $port..." --time --weight=1 # ynh_script_progression --message="Closing port $port..." --time --weight=1
ynh_exec_warn_less yunohost firewall disallow TCP $port # ynh_exec_warn_less yunohost firewall disallow TCP $port
fi # fi
#================================================= #=================================================
# REMOVE FAIL2BAN CONFIGURATION # REMOVE FAIL2BAN CONFIGURATION