gpt4 book ai didi

docker - Traefik 身份验证失败

转载 作者:行者123 更新时间:2023-12-02 05:41:40 26 4
gpt4 key购买 nike

这是我的目标,我想在我的服务器上设置一个反向代理。我曾经使用 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/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com