Skip to content

Conversation

Jgigantino31
Copy link
Contributor

Add parser to allow all IPv6 addresses in a /64 to be combined into one shared bucket. This parser must be used with the crowdsecurity/ipv6_to_range postoverflow. Should there be an IPv6 collection that has both?

This is accomplished by using TrimSuffix(IpToRange(evt.Meta.source_ip,"/64"),"/64") to rewrite the source IP in the parser/s02-enrich stage to force the lower 64 bits to zero, which is still a valid IPv6 address. When going to scenarios designed for IP addresses all IPv6 addresses in a /64 will now go into a single bucket. On overflow, the crowdsecurity/ipv6_to_range postoverflow remediates on the entire /64 range.

Example effects on source_ip:

2001:db8:1234:5678::abcd => 2001:db8:1234:5678::
2001:db8:1234:5678::1234 => 2001:db8:1234:5678::
2001:db8:1234:5678::5678 => 2001:db8:1234:5678::
2001:db8:1234:5678:abcd:1234:ef10:5678 => 2001:db8:1234:5678::
2001:db8:1234:5678:4545:cdcd:6868:dada => 2001:db8:1234:5678::
2001:db8:abcd:2020:abcd:1234:ef10:5678 => 2001:db8:abcd:2020::

image

@@ -0,0 +1 @@

Copy link
Member

Choose a reason for hiding this comment

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

Please fill the parser assert file (even though you have added assertions for the scenario to validate the behavior, it's still a parser, so we also want to test it by itself).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Understood, updated parser.assert file with test results.

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