创建TLS配置(v1.3.7)时出错 [英] Error creating TLS config (v1.3.7)

查看:78
本文介绍了创建TLS配置(v1.3.7)时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经摆弄Traefik几个小时了,发现它非常有趣。但是,我遇到了一个我自己似乎无法解决的问题。

I've been fiddling with Traefik for a few hours and find it extremely interesting. However, I've ran into a problem that I can't seem to solve by myself.

这是一个非常简单的设置,只是尝试测试HTTP到HTTPS重定向和我的SSL证书。

It's a very simple setup, just trying to test the HTTP to HTTPS redirection and my SSL certificates.

我有以下 docker-compose.yml

version: '2'

    services:
      traefik:
        image: traefik:v1.3.7-alpine
        ports:
          - "80:80"
          - "443:443"
          - "8080:8080"
        volumes:
          - /var/run/docker.sock:/var/run/docker.sock:z
          - /opt/dockerapp/rocketchat/traefik/traefik.toml:/etc/traefik/traefik.toml:ro,z
          - /opt/dockerapp/rocketchat/traefik/ssl:/etc/traefik/ssl/:ro,z
        command: --logLevel=DEBUG

我的 traefik.toml

defaultEntryPoints = ["http", "https"]
[entryPoints]
  [entryPoints.http]
  address = ":80"
    [entryPoints.http.redirect]
    entryPoint = "https"
  [entryPoints.https]
  address = ":443"
    [entryPoints.https.tls]
      [[entryPoints.https.tls.certificates]]
        CertFile = "ssl/mycert.pem"
        KeyFile = "ssl/mycert.key"
[docker]
domain = "docker.local"
watch = true

[web]
address = ":8080"

但是,当我尝试运行它时:

However, when I try to run it:

docker-compose up
Starting rocketchat_traefik_1
Attaching to rocketchat_traefik_1
traefik_1  | time="2017-08-29T13:45:55Z" level=info msg="Traefik version v1.3.7 built on 2017-08-25_08:56:06PM" 
traefik_1  | time="2017-08-29T13:45:55Z" level=info msg="Using TOML configuration file /etc/traefik/traefik.toml" 
traefik_1  | time="2017-08-29T13:45:55Z" level=debug msg="Global configuration loaded {"GraceTimeOut":10000000000,"Debug":false,"CheckNewVersion":true,"AccessLogsFile":"","TraefikLogsFile":"","LogLevel":"DEBUG","EntryPoints":{"http":{"Network":"","Address":":80","TLS":null,"Redirect":{"EntryPoint":"https","Regex":"","Replacement":""},"Auth":null,"Compress":false},"https":{"Network":"","Address":":443","TLS":{"MinVersion":"","CipherSuites":null,"Certificates":[{"CertFile":"ssl/mycert.pem","KeyFile":"ssl/mycert.key"}],"ClientCAFiles":null},"Redirect":null,"Auth":null,"Compress":false}},"Cluster":null,"Constraints":[],"ACME":null,"DefaultEntryPoints":["http","https"],"ProvidersThrottleDuration":2000000000,"MaxIdleConnsPerHost":200,"IdleTimeout":180000000000,"InsecureSkipVerify":false,"Retry":null,"HealthCheck":{"Interval":30000000000},"Docker":{"Watch":true,"Filename":"","Constraints":null,"Endpoint":"unix:///var/run/docker.sock","Domain":"docker.local","TLS":null,"ExposedByDefault":true,"UseBindPortIP":false,"SwarmMode":false},"File":null,"Web":{"Address":":8080","CertFile":"","KeyFile":"","ReadOnly":false,"Statistics":null,"Metrics":null,"Path":"","Auth":null},"Marathon":null,"Consul":null,"ConsulCatalog":null,"Etcd":null,"Zookeeper":null,"Boltdb":null,"Kubernetes":null,"Mesos":null,"Eureka":null,"ECS":null,"Rancher":null,"DynamoDB":null}" 
traefik_1  | time="2017-08-29T13:45:55Z" level=info msg="Preparing server http &{Network: Address::80 TLS:<nil> Redirect:0xc4202f4ea0 Auth:<nil> Compress:false}" 
traefik_1  | time="2017-08-29T13:45:55Z" level=info msg="Preparing server https &{Network: Address::443 TLS:0xc42032c000 Redirect:<nil> Auth:<nil> Compress:false}" 
traefik_1  | time="2017-08-29T13:45:55Z" level=error msg="Error creating TLS config: tls: failed to find any PEM data in certificate input" 
traefik_1  | time="2017-08-29T13:45:55Z" level=fatal msg="Error preparing server: tls: failed to find any PEM data in certificate input" 
rocketchat_traefik_1 exited with code 1

这似乎表明我的证书有问题。我肯定知道证书是正确的,这是我们已在Apache和NGINX上成功使用的通配符证书。

Which seems to indicate there's something wrong with my certificate. I know for sure the certificate is fine, it's a wildcard certificate we're using successfully with Apache and NGINX.

我已经检查了可能的答案,但证书和私钥均匹配这些参数。

I've already checked this possible answer, but both the certificate and the private key match those parameters.

任何人都能说清楚吗?

谢谢!

推荐答案

好像traefik找不到您的证书。
尝试为CertFile和KeyFile放置绝对路径,例如:

Looks like traefik is not finding your certificates. Try putting an absolute path for CertFile and KeyFile such as:

defaultEntryPoints = ["http", "https"]
[entryPoints]
  [entryPoints.http]
  address = ":80"
    [entryPoints.http.redirect]
    entryPoint = "https"
  [entryPoints.https]
  address = ":443"
    [entryPoints.https.tls]
      [[entryPoints.https.tls.certificates]]
        CertFile = "/etc/traefik/ssl/mycert.pem"
        KeyFile = "/etc/traefik/ssl/mycert.key"
[docker]
domain = "docker.local"
watch = true

[web]
address = ":8080"

这篇关于创建TLS配置(v1.3.7)时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆