Cant get my DNS-Provider-Module for DNS-Challenge working

1. Caddy version (caddy version):

v2.5.2 h1:eCJdLyEyAGzuQTa5Mh3gETnYWDClo1LjtQm2q9RNZrs=

2. How I run Caddy:

Installation steps were:

NOT containerized by Docker, LXC, etc

a. System environment:

VM using Ubuntu 22.04 LTS
No LSB modules are available.

lsb_release -a
Distributor ID: Ubuntu
Description: Ubuntu 22.04 LTS
Release: 22.04
Codename: jammy

b. Command:

service caddy start

c. Service/unit/compose file:

None

d. My complete Caddyfile or JSON config:

Copied from /etc/caddy/Caddyfile

my domain {
    #Caddy DNS Challenge via Netcup DNS (ACME)
    log {
        level DEBUG
        output file /data/log/caddy_test.log {
            roll_size 10MiB
            roll_keep 10
            roll_keep_for 336h
        }
    }

    tls {
        dns netcup {
            customer_number {env.NETCUP_CUSTOMER_NUMBER}
            api_key {env.NETCUP_API_KEY}
            api_password {env.NETCUP_API_PASSWORD}
        }
    }
}

3. The problem I’m having:

Hi, I want to get my DNS-Provider-Plugin from Netcup working.

The Problem is that I have pretty much no experience in the DevOps Field.

I had to restore my Caddy-VM to an earlier Snapshot three times now because I cant the DNS-Provider-Plugin for Netcup-DNS working.

I want to use the Netcup DNS-Plugin for Caddy to automatically renew my Lets Encrypt certificate/s without having to interact with it.
Link to Netcup DNS Plugin: https://github.com/caddy-dns/netcup

I was following these instructions from Matt to install the Plugin:

The steps I was doing in my Caddy VM were the following:

  1. apt install golang
  2. git clone " "
  3. cd caddy/cmd/caddy/
  4. go build

Install xcaddy

  1. apt install -y debian-keyring debian-archive-keyring apt-transport-https
  2. curl -1sLf '' | sudo gpg --dearmor -o /usr/share/keyrings/caddy-xcaddy-archive-keyring.gpg
  3. curl -1sLf '' | sudo tee /etc/apt/sources.list.d/caddy-xcaddy.list
  4. sudo apt update
  5. sudo apt install xcaddy

#Then setting the environment variable for xcaddy in my Home-Path
10. sudo nano /etc/environment
11. PATH="(...):/usr/bin/xcaddy"
12. source /etc/environment

Ran the xcaddy command following the instructions by Matt

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

#Restarted Caddy Service
sudo service xcaddy restart

And this is where I get an error:

Jul 23 06:35:10 caddyserver caddy[13052]: run: adapting config using caddyfile: parsing caddyfile tokens for 'tls': /etc/caddy/Caddyfile:13 - Error during parsing: getting module named 'dns.providers.netcup': module not registered: dns.providers.netcup

The full Log below

4. Error messages and/or full log output:

caddy@caddyserver:~/caddy/cmd/caddy$ journalctl -xeu caddy.service

Jul 23 06:35:10 caddyserver systemd[1]: Starting Caddy...
β–‘β–‘ Subject: A start job for unit caddy.service has begun execution
β–‘β–‘ Defined-By: systemd
β–‘β–‘ Support: 
β–‘β–‘ 
β–‘β–‘ A start job for unit caddy.service has begun execution.
β–‘β–‘ 
β–‘β–‘ The job identifier is 4347.
Jul 23 06:35:10 caddyserver caddy[13052]: caddy.HomeDir=/home/caddy
Jul 23 06:35:10 caddyserver caddy[13052]: caddy.AppDataDir=/home/caddy/.local/share/caddy
Jul 23 06:35:10 caddyserver caddy[13052]: caddy.AppConfigDir=/home/caddy/.config/caddy
Jul 23 06:35:10 caddyserver caddy[13052]: caddy.ConfigAutosavePath=/home/caddy/.config/caddy/autosave.json
Jul 23 06:35:10 caddyserver caddy[13052]: caddy.Version=v2.5.2 h1:eCJdLyEyAGzuQTa5Mh3gETnYWDClo1LjtQm2q9RNZrs=
Jul 23 06:35:10 caddyserver caddy[13052]: runtime.GOOS=linux
Jul 23 06:35:10 caddyserver caddy[13052]: runtime.GOARCH=amd64
Jul 23 06:35:10 caddyserver caddy[13052]: runtime.Compiler=gc
Jul 23 06:35:10 caddyserver caddy[13052]: runtime.NumCPU=4
Jul 23 06:35:10 caddyserver caddy[13052]: runtime.GOMAXPROCS=4
Jul 23 06:35:10 caddyserver caddy[13052]: runtime.Version=go1.18.3
Jul 23 06:35:10 caddyserver caddy[13052]: os.Getwd=/
Jul 23 06:35:10 caddyserver caddy[13052]: LANG=en_US.UTF-8
Jul 23 06:35:10 caddyserver caddy[13052]: PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin
Jul 23 06:35:10 caddyserver caddy[13052]: NOTIFY_SOCKET=/run/systemd/notify
Jul 23 06:35:10 caddyserver caddy[13052]: HOME=/home/caddy
Jul 23 06:35:10 caddyserver caddy[13052]: LOGNAME=caddy
Jul 23 06:35:10 caddyserver caddy[13052]: USER=caddy
Jul 23 06:35:10 caddyserver caddy[13052]: SHELL=/bin/bash
Jul 23 06:35:10 caddyserver caddy[13052]: INVOCATION_ID=72e80a31dc7f41a99bfdda168d0ff170
Jul 23 06:35:10 caddyserver caddy[13052]: JOURNAL_STREAM=8:59430
Jul 23 06:35:10 caddyserver caddy[13052]: SYSTEMD_EXEC_PID=13052
Jul 23 06:35:10 caddyserver caddy[13052]: {"level":"info","ts":1658558110.9286294,"msg":"using provided configuration","config_file":"/etc/caddy/Caddyfile","config_adapter":""}
Jul 23 06:35:10 caddyserver caddy[13052]: run: adapting config using caddyfile: parsing caddyfile tokens for 'tls': /etc/caddy/Caddyfile:13 - Error during parsing: getting module named 'dns.providers.netcup': module not registered: dns.providers.netcup
Jul 23 06:35:10 caddyserver systemd[1]: caddy.service: Main process exited, code=exited, status=1/FAILURE
β–‘β–‘ Subject: Unit process exited
β–‘β–‘ Defined-By: systemd
β–‘β–‘ Support: 
β–‘β–‘ 
β–‘β–‘ An ExecStart= process belonging to unit caddy.service has exited.
β–‘β–‘ 
β–‘β–‘ The process' exit code is 'exited' and its exit status is 1.
Jul 23 06:35:10 caddyserver systemd[1]: caddy.service: Failed with result 'exit-code'.
β–‘β–‘ Subject: Unit failed
β–‘β–‘ Defined-By: systemd
β–‘β–‘ Support: 
β–‘β–‘ 
β–‘β–‘ The unit caddy.service has entered the 'failed' state with result 'exit-code'.
Jul 23 06:35:10 caddyserver systemd[1]: Failed to start Caddy.
β–‘β–‘ Subject: A start job for unit caddy.service has failed
β–‘β–‘ Defined-By: systemd
β–‘β–‘ Support: 
β–‘β–‘ 
β–‘β–‘ A start job for unit caddy.service has finished with a failure.

Relevant Debug-Log stays empty because service doesnt start: /var/log/caddy/debug.log

5. What I already tried:

Installing xcaddy without building Caddy from source. Probably a stupid idea, but as I’ve already mentioned, I have no experience in handling tasks like this. I dont know any programming language or how they work. I really just want to get my DNS-Challenge for Caddy working.

6. Links to relevant resources:

Cant post this, because my new Caddy Community Account is limited to 4 URLs only. I already had to butcher many URLs to get this posted. Lul

1 Like

I fixed the issue thanks to this post:

Solution is to copy all of the caddy-build-binarys over to /usr/bin/
mv ~/caddy/cmd/caddy/* /usr/bin/

Now the command caddy list-modules shows that my DNS-Provider-Plugin is installed:

  Standard modules: 97
dns.providers.netcup
  Non-standard modules: 1
  Unknown modules: 0

Although I got this issue fixed, I run into the next error when I do β€œservice caddy restart”:

Output of journalctl -xeu caddy.service:

run: adapting config using caddyfile: hostname appears in more than one automation policy, making certificate management ambiguous: <my domain>

Does anyone know how to disable the inital HTTP-Challenge that is still applied to ? I want to switch to the DNS-Challenge

Thread can be closed, I fixed my last mentioned issue aswell.

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