From f65fc16f3f8c6bec7665cb46f4d9696155743d2f Mon Sep 17 00:00:00 2001 From: OniriCorpe Date: Wed, 27 Dec 2023 03:26:04 +0100 Subject: [PATCH] hardcode port 53 (mandatory but conflicting with dnsmasq and the core) --- conf/AdGuardHome.yaml | 2 +- manifest.toml | 3 --- scripts/config | 4 ++-- scripts/install | 8 +++----- scripts/restore | 9 +++++---- scripts/upgrade | 11 ++++++----- 6 files changed, 17 insertions(+), 20 deletions(-) diff --git a/conf/AdGuardHome.yaml b/conf/AdGuardHome.yaml index ff65a25..c0d2076 100644 --- a/conf/AdGuardHome.yaml +++ b/conf/AdGuardHome.yaml @@ -16,7 +16,7 @@ dns: bind_hosts: __IPV4_ADDR__ __IPV6_ADDR__ - port: __PORT_ADGUARD__ + port: 53 anonymize_client_ip: false ratelimit: 20 ratelimit_subnet_len_ipv4: 24 diff --git a/manifest.toml b/manifest.toml index 97e6052..fc0ba0a 100644 --- a/manifest.toml +++ b/manifest.toml @@ -72,9 +72,6 @@ autoupdate.asset.armhf = "^AdGuardHome_linux_armv7.tar.gz$" autoupdate.strategy = "latest_github_release" [resources.ports] -adguard.default = 53 -adguard.exposed = "Both" -adguard.fixed = true dns_over_http.default = 853 dns_over_http.exposed = "Both" dns_over_quic.default = 784 diff --git a/scripts/config b/scripts/config index 54504d7..8d4ed16 100644 --- a/scripts/config +++ b/scripts/config @@ -20,12 +20,12 @@ set__open_port_53() { if [ "$open_port_53" == "true" ]; then ynh_script_progression --message="Opening port 53..." # if the user would expose port 53 to the Internet, open it - ynh_exec_warn_less yunohost firewall allow Both "$port_adguard" + ynh_exec_warn_less yunohost firewall allow Both 53 yunohost firewall reload elif [ "$open_port_53" == "false" ]; then # else if false, close it ynh_script_progression --message="Closing port 53..." - ynh_exec_warn_less yunohost firewall disallow Both "$port_adguard" + ynh_exec_warn_less yunohost firewall disallow Both 53 yunohost firewall reload else # else, throw error diff --git a/scripts/install b/scripts/install index b72c0ee..73c1fef 100644 --- a/scripts/install +++ b/scripts/install @@ -30,13 +30,11 @@ ynh_app_setting_set --app="$app" --key=dns_over_https --value="$dns_over_https" if [ "$open_port_53" == "1" ]; then open_port_53="true" - # no need to open th port, as it were opened at the 'Provisioning ports' step + # if open_port_53 is true, we need to open port 53 + ynh_exec_warn_less yunohost firewall allow Both 53 + ynh_exec_warn_less yunohost firewall reload else open_port_53="false" - # if open_port_53 is false, we need to close port, - # as it were opened at the 'Provisioning ports' step - ynh_exec_warn_less yunohost firewall disallow Both "$port_dns_over_http" - ynh_exec_warn_less yunohost firewall reload fi ynh_app_setting_set --app="$app" --key=open_port_53 --value="$open_port_53" diff --git a/scripts/restore b/scripts/restore index 84bdd3f..5f06061 100644 --- a/scripts/restore +++ b/scripts/restore @@ -11,8 +11,8 @@ 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 +# PROCESS OPENING/CLOSING PORTS +# no need to open the DoH/DoQ ports, as they were opened at the 'Provisioning ports' step #================================================= if [ "$dns_over_https" == "false" ]; then @@ -23,8 +23,9 @@ if [ "$dns_over_https" == "false" ]; then ynh_exec_warn_less yunohost firewall reload fi -if [ "$open_port_53" == "false" ]; then - ynh_exec_warn_less yunohost firewall disallow Both "$port_dns_over_http" +if [ "$open_port_53" == "true" ]; then + # if open_port_53 is true, we need to open port 53 + ynh_exec_warn_less yunohost firewall allow Both 53 ynh_exec_warn_less yunohost firewall reload fi diff --git a/scripts/upgrade b/scripts/upgrade index 2652ce0..f25f601 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -66,16 +66,17 @@ fi if [ -n "${open_port_53:-}" ] && [ "${open_port_53:-}" == "1" ]; then open_port_53="true" ynh_app_setting_set --app="$app" --key=open_port_53 --value="$open_port_53" - # no need to open th port, as it were opened at the 'Provisioning ports' step + # if open_port_53 is true, we need to open port 53 + ynh_exec_warn_less yunohost firewall allow Both 53 + ynh_exec_warn_less yunohost firewall reload elif [ -z "${open_port_53:-}" ] || [ "${open_port_53:-}" == "0" ]; then open_port_53="false" ynh_app_setting_set --app="$app" --key=open_port_53 --value="$open_port_53" - # if open_port_53 is false, we need to close port, - # as it were opened at the 'Provisioning ports' step - ynh_exec_warn_less yunohost firewall disallow Both "$port_dns_over_http" - ynh_exec_warn_less yunohost firewall reload fi +# remove setting no longer required +ynh_app_setting_delete --app="$app" --key="$port_adguard" + #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #=================================================