mirror of
https://github.com/YunoHost-Apps/adguardhome_ynh.git
synced 2024-09-03 18:06:23 +02:00
open or close DoH/DoQ ports according to the selected choice in the config panel
This commit is contained in:
parent
cbd3ad057e
commit
c9c017af09
2 changed files with 39 additions and 1 deletions
|
@ -5,7 +5,7 @@ name = "AdguardHome configuration"
|
|||
services = ["__APP__"]
|
||||
|
||||
[main.options.dns_over_https]
|
||||
ask = "Enable DNS-over-HTTPS"
|
||||
ask = "Enable DNS-over-HTTPS/QUIC"
|
||||
bind = "tls>enabled:__INSTALL_DIR__/AdGuardHome.yaml"
|
||||
no = "false"
|
||||
type = "boolean"
|
||||
|
|
38
scripts/config
Normal file
38
scripts/config
Normal file
|
@ -0,0 +1,38 @@
|
|||
#!/bin/bash
|
||||
|
||||
#=================================================
|
||||
# GENERIC STARTING
|
||||
#=================================================
|
||||
# IMPORT GENERIC HELPERS
|
||||
#=================================================
|
||||
|
||||
source _common.sh
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
ynh_abort_if_errors
|
||||
|
||||
#=================================================
|
||||
# CUSTOM THINGS
|
||||
#=================================================
|
||||
|
||||
ynh_app_config_apply() {
|
||||
_ynh_app_config_apply
|
||||
|
||||
if [ "$dns_over_https" == "true" ]; then
|
||||
ynh_script_progression --message="Opening DoH and DoQ ports..."
|
||||
# if DNS over HTTPS/QUIC is activated, open the associated ports
|
||||
ynh_exec_warn_less yunohost firewall allow --no-upnp TCP "$port_dns_over_http"
|
||||
ynh_exec_warn_less yunohost firewall allow --no-upnp TCP "$port_dns_over_quic"
|
||||
yunohost firewall reload
|
||||
elif [ "$dns_over_https" == "false" ]; then
|
||||
# else if false, close them
|
||||
ynh_script_progression --message="Closing DoH and DoQ ports..."
|
||||
ynh_exec_warn_less yunohost firewall disallow --no-upnp TCP "$port_dns_over_http"
|
||||
ynh_exec_warn_less yunohost firewall disallow --no-upnp TCP "$port_dns_over_quic"
|
||||
yunohost firewall reload
|
||||
else
|
||||
# else, throw error
|
||||
ynh_print_warn --message="The variable 'dns_over_https' should be 'true' or 'false' but isn't, please report this."
|
||||
fi
|
||||
|
||||
}
|
Loading…
Add table
Reference in a new issue