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

add a new password tool in the config panel

This commit is contained in:
OniriCorpe 2024-01-03 22:41:43 +01:00
parent 8fa54453a5
commit c569b80b4a
5 changed files with 23 additions and 0 deletions

View file

@ -19,3 +19,8 @@ type = "boolean"
yes = "true"
bind = "tls>enabled:__INSTALL_DIR__/AdGuardHome.yaml"
help = "If so, anyone who knows your adguard address can make a doh request to https://adguardomain.tld/dns-query It also may be used to perform amplification attacks. Read the admin doc to secure your server using allowlist."
[main.extra.new_password]
ask = "Set a new admin password"
type = "string"
help = "With this tool, you can easily change the password of your AdGuard Home. Just put the desired password in the text input."

View file

@ -10,6 +10,8 @@ Applications → AdGuard Home → AdGuard Home configuration
It's really important to use the configuration panel to activate or deactivate the DNS-over-HTTPS/QUIC setting, and **NOT** the built-in setting in the AdGuardHome interface.
This is because YunoHost needs to perform actions such as automatically opening or closing the server's ports and refresh the IP to provide to AdGuard Home, which cannot be done without going through the configuration panel.
A new password tool has been added in the config panel too, to make it easier to change the administration password of AdGuard Home
This update is at risk of crashing AdGuard Home, so:
- If any trouble or question, please refer to [the package's admin docs](https://github.com/YunoHost-Apps/adguardhome_ynh/blob/master/doc/ADMIN.md)! In any case, we recommend reading it! ^w^
- If needed and a similar issue does not already exist, please [open an issue on the GitHub's package page](https://github.com/YunoHost-Apps/adguardhome_ynh/issues)!

View file

@ -88,6 +88,16 @@ set__dns_over_https() {
ynh_app_setting_set --app="$app" --key=dns_over_https --value="$dns_over_https"
}
set__new_password() {
# user's password encryption
password=$(python3 -c "import bcrypt; print(bcrypt.hashpw(b\"$new_password\", bcrypt.gensalt(rounds=10)).decode())")
ynh_app_setting_set --app="$app" --key=password --value="$password"
# save the new setting in the AGH config file
ynh_write_var_in_file --file="$install_dir/AdGuardHome.yaml" --key="password" --value="$password"
}
#=================================================
# GENERIC FINALIZATION
#=================================================

View file

@ -44,6 +44,8 @@ fi
ynh_app_setting_set --app="$app" --key=expose_port_53 --value="$expose_port_53"
ynh_app_setting_set --app="$app" --key=new_password --value=""
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================

View file

@ -86,6 +86,10 @@ fi
# remove setting no longer required
ynh_app_setting_delete --app="$app" --key=port_adguard
if [ -z "${new_password:-}" ]; then
ynh_app_setting_set --app="$app" --key=new_password --value=""
fi
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================