puppetlabs-apache icon indicating copy to clipboard operation
puppetlabs-apache copied to clipboard

ModSecurity - enable management of rulesets on Debian, add option for custom `SecAction`

Open griggi-ws opened this issue 3 months ago • 1 comments

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 a custom_actions_set to similarly define SecActions 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

  • [x] 🟢 Spec tests.
  • [ ] 🟢 Acceptance tests.
  • [x] Manually verified.

griggi-ws avatar Sep 16 '25 14:09 griggi-ws