mirror of
https://github.com/YunoHost-Apps/adguardhome_ynh.git
synced 2024-09-03 18:06:23 +02:00
rework port 53 expose
This commit is contained in:
parent
06737daaa3
commit
b994dd48d1
4 changed files with 18 additions and 21 deletions
|
@ -17,19 +17,6 @@ ynh_abort_if_errors
|
||||||
|
|
||||||
set__expose_port_53() {
|
set__expose_port_53() {
|
||||||
|
|
||||||
if [ "$expose_port_53" == "true" ]; then
|
|
||||||
ynh_print_info --message="Opening port 53..."
|
|
||||||
# if the user would expose port 53 to the Internet, open it
|
|
||||||
ynh_exec_warn_less yunohost firewall allow Both 53
|
|
||||||
elif [ "$expose_port_53" == "false" ]; then
|
|
||||||
# else if false, close it
|
|
||||||
ynh_print_info --message="Closing port 53..."
|
|
||||||
ynh_exec_warn_less yunohost firewall disallow Both 53
|
|
||||||
else
|
|
||||||
# else, throw error
|
|
||||||
ynh_print_warn --message="The variable 'expose_port_53' should be 'true' or 'false' but isn't, please report this."
|
|
||||||
fi
|
|
||||||
|
|
||||||
# regenerate config, needed to add or delete public IPs following the user's choice
|
# regenerate config, needed to add or delete public IPs following the user's choice
|
||||||
|
|
||||||
ynh_print_info --message="Obtaining IP addresses for the AGH config file..."
|
ynh_print_info --message="Obtaining IP addresses for the AGH config file..."
|
||||||
|
|
|
@ -29,8 +29,13 @@ fi
|
||||||
|
|
||||||
ynh_app_setting_set --app="$app" --key=dns_over_https --value="$dns_over_https"
|
ynh_app_setting_set --app="$app" --key=dns_over_https --value="$dns_over_https"
|
||||||
|
|
||||||
|
|
||||||
|
# if the port 53 is not open, open it, it's mandatory to use AGH
|
||||||
|
if ! yunohost firewall list | grep -q " 53$"; then
|
||||||
ynh_print_info --message="Opening port 53..."
|
ynh_print_info --message="Opening port 53..."
|
||||||
ynh_exec_warn_less yunohost firewall allow Both 53
|
ynh_exec_warn_less yunohost firewall allow Both 53
|
||||||
|
fi
|
||||||
|
|
||||||
if [[ $expose_port_53 == 0 ]]; then
|
if [[ $expose_port_53 == 0 ]]; then
|
||||||
expose_port_53="true"
|
expose_port_53="true"
|
||||||
else
|
else
|
||||||
|
|
|
@ -22,8 +22,10 @@ if [ "$dns_over_https" == "false" ]; then
|
||||||
ynh_exec_warn_less yunohost firewall disallow UDP "$port_dns_over_quic"
|
ynh_exec_warn_less yunohost firewall disallow UDP "$port_dns_over_quic"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$expose_port_53" == "true" ]; then
|
|
||||||
# if expose_port_53 is true, we need to open port 53
|
# if the port 53 is not open, open it, it's mandatory to use AGH
|
||||||
|
if ! yunohost firewall list | grep -q " 53$"; then
|
||||||
|
ynh_print_info --message="Opening port 53..."
|
||||||
ynh_exec_warn_less yunohost firewall allow Both 53
|
ynh_exec_warn_less yunohost firewall allow Both 53
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
|
@ -29,18 +29,21 @@ ynh_systemd_action --service_name="$app" --action="stop"
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Ensuring downward compatibility..." --weight=1
|
ynh_script_progression --message="Ensuring downward compatibility..." --weight=1
|
||||||
|
|
||||||
|
# if the port 53 is not open, open it, it's mandatory to use AGH
|
||||||
|
if ! yunohost firewall list | grep -q " 53$"; then
|
||||||
|
ynh_print_info --message="Opening port 53..."
|
||||||
|
ynh_exec_warn_less yunohost firewall allow Both 53
|
||||||
|
fi
|
||||||
|
|
||||||
if [ -z "${expose_port_53:-}" ] && [ "${expose_port_53:-}" = true ]; then
|
if [ -z "${expose_port_53:-}" ] && [ "${expose_port_53:-}" = true ]; then
|
||||||
expose_port_53="true"
|
expose_port_53="true"
|
||||||
ynh_app_setting_set --app="$app" --key=expose_port_53 --value="$expose_port_53"
|
ynh_app_setting_set --app="$app" --key=expose_port_53 --value="$expose_port_53"
|
||||||
# if expose_port_53 is true, we need to open port 53
|
|
||||||
ynh_print_info --message="Opening port 53..."
|
|
||||||
ynh_exec_warn_less yunohost firewall allow Both 53
|
|
||||||
elif [ -n "${expose_port_53:-}" ] || [ "${expose_port_53:-}" = false ]; then
|
elif [ -n "${expose_port_53:-}" ] || [ "${expose_port_53:-}" = false ]; then
|
||||||
expose_port_53="false"
|
expose_port_53="false"
|
||||||
ynh_app_setting_set --app="$app" --key=expose_port_53 --value="$expose_port_53"
|
ynh_app_setting_set --app="$app" --key=expose_port_53 --value="$expose_port_53"
|
||||||
ynh_print_info --message="Port 53 is closed."
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
if [ -z "${dns_over_https:-}" ] && [ "${dns_over_https:-}" = true ]; then
|
if [ -z "${dns_over_https:-}" ] && [ "${dns_over_https:-}" = true ]; then
|
||||||
dns_over_https="true"
|
dns_over_https="true"
|
||||||
ynh_app_setting_set --app="$app" --key=dns_over_https --value=$dns_over_https
|
ynh_app_setting_set --app="$app" --key=dns_over_https --value=$dns_over_https
|
||||||
|
|
Loading…
Add table
Reference in a new issue