Traefik无法通过Route 53获取Acme证书

时间:2019-02-20 21:58:14

标签: docker docker-compose amazon-route53 traefik

我在使用AWS Route 53配置Traefik和ACME证书时遇到了一些麻烦。我尝试了http和dns挑战都无济于事。它不断出现此错误:acme:呈现令牌时出错:route53:无法确定托管区域ID:NoCredentialProviders:链中没有有效的提供者

我在这里做错了什么?预先感谢。

httpChallenge错误(注意没有防火墙):

app_1  | time="2019-02-20T21:49:52Z" level=debug msg="Using HTTP Challenge provider."
app_1  | time="2019-02-20T21:50:04Z" level=error msg="Unable to obtain ACME certificate for domains \"monitor.example.net\" detected thanks to rule \"Host:monitor.example.net\" : unable to generate a certificate for the domains [monitor.example.net]: acme: Error -> One or more domains had a problem:\n[monitor.example.net] acme: error: 400 :: urn:ietf:params:acme:error:connection :: Fetching http://monitor.example.net/.well-known/acme-challenge/AwJq4WU0OKN943nyHW6e3jzirdsWw6QAeE-CXD7QRhQ: Timeout during connect (likely firewall problem), url: \n"

dnsChallenge错误:

app_1  | time="2019-02-20T21:18:26Z" level=debug msg="Try to challenge certificate for domain [monitor.example.net] founded in Host rule"
app_1  | time="2019-02-20T21:18:26Z" level=debug msg="Looking for provided certificate(s) to validate [\"monitor.example.net\"]..."
app_1  | time="2019-02-20T21:18:26Z" level=debug msg="Domains [\"monitor.example.net\"] need ACME certificates generation for domains \"monitor.example.net\"."
app_1  | time="2019-02-20T21:18:26Z" level=debug msg="Loading ACME certificates [monitor.example.net]..."
app_1  | time="2019-02-20T21:18:26Z" level=debug msg="Building ACME client..."
app_1  | time="2019-02-20T21:18:26Z" level=debug msg="https://acme-v02.api.letsencrypt.org/directory"
app_1  | time="2019-02-20T21:18:26Z" level=debug msg="Using DNS Challenge provider: route53"
app_1  | time="2019-02-20T21:18:27Z" level=error msg="Unable to obtain ACME certificate for domains \"monitor.example.net\" detected thanks to rule \"Host:monitor.example.net\" : unable to generate a certificate for the domains [monitor.example.net]: acme: Error -> One or more domains had a problem:\n[monitor.example.net] [monitor.example.net] acme: error presenting token: route53: failed to determine hosted zone ID: NoCredentialProviders: no valid providers in chain. Deprecated.\n\tFor verbose messaging see aws.Config.CredentialsChainVerboseErrors\n"

附加的docker-compose.yml

version: '3'

services:
  app:
    image: traefik:alpine
    restart: always
    ports:
      - 80:80
      - 443:443
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
      - ./traefik.toml:/traefik.toml 
      - ./acme.json:/acme.json
    labels:
      - traefik.frontend.rule=Host:monitor.example.net
      - traefik.port=8080
    networks:
      - web

networks:
  web:
    external: true

附加的traefik.toml

logLevel = "DEBUG"
defaultEntryPoints = ["http", "https"]

[entryPoints]
  [entryPoints.dashboard]
    address = ":8080"
    [entryPoints.dashboard.auth]
      [entryPoints.dashboard.auth.basic]
        users = ["admin:foobar"]
  [entryPoints.http]
    address = ":80"
#      [entryPoints.http.redirect]
#        entryPoint = "https"
  [entryPoints.https]
    address = ":443"
      [entryPoints.https.tls]

[api]
entrypoint="dashboard"

[acme]
email = "donotspam@me.com"
storage = "acme.json"
entryPoint = "https"
onHostRule = true
#  [acme.httpChallenge] #<--tried both httpChallenge and dnsChallenge
#  entryPoint = "http"
  [acme.dnsChallenge]
  provider = "route53"
  delayBeforeCheck = 0

[docker]
domain = "example.net"
watch = true
network = "web"

1 个答案:

答案 0 :(得分:1)

HTTP挑战要求端口80可以在Internet上访问。

对于DNS挑战,您需要定义凭据:

  

AWS_ACCESS_KEY_IDAWS_SECRET_ACCESS_KEY,[AWS_REGION,[AWS_HOSTED_ZONE_ID]或已配置的用户/实例IAM配置文件。   https://docs.traefik.io/configuration/acme/#provider