DNS Module Not Registered

1. The problem I’m having:

I cant start Caddy Web Server with DNS provider.
I built with xcaddy, command:

xcaddy build --with github.com/caddy-dns/cloudflare

And this is my Caddyfile:

https://getseopro.com {
  root * /var/www/html/public
  encode zstd gzip
  file_server

  tls {
	  dns cloudflare mytokenwashere
    resolvers 1.1.1.1
  }
  # reverse_proxy localhost:3000
}

I tried with cloduflare and powerdns (gmysql backend, bind backend) and still i have an error like this;

2. Error messages and/or full log output:

Error: adapting config using caddyfile: parsing caddyfile tokens for 'tls': getting module named 'dns.providers.cloudflare': module not registered: dns.providers.cloudflare, at Caddyfile:7

3. Caddy version:

v2.7.6 h1:w0NymbG2m9PcvKWsrXO6EEkY9Ru4FJK8uQbYcev1p3A=

4. How I installed and ran Caddy:

a. System environment:

Centos Stream 8

b. Command:

dnf install 'dnf-command(copr)'
dnf copr enable @caddy/caddy
dnf install caddy

c. Service/unit/compose file:


d. My complete Caddy config:

https://getseopro.com {
  root * /var/www/html/public
  encode zstd gzip
  file_server

  tls {
	  dns cloudflare mytokenwashere
    resolvers 1.1.1.1
  }
  # reverse_proxy localhost:3000
}

And i tried global version with this config file:

{
  acme_dns cloudflare mytokenrlywashere
}

https://getseopro.com {
  root * /var/www/html/public
  encode zstd gzip
  file_server

  # reverse_proxy localhost:3000
}

Error Output:

Error: adapting config using caddyfile: parsing caddyfile tokens for 'acme_dns': getting module named 'dns.providers.cloudflare': module not registered: dns.providers.cloudflare, at Caddyfile:2

You built it, but did you replace your actual binary with the built one? It’ll just output the new binary to your current directory, you then need to move it where it needs to go.

Since you installed using dnf, the binary is at /usr/bin/caddy. You can replace it there, but keep in mind next time you update your packages, your custom binary will be wiped out.

You could instead move it to /usr/bin/caddy.custom or something like that, then override the default command with a systemd override (see Keep Caddy Running — Caddy Documentation).

1 Like

DNS module became operational. Now I need to work on this error;

2024/03/17 22:12:25.685 WARN    tls     storage cleaning happened too recently; skipping for now        {"storage": "FileStorage:/root/.local/share/caddy", "instance": "5905667c-136c-4c01-9292-9e8e4d9b4edc", "try_again": "2024/03/18 22:12:25.685", "try_again_in": 86399.999999177}
2024/03/17 22:12:25.685 INFO    tls     finished cleaning storage units
2024/03/17 22:12:25.685 INFO    tls.obtain      lock acquired   {"identifier": "getseoranker.com"}
2024/03/17 22:12:25.686 INFO    tls.obtain      obtaining certificate   {"identifier": "getseoranker.com"}
2024/03/17 22:12:25.688 INFO    tls.issuance.acme       waiting on internal rate limiter        {"identifiers": ["getseoranker.com"], "ca": "https://acme-v02.api.letsencrypt.org/directory", "account": ""}
2024/03/17 22:12:25.688 INFO    tls.issuance.acme       done waiting on internal rate limiter   {"identifiers": ["getseoranker.com"], "ca": "https://acme-v02.api.letsencrypt.org/directory", "account": ""}
2024/03/17 22:12:26.702 INFO    tls.issuance.acme.acme_client   trying to solve challenge       {"identifier": "getseoranker.com", "challenge_type": "dns-01", "ca": "https://acme-v02.api.letsencrypt.org/directory"}
2024/03/17 22:12:27.471 ERROR   tls.issuance.acme.acme_client   cleaning up solver      {"identifier": "getseoranker.com", "challenge_type": "dns-01", "error": "no memory of presenting a DNS record for \"_acme-challenge.getseoranker.com\" (usually OK if presenting also failed)"}
2024/03/17 22:12:27.647 ERROR   tls.obtain      could not get certificate from issuer   {"identifier": "getseoranker.com", "issuer": "acme-v02.api.letsencrypt.org-directory", "error": "[getseoranker.com] solving challenges: presenting for challenge: adding temporary record for zone \"getseoranker.com.\": got error status: HTTP 400: [{Code:6003 Message:Invalid request headers}] (order=https://acme-v02.api.letsencrypt.org/acme/order/1623656287/253172410667) (ca=https://acme-v02.api.letsencrypt.org/directory)"}
2024/03/17 22:12:27.647 INFO    tls.issuance.zerossl    waiting on internal rate limiter        {"identifiers": ["getseoranker.com"], "ca": "https://acme.zerossl.com/v2/DV90", "account": "caddy@zerossl.com"}
2024/03/17 22:12:27.647 INFO    tls.issuance.zerossl    done waiting on internal rate limiter   {"identifiers": ["getseoranker.com"], "ca": "https://acme.zerossl.com/v2/DV90", "account": "caddy@zerossl.com"}
2024/03/17 22:12:28.796 INFO    tls.issuance.zerossl.acme_client        trying to solve challenge       {"identifier": "getseoranker.com", "challenge_type": "dns-01", "ca": "https://acme.zerossl.com/v2/DV90"}
2024/03/17 22:12:29.500 ERROR   tls.issuance.zerossl.acme_client        cleaning up solver      {"identifier": "getseoranker.com", "challenge_type": "dns-01", "error": "no memory of presenting a DNS record for \"_acme-challenge.getseoranker.com\" (usually OK if presenting also failed)"}
2024/03/17 22:12:29.815 ERROR   tls.obtain      could not get certificate from issuer   {"identifier": "getseoranker.com", "issuer": "acme.zerossl.com-v2-DV90", "error": "[getseoranker.com] solving challenges: presenting for challenge: adding temporary record for zone \"getseoranker.com.\": got error status: HTTP 400: [{Code:6003 Message:Invalid request headers}] (order=https://acme.zerossl.com/v2/DV90/order/klRo-b7mEFRi0lkxhTv_hg) (ca=https://acme.zerossl.com/v2/DV90)"}
2024/03/17 22:12:29.815 ERROR   tls.obtain      will retry      {"error": "[getseoranker.com] Obtain: [getseoranker.com] solving challenges: presenting for challenge: adding temporary record for zone \"getseoranker.com.\": got error status: HTTP 400: [{Code:6003 Message:Invalid request headers}] (order=https://acme.zerossl.com/v2/DV90/order/klRo-b7mEFRi0lkxhTv_hg) (ca=https://acme.zerossl.com/v2/DV90)", "attempt": 1, "retrying_in": 60, "elapsed": 4.129486612, "max_duration": 2592000}

Thanks @francislavoie

This usually means your Cloudflare token was invalid. Make sure to follow the instructions on GitHub - libdns/cloudflare: Cloudflare provider implementation for libdns to correctly set up your token.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.