caddy: fix Dynamic DNS zone detection for subdomain domain entries#5302
Draft
0xMH wants to merge 1 commit intoopnsense:masterfrom
Draft
caddy: fix Dynamic DNS zone detection for subdomain domain entries#53020xMH wants to merge 1 commit intoopnsense:masterfrom
0xMH wants to merge 1 commit intoopnsense:masterfrom
Conversation
When a non-wildcard domain entry like "blog.example.com" has DynDns enabled, the template generates "blog.example.com @" in the dynamic_dns domains block, treating the full FQDN as the DNS zone name. The caddy-dynamicdns module then fails to find a matching zone in the DNS provider since "blog.example.com" is not a zone - "example.com" is. This fix splits multi-part domain names into zone and record components (e.g. "blog.example.com" becomes "example.com blog"), matching the same logic already used for subdomain entries on lines 161-164. Bare domains like "example.com" continue to generate "example.com @" as before.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Important notices
Before you submit a pull request, we ask you kindly to acknowledge the following:
Related issue
#5303
Describe the problem
When a non-wildcard domain entry like
blog.example.comhas Dynamic DNS enabled, the Caddyfile template generatesblog.example.com @in thedynamic_dnsdomains block. Thecaddy-dynamicdnsmodule treats the first field as the DNS zone name, butblog.example.comis not a DNS zone -example.comis. The DNS provider lookup fails silently and the record never gets updated.This only works correctly for:
*.example.com->example.com *)The current workaround is to create a wildcard parent domain and nest subdomains under it, which is unintuitive and unnecessary.
Describe the proposed solution
When a non-wildcard domain entry has more than two parts (e.g.
blog.example.com), split it into zone + record name using the same logic already present for subdomain entries:blog.example.com->example.com blogexample.com->example.com @(unchanged)*.example.com->example.com *(unchanged)