【问题标题】:Traefik acme timeoutsTraefik 极致超时
【发布时间】:2019-09-11 15:03:08
【问题描述】:

我试图让 Traefik 在 AKS 中正常工作。总的来说,它工作正常,但我无法让 ACME 证书工作。下面附上了我的 traefik.toml 配置,我找不到任何奇怪的东西。

在这个用例中提到的 3 个域是虚拟的,实际上存在并回复

# traefik.toml
logLevel = "info"
defaultEntryPoints = ["http","https"]
[entryPoints]
  [entryPoints.http]
  address = ":80"
  compress = true
  [entryPoints.https]
  address = ":443"
  compress = true
    [entryPoints.https.tls]
      [[entryPoints.https.tls.certificates]]
      CertFile = "/ssl/tls.crt"
      KeyFile = "/ssl/tls.key"
  [entryPoints.traefik]
  address = ":8080"
[ping]
entryPoint = "http"
[kubernetes]
[traefikLog]
  format = "json"
[acme]
KeyType = "RSA4096"
email = "pimjansen@domain.com"
storage = "/acme/acme.json"
entryPoint = "https"
onHostRule = true
acmeLogging = true
  [acme.httpChallenge]
  entryPoint = "http"
[[acme.domains]]
   main = "traefik.domain.com"
[[acme.domains]]
   main = "elasticsearch.domain.com"
[[acme.domains]]
   main = "kibana.domain.com"
[api]
  entryPoint = "traefik"
  dashboard = true

我收到的实际错误是这样的:

{"level":"error","msg":"Unable to obtain ACME certificate for domains \"traefik.hardstyletop40.com\" : unable to generate a certificate for the domains [traefik.domain.com]: acme: Error -\u003e One or more domains had a problem:\n[traefik.domain.com] acme: error: 400 :: urn:ietf:params:acme:error:connection :: Fetching http://traefik.hardstyletop40.com/.well-known/acme-challenge/mYkyJzIM-6Y2UIknhXpCkUUTZWjzsAeMuqx7eDCZloY: Error getting validation data, url: \n","time":"2019-09-11T14:47:13Z"}

关于挑战的详细信息:

"challenges": [
    {
      "type": "http-01",
      "status": "invalid",
      "error": {
        "type": "urn:ietf:params:acme:error:connection",
        "detail": "Fetching http://traefik.domain.com/.well-known/acme-challenge/mYkyJzIM-6Y2UIknhXpCkUUTZWjzsAeMuqx7eDCZloY: Error getting validation data",
        "status": 400
      },
      "url": "https://acme-v02.api.letsencrypt.org/acme/chall-v3/293838266/LPH2sA",
      "token": "mYkyJzIM-6Y2UIknhXpCkUUTZWjzsAeMuqx7eDCZloY",
      "validationRecord": [
        {
          "url": "http://traefik.domain.com/.well-known/acme-challenge/mYkyJzIM-6Y2UIknhXpCkUUTZWjzsAeMuqx7eDCZloY",
          "hostname": "traefik.hardstyletop40.com",
          "port": "80",
          "addressesResolved": [
            "13.79.159.165"
          ],
          "addressUsed": "13.79.159.165"
        }
      ]
    },

提前致谢

【问题讨论】:

    标签: lets-encrypt traefik


    【解决方案1】:

    letsencrypt 的工作原理是将文件放在指定网络服务器上的 .well-known 目录中。 你是说他们是假的,所以你可能在本地做?无论如何,如果在网络服务器上找不到自动生成的文件,则无法验证证书是从“拥有”域请求的。

    流程的工作方式大大简化:

    1. letsencrypt -> 生成文件名:abc133......
    2. letsencrypt -> 在网络服务器配置中找到所提供域的 webroot
    3. letsencrypt -> 将文件复制到给定域的 webroot 中的 .well-known
    4. letsencrypt -> 向letsencrypt.org 发送一个带有文件名和域名的webrequest
    5. letsencrypt.org -> 尝试从通过 dns 查找的给定域请求文件
    6. letsencrypt.org -> 成功请求文件并验证,输出证书
    7. letsencrypt -> 读取证书并复制到证书文件夹,创建几个符号链接
    8. letsencrypt -> 根据需要修改网络服务器配置

    现在,如果您正在使用虚拟域而不是在实时服务器上,上述过程将在第 3 步失败,这将导致第 5 步失败,这将导致您遇到错误。

    如果您无法在网络服务器上运行命令来生成证书,则另一种方法是设置 DNS 记录密钥进行验证。

    sudo certbot -d your.dummy.com --manual --preferred-challenges dns certonly
    

    这将为您提供一个代码,您需要将其放入域服务器上的 txt 记录中

    完成此操作后,您在letsencrypt应用程序中确认您已设置记录并继续。

    简而言之,如果你不能在webserver上运行命令生成证书,或者不能修改dns记录,你就无法通过letsencrypt获取证书。

    【讨论】:

    • 是的,我知道流程是如何工作的,并让它与 certmanager 一起工作,但是通过 Traefik,这个主题不是关于它的。而且似乎有更多人对此有疑问
    • @Dirkos 仍然必须遵守流程,certbot 需要一种验证方式,因此 DNS 也适用于您。如果您无权访问 DNS 记录,您是否尝试过 stackoverflow.com/questions/50575675/…
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-02-20
    • 1970-01-01
    • 2018-03-23
    • 2016-05-23
    相关资源
    最近更新 更多