Skip to content

fix: correctly support cname follow on and off#6

Merged
bittermandel merged 4 commits intomainfrom
clean-verify-cname-follow
Feb 11, 2025
Merged

fix: correctly support cname follow on and off#6
bittermandel merged 4 commits intomainfrom
clean-verify-cname-follow

Conversation

@bittermandel
Copy link
Contributor

There are some issues with the DNS resolving. If we enable CNameFollow, e.g. _acme-challenge.example.com resolves to example_com.verify.molnett.net which the cleaning turns into example_com_verify_molnett_net.verify.molnett.net. This is incorrect. So the changes fixes this issue by removing the verify part from the resolved FQDN.

In case the domain has to been setup yet, it will simply resolve to the base domain.
e.g. _acme-challenge.example.com is translated to to example_com.verify.molnett.net

entry = strings.TrimSuffix(entry, ".")
entry = strings.Replace(entry, ".", "_", -1)
entry = entry + ".verify"

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reading the code for the webhook, I think maybe the only bug is that we are using cn.ResolvedFQDN instead of domain which is returned from c.getDomainAndEntry()? That function seems to strip both the . and the cn.ResolvedZone which (probably) would be the equivalent of at least molnett.net in our case.

Then we would not need the nested strings.Replace that you have - but I may be reading the code wrong!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are probably right that we can use domain or ch.name straight off when we use Root Domain. I'll try it later

@bittermandel bittermandel merged commit 444ca8a into main Feb 11, 2025
1 check passed
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

Successfully merging this pull request may close these issues.

2 participants