DNS issues - NXDOMAIN for acme-challenge

1. Caddy version (caddy version):

1.0.4

2. How I run Caddy:

[Unit]
Description=Caddy HTTP/2 web server
Documentation=https://caddyserver.com/docs
After=network-online.target
Wants=network-online.target systemd-networkd-wait-online.service

[Service]
Restart=on-abnormal

; User and group the process will run as.
User=caddy
Group=caddy

; Letsencrypt-issued certificates will be written to this directory.
Environment=CADDYPATH=/etc/ssl/caddy
Environment=CLOUDFLARE_EMAIL=**removed**
Environment=CLOUDFLARE_API_KEY=**removed**

; Always set "-root" to something safe in case it gets forgotten in the Caddyfile.
ExecStart=/usr/local/bin/caddy -log stderr -agree=true -conf=/etc/caddy/Caddyfile -root=/var/tmp
ExecReload=/bin/kill -USR1 $MAINPID

; Use graceful shutdown with a reasonable timeout
KillMode=mixed
KillSignal=SIGQUIT
TimeoutStopSec=5s

; Limit the number of file descriptors; see `man systemd.exec` for more limit settings.
LimitNOFILE=1048576
; Unmodified caddy is not expected to use more than that.
LimitNPROC=512

; Use private /tmp and /var/tmp, which are discarded after caddy stops.
PrivateTmp=true
; Use a minimal /dev (May bring additional security if switched to 'true', but it may not work on Raspberry Pi's or other devices, so it has been disabled in this dist.)
PrivateDevices=false
; Hide /home, /root, and /run/user. Nobody will steal your SSH-keys.
ProtectHome=true
; Make /usr, /boot, /etc and possibly some more folders read-only.
ProtectSystem=full
; … except /etc/ssl/caddy, because we want Letsencrypt-certificates there.
;   This merely retains r/w access rights, it does not add any new. Must still be writable on the host!
ReadWriteDirectories=/etc/ssl/caddy

; The following additional security directives only work with systemd v229 or later.
; They further restrict privileges that can be gained by caddy. Uncomment if you like.
; Note that you may have to add capabilities required by any plugins in use.
;CapabilityBoundingSet=CAP_NET_BIND_SERVICE
;AmbientCapabilities=CAP_NET_BIND_SERVICE
;NoNewPrivileges=true

[Install]
WantedBy=multi-user.target

a. System environment:

CentOS 7 - systemd

b. Command:

systemctl restart/status caddy

d. My complete Caddyfile or JSON config:

https://drive.google.com/open?id=1YP-tmsWTXnjm2qcdmSamnoM3aj6xoh7Z

3. The problem I’m having:

Cannot get this site to grab a valid cert - locally/intranet when I browse to the site through Caddy proxying it - it tells me the site cert date is invalid.

If I attempt to access the site from the internet it just times out and cloudlfare tells me the host is down.

I have multiple sites working fine on the *.batcave.host domain without issue - I’m only having an issue with schnell-engineering.com and with seafile.batcave.host for some reason (although seafile site works internally and externally)

4. Error messages and/or full log output:

https://drive.google.com/open?id=1bN9Edlb0IPpromRu-z8qobf9DCOJxBcL

5. What I already tried:

Not sure what to try - I don’t see why this would fail as I already use 10.10.1.8 to serve web pages without issue - there is something I am missing between the two domain names I suppose and possibly cloudlfare config (both domains are under the same cloudflare account and API access).

Checking my local DNS servers I seem to have the TXT record in place as well:

nslookup -q=TXT schnell-engineering.com
Server:  BATCAVEDC01.batcave.com
Address:  10.10.1.50

schnell-engineering.com
        primary name server = batcavedc01.batcave.com
        responsible mail addr = hostmaster.batcave.com
        serial  = 6
        refresh = 900 (15 mins)
        retry   = 600 (10 mins)
        expire  = 86400 (1 day)
        default TTL = 3600 (1 hour)

Do you have a paid Cloudflare account with batcavedc01.batcave.com as some kind of white label nameserver maybe?

This error Caddy’s returning:

NS batcavedc01.batcave.com. returned NXDOMAIN for _acme-challenge.schnell-engineering.com

Doesn’t seem to match up with what I’m seeing with respect to the name server:

~/Projects/test
➜ dig @1.1.1.1 schnell-engineering.com ns

; <<>> DiG 9.10.6 <<>> @1.1.1.1 schnell-engineering.com ns
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 22544
;; flags: qr rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 1452
;; QUESTION SECTION:
;schnell-engineering.com.	IN	NS

;; ANSWER SECTION:
schnell-engineering.com. 86400	IN	NS	fattouche.ns.cloudflare.com.
schnell-engineering.com. 86400	IN	NS	itzel.ns.cloudflare.com.

;; Query time: 15 msec
;; SERVER: 1.1.1.1#53(1.1.1.1)
;; WHEN: Thu May 14 09:20:50 AEST 2020
;; MSG SIZE  rcvd: 133

Whatever’s going on, Caddy isn’t checking the actual authoritative nameserver for DNS propagation. You’re using the Cloudflare module, your public domain nameserver records are Cloudflare servers, Caddy appears to believe it’s successfully configuring your zone on Cloudflare, but it’s checking batcavedc01.batcave.com for propagation instead.

1 Like

Do you have a paid Cloudflare account with batcavedc01.batcave.com as some kind of white label nameserver maybe?

This error Caddy’s returning:

NS batcavedc01.batcave.com. returned NXDOMAIN for _acme-challenge.schnell-engineering.com

I do not - batcave.com is my internal/local domain batcavedc01 is my AD server (DHCP/DNS).

batcave.host and schnell-engineering.com are both using the single cloudflare account - and this all used to work just fine before I switched to CF. I’ve had a lot of troubles making this all work with CF to be honest.

Using Caddy in it’s default setup and another DNS (afraid) worked flawless. After many stuggles after moving to .host to CF I finally was ready to bring over the last domain now - it’s when I noticed that schnell-engineering.com and seafile.batcave.host give me these errors. Why that is I do not know.

Doesn’t seem to match up with what I’m seeing with respect to the name server:

~/Projects/test
➜ dig @1.1.1.1 schnell-engineering.com ns

; <<>> DiG 9.10.6 <<>> @1.1.1.1 schnell-engineering.com ns
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 22544
;; flags: qr rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 1452
;; QUESTION SECTION:
;schnell-engineering.com.	IN	NS

;; ANSWER SECTION:
schnell-engineering.com. 86400	IN	NS	fattouche.ns.cloudflare.com.
schnell-engineering.com. 86400	IN	NS	itzel.ns.cloudflare.com.

;; Query time: 15 msec
;; SERVER: 1.1.1.1#53(1.1.1.1)
;; WHEN: Thu May 14 09:20:50 AEST 2020
;; MSG SIZE  rcvd: 133

Whatever’s going on, Caddy isn’t checking the actual authoritative nameserver for DNS propagation. You’re using the Cloudflare module, your public domain nameserver records are Cloudflare servers, Caddy appears to believe it’s successfully configuring your zone on Cloudflare, but it’s checking batcavedc01.batcave.com for propagation instead.

I agree that is the case - why that is so I do not understand - nothing is set up any different for me anywhere when it comes to my DNS.

For some reason, your local DNS resolver is telling Caddy that it is the authoritative name server for schnell-engineering.com, not the Cloudflare NS.

That means when Caddy goes and changes the zone on Cloudflare’s nameservers, your own nameserver doesn’t update, but Caddy’s checking your nameserver, not Cloudflare’s.

Your local DNS either needs to give Caddy the correct nameserver, or it needs to very closely propagate those TXT records from the real authoritative nameserver (Cloudflare’s).

If you can edit your schnell-engineering.com zone in your AD DNS, and set the NS records manually to Cloudflare so it doesn’t assume it’s authoritative, that might work?

I did as a quick test - just deleted the schnell-engineering.com zone from my AD’s and it worked first shot.

Why this changed I have no idea - as I’ve had my DNS setup this way for years - but at least I have something to go on.

I appreciate the time and help pointing me into the right direction - I was literally starting to pull my hair out lol

Cheers!

1 Like

No worries! Glad it’s all working now!

Next step is to migrate to Caddy v2 - although v1 has just been so awesome I feel a little nostalgic towards it :grin:

You and me both, heh.

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