Search code examples
dockertraefiktoml

Traefik authentication failed


Here's my goal, I would like to set up a reverse-proxy on my server. I used to use Haproxy for this job but I wanted to try Traefik.

First I wanted to get the Traefik's dashboard page. It almost works, a pop-up appears to enter my credentials but it always failed even if I'm sure that credentials are correct.

Here's my traefik.toml

defaultEntryPoints = ["http", "https"]
# Web section is for the dashboard interface
[web]
address = ":8080"
[web.auth.basic]
  users = ["admin:aaa"]

# entryPoints section configures the addresses that Traefik and the proxied containers can listen on
[entryPoints]
  [entryPoints.http]
  address = ":80"
    [entryPoints.http.redirect] 
    entryPoint = "https"
[entryPoints.https]
address = ":443"
  [entryPoints.https.tls]

Here's my docker command to run the container

docker run -d \
   -v /var/run/docker.sock:/var/run/docker.sock \
   -v $PWD/traefik.toml:/traefik.toml \
   -v $PWD/acme.json:/acme.json \
   -p 80:80 \
   -p 443:443 \
   -l traefik.frontend.rule=Host:monitor.firelabs.fr \
   -l traefik.port=8080 \
   --network proxy \
   --name traefik \
   traefik:1.3.6-alpine --docker --logLevel=DEBUG    

As you can see my credentials are admin:aaa, whenever I try to enter them into the dialog box it send me this message :

time="2017-11-19T13:28:22Z" level=debug msg="Basic auth success..."

As you can see it's a very basic configuration only to start to work with Traefik. So I don't know where I'm wrong, I looked the doc about the web section configuration and it doesn't seem to be wrong ...

Do I miss something in the typo ?


Solution

  • Traefik stores passwords as an md5 hash, not in plain text. You can use htpasswd to generate this:

    $ htpasswd -nb admin aaa
    admin:$apr1$DWU.kdcZ$iqwGcFl9bfwp1WfKHE2yl.
    

    So your traefik.toml file would look like:

    [web.auth.basic]
    users = "admin:$apr1$DWU.kdcZ$iqwGcFl9bfwp1WfKHE2yl."