这是我的目标,我想在我的服务器上设置一个反向代理。我曾经使用 Haproxy 来完成这项工作,但我想尝试使用 Traefik。

首先,我想获得 Traefik 的仪表板页面。它几乎可以工作,弹出窗口似乎输入了我的凭据,但即使我确定凭据正确,它也总是失败。

这是我的 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]

这是我运行容器的 docker 命令
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

如您所见,我的凭据是 admin:aaa,每当我尝试将它们输入对话框时,它都会向我发送以下消息:
time="2017-11-19T13:28:22Z" level=debug msg="Basic auth success..."

如您所见,这是一个非常基本的配置,仅用于开始使用 Traefik。所以我不知道我错在哪里,我查看了关于 web 部分配置的文档,它似乎没有错......

我错过了错字中的某些内容吗?

最佳答案

Traefik 将密码存储为 md5 哈希,而不是纯文本。您可以使用 htpasswd 来生成:

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

所以你的 traefik.toml 文件看起来像:
[web.auth.basic]
users = "admin:$apr1$DWU.kdcZ$iqwGcFl9bfwp1WfKHE2yl."

关于docker - Traefik 身份验证失败,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/47376909/

10-11 09:27
查看更多