Advertisement
DD3AH

Apache ModSecurity2

Oct 2nd, 2022 (edited)
2,072
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
SSH Config 0.79 KB | Cybersecurity | 0 0
  1. # Standard-Konfiguration von Apache ModSecurity2 unter Debian 11
  2.  
  3. # Pakete installieren
  4. apt-get install modsecurity-crs libapache2-mod-security2
  5.  
  6. # Konfiguration anpassen
  7. cd /etc/modsecurity/
  8.  
  9. # Standard-Konfig aktivieren
  10. cp modsecurity.conf-recommended modsecurity.conf
  11.  
  12. # Engine einschalten
  13. sed -i 's/SecRuleEngine DetectionOnly/SecRuleEngine On/;'  modsecurity.conf
  14.  
  15. # Modul im Apache aktivieren (wird meist schon beim apt-get gemacht)
  16. a2enmod security2
  17.  
  18. # Konfiguration prüfen
  19. apachectl configtest
  20.  
  21. # Apache neu starten
  22. apachectl graceful
  23.  
  24. # finde blockierende Regeln
  25. perl -ne 'if (/id "(\d*)"/){print "$1\n"}' /var/log/apache2/modsec_audit.log  | sort -u | xargs
  26.  
  27. # false positive Regeln für das passende Verzeichnis in der Apache-Konfig deaktivieren
  28. SecRuleRemoveByID ...
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement