-
Notifications
You must be signed in to change notification settings - Fork 124
Allow new documentation ranges in the validation of IPs #2529
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
Conversation
docs/howto/ingest_geoip.md
Outdated
@@ -2,7 +2,19 @@ | |||
|
|||
Elasticsearch provides default GeoIP databases that can be downloaded in runtime and which weights ~70 MB. This can be | |||
a root cause of flakiness of package tests, so elastic-package embeds small samples of GeoIP databases, that can identify | |||
accurately only few ranges of IP addresses included [here](../../internal/fields/_static/allowed_geo_ips.txt) | |||
accurately only few ranges of IP addresses included [here](../../internal/fields/_static/allowed_geo_ips.txt). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We want to eventually use documentation IP ranges only. I think we can remove the mention to allowed_geo_ips.txt
in docs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've updated this doc to remove that reference.
Could you check if that makes sense ? thanks!
return len(ip) == net.IPv6len && | ||
(ip[0] == 32 && ip[1] == 1 && ip[2] == 13 && ip[3] == 184) || | ||
(ip[0] == 63 && ip[1] == 255 && ip[2] <= 15) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Got these values from this code
package main
import (
"fmt"
"log"
"net"
)
func main() {
showBlocks("3fff:0000:0000:0000:0000:0000:0000:0000")
showBlocks("3fff:0fff:ffff:ffff:ffff:ffff:ffff:ffff")
fmt.Println()
showBlocks("2001:0db8:0000:0000:0000:0000:0000:0000")
showBlocks("2001:0db8:ffff:ffff:ffff:ffff:ffff:ffff")
}
func showBlocks(s string) {
ip := net.ParseIP(s)
if ip == nil {
log.Fatalf("wrong ip: %s", s)
}
for i, k := range ip {
fmt.Printf("ip[%d] == %d\n", i, k)
}
}
💚 Build Succeeded
History
cc @mrodm |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
This PR adds the required ranges to the
isDocumentation
so they can be validated successfully inelastic-package
tests.If these ranges a test including for instance
3fff::1
would fail with this error:But, that IP should be allowed since it is part of the documentation range
3fff::/20
(RFC9637)How to test this PR locally
Test package
apache
now includes a log line including an IPv6 from range3fff::/20
:Relates #2476