Unable to install Cloudflare DNS module

1. The problem I’m having:

Trying to install and register Cloudflare module but apparently it isn’t listed in caddy list-modules. Am I missing something?

2. Full log output:

2024/09/04 20:46:20 [INFO] absolute output file path: /root/caddy
2024/09/04 20:46:20 [INFO] Temporary folder: /tmp/buildenv_2024-09-04-2046.2820181764
2024/09/04 20:46:20 [INFO] Writing main module: /tmp/buildenv_2024-09-04-2046.2820181764/main.go
package main

import (
        caddycmd "github.com/caddyserver/caddy/v2/cmd"

        // plug in Caddy modules here
        _ "github.com/caddyserver/caddy/v2/modules/standard"
        _ "github.com/caddy-dns/cloudflare"
)

func main() {
        caddycmd.Main()
}
2024/09/04 20:46:20 [INFO] Initializing Go module
2024/09/04 20:46:20 [INFO] exec (timeout=0s): /usr/local/go/bin/go mod init caddy 
go: creating new go.mod: module caddy
go: to add module requirements and sums:
        go mod tidy
2024/09/04 20:46:20 [INFO] Pinning versions
2024/09/04 20:46:20 [INFO] exec (timeout=0s): /usr/local/go/bin/go get -d -v github.com/caddyserver/caddy/v2 
go: -d flag is deprecated. -d=true is a no-op
go: added github.com/beorn7/perks v1.0.1
go: added github.com/caddyserver/caddy/v2 v2.8.4
go: added github.com/caddyserver/certmagic v0.21.3
go: added github.com/caddyserver/zerossl v0.1.3
go: added github.com/cespare/xxhash/v2 v2.2.0
go: added github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572
go: added github.com/google/pprof v0.0.0-20231212022811-ec68065c825e
go: added github.com/google/uuid v1.6.0
go: added github.com/klauspost/cpuid/v2 v2.2.7
go: added github.com/libdns/libdns v0.2.2
go: added github.com/mholt/acmez/v2 v2.0.1
go: added github.com/miekg/dns v1.1.59
go: added github.com/onsi/ginkgo/v2 v2.13.2
go: added github.com/prometheus/client_golang v1.19.1
go: added github.com/prometheus/client_model v0.5.0
go: added github.com/prometheus/common v0.48.0
go: added github.com/prometheus/procfs v0.12.0
go: added github.com/quic-go/qpack v0.4.0
go: added github.com/quic-go/quic-go v0.44.0
go: added github.com/zeebo/blake3 v0.2.3
go: added go.uber.org/mock v0.4.0
go: added go.uber.org/multierr v1.11.0
go: added go.uber.org/zap v1.27.0
go: added go.uber.org/zap/exp v0.2.0
go: added golang.org/x/crypto v0.23.0
go: added golang.org/x/exp v0.0.0-20240506185415-9bf2ced13842
go: added golang.org/x/mod v0.17.0
go: added golang.org/x/net v0.25.0
go: added golang.org/x/sync v0.7.0
go: added golang.org/x/sys v0.20.0
go: added golang.org/x/term v0.20.0
go: added golang.org/x/text v0.15.0
go: added golang.org/x/time v0.5.0
go: added golang.org/x/tools v0.21.0
go: added google.golang.org/protobuf v1.34.1
2024/09/04 20:46:21 [INFO] exec (timeout=0s): /usr/local/go/bin/go get -d -v github.com/caddy-dns/cloudflare github.com/caddyserver/caddy/v2 
go: -d flag is deprecated. -d=true is a no-op
go: added github.com/caddy-dns/cloudflare v0.0.0-20240703190432-89f16b99c18e
go: added github.com/libdns/cloudflare v0.1.2-0.20240604123710-0549667a10ab
2024/09/04 20:46:22 [INFO] exec (timeout=0s): /usr/local/go/bin/go get -d -v  
go: -d flag is deprecated. -d=true is a no-op
2024/09/04 20:46:25 [INFO] Build environment ready
2024/09/04 20:46:25 [INFO] Building Caddy
2024/09/04 20:46:25 [INFO] exec (timeout=0s): /usr/local/go/bin/go mod tidy -e 
2024/09/04 20:46:25 [INFO] exec (timeout=0s): /usr/local/go/bin/go build -o /root/caddy -ldflags -w -s -trimpath -tags nobadger 
2024/09/04 20:46:26 [INFO] Build complete: ./caddy
2024/09/04 20:46:26 [INFO] Cleaning up temporary folder: /tmp/buildenv_2024-09-04-2046.2820181764

././caddy version
v2.8.4 h1:q3pe0wpBj1OcHFZ3n/1nl4V4bxBrYoSoab7rL9BMYNk=

3. Caddy version:

v2.8.4

4. How I installed and ran Caddy:

Since I’m using Proxmox and decided to try out with Caddy and replace Nginx Proxy Manager, I used a Proxmox script to install and configure itself. It does not come with xcaddy so I had to install them myself.

  1. Ran this command to create a new LXC (container) and install+configure Caddy bash -c "$(wget -qLO - https://github.com/tteck/Proxmox/raw/main/ct/caddy.sh)"
  2. Ran caddy first time to be sure it is working properly.
  3. When created and installed, install xcaddy following xcaddy’s github repo using cloudsmith repo approach.
  4. Ran xcaddy build --with github.com/caddy-dns/cloudflare to try to install Cloudflare DNS module
  5. Ran caddy list-modules to verify that the cloudflare dns is on the non-standard module list, which is it isn’t on it even with clean install.

a. System environment:

Debian 12

b. Command:

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

c. Service/unit/compose file:

Not using docker or systemd

d. My complete Caddy config:

# The Caddyfile is an easy way to configure your Caddy web server.
#
# Unless the file starts with a global options block, the first
# uncommented line is always the address of your site.
#
# To use your own domain name (with automatic HTTPS), first make
# sure your domain's A/AAAA DNS records are properly pointed to
# this machine's public IP, then replace ":80" below with your
# domain name.

#:80 {
# Set this path to your site's directory.
#       root * /usr/share/caddy

# Enable the static file server.
#       file_server

# Another common task is to set up a reverse proxy:
# reverse_proxy localhost:8080

# Or serve a PHP site through php-fpm:
# php_fastcgi localhost:9000
#}

# Refer to the Caddy docs for more information:
# https://caddyserver.com/docs/caddyfile

(cloudflare) {
        tls {
                dns cloudflare {env.CLOUDFLARE_AUTH_TOKEN}
        }
}

# pdf
pdf.coltvel.com {
        reverse_proxy http://10.0.0.103
        import cloudflare
}

5. Links to relevant resources:

How to use DNS provider modules in Caddy 2 .
GitHub - caddyserver/xcaddy: Build Caddy with plugins .
GitHub - tteck/Proxmox: Proxmox VE Helper-Scripts .
Proxmox VE Helper-Scripts (Search “caddy”, it should show you Caddy LXC)

1 Like

Never mind, I realized I installed windows instead of linux version. What a big oversight… lol

1 Like