【问题标题】:Let's Encrypt with Traefik让我们用 Traefik 加密
【发布时间】:2018-02-08 12:53:30
【问题描述】:

我尝试使用 Let's Encrypt 和 Traefik,但这里是 Traefik 的日志:

Looking for provided certificate to validate [rancher.foo.bar]...
No provided certificate found for domains [rancher.foo.bar], get ACME certificate.
Looking for an existing ACME challenge for rancher.foo.bar...
No certificate found or generated for rancher.foo.bar
http2: server: error reading preface from client 1.2.3.4:60876: remote error: tls: unknown certificate authority

这是我的配置:

traefikLogsFile = "/tmp/traefik.log"
logLevel = "DEBUG" # DEBUG, INFO, WARN, ERROR, FATAL, PANIC
[accessLog]
filePath = "/tmp/access.log"


[entryPoints]
  [entryPoints.http]
  address = ":80"
    [entryPoints.https]
    address = ":443"
      [entryPoints.https.tls]

# Enable ACME (Let's Encrypt): automatic SSL.
[acme]
email = "foo@foo.bar"
storage = "/tmp/acme.json"
entryPoint = "https"
onHostRule = true
[acme.httpChallenge]
entryPoint = "http"


[api]
entryPoint = "traefik"
dashboard = true


[docker]
endpoint = "unix:///var/run/docker.sock"
domain = "foo.bar"
watch = true
exposedbydefault = true
usebindportip = true
swarmmode = false

Traefik 提供者:

{
  "docker": {
    "backends": {
      "backend-rancher": {
        "servers": {
          "server-rancher": {
            "url": "http://172.17.0.3:8080",
            "weight": 0
          }
        },
        "loadBalancer": {
          "method": "wrr"
        }
      }
    },
    "frontends": {
      "frontend-Host-rancher-foo-bar-0": {
        "entryPoints": [
          "http"
        ],
        "backend": "backend-rancher",
        "routes": {
          "route-frontend-Host-rancher-foo-bar-0": {
            "rule": "Host:rancher.foo.bar"
          }
        },
        "passHostHeader": true,
        "priority": 0,
        "basicAuth": []
      }
    }
  }
}

怎么了?
谢谢

【问题讨论】:

  • 其实我们需要更多的日志来理解你的问题。日志在这里说的是,您的证书从未生成过。您启用了 onHostRule,您是否有一个带有 foo.bar.baz 主机规则的后端?
  • 我更新了我的消息并添加了 traefik 提供者
  • 您能添加完整的 TOML 配置吗?
  • 好的,我更新了我的配置

标签: lets-encrypt traefik


【解决方案1】:

您使用 onHostRule,这将为每个带有 Host 规则的前端请求 Let's Encrypt 的证书。但是您需要将您的前端分配给 ACME 的 TLS 入口点。 (这里https)。

所以在你的 docker 标签中,你需要在 frontend.entrypoint 上添加https

【讨论】:

  • 好吧,我这样用成功了:--label traefik.protocol=http --label traefik.frontend.entryPoints=https
【解决方案2】:

你能补充一下吗:

defaultEntryPoints = ["http", "https"]

在 TOML 文件的顶部。

【讨论】:

  • 我做到了,结果一样。
猜你喜欢
  • 2019-02-21
  • 1970-01-01
  • 2021-09-08
  • 1970-01-01
  • 2021-10-22
  • 1970-01-01
  • 2018-04-23
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多