Skip to content

Blocklists not considering allowlisted IPs from ranges #4022

@dotsam

Description

@dotsam

What would you like to be added?

/kind enhancement

Ranges on a blocklist should consider if allowlisted IP addresses fall within them and not distribute them to bouncers

Why is this needed?

We're an enterprise customer currently using the Service API to create a custom blocklist which we're then subscribing a distributed security engine to. We're also using centralized allowlists in the Console.

The issue that's come up is that in our custom blocklist, we're including some large IP blocks, while some of our allowlists contain a single IP address from the larger block that should be allowed.

We're currently only using the crowdsec-firewall-bouncer remediation component, and it seems like there's nothing that will factor a single IP out being included in a blocked IP set.

I see a few potential solutions here:

  • Given that these are centralized allow and block lists, either the CAPI or the LAPI could spot that the allowed IP is in a blocked range and factor it out. In the example below though, this creates 17 ranges from a single range, so this may not scale
  • Distribute the allowlist to bouncers for them to implement. In the case of the firewall bouncer, this could be implemented as a dedicated ipset where traffic is accepted, or the existing ipsets for blocklists could have an entry added with nomatch.

Here's an example, where 52.86.0.0/15 is on the custom blocklist, and 52.87.72.16 is on a centralized allowlist.

On the LAPI:

# cscli decisions list --all -o raw | grep '52\.86\.0'

368969241,lists,Ip:52.86.0.0/15,our-custom-blocklist,ban,,,0,-5h23m53s,false,1943512
# cscli allowlists check 52.87.72.16

52.87.72.16 is allowlisted by item 52.87.72.16 from uptimerobot (uptimerobot)

And on the host where the firewall bouncer is installed:

# ipset test crowdsec-blacklists-4 52.87.72.16

Warning: 52.87.72.16 is in set crowdsec-blacklists-4.
# ipset list crowdsec-blacklists-4 | grep '52\.86\.0'

52.86.0.0/15 timeout 64943

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions