【发布时间】:2019-06-17 22:25:18
【问题描述】:
Traefik 和 Docker 的新手。我准备了一份自签名证书,使用:
openssl req -x509 -newkey rsa:4096 -keyout www.example.co.uk.key -out www.example.co.uk.crt-days 365
在我的 traefik.toml 文件中,我有:
[entryPoints]
[entryPoints.http]
address = ":80"
[entryPoints.https]
address = ":443"
[entryPoints.https.tls]
[[entryPoints.https.tls.certificates]]
certFile = "certs/www.example.co.uk.crt"
keyFile = "certs/www.example.co.uk.key"
但是这会导致:
traefik | time="2019-06-17T22:11:17Z" level=debug msg="Serving default cert for request: \"www.example.co.uk\""
traefik | time="2019-06-17T22:11:17Z" level=debug msg="http: TLS handshake error from 172.20.0.1:57770: tls: no certificates configured"
如果我省略了证书定义,那么 traefik.toml 读取为:
[entryPoints]
[entryPoints.http]
address = ":80"
[entryPoints.https]
address = ":443"
[entryPoints.https.tls]
# [[entryPoints.https.tls.certificates]]
# certFile = "certs/www.example.co.uk.crt"
# keyFile = "certs/www.example.co.uk.key"
我得到了 Traefik 提供的虚拟证书,它工作得很好,但我只是想弄清楚为什么我定义的证书没有被使用。
在我的 docker-compose.yml 中,我相信我已经安装了正确的卷:
volumes:
- /var/run/docker.sock:/var/run/docker.sock # So that Traefik can listen to the Docker events
- ./traefik.toml:/traefik.toml
- /var/www/docker/certs:/certs
相对于我的docker-compose.yml 和traefik.toml 文件,证书位于certs/。权限似乎都由 root 拥有 - crt 拥有 644 和 key 拥有 600。
如何使用自签名证书而不是 Traefiks 默认值?
【问题讨论】:
标签: docker ssl openssl traefik