- Maintenance and security teams
- Training and technical support
- Managers and other internal key stakeholders
- Future project/feature owners/maintainers
TL;DR: We need:
- a better way to keep people’s rules up to date
- to consider that modsec2 is close to EOL and 3.x is on the horizon
- to support multiple web servers (starting w/ 3.x probably though 2 is possible).
Details:
We had been distributing OWASP’s Core Rule Set via WHM’s vendor YAML system.
The YAML and data was built using the voodoo system.
It was ineffective because no one really understands or “owns” the system. The result? The latest rules voodoo installs are over 3 years old at the time of this writing.
Mod Security 2 is very Apache centric so its more difficult to make it work with other web servers.
We need to factor in this information:
- the current voodoo based rules are v3.0.3, and the latest as of this writing it v3.3.0
- OWASP CRS support mod sec “2.8 on”, with some hints that they might work on 3.0 but definetly not 3.1
- it sounds more like rules written for 3.0 will work on 2.8 but not 3.1 but 2.8 won’t work on 3.0
- the current voodoo based rules get installed to /etc/apache2/conf.d/modsec_vendor_configs/OWASP3/
- the actual vendor configuration that Apache uses to turn vendor rules on or off/that can be managed via WHM are in /etc/apache2/conf.d/modsec/modsec2.cpanel.conf (Owned by ea-apache24-mod_security2)
- arbitrary custom rules are put into /etc/apache2/conf.d/modsec/modsec2.user.conf (Owned by ea-apache24-mod_security2)
While modsec3 design will be its own document we do need to consider some things during the RPMifying of the modsec2 rules.
For example, using this naming for rules packages:
<PREFIX>-modsec<DIGITS>-rules-<ORGANIZATION>-<RULESET NAME> gives us ea-modsec2-rules-owasp-crs now and for, say 3.1, we’d do ea-modsec31-rules-owasp-crs, for 3.2 ea-modsec32-rules-owasp-crs, ad infinitum. That also allows for other vendors, oranizations, and multiple rulesets (e.g. alt-modsec42-comodo-free, alt-modsec42-comodo-pro, etc).
The versioning would fit in w/ the v3 approach of library and connectors, e.g.:
ea-modsec31ea-modsec31-connector-nginxea-modsec31-connector-apache24
Estimate:
- how much time and resources will be needed to maintain the feature in the future
- how frequently maintenance will need to happen
To implement, normal new package efforts (i.e. et new).
Once implemented, normal EA4 package maintenance (i.e. automated updates via et update).
Since we have to work around existing stuff there are not a lot of options. The naming scheme seems future proof per the details above.
If the RPM installs and owns /etc/apache2/conf.d/modsec_vendor_configs/OWASP3/ then everything should just work w/ a minimum of changes to one UI (no API call or backend changes necessary).
The RPM needs to take over the voodoo files/configuration on install. That includes setting it to enabled and turning off updates (so the system does not try to update a thing that does not use that update system). On uninstall we don’t want to restore the backed up voodoo files because if they made any changes that are not compatible it could take Apache down.
The RPM should enable all the rulesets on install (unless there is existing OWASP3 rulesets).
On install (unless we’ve enabled all rulesets) and update we want to enable new rulesets (checking the syntax before adding).
We do not want to make the ea-apache24-mod_security2 require this ruleset because everyone has mod security so everyone would get rules they didn’t ask for, which is begging for tickets and ill will.
| Approach | Pro | Con | Notes |
|---|---|---|---|
| Do v3.3.0 first thing | Gets everyone updated | If there is a problem we have no easy recourse | Nope |
| Do v3.0.2 first thing, update to v3.3.0 in a few months | Should be most likely to keep working when RPM is installed | If we update to 3.3.0 and there are problems we break everyone at the same time | Nope |
| Do v3.0.2, then immedietly update to v3.3.0 | Opt in to 3.3.0 so if there is a problem we effect a minimum of servers | If there is a huge problem that doofs a tons of people we can et rollback to the 3.0.2 version |
Opt in via CLI, UI, or feature showcase |
There are a few ULC items that could confuse users and/or cause problems if they were to use RPM based mod sec rule vendors (see CPANEL-33703 for details).
| Approach | Pro | Con | Notes |
|---|---|---|---|
| old versions can deal w/ bad UX, maybe backport CPANEL-33703 to 90? | very little work | older verison will have bad UX | N/A - it is what it is |
| Backport CPANEL-33703 from 92 to LTS (86) | Sane method | People who stay on old versions are unlikely to update to the new version | At least support could say, update your 86 and it won’t be weird |
| Have an RPM apply a patch of what would have been backported | All supported versions would have good UX | It is really gross to change files that belong to the ULC install | N/A - it is what it is |
Do v3.0.2 then immediate v3.3.0 option then make these UI changes:
/scripts2/manage_mod_security_vendors/vendors
- add a table (¿above vendor based for prominence?) for RPM based rulesets:
- if
ea-apache24-mod_security2is installed show a row for each<PREFIX>-modsec2-rules-<ORGANIZATION>-<RULESET NAME>package available - for each
ea-modsec<DIGITS>that is installed show a row for each<PREFIX>-modsec<DIGITS>-rules-<ORGANIZATION>-<RULESET NAME>package available - each row should have an install/uninstall button (depending on its current state)
- we could instead use the existing pattern and show each RPM that is available but uninstalled as a row that says “this is not installed” and has an install button
- if
- if they currently have our voodoo YAML bit enabled: give them a “switch to the new hotness” button that installs the RPM (the RPM removes the voodoo bits)
- if they do not have our voodoo YAML bit enabled: do not show the “want to install it?” thing (should not even have a row):
- if they try to install our voodoo via the YAML file: it should error
- The table that shows vendors, when it gets to an RPM based rule set:
- Updates: should be disabled/clear that this is moot (ZC-7305 has a patch that makes it “RPM: Always Updated”)
- Delete: should take them to the EA4 provision screen (ZC-7305 has a patch that does that)
Initially, try for backport CPANEL-33703 to LTS and adjust based on pushback.
None.