I'm having a problem getting dashboard and metrics authentication to work when using an external usersFile created using htpasswd
If I manually set the username and password in the traefik.yml file authentication works fine. However, when I swap that for usersFile I keep getting error 401 unauthorised in prometheus and prompt to enter username and password for the dashboard page.
I am generating the password using the following command:
echo $(htpasswd -nB $input) | sed -e s/\\$/\\$\\$/g > $DIR/.passwd
Here is the relevant part in the config.yml file for Traefik
middlewares: auth-dashboard: basicAuth: usersFile: "/etc/traefik/.passwd" # users: # - "admin:$apr1$skWr6iM7$ybokdopHX/dZvkAlqgmHk0"
I inspected the container and the password file is visible, permissions are correct. I tested this and got error 404 when the file name is changed. If I uncomment users and the subsequent line I can access the dashboard page. The same goes for prometheus but if I use a usersFile it doesn't work.
How can I fix this?