mirror of
https://github.com/YunoHost-Apps/adguardhome_ynh.git
synced 2024-09-03 18:06:23 +02:00
handle closing unnecessary ports at restore and upgrade
This commit is contained in:
parent
0475073364
commit
8aa3f1508b
2 changed files with 21 additions and 0 deletions
|
@ -10,6 +10,20 @@
|
|||
source ../settings/scripts/_common.sh
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
#=================================================
|
||||
# CLOSE UNNECESSARY PORTS
|
||||
# no need to open the ports, as they were opened at the 'Provisioning ports' step
|
||||
#=================================================
|
||||
|
||||
if [ "$dns_over_https" == "false" ]; then
|
||||
# if dns_over_https is false, we need to close ports,
|
||||
# as they were opened at the 'Provisioning ports' step
|
||||
ynh_exec_warn_less yunohost firewall disallow --no-upnp TCP "$port_dns_over_http"
|
||||
ynh_exec_warn_less yunohost firewall disallow --no-upnp UDP "$port_dns_over_http"
|
||||
ynh_exec_warn_less yunohost firewall disallow --no-upnp UDP "$port_dns_over_quic"
|
||||
ynh_exec_warn_less yunohost firewall reload
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# RESTORE THE APP MAIN DIR
|
||||
#=================================================
|
||||
|
|
|
@ -33,10 +33,17 @@ if [ -n "$dns_over_https" ] && [ "$dns_over_https" == "1" ];
|
|||
then
|
||||
dns_over_https="true"
|
||||
ynh_app_setting_set --app="$app" --key=dns_over_https --value=$dns_over_https
|
||||
# no need to open the ports, as they were opened at the 'Provisioning ports' step
|
||||
elif [ -z "$dns_over_https" ] || [ "$dns_over_https" == "0" ];
|
||||
then
|
||||
dns_over_https="false"
|
||||
ynh_app_setting_set --app="$app" --key=dns_over_https --value=$dns_over_https
|
||||
# if dns_over_https is false, we need to close ports,
|
||||
# as they were opened at the 'Provisioning ports' step
|
||||
ynh_exec_warn_less yunohost firewall disallow --no-upnp TCP "$port_dns_over_http"
|
||||
ynh_exec_warn_less yunohost firewall disallow --no-upnp UDP "$port_dns_over_http"
|
||||
ynh_exec_warn_less yunohost firewall disallow --no-upnp UDP "$port_dns_over_quic"
|
||||
ynh_exec_warn_less yunohost firewall reload
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
|
|
Loading…
Add table
Reference in a new issue