nself waf
هذا المحتوى غير متوفر بلغتك بعد.
nself waf
Section titled “nself waf”Manage the Web Application Firewall (Coraza + OWASP CRS).
Synopsis
Section titled “Synopsis”nself waf <subcommand> [flags]Description
Section titled “Description”nself waf manages a Coraza WAF integrated with nginx, using the OWASP Core Rule Set (CRS). It supports two modes: detection (log suspicious requests but allow them through) and blocking (reject requests matching CRS rules). Detection is the safer first step when introducing a WAF.
waf enable provisions nginx/waf/coraza.conf and an empty nginx/waf/custom.conf for project-specific rules. waf mode <detection|blocking> flips the SecRuleEngine directive in coraza.conf. waf report reads the WAF audit log inside the running nginx container and prints recent events; --since filters by time window.
After enabling or switching mode, run nself build && nself restart nginx so nginx picks up the change. WAF events are also emitted with the waf_event label so Loki and Grafana dashboards can chart them.
Subcommands
Section titled “Subcommands”| Name | Description |
|---|---|
enable | Enable the WAF in detection mode |
mode <detection|blocking> | Set WAF enforcement mode |
report | Show recent WAF events |
waf report
Section titled “waf report”| Flag | Default | Description |
|---|---|---|
--since | 24h | Time window for report (e.g., 1h, 24h, 7d) |
Examples
Section titled “Examples”# First-time enable in safe detection modenself waf enablenself build && nself restart nginx
# Switch to blocking mode after a soak periodnself waf mode blockingnself restart nginx
# Switch back to detection if blocking causes false positivesnself waf mode detectionnself restart nginx
# Inspect events from the last hournself waf report --since 1hSee Also
Section titled “See Also”- cmd-security: security audit and setup
- cmd-alerts: alert rules
- cmd-monitor: Grafana dashboards
- Commands: full command index