mirror of
https://github.com/pi-hole/pi-hole.git
synced 2025-03-03 23:38:29 +00:00
Don't set a random password on v5 -> v6 updates (#5960)
This commit is contained in:
commit
5d5bddc979
1 changed files with 13 additions and 8 deletions
|
@ -93,6 +93,7 @@ IPV6_ADDRESS=${IPV6_ADDRESS}
|
||||||
QUERY_LOGGING=
|
QUERY_LOGGING=
|
||||||
WEBPORT=
|
WEBPORT=
|
||||||
PRIVACY_LEVEL=
|
PRIVACY_LEVEL=
|
||||||
|
v5_to_v6_update=false
|
||||||
|
|
||||||
# Where old configs go to if a v6 migration is performed
|
# Where old configs go to if a v6 migration is performed
|
||||||
V6_CONF_MIGRATION_DIR="/etc/pihole/migration_backup_v6"
|
V6_CONF_MIGRATION_DIR="/etc/pihole/migration_backup_v6"
|
||||||
|
@ -2356,6 +2357,8 @@ migrate_dnsmasq_configs() {
|
||||||
|
|
||||||
# Print a blank line for separation
|
# Print a blank line for separation
|
||||||
printf "\\n"
|
printf "\\n"
|
||||||
|
|
||||||
|
v5_to_v6_update=true
|
||||||
}
|
}
|
||||||
|
|
||||||
# Check for availability of either the "service" or "systemctl" commands
|
# Check for availability of either the "service" or "systemctl" commands
|
||||||
|
@ -2515,18 +2518,11 @@ main() {
|
||||||
# Copy the temp log file into final log location for storage
|
# Copy the temp log file into final log location for storage
|
||||||
copy_to_install_log
|
copy_to_install_log
|
||||||
|
|
||||||
# Add password to web UI if there is none
|
|
||||||
pw=""
|
|
||||||
# If no password is set,
|
|
||||||
if [[ -z $(pihole-FTL --config webserver.api.pwhash) ]]; then
|
|
||||||
# generate a random password
|
|
||||||
pw=$(tr -dc _A-Z-a-z-0-9 </dev/urandom | head -c 8)
|
|
||||||
pihole setpassword "${pw}"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Migrate existing install to v6.0
|
# Migrate existing install to v6.0
|
||||||
migrate_dnsmasq_configs
|
migrate_dnsmasq_configs
|
||||||
|
|
||||||
|
|
||||||
# Check for and disable systemd-resolved-DNSStubListener before reloading resolved
|
# Check for and disable systemd-resolved-DNSStubListener before reloading resolved
|
||||||
# DNSStubListener needs to remain in place for installer to download needed files,
|
# DNSStubListener needs to remain in place for installer to download needed files,
|
||||||
# so this change needs to be made after installation is complete,
|
# so this change needs to be made after installation is complete,
|
||||||
|
@ -2549,6 +2545,15 @@ main() {
|
||||||
|
|
||||||
restart_service pihole-FTL
|
restart_service pihole-FTL
|
||||||
|
|
||||||
|
# Add password to web UI if there is none
|
||||||
|
pw=""
|
||||||
|
# If this is a fresh installation and no password is set,
|
||||||
|
if [[ ${v5_to_v6_update} = false && -z $(getFTLConfigValue webserver.api.pwhash) ]]; then
|
||||||
|
# generate a random password
|
||||||
|
pw=$(tr -dc _A-Z-a-z-0-9 </dev/urandom | head -c 8)
|
||||||
|
pihole setpassword "${pw}"
|
||||||
|
fi
|
||||||
|
|
||||||
# apply settings to pihole.toml
|
# apply settings to pihole.toml
|
||||||
# needs to be done after FTL service has been started, otherwise pihole.toml does not exist
|
# needs to be done after FTL service has been started, otherwise pihole.toml does not exist
|
||||||
# set on fresh installations by setDNS() and setPrivacyLevel() and setLogging()
|
# set on fresh installations by setDNS() and setPrivacyLevel() and setLogging()
|
||||||
|
|
Loading…
Add table
Reference in a new issue