【问题标题】:Traefik https backend communication causes x509: certificate is valid for 127.0.0.1 not <Container IP>Traefik https 后端通信导致 x509: certificate is valid for 127.0.0.1 not <Container IP>
【发布时间】:2019-02-07 10:47:53
【问题描述】:

使用 Traefik,我有一个 https 后端,它是一个在 https 模式下运行 webpack devserver 的 docker 容器 - 即 devserver 正在生成一个自签名的 ssl 证书。

访问时我得到 x509:证书对 127.0.0.1 有效,而不是 #backendContainerIP#。

我尝试在 Traefik 服务上设置标签“traefik.frontend.auth.forward.tls.insecureSkipVerify=true”,希望它会忽略证书有效性,但没有奏效。

这是撰写文件的相关摘录:-

traefik:
    image: traefik:1.7.8-alpine
    command: --docker --logLevel=DEBUG
    ports:
      - 86:443
    volumes:
      - <traefikConfigFilePath>:/traefik.toml
      - <traefikAcmeFilePath>:/acme.json
      - /var/run/docker.sock:/var/run/docker.sock
    labels:
      - traefik.frontend.auth.forward.tls.insecureSkipVerify=true
    networks:
      - <dockerNetwork>
    container_name: traefik
    depends_on:
      - portal

portal:
    build: <github link>
    expose:
      - <portalPort>
    labels:
      - traefik.backend=portal
      - traefik.enable=true
      - traefik.docker.network=<dockerNetwork>
      - traefik.port=<portalPort>
      - traefik.protocol=https
      - traefik.frontend.rule=PathPrefixStrip:/
    networks:
      - <dockerNetwork>

这里是相关的toml文件

defaultEntryPoints = ["http", "https"]

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

[acme]
email=<emailaddress>
storage="acme.json"
entryPoint="https"
onHostRule=true
onDemand=false
acmeLogging=true

[docker]
endpoint = "unix:///var/run/docker.sock"
watch = true
exposedByDefault = false

任何帮助将不胜感激。谢谢,

【问题讨论】:

  • 您可能需要设置一个 SAN,在证书上保存您的
  • 容器IP不是静态的,怎么办?或者请告诉我如何设置 SAN。正如我看到的所有示例都给出了域而不是 IP
  • 标签traefik.frontend.auth.forward.tls.insecureSkipVerify 用于forward authentication

标签: docker ssl traefik


【解决方案1】:

我通过在 toml 的顶层添加 insecureSkipVerify= true 使其工作,如下所示:-

toml 文件:-

...
insecureSkipVerify= true

defaultEntryPoints = ["http", "https"]

[entryPoints]
    [entryPoints.http]
....

找到那个是非常痛苦的!

【讨论】:

  • 确保它真的在顶部...我在[traefikLog]之后得到它然后它没有被识别
猜你喜欢
  • 2021-07-09
  • 1970-01-01
  • 2017-03-03
  • 1970-01-01
  • 1970-01-01
  • 2023-02-23
  • 2014-11-23
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多