【发布时间】:2020-12-10 13:25:02
【问题描述】:
我已经尝试解决这个问题好几天了,但没有任何运气:
情况:
我在 AWS 上有一个使用 Fargate 的 ECS 集群,该集群包含一个 Traefick 2.3.4 实例和其他容器。我使用 Traefick 作为反向代理将请求转发到其他容器。 使用 HTTP 一切正常,所以我决定添加到 Traefick 的安全连接。我已经尝试了在 Internet 上可以找到的所有内容,但没有任何效果,当我尝试使用 curl 连接到指定域时,它返回:
curl: (35) error:1408F10B:SSL routines:ssl3_get_record:wrong version number
这里有一些我做过的测试:
traefick.yml:
log:
level: DEBUG
api:
dashboard: true
entryPoints:
web:
address: :80
http:
redirections:
entryPoint:
to: websecure
scheme: https
websecure:
address: ":443"
providers:
ecs:
clusters:
- tools-cluster
region: eu-west-2
exposedByDefault: false
certificatesResolvers:
letsencrypt:
acme:
caServer: https://acme-staging-v02.api.letsencrypt.org/directory
email: #########################
storage: acme.json
httpchallenge:
entrypoint: web
标签:
"dockerLabels": {
"traefik.enable": "true",
"traefik.http.services.traefik.loadbalancer.server.port": "8080",
"traefik.http.routers.traefik.rule": "Host(`${host}`)",
"traefik.http.routers.traefik.entrypoints": "websecure",
"traefik.http.routers.traefik.tls.certresolver": "letsencrypt",
"traefik.http.routers.traefik.service": "api@internal"
}
此版本返回此错误:
rror: 400 :: urn:ietf:params:acme:error:connection :: Fetching https://traefik.baaluu.com/.well-known/acme-challenge/td8IdOvJ1_GkigY-jPYaA4YsgeiS5FUiuUS-avbpsuY: Error getting validation data, url
它尝试检索该数据,但它无法检索,因为它被重定向到 https 并且它无法检索,因为 https 不起作用,我也尝试过不使用自动重定向,它返回类似的错误,它无法检索该数据。
但是按照这个guide它应该可以正常工作。
所以我决定使用以下配置转移到 dnsChallenge: Traefick.yml
log:
level: DEBUG
api:
dashboard: true
entryPoints:
web:
address: :80
websecure:
address: ":443"
providers:
ecs:
clusters:
- tools-cluster
region: eu-west-2
exposedByDefault: false
certificatesResolvers:
letsencrypt:
acme:
caServer: https://acme-staging-v02.api.letsencrypt.org/directory
email: ######################
storage: acme.json
dnsChallenge:
provider: route53
delayBeforeCheck: 3
和以前一样的标签:
"dockerLabels": {
"traefik.enable": "true",
"traefik.http.services.traefik.loadbalancer.server.port": "8080",
"traefik.http.routers.traefik.rule": "Host(`${host}`)",
"traefik.http.routers.traefik.entrypoints": "websecure",
"traefik.http.routers.traefik.tls.certresolver": "letsencrypt",
"traefik.http.routers.traefik.service": "api@internal"
}
仍然没有,我在日志中有这个:AuthURL: https://acme-staging-v02.api.letsencrypt.org/acme/authz-v3/170242259"
该网址包含:
{
"type": "urn:ietf:params:acme:error:malformed",
"detail": "Method not allowed",
"status": 405
}
我做的最新测试是删除暂存ca服务器:
log:
level: DEBUG
api:
dashboard: true
entryPoints:
web:
address: :80
websecure:
address: :443
providers:
ecs:
clusters:
- tools-cluster
region: eu-west-2
exposedByDefault: false
certificatesResolvers:
letsencrypt:
acme:
email: ###############
storage: acme.json
dnsChallenge:
provider: route53
delayBeforeCheck: 2
ssl 仍然无法工作,但我在日志中看不到任何错误消息:这是我收到的关于证书的最后一条消息:
Try to challenge certificate for domain [traefik.baaluu.com] found in HostSNI rule" providerName=letsencrypt.acme routerName=traefik@ecs rule="Host(`traefik.baaluu.com`)"
之后就没有更多了: (我很抱歉这张照片,但我找不到从 ECS 中提取该日志的方法)
其他容器仍然可以通过 http 协议访问。
如果我尝试使用 telnet 连接到它,我可以访问该服务:
telnet traefik.baaluu.com 443
Trying 3.8.30.164...
Connected to traefik-1547500306.eu-west-2.elb.amazonaws.com.
Escape character is '^]'.
80后也是如此
在日志中看起来更好,我也发现了这个
retry due to: acme: error: 400 :: POST :: https://acme-v02.api.letsencrypt.org/acme/chall-v3/9205340157/1Wh0tQ :: urn:ietf:params:acme:error:badNonce :: JWS has an invalid anti-replay nonce: \"0004cbkFTGjCALFGDYOmhruMl6_F_fRSj33cOMvdpx5Xd2M\", url: "
time="2020-12-10T13:08:21Z" level=debug msg="legolog: [INFO] retry due to: acme: error: 400 :: POST :: https://acme-v02.api.letsencrypt.org/acme/chall-v3/9205340157/1Wh0tQ :: urn:ietf:params:acme:error:badNonce :: JWS has an invalid anti-replay nonce: \"0004cbkFTGjCALFGDYOmhruMl6_F_fRSj33cOMvdpx5Xd2M\", url: "
包含此网址:https://acme-v02.api.letsencrypt.org/acme/chall-v3/9205340157/1Wh0tQ
{
"type": "dns-01",
"status": "valid",
"url": "https://acme-v02.api.letsencrypt.org/acme/chall-v3/9205340157/1Wh0tQ",
"token": "44R4gD4_ZmemiCn5rtkqJyWOcjoj09sEgobUvZLH6yc",
"validationRecord": [
{
"hostname": "traefik.baaluu.com"
}
]
}
所以我认为 ssl 已正确生成,但我不确定。
有什么想法或建议吗?
提前致谢。
H2K
编辑:
我已经从仪表板中删除了 ssl,并将它放在另一个容器上,现在进入仪表板内部我可以看到:
所以我认为 ssl 正在为该域工作,但我仍然无法连接到它。
编辑 2:
如果我使用 telnet 连接到端口 443 上的那个 url 并且我请求可以看到内容的页面:
telnet xxxxxxxxxxxxxxxxx 443
Trying 3.10.148.201...
Connected to traefik-1547500306.eu-west-2.elb.amazonaws.com.
Escape character is '^]'.
GET /index.html HTTP/1.1
Host: xxxxxxxxxxxxxxxxx
并且页面的内容出现了,所以不是负载均衡问题或路由问题,看来我可以使用443到达容器,只是ssl不存在。就像有 2 个 http 端口,并且两者的行为方式相同。此刻的443就像一个80端口。
【问题讨论】:
-
你有没有得到这个?我也遇到了同样的问题
标签: ssl amazon-ecs lets-encrypt traefik aws-fargate