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

Error with DNS Cloudflare Challenge Method #22

Closed AleksandrMelnik closed 11 months ago

AleksandrMelnik commented 11 months ago

When I try to issue a certificate using DNS Cloudflare, I get the following error:

8/4/2023, 9:17:11 AM, error, orders/worker.go:130, dns01cloudflare domain name not configured (restart lego if zone was just added to an account)
8/4/2023, 9:17:11 AM, error, challenges/solver.go:40, dns01cloudflare domain name not configured (restart lego if zone was just added to an account)

But when the server starts, everything is OK and the domain is displayed:

8/4/2023, 9:14:31 AM, info, dns01cloudflare/service.go:54, dns01cloudflare configured domains: [dteam.in.ua]

gregtwallace commented 11 months ago

This is due to the zone lookup method which currently only matches based on the last two parts of the resource name. In your case, it is looking for zone "in.ua" instead of "dteam.in.ua", which causes the look up to fail.

I had not considered this case but it should be easy to fix. In the meantime, if you're in a hurry you should be able to use the acme.sh method configured for Cloudflare.

Thanks for reporting this.

gregtwallace commented 11 months ago

Fix merged.

Please build master branch and test to confirm and let me know: https://github.com/gregtwallace/legocerthub-backend

AleksandrMelnik commented 11 months ago

Thank you very much for the revision. Everything works correctly.

Regarding scripts acme.sh could you please add instructions for users. Where to take the keys how to use it.

gregtwallace commented 11 months ago

I am working on revising the acme.sh default config comments. Does this make sense to you?

    dns_01_acme_sh:
      # enable acme.sh method?
      enable: false
      # path to the acme.sh script. /dnsapi subfolder must also exist and contain
      # the script for the relevant dns provider (hook script)
      # acme.sh is installed with LeGo by default at the default path so
      # you should not need to change this
      acme_sh_path: ./scripts/acme.sh
      # for environment and dns_hook, see:
      # https://github.com/acmesh-official/acme.sh/wiki/dnsapi
      # environment vars are the 'export' items listed at the above URL for your
      # specific dns provider
      environment:
        - 'MY_EXPORT_VAR=some_value'
        - 'ANOTHER_EXPORT_ENV=another_value'
      # dns_hook is the text after the '--dns' flag in the command listed after the
      # text 'let's issue a cert now:' for your specific dns provider
      dns_hook: dns_cf
gregtwallace commented 11 months ago

Disregard these commits. Typed wrong issue #.