Skip to content

Conversation

@LaurenceJJones
Copy link
Member

@LaurenceJJones LaurenceJJones commented Aug 13, 2025

fix #84 to be tested and validated by the team, the PR does not mean that this solution will be accept and simply is just the building blocks.

What

  • Added root-level disable_ipv4 and disable_ipv6.
  • Added per-WAF disable_ipv4 and disable_ipv6 in each waf_config entry.
  • Inheritance: per-WAF overrides root; if not set per-WAF, inherits from root.
  • Enforcement: UpdateSetsContent skips both add and delete operations for the disabled IP family.

Why

  • Allow globally disabling an IP family or overriding per WAF to opt-in/out.

Behavior

  • Defaults to enabled for both families (flags default to false).
  • If disabled, both additions and deletions for that IP family are skipped.

Env vars

  • Root: BOUNCER_DISABLE_IPV4, BOUNCER_DISABLE_IPV6
  • Per-WAF: BOUNCER_WAF_CONFIG_<N>_DISABLE_IPV4, BOUNCER_WAF_CONFIG_<N>_DISABLE_IPV6

Example YAML

Root only:

api_key: ${API_KEY}
api_url: "http://127.0.0.1:8080/"
update_frequency: 10s

disable_ipv6: true

waf_config:
  - web_acl_name: mywebacl
    fallback_action: ban
    rule_group_name: crowdsec-rule-group
    scope: REGIONAL
    region: eu-west-1
    ipset_prefix: crowdsec-blocklist

Per-WAF overrides:

api_key: ${API_KEY}
api_url: "http://127.0.0.1:8080/"
update_frequency: 10s

waf_config:
  - web_acl_name: ipv4onlywebcl
    disable_ipv6: true    # override: disable IPv6 for this WAF
    fallback_action: ban
    rule_group_name: crowdsec-rule-group
    scope: REGIONAL
    region: eu-west-1
    ipset_prefix: crowdsec-blocklist
  - web_acl_name: ipv6onlywebcl
    disable_ipv4: true    # override: disable IPv4 for this WAF
    fallback_action: ban
    rule_group_name: crowdsec-rule-group
    scope: REGIONAL
    region: eu-west-1
    ipset_prefix: crowdsec-blocklist
  • Backward compatibility: no change unless the new flags are set.

@LaurenceJJones
Copy link
Member Author

LaurenceJJones commented Aug 13, 2025

@mmetc the python testing library to spin up a crowdsec instance, we should probably add CROWDSEC_BYPASS_DB_VOLUME_CHECK by default to the passed in env or else all tests using the python package will most likely fail now.

edit didnt see this was already handled, need to merge #86 before any new PR's.

@arthurzenika
Copy link

We'd be interested in having this integrated. Happy to test and provide feedback.

@LaurenceJJones
Copy link
Member Author

We'd be interested in having this integrated. Happy to test and provide feedback.

Feel free! the CI is failing because the env code is massive switch/if blocks, not an actual issue with the code.

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.

Cannot Disable IPV6 Set Creation

2 participants