Enabling DynDNS in Caddy Web Server stops the process.

Started by cloudz, August 13, 2024, 03:00:29 PM

Previous topic - Next topic
I'm using Bunny.net as external DNS provider. It works perfectly fine for DNS/TLS certificates.

As soon as I enable "dyndns" on a record, it stops the process and I can't start it anymore until I remove the checkbox.
Can't seem to find a reason for it in the logs.

I have tried to recreate this from a clean caddy installation. It does not happen there, the service continues to run.

I get these logs, so it tries to do the updates but since I dont have a bunny account I cant test it:

"error","ts":"2024-08-13T15:39:54Z","logger":"dynamic_dns","msg":"failed setting DNS record(s) with new IP address(es)","zone":"example.com","error":"Unauthorized (401)"}

Here is my test caddyfile:


# DO NOT EDIT THIS FILE -- OPNsense auto-generated file


# caddy_user=root

# Global Options
{
log {
output net unixgram//var/run/caddy/log.sock {
}
format json {
time_format rfc3339
}
}

dynamic_dns {
provider bunny awsdasdasdasd
domains {
example.com @
}
}

email info@example.com
grace_period 10s
import /usr/local/etc/caddy/caddy.d/*.global
}

# Reverse Proxy Configuration


# Reverse Proxy Domain: "d3ca0f3d-af7c-49de-a4c8-52667545cbf8"
example.com {
tls {
dns bunny awsdasdasdasd
}
}

import /usr/local/etc/caddy/caddy.d/*.conf


Please provide your Caddyfile, with dyndns activated. Please remove your API key, and best PM it to me.
Hardware:
DEC740

The current template for dynamic_dns takes the full fqdn as entrypoint. This should be split into subdomain / domain.tld. If you use the full subdomain.domain.tld, the Dynamic DNS/DNS plugin cannot find the right domain and errors.

Instead of

dynamic_dns {
provider bunny awsdasdasdasd
domains {
subdomain.example.com @
}
}


It should be

dynamic_dns {
provider bunny awsdasdasdasd
domains {
example.com subdomain
}
}


Expanding on this, if you have multiple subdomains in that same zone, they should be added like this


dynamic_dns {
provider bunny awsdasdasdasd
domains {
example.com subdomain subdomain2 subdomain3
}
}

That is supported in the plugin when using subdomains as described here:

https://docs.opnsense.org/manual/how-tos/caddy.html#wildcard-domain-with-subdomains

When enabling dynamic DNS on a subdomain it will create them like this:


example.com subdomain

Enabling Dynamic DNS on a base domain will always create it like this:

example.com @

or for wildcard base domains:

example.com *
Hardware:
DEC740

Point taken - this flow didn't work like that in my head :)

Maybe a small change in the UI suggested > the Subdomains tab > at the top it still says 'add domain' etc. That's not really logical at that page.

Yeah I can hide these two fields there probably sometime. It just made the code easier since theyre in the same div that gets hidden by the "Filter by Domain" filter on tab change.
Hardware:
DEC740

After adding a wildcard domain, I can now add other subdomain.otherdomain.tld as well without the process quiting. Thanks for the help!