-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Inconsistent support of IPv6 literals #1171
Comments
Oddly, Go's own net.SplitHostPort allows domain names and IPv4 literals inside square brackets.
|
Reading RFC 3986 3.2.2, which defines the square bracket syntax, I don't think IPv4 or DNS names with square brackets are allowed.
My understanding of that means you can have |
Indeed, that's why it'd odd and I think the behaviour is too lax here - the last two examples should have been rejected. Changing it is backwards-incompatible though. EDIT: thinking about it, |
It would appear that this also doesn't support scoped v6 link-local addresses:
|
Host operating system: output of
uname -a
blackbox_exporter version: output of
blackbox_exporter --version
What is the blackbox.yml module config.
What did you do that produced an error?
Supplying an IPv6 literal with square brackets but without a port.
icmp prober (where port makes no sense)
curl -gsSv 'localhost:9115/probe?target=2001:db8::1&module=icmp'
curl -gsSv 'localhost:9115/probe?target=[2001:db8::1]&module=icmp'
debug=true
:caller=icmp.go:91 module=icmp target=[2001:db8::1] level=error msg="Resolution with IP protocol failed" target=[2001:db8::1] err="lookup [2001:db8::1]: no such host"
dns prober (port is optional, default is 53)
curl -gsSv 'localhost:9115/probe?target=2606:4700:58::adf5:3b60&module=dns_version'
curl -gsSv 'localhost:9115/probe?target=[2606:4700:58::adf5:3b60]:53&module=dns_version'
curl -gsSv 'localhost:9115/probe?target=[2606:4700:58::adf5:3b60]&module=dns_version'
debug=true
:caller=dns.go:200 module=dns_version target=[2606:4700:58::adf5:3b60] level=error msg="Resolution with IP protocol failed" target=[2606:4700:58::adf5:3b60] err="lookup [2606:4700:58::adf5:3b60]: no such host"
(This is similar to prometheus/snmp_exporter#1076)
tcp prober (port is required)
curl -gsSv 'localhost:9115/probe?target=[2001:db8::1]:443&module=certificate_invalid
There is no problem here because a port is always required. (A bare IPv4 address says that it can't split address/port, and a bare IPv6 address says there are too many colons)
Aside: this could change if the tcp prober gained an option to set a default port. For example, given this config:
It would be nice if a default port 22 could be set in blackbox.yml.
http prober (default port 80 or 443)
curl -gsSv 'localhost:9115/probe?target=http://[2001:db8::1]&module=http_example'
curl -gsSv 'localhost:9115/probe?target=http://[2001:db8::1]:8080&module=http_example'
curl -gsSv 'localhost:9115/probe?target=https://[2001:db8::1]&module=http_example'
curl -gsSv 'localhost:9115/probe?target=https://[2001:db8::1]:8443&module=http_example'
curl -gsSv 'localhost:9115/probe?target=[2001:db8::1]&module=http_example'
There is no problem here, because the URL syntax requires IPv6 addresses to be enclosed in square brackets anyway.
Proposal
Fix dns_prober to accept IPv6 literals with square brackets but without a port.
Make icmp_prober accept IPv6 literals with or without square brackets, for consistency with dns_prober (and snmp_exporter when fixed)
The text was updated successfully, but these errors were encountered: