Update of "modseccfg"
Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
| Artifact ID: | 0f1eb171cf238aea3439e1f450fb84823d83c575a16fdcd9a35cea5cbc029420 |
|---|---|
| Page Name: | modseccfg |
| Date: | 2020-11-19 19:25:57 |
| Original User: | mario |
| Mimetype: | text/x-markdown |
| Parent: | 30303fa2ea1c9a0c708a8a13a324d69c5a1a762fd5ed66df12af4f97d308c79c (diff) |
| Next | 302b15189bd8893e7a9e114ad37375b94d8723cfc23b6d1af4ad64618eddbc91 |
WARNING: THIS IS ALPHA STAGE QUALITY AND WILL MOST CERTAINLY DELETE YOUR APACHE CONFIGURATION - It doesn't, but: no warranty and such. - Also, hasn't many features yet.
mod_security config
- Simple GUI editor for SecRuleRemoveById settings
- Tries to suggest false positives from error and audit logs
- Can configure mod_security directives and CoreRuleSet variables.
- Runs locally, via
ssh -Xforwarding, or permodseccfg vps5:/automount.
Installation
You can install this package locally or on a server:
pip3 install modseccfgRequires a full Python 3.x installation:
sudo apt install python3-tk ttf-unifont libapache2-mod-security2
Start options
To run the GUI locally / on test setups:
modseccfgTo start it on a server per X11 forwarding (terribly slow over SSH):
ssh -X vps5 modseccfgAlternatively use xpra:
xpra --start ssh:vps5 --start=modseccfgBest: use an automatic filesystem mount (with ssh shortcut/pubkey auth already configured). That's a bit slow on startup, but pays off when browsing for details.
modseccfg vps5:/
WARNING: This will bind the remote
/server root. Take care to configure the mount point (File β Settings β Utils β Remote binding), and no backup or cleanup job is running whilst modseccfg is active.
This doesn't strictly require the root user for ssh, but permissions for logs and individual*.conffiles when changed (chownthe ones that shall be editable). The sshfs/fuse mount will be terminated with the GUI, though.
Usage
You obviously should have Apache(2.x) + mod_security(2.9) + CRS(3.x) set up and running already (in DetectionOnly mode initially), to allow for log inspection and adapting rules.
- Start modseccfg (
python3 -m modseccfg) - Select a configuration/vhost file to inspect + work on.
- Pick the according error.log
- Inspect the rules with a high error count.
- [Disable] offending rules
- Don't just go by the error count however!
- Make sure you don't disable essential or heuristic rules.
- Compare error with access log details.
- Else craft an exception rule ([Modify] or βRecipes).
- Thenceforth restart Apache after testing changes (
apache2ctl -t).
Notes
- Preferrably do not edit default
/etc/apache*files - Work on separated
/srv/web/conf.d/*configuration, if available - And keep vhost settings in e.g.
vhost.*.dirfiles, rather than multiple<VirtualHost>in one*.conf(else only the first section will be augmented). - Use the editor (F4) to verify more complex settings.
Missing features
- Doesn't process any audit.log yet.
- Can't classify wrapped (
<Location>or other directives) rules yet. - Recipes are not worth using yet.
- No sudo usage.