1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/adguardhome_ynh.git synced 2024-09-03 18:06:23 +02:00

Merge branch 'testing' into version-2

This commit is contained in:
Éric Gaspar 2023-10-18 23:27:58 +02:00
commit 92277f9866
9 changed files with 37 additions and 40 deletions

View file

@ -21,7 +21,7 @@ AdGuard Home is a network-wide software for blocking ads & tracking. After you s
It operates as a DNS server that re-routes tracking domains to a "black hole", thus preventing your devices from connecting to those servers. It's based on software we use for our public AdGuard DNS servers -- both share a lot of common code. It operates as a DNS server that re-routes tracking domains to a "black hole", thus preventing your devices from connecting to those servers. It's based on software we use for our public AdGuard DNS servers -- both share a lot of common code.
**Shipped version:** 0.107.27~ynh1 **Shipped version:** 0.107.40~ynh1
## Screenshots ## Screenshots
@ -33,7 +33,6 @@ It operates as a DNS server that re-routes tracking domains to a "black hole", t
* Official user documentation: <https://kb.adguard.com/en> * Official user documentation: <https://kb.adguard.com/en>
* Official admin documentation: <https://github.com/AdguardTeam/AdGuardHome/wiki> * Official admin documentation: <https://github.com/AdguardTeam/AdGuardHome/wiki>
* Upstream app code repository: <https://github.com/AdguardTeam/AdGuardHome> * Upstream app code repository: <https://github.com/AdguardTeam/AdGuardHome>
* YunoHost documentation for this app: <https://yunohost.org/app_adguardhome>
* Report a bug: <https://github.com/YunoHost-Apps/adguardhome_ynh/issues> * Report a bug: <https://github.com/YunoHost-Apps/adguardhome_ynh/issues>
## Developer info ## Developer info

View file

@ -21,7 +21,7 @@ AdGuard Home est un logiciel à l'échelle du réseau pour bloquer les publicit
Il fonctionne comme un serveur DNS qui redirige les domaines de pistage vers un "trou noir", empêchant ainsi vos appareils de se connecter à ces serveurs. Il est basé sur un logiciel que nous utilisons pour nos serveurs DNS publics AdGuard - les deux partagent beaucoup de code commun. Il fonctionne comme un serveur DNS qui redirige les domaines de pistage vers un "trou noir", empêchant ainsi vos appareils de se connecter à ces serveurs. Il est basé sur un logiciel que nous utilisons pour nos serveurs DNS publics AdGuard - les deux partagent beaucoup de code commun.
**Version incluse :** 0.107.27~ynh1 **Version incluse :** 0.107.40~ynh1
## Captures décran ## Captures décran
@ -33,7 +33,6 @@ Il fonctionne comme un serveur DNS qui redirige les domaines de pistage vers un
* Documentation officielle utilisateur : <https://kb.adguard.com/en> * Documentation officielle utilisateur : <https://kb.adguard.com/en>
* Documentation officielle de ladmin : <https://github.com/AdguardTeam/AdGuardHome/wiki> * Documentation officielle de ladmin : <https://github.com/AdguardTeam/AdGuardHome/wiki>
* Dépôt de code officiel de lapp : <https://github.com/AdguardTeam/AdGuardHome> * Dépôt de code officiel de lapp : <https://github.com/AdguardTeam/AdGuardHome>
* Documentation YunoHost pour cette app : <https://yunohost.org/app_adguardhome>
* Signaler un bug : <https://github.com/YunoHost-Apps/adguardhome_ynh/issues> * Signaler un bug : <https://github.com/YunoHost-Apps/adguardhome_ynh/issues>
## Informations pour les développeurs ## Informations pour les développeurs

View file

@ -118,11 +118,12 @@ dhcp:
ra_slaac_only: false ra_slaac_only: false
ra_allow_slaac: false ra_allow_slaac: false
clients: [] clients: []
log_compress: false log:
log_localtime: false compress: false
log_max_backups: 0 localtime: false
log_max_size: 100 max_backups: 0
log_max_age: 3 max_size: 100
log_file: "" max_age: 3
file: ""
verbose: false verbose: false
schema_version: 10 schema_version: 10

View file

@ -9,6 +9,7 @@ location __PATH__/ {
proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Host $server_name; proxy_set_header X-Forwarded-Host $server_name;
proxy_set_header X-Remote-User $remote_user;
proxy_http_version 1.1; proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade; proxy_set_header Upgrade $http_upgrade;
@ -19,7 +20,7 @@ location __PATH__/ {
} }
location /dns-query { location /dns-query {
proxy_set_header Host $http_host; proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_redirect off; proxy_redirect off;
proxy_buffering on; proxy_buffering on;

View file

@ -4,9 +4,6 @@ version = "1.0"
name = "AdguardHome configuration" name = "AdguardHome configuration"
services = ["__APP__"] services = ["__APP__"]
[main.options]
name = "Enable some features"
[main.options.dns_over_https] [main.options.dns_over_https]
ask = "Enable DNS-over-HTTPS" ask = "Enable DNS-over-HTTPS"
type = "boolean" type = "boolean"

View file

@ -19,17 +19,17 @@ then
dns_over_https="true" dns_over_https="true"
# DNS over TLS # DNS over TLS
adguard_DoT_port=853 adguard_DoT_port=853
ynh_app_setting_set --app=$app --key=adguard_DoT_port --value=$adguard_DoT_port ynh_app_setting_set --app="$app" --key=adguard_DoT_port --value=$adguard_DoT_port
ynh_exec_warn_less yunohost firewall allow --no-upnp UDP $adguard_DoT_port ynh_exec_warn_less yunohost firewall allow --no-upnp UDP $adguard_DoT_port
ynh_exec_warn_less yunohost firewall allow --no-upnp TCP $adguard_DoT_port ynh_exec_warn_less yunohost firewall allow --no-upnp TCP $adguard_DoT_port
# DNS over QUIC # DNS over QUIC
adguard_DoQ_port=784 adguard_DoQ_port=784
ynh_app_setting_set --app=$app --key=adguard_DoQ_port --value=$adguard_DoQ_port ynh_app_setting_set --app="$app" --key=adguard_DoQ_port --value=$adguard_DoQ_port
ynh_exec_warn_less yunohost firewall allow --no-upnp UDP $adguard_DoQ_port ynh_exec_warn_less yunohost firewall allow --no-upnp UDP $adguard_DoQ_port
else else
dns_over_https="false" dns_over_https="false"
fi 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
#================================================= #=================================================
# CREATE DEDICATED USER # CREATE DEDICATED USER
@ -93,25 +93,25 @@ ipv4_route_output=$(echo "$(ip -4 route get 1.2.3.4 2> /dev/null)" | head -n1 |
ipv6_route_output=$(echo "$(ip -6 route get ::1.2.3.4 2> /dev/null)" | head -n1) ipv6_route_output=$(echo "$(ip -6 route get ::1.2.3.4 2> /dev/null)" | head -n1)
ipv4_addr="" ipv4_addr=""
for i in $(seq "$(echo $ipv4_route_output | wc -w)" -1 1); do for i in $(seq "$(echo "$ipv4_route_output" | wc -w)" -1 1); do
ip=$(echo $ipv4_route_output | awk "{print \$$i}") ip=$(echo "$ipv4_route_output" | awk "{print \$$i}")
if ynh_validate_ip4 --ip_address=$ip; then if ynh_validate_ip4 --ip_address="$ip"; then
ipv4_addr="- $ip" ipv4_addr="- $ip"
break break
fi fi
done done
ipv6_addr="" ipv6_addr=""
for i in $(seq "$(echo $ipv6_route_output | wc -w)" -1 1); do for i in $(seq "$(echo "$ipv6_route_output" | wc -w)" -1 1); do
ip=$(echo $ipv6_route_output | awk "{print \$$i}") ip=$(echo "$ipv6_route_output" | awk "{print \$$i}")
if ynh_validate_ip6 --ip_address=$ip; then if ynh_validate_ip6 --ip_address="$ip"; then
ipv6_addr="- $ip" ipv6_addr="- $ip"
break break
fi fi
done done
password=$(python3 -c "import bcrypt; print(bcrypt.hashpw(b\"$password\", bcrypt.gensalt(rounds=10)).decode())") password=$(python3 -c "import bcrypt; print(bcrypt.hashpw(b\"$password\", bcrypt.gensalt(rounds=10)).decode())")
ynh_app_setting_set --app=$app --key=password --value=$password ynh_app_setting_set --app="$app" --key=password --value="$password"
# Main config File # Main config File
ynh_add_config --template="../conf/AdGuardHome.yaml" --destination="$install_dir/AdGuardHome.yaml" ynh_add_config --template="../conf/AdGuardHome.yaml" --destination="$install_dir/AdGuardHome.yaml"
@ -135,7 +135,7 @@ yunohost service add $app --description="Ads & trackers blocking DNS server" --n
ynh_script_progression --message="Starting a systemd service..." --weight=2 ynh_script_progression --message="Starting a systemd service..." --weight=2
# Start a systemd service # Start a systemd service
ynh_systemd_action --service_name=$app --action="restart" --log_path=systemd ynh_systemd_action --service_name="$app" --action="restart" --log_path=systemd
#================================================= #=================================================
# END OF SCRIPT # END OF SCRIPT

View file

@ -16,10 +16,10 @@ source /usr/share/yunohost/helpers
#================================================= #=================================================
# Remove the service from the list of services known by YunoHost (added from `yunohost service add`) # Remove the service from the list of services known by YunoHost (added from `yunohost service add`)
if ynh_exec_warn_less yunohost service status $app >/dev/null if ynh_exec_warn_less yunohost service status "$app" >/dev/null
then then
ynh_script_progression --message="Removing $app service integration..." --weight=1 ynh_script_progression --message="Removing $app service integration..." --weight=1
yunohost service remove $app yunohost service remove "$app"
fi fi
# Remove the dedicated systemd config # Remove the dedicated systemd config

View file

@ -36,7 +36,7 @@ ynh_script_progression --message="Restoring the NGINX web server configuration..
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
ynh_restore_file --origin_path="/etc/systemd/system/$app.service" ynh_restore_file --origin_path="/etc/systemd/system/$app.service"
systemctl enable $app.service --quiet systemctl enable "$app.service" --quiet
yunohost service add $app --description="Ads & trackers blocking DNS server" --needs_exposed_ports $port_adguard yunohost service add $app --description="Ads & trackers blocking DNS server" --needs_exposed_ports $port_adguard
@ -45,7 +45,7 @@ yunohost service add $app --description="Ads & trackers blocking DNS server" --n
#================================================= #=================================================
ynh_script_progression --message="Starting a systemd service..." --weight=1 ynh_script_progression --message="Starting a systemd service..." --weight=1
ynh_systemd_action --service_name=$app --action="restart" --log_path="systemd" ynh_systemd_action --service_name="$app" --action="restart" --log_path="systemd"
ynh_systemd_action --service_name=nginx --action=reload ynh_systemd_action --service_name=nginx --action=reload

View file

@ -22,7 +22,7 @@ upgrade_type=$(ynh_check_app_version_changed)
#================================================= #=================================================
ynh_script_progression --message="Stopping a systemd service..." --weight=1 ynh_script_progression --message="Stopping a systemd service..." --weight=1
ynh_systemd_action --service_name=$app --action="stop" ynh_systemd_action --service_name="$app" --action="stop"
#================================================= #=================================================
# ENSURE DOWNWARD COMPATIBILITY # ENSURE DOWNWARD COMPATIBILITY
@ -32,7 +32,7 @@ ynh_script_progression --message="Ensuring downward compatibility..." --weight=1
if [ -n "$dns_over_https" ] && [ "$dns_over_https" == "1" ]; if [ -n "$dns_over_https" ] && [ "$dns_over_https" == "1" ];
then 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
# DNS over TLS # DNS over TLS
adguard_DoT_port=853 adguard_DoT_port=853
ynh_app_setting_set --app=$app --key=adguard_DoT_port --value=$adguard_DoT_port ynh_app_setting_set --app=$app --key=adguard_DoT_port --value=$adguard_DoT_port
@ -40,12 +40,12 @@ then
ynh_exec_warn_less yunohost firewall allow --no-upnp TCP $adguard_DoT_port ynh_exec_warn_less yunohost firewall allow --no-upnp TCP $adguard_DoT_port
# DNS over QUIC # DNS over QUIC
adguard_DoQ_port=784 adguard_DoQ_port=784
ynh_app_setting_set --app=$app --key=adguard_DoQ_port --value=$adguard_DoQ_port ynh_app_setting_set --app="$app" --key=adguard_DoQ_port --value=$adguard_DoQ_port
ynh_exec_warn_less yunohost firewall allow --no-upnp UDP $adguard_DoQ_port ynh_exec_warn_less yunohost firewall allow --no-upnp UDP $adguard_DoQ_port
elif [ -z "$dns_over_https" ] || [ "$dns_over_https" == "0" ]; elif [ -z "$dns_over_https" ] || [ "$dns_over_https" == "0" ];
then then
dns_over_https="false" dns_over_https="false"
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
fi fi
#================================================= #=================================================
@ -110,18 +110,18 @@ ipv4_route_output=$(echo "$(ip -4 route get 1.2.3.4 2> /dev/null)" | head -n1)
ipv6_route_output=$(echo "$(ip -6 route get ::1.2.3.4 2> /dev/null)" | head -n1) ipv6_route_output=$(echo "$(ip -6 route get ::1.2.3.4 2> /dev/null)" | head -n1)
ipv4_addr="" ipv4_addr=""
for i in $(seq "$(echo $ipv4_route_output | wc -w)" -1 1); do for i in $(seq "$(echo "$ipv4_route_output" | wc -w)" -1 1); do
ip=$(echo $ipv4_route_output | awk "{print \$$i}") ip=$(echo "$ipv4_route_output" | awk "{print \$$i}")
if ynh_validate_ip4 --ip_address=$ip; then if ynh_validate_ip4 --ip_address="$ip"; then
ipv4_addr="$ip" ipv4_addr="$ip"
break break
fi fi
done done
ipv6_addr="" ipv6_addr=""
for i in $(seq "$(echo $ipv6_route_output | wc -w)" -1 1); do for i in $(seq "$(echo "$ipv6_route_output" | wc -w)" -1 1); do
ip=$(echo $ipv6_route_output | awk "{print \$$i}") ip=$(echo "$ipv6_route_output" | awk "{print \$$i}")
if ynh_validate_ip6 --ip_address=$ip; then if ynh_validate_ip6 --ip_address="$ip"; then
ipv6_addr="$ip" ipv6_addr="$ip"
break break
fi fi
@ -159,7 +159,7 @@ chown -R $app:$app "$install_dir/AdGuardHome.yaml"
#================================================= #=================================================
ynh_script_progression --message="Starting a systemd service..." --weight=1 ynh_script_progression --message="Starting a systemd service..." --weight=1
ynh_systemd_action --service_name=$app --action="restart" --log_path="systemd" ynh_systemd_action --service_name="$app" --action="restart" --log_path="systemd"
#================================================= #=================================================
# END OF SCRIPT # END OF SCRIPT