SensorsIot / IOTstack

Docker stack for getting started on IOT on the Raspberry PI
GNU General Public License v3.0
1.43k stars 303 forks source link

2023-01-22 Pi-hole admin password changes - master branch - PR 1 of 3 #648

Closed Paraphraser closed 1 year ago

Paraphraser commented 1 year ago

Circa July 9, 2022 docker-pi-hole PR 1106 made some significant changes to how the admin password is handled. The only documentation for this change was in Changelog 2022.07:

Always use WEBPASSWORD env var if set by @rdwebdesign in #1106

This change was reported on Discord.

To summarise the new behaviour:

  1. If WEBPASSWORD is not set on first launch, a random password is generated.
  2. If WEBPASSWORD is not set on second-or-subsequent launch, whatever password was already in effect is re-used. This also applies when there is no admin password.
  3. If WEBPASSWORD is defined but has a null value, any pre-existing password is cleared and the Web UI bypasses the login screen.
  4. If WEBPASSWORD is defined and has a value, that value is always used to update the admin password stored internally.

This PR adjusts the IOTstack Pi-hole template to default to the third option above (ie no admin password). This avoids the need for any "build" process and the need to set/generate any password, and obviates the need for the associated Python scripts which have been removed.

A comment is added to the service definition template directing users to the IOTstack wiki page where the behaviour of WEBPASSWORD is documented in full.

This change should only affect new users.

Any existing users who had followed the previous procedure of selecting Pi-hole, choosing a password or allowing one to be generated, and bringing up the container would have an admin password matching the value of WEBPASSWORD.

Any existing users who had reset their password via:

$ docker exec pihole pihole -a -p myNewPassword

will either have:

  1. Changed their service definition to match. The July 9 2022 changes would already be enforcing WEBPASSWORD on each launch.
  2. Not changed their service definition to match. The July 9 2022 changes would already have reverted to the value of WEBPASSWORD.
  3. Removed WEBPASSWORD from their list of environment variables. The July 9 2022 changes would continue to use the existing password.

This PR also takes the opportunity to:

  1. Re-align the service definition entries.
  2. Adopt new-style TZ which either accepts a value from ~/IOTstack/.env or defaults to Etc/UTC.
  3. Add a comment pointing to the Pi-hole documentation for its supported environment variables.

IOTstack Pi-hole documentation updated.

Signed-off-by: Phill Kelley 34226495+Paraphraser@users.noreply.github.com