V6 on Docker: FTLCONF_webserver_api_password support secrets

Expected Behaviour:

I am running Pihole in a docker instance. I upgraded to v6 this morning and having trouble with FTLCONF_webserver_api_password. I expected this variable to support secrets so I don't have to include my password in the compose.yaml. Previously, this worked having these variables set in my compose.yaml

WEBPASSWORD:
WEBPASSWORD_FILE: /opt/pihole/secrets/admin_pw.txt

-operating system: Raspberry Pi OS Bookworm (Debian 12)
-hardware: RPi4

Actual Behaviour:

After upgrading to v6 and launching the admin interface for the first time, I get an error for password. Here is my new environment section in my compose.yaml

TZ: American/New_York
FTLCONF_weserver_api_password: /opt/pihole/secrets/admin_pw.txt
FTLCONF_dns_listeningMode: 'all'

Debug Token:

https://tricorder.pi-hole.net/JQM2o79t/

1 Like

There is no replacement for WEBPASSWORD_FILE and I'm not sure if the compose file allows to use an external file like you are trying.

Compose files can use .env files to store environment variables.

Try adding a file called .env on the same directory where your compose file is.
Then add something like this in the file:

PASSWORD=My_Password_1234

Now change your compose file to use the variable, like this:

FTLCONF_weserver_api_password: "${PASSWORD}"

Thank you for the detailed guidance! This worked!

Hello, from my understanding this workaround isn't equivalent from a security point of view. Ability to use Docker Swarm secrets is a must have for me. I'd really like to see this security feature in PiHole v6 as it worked in v5 please.

Other breaking changes about using PiHole in Docker were really well documented and this went smoothly for me so a big thanks for your work :slight_smile:
Best regards

Other references :

1 Like

You can use the env_file attribute:

I don't think it was dropped on purpose.

The image for V6 was entirely built from scratch - so it might just be that I missed it while developing. Nobody had mentioned it throughout the beta (or I'm really bad at paying attention!!)

But, I'll look into it - it shouldn't be too difficult to add back in

2 Likes

Just tested pihole/pihole:development image, seems ok to me, I've been able to set the password with a secret.

[i] Setting FTLCONF_webserver_api_password from file
[i] Assigning password defined by Environment Variable

Thank you very much.
Are you planning to harmonize the name of the parameter with your new naming convention? Something like FILE_xxx or xxx_FILE (xxx being FTLCONF_webserver_api_password) maybe?

I thought about this - but what I was trying not to do was to confuse it with an actual setting for FTL - as it is handled separately.

I'll mull it over some more

1 Like

Any update for the _FILE implementation?

https://docs.pi-hole.net/docker/configuration/#webpassword_file-example

Thanks for this.
I will play around with it, because at the moment all all my input is being ignored. Even when completely removing the container and volumes. But i expect this is my issue:)
- WEBPASSWORD=
- WEBPASSWORD_file=/run/secrets/pihole
- WEBPASSWORD_FILE=/run/secrets/pihole
- WEBPASSWORD=$WEBPASSWORD

[i] No password set in environment or config file

I'd suggest reading the docs, it's described in there exactly how to set the password :wink: . Here is the complete section about setting the web password, which covers just the password via environment variable, and also the docker secrets method I linked directly to before.

Heads up, I was also setting this up just now and stumbled on a slight issue in that documentation.

It seems like the WEBPASSWORD_FILE environment variable is case sensitive. It is correctly written in all caps everywhere on that page except the example compose file at the bottom of the page, where it is written as WEBPASSWORD_file. My password was not being read with the lowercase _file variable name, but started working once I switched it to all caps.

It's relatively easy to spot and correct while troubleshooting, but still a bit of a snag if someone was following the documentation line for line.

1 Like

In docker-pi-hole repository, the README file shows the correct name:

I can confirm the Docs page is wrong. I will fix it.

Docs page is already fixed.

1 Like