ModSecurity - enable management of rulesets on Debian, add option for custom SecAction
#2607
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
The management of
activated_rules
was disabled many years ago for Debian, but in its current state the module does have the appropriate paths defined in the module config to properly manage it. I've removed the condition preventing it and added some test coverage to match that of RHEL.The custom rules definition currently only supports the definition of
SecRules
, I considered modifying the existing config to optionally support a more complex input with an enum for action/rule, but decided to minimize complexity there and not affect any existing usage. I've added acustom_actions_set
to similarly defineSecActions
in the same custom rules file. In an ideal implementation, one could define Actions, Rules, and Markers in a given data structure and the order would be respected to allow for more complex rule definition.I validated this on Ubuntu, but verified that the Debian package has the same file layout for rules:
https://packages.debian.org/trixie/all/modsecurity-crs/filelist
Checklist