-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
server: resolve hostnames before use #16177
Conversation
Channeling my inner Tamir: doesn't this deserve a test? Review status: 0 of 2 files reviewed at latest revision, 1 unresolved discussion, some commit checks failed. pkg/server/server.go, line 1030 at r1 (raw file):
Shouldn't we try to resolve the hostname even when one was explicitly provided? This will probably require updating Comments from Reviewable |
Why it certainly does! I don't know how to make Review status: 0 of 2 files reviewed at latest revision, 1 unresolved discussion, some commit checks failed. pkg/server/server.go, line 1030 at r1 (raw file): Previously, petermattis (Peter Mattis) wrote…
Well, if one was explicitly provided, it's conceivable that the user simply knows better than we do. This function is use to "officialize" 3 addresses:
The user may very well know better than us in the case of the latter two (i.e. the user is giving us an address that is externally resolvable, despite not being locally resolvable).
Comments from Reviewable |
Pass Review status: 0 of 2 files reviewed at latest revision, 1 unresolved discussion, some commit checks failed. pkg/server/server.go, line 1030 at r1 (raw file): Previously, tamird (Tamir Duberstein) wrote…
This is exactly the sort of misconfiguration we should be helping the user discover. Are there common deployment scenarios where a hostname is externally resolvable despite not being locally resolvable? At the very least, we should be resolving the hostname and shouting a warning (but still using the hostname) if it is not resolvable. Comments from Reviewable |
That's half the problem. Finding a reliably non-resolvable hostname is tricky too. I've seen resolvers give results (the bogus ad-insertion kind) even for names containing spaces and other garbage. Fortunately, Go's resolver guarantees that an empty string will never resolve. Review status: 0 of 2 files reviewed at latest revision, 2 unresolved discussions, some commit checks failed. pkg/server/server.go, line 1030 at r1 (raw file): Previously, petermattis (Peter Mattis) wrote…
There are common scenarios where a hostname resolves differently locally than it does remotely (i.e. it may resolve to a loopback IP instead of a routable one). But I think it's correct to require that it always resolve to something locally. pkg/server/server.go, line 1036 at r1 (raw file):
Why are we logging this error (and below) instead of returning it? These errors should cause the server to fail to start instead of just logging quietly. Comments from Reviewable |
Updated, PTAL. Review status: 0 of 2 files reviewed at latest revision, 2 unresolved discussions, some commit checks pending. pkg/server/server.go, line 1030 at r1 (raw file): Previously, bdarnell (Ben Darnell) wrote…
Done. pkg/server/server.go, line 1036 at r1 (raw file): Previously, bdarnell (Ben Darnell) wrote…
OK, changed to return errors. Comments from Reviewable |
Reviewed 2 of 2 files at r2. Comments from Reviewable |
It seems that configurations where the OS-provided hostname doesn't
actually resolve from the local machine are quite common and can cause
hard to diagnose problems for users. Avoid using the OS-provided host
if we're not even able to resolve it locally.
Updates #16173.