doc:appunti:linux:sa:apache_modsecurity2
Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
doc:appunti:linux:sa:apache_modsecurity2 [2025/07/07 09:26] – created niccolo | doc:appunti:linux:sa:apache_modsecurity2 [2025/07/16 18:26] (current) – [Definizione delle regole] niccolo | ||
---|---|---|---|
Line 4: | Line 4: | ||
* **libapache2-mod-security2** - Modulo Apache | * **libapache2-mod-security2** - Modulo Apache | ||
- | * **modsecurity-crs** - Set di regole OWASP | + | * **modsecurity-crs** - Set di regole OWASP, pacchetto opzionale, ma raccomandato. Viene quindi installato automaticamente. |
+ | |||
+ | Il file di configurazione è **/ | ||
- | Il file di configurazione è **/ | ||
< | < | ||
Line 21: | Line 22: | ||
# Track requests to some php pages. | # Track requests to some php pages. | ||
- | SecRule REQUEST_URI " | + | SecRule REQUEST_URI " |
- | | + | SecRule REQUEST_URI " |
- | SecRule REQUEST_URI " | + | |
- | | + | |
# Threshold: one request every 3 seconds (60 req / 180 s). | # Threshold: one request every 3 seconds (60 req / 180 s). | ||
- | SecRule IP: | + | SecRule IP: |
- | | + | SecRule IP: |
- | | + | |
- | SecRule IP: | + | |
- | | + | |
- | | + | |
# Reset the counter using a rolling window. | # Reset the counter using a rolling window. | ||
SecAction " | SecAction " | ||
Line 37: | Line 32: | ||
# Block any further requests if the IP is blocked | # Block any further requests if the IP is blocked | ||
SecRule IP:BLOCKED "@eq 1" " | SecRule IP:BLOCKED "@eq 1" " | ||
+ | </ | ||
+ | |||
+ | ===== Definizione delle regole ===== | ||
+ | |||
+ | La prima **SecRule** definita valuta la variabile **REQUEST_URI**, | ||
+ | |||
+ | **ATTENZIONE**: | ||
+ | |||
+ | Collegata alla regola precedente vi è un' | ||
+ | |||
+ | FIXME | ||
+ | |||
+ | Quando si cambia il file di configurazione è sufficiente fare il reload di Apache: | ||
+ | |||
+ | < | ||
+ | systemctl reload apache2.service | ||
+ | </ | ||
+ | |||
+ | Nella configurazione sopra viene indicato il file di log **/ | ||
+ | |||
+ | < | ||
+ | / | ||
+ | daily | ||
+ | missingok | ||
+ | rotate 365 | ||
+ | compress | ||
+ | delaycompress | ||
+ | notifempty | ||
+ | create 640 root adm | ||
+ | } | ||
</ | </ | ||
doc/appunti/linux/sa/apache_modsecurity2.1751873192.txt.gz · Last modified: by niccolo