-
Notifications
You must be signed in to change notification settings - Fork 18k
net: LookupCNAME inconsistency on unix systems #59943
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
Comments
cc @neild |
Change https://go.dev/cl/455275 mentions this issue: |
CC @rsc |
@mateusz834 any traction on this? I noticed your PR fix above was never merged unfortunately. This is still an issue, tested up to Go version 1.23.5. |
This seems to be a serious bug affecting basic workflows, e.g. for ACME servers (like OpenBao) based on that Golang resolver library which are performing CNAME delegation to restricted subzones. |
So there was a #50101 proposal to make the LookupCNAME consistent between unix/windows, or more concrete to make it send an explicit CNAME query, so that when the last CNAME doesn't have an ending A/AAAA record it returns the CNAME. So the change made the cgo version to use the res_search routines instead of getaddrinfo.
And that leads to some compat breaking changes that were made because of this change and some minor differences between linux/windows.
Current Issues:
go/src/net/cgo_unix.go
Lines 296 to 300 in 0d34754
go/src/net/lookup_unix.go
Lines 102 to 110 in 0d34754
getaddrinfo
, so when in nsswitch.conf is different in any way from:hosts: dns
it returns the wrong result (different that before that change), because of the fallback to go (Issue 1) this is not really noticeable, because the go resolver handles/etc/hosts
aliases correctly. (but for other nss modules it might cause problems (mdns, myhostname, resolve, ....))I made before a CL 455275 to try address that problems.
The best solution to fix that is to do something like (for cgo resolver):
Try with
getaddrinfo
, if it doesn't find anything (returnserrNoSuchHost
) then try withres_search
query for CNAME.CC @ianlancetaylor
The text was updated successfully, but these errors were encountered: