Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Normalize Domain Names (trailing .) #6

Open
piboistudios opened this issue Nov 14, 2024 · 1 comment
Open

Normalize Domain Names (trailing .) #6

piboistudios opened this issue Nov 14, 2024 · 1 comment

Comments

@piboistudios
Copy link

piboistudios commented Nov 14, 2024

Using dynamic_dns module in Go Caddy and got this error repeatedly:
unable to find Google managaged zone for domain what-the-heck-is-wrong-with-libdns.com

All my configurations were correct, I even ran the API call using an access token from the service account being used by Go Caddy and ran the domain listing call to be sure.

After scratching my head for about an hour, I finally realized the issue:
The API call returns dnsName as <domain>. (note the . at the end). In turn, this means I had to update my Caddy config to include . at the end of all domains.

It would be nice to have this normalized at the module level here, as I assume for other libdns providers, this is a non-issue (based on the config examples I've seen for dynamic_dns, none of them included a trailing ., hence the assumption)

This also seemingly breaks dynamic_dns now because it won't match subdomains to the domain with the . at the end.

I believe this PR would fix it (I have never written Go before, but its a 3 line change)
#7

@piboistudios
Copy link
Author

This issue was specifically for fixing the Caddy dynamic_dns module's use of clouddns. As of now, it appears fixed on my PR branch:

  • normalize trailing . in GCD zone lookup
  • deduplicate prepValuesForCloudDNS array (probably some Caddy configuration error on my part, but the duplicate was causing the POST to fail with Already Exists error code 409, and the subsequent PATCH would fail because the POST failed to create the record, but not for the expected reason; anyway by deduplicating this array, we can be sure 409 truly means the record already exists, and this isn't simply a rrsValue duplication issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant