gregtwallace / certwarden

Cert Warden is a centralized ACME Client. It provides an API for certificate consumers to fetch their individual keys and certs with API keys.
https://www.certwarden.com/
Other
176 stars 6 forks source link

Cloudflare DNS provider issue #14

Closed mhhakim closed 1 year ago

mhhakim commented 1 year ago

Hi, I am having issue on configuring Cloudflare DNS challenge as provider. When I use “account” credential (email & global key), it works fine. But when I try to configure using API token, I get the following error.

error   challenges/service.go:131   failed to configure dns 01 cloudflare (cloudflare config error: no domains (zones) found)
error   app/run.go:271  failed to configure app challenges (cloudflare config error: no domains (zones) found)
error   app/run.go:40   failed to create app (cloudflare config error: no domains (zones) found)

My API token is fine, I checked by making direct curl request to Cloudflare API endpoint. Here is the config format I am using:

# Challenge Providers
challenges:
  dns_checker:
    skip_check_wait_seconds: null
    dns_services:
      - primary_ip: 1.1.1.1
        secondary_ip: 1.0.0.1
      - primary_ip: 9.9.9.9
        secondary_ip: 149.112.112.112
      - primary_ip: 8.8.8.8
        secondary_ip: 8.8.4.4
  providers:
    http_01_internal:
      enable: false
      port: 81
    dns_01_cloudflare:
      enable: true
      tokens:
        - api_token: API_Token
          zone_names:
            - domain.tld

Any help is appreciated.

Thanks

gregtwallace commented 1 year ago

This appears to be the correct format. When you created the token in cloudflare, did you ensure that the Permissions on the token included DNS Edit and that Zone Resources had Include specific zone <desired tld> ?

gregtwallace commented 1 year ago

I found the problem . I'm sorry, the sample config has a typo in the yaml.

tokens should be api_tokens

e.g.

dns_01_cloudflare:
  enable: true
  api_tokens:        <----- issue
    - api_token: API_Token
      zone_names:
        - domain.tld