Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to login to Traefik Dashboard even after providing Correct password in Basic Auth. #1002

Closed
AnkurThakur opened this issue Nov 22, 2022 · 7 comments
Labels

Comments

@AnkurThakur
Copy link

Description of the issue

Unable to login to Traefik Dashboard even after providing Correct password in Basic Auth.

Context information (for bug reports)

During the installation, when we setup Traefik, it uses the Docker Environment file traefik.env. It contains HASHED_PASSWORD which is used for Traefik login. It contains the encrypted password, e.g $apr1$TzHiJVlu$d3bQf1d8IgV2X2x625GMB1. The $ is considered as variable by Compose which results in incorrect password.

Steps to reproduce the issue

  1. After setting up the traefik.env file, try installing Traefik using Docker Compose and it will throw warnings.

Observed result

$ docker compose --project-name traefik \
  --env-file ~/erp_next_ops/traefik.env \
  -f docs/compose/compose.traefik.yaml up -d
WARN[0000] The "apr1" variable is not set. Defaulting to a blank string. 
WARN[0000] The "TzHiJVlu" variable is not set. Defaulting to a blank string. 
WARN[0000] The "d3bQf1d8IgV2X2x625GMB1" variable is not set. Defaulting to a blank string. 
WARN[0000] The "apr1" variable is not set. Defaulting to a blank string. 
WARN[0000] The "TzHiJVlu" variable is not set. Defaulting to a blank string. 
WARN[0000] The "d3bQf1d8IgV2X2x625GMB1" variable is not set. Defaulting to a blank string. 
WARN[0000] The "apr1" variable is not set. Defaulting to a blank string. 
WARN[0000] The "TzHiJVlu" variable is not set. Defaulting to a blank string. 
WARN[0000] The "d3bQf1d8IgV2X2x625GMB1" variable is not set. Defaulting to a blank string. 
[+] Running 1/1
 ⠿ Container traefik-traefik-1  Started

Expected result

$ docker compose --project-name traefik   --env-file ~/erp_next_ops/traefik.env   -f docs/compose/compose.traefik.yaml up -d
[+] Running 1/1
 ⠿ Container traefik-traefik-1  Started
@AnkurThakur
Copy link
Author

@revant
Copy link
Collaborator

revant commented Nov 22, 2022

send pr
i don't use compose files

I'm using helm chart

@felixalguzman
Copy link

@AnkurThakur thanks for your solution, but I can't access traefik even with this change, i followed the steps from tutorial. Is there anything I am missing ?

@kurtrottmann
Copy link

It works for me, but I have to use: openssl passwd -apr1 changeit | sed 's/\$/\\$$/g' instead of openssl passwd -apr1 changeit | sed 's/\$/\\\$/g' when I create the hashed password for Traefik.

@revant
Copy link
Collaborator

revant commented Nov 30, 2022

forget environment variables

hard code it in yaml and replace $ with $$

example.

❯ openssl passwd -apr1 "Secret"
$apr1$lou.E/tO$tcnqp1gKiz5G/EVvhIQtD0

$apr1$lou.E/tO$tcnqp1gKiz5G/EVvhIQtD0 will become $$apr1$$lou.E/tO$$tcnqp1gKiz5G/EVvhIQtD0

In some cases I don't even expose and load balance traefik dashboard to public with basic auth.

@revant
Copy link
Collaborator

revant commented Jan 9, 2023

re open new if needed, closing this.

@revant revant closed this as completed Jan 9, 2023
@sinhpn92
Copy link

forget environment variables

hard code it in yaml and replace $ with $$

example.

❯ openssl passwd -apr1 "Secret"
$apr1$lou.E/tO$tcnqp1gKiz5G/EVvhIQtD0

$apr1$lou.E/tO$tcnqp1gKiz5G/EVvhIQtD0 will become $$apr1$$lou.E/tO$$tcnqp1gKiz5G/EVvhIQtD0

In some cases I don't even expose and load balance traefik dashboard to public with basic auth.

Thank you so much. It's working.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants