Defense evaluation
Define success before enabling blocking
Measure legitimate successful requests, latency, origin saturation, rejection counts and false-positive reports. A WAF alert is evidence of a policy match, not proof of a successful attack. Compare results with a pre-change baseline and decide a rollback trigger with the service owner. Never flood a real service for a lesson. The offline fixture contains labeled synthetic decisions, not actual traffic or vendor logs.
{ "window": "synthetic-01", "legitimate": 100, "incorrectly_flagged": 3, "mode": "observe", "review_required": true}Collect useful evidence without collecting secrets
Prefer bounded structured telemetry containing a request identifier, status, latency and policy outcome; avoid request bodies, tokens, cookies and query strings in general-purpose logs. Keep separately governed sensitive audit logs only where required. A 429 may come from a local limit or upstream, so log local decision variables alongside HTTP status. The example belongs in http context and only reports the Nginx rate limiter, not WAF outcomes.
log_format edge_minimal escape=json '{"status":$status,"seconds":$request_time,"rate":"$limit_req_status"}';access_log logs/access.log edge_minimal;Build an incident escalation runbook
During an availability incident, first confirm user impact and compare edge versus origin telemetry. Escalate network saturation to the provider; coordinate application overload with the application and SRE teams. Keep an incident owner, change record and communications channel. Use temporary changes with a rollback plan, verify successful ordinary requests, and restore normal policies after review. Do not treat a higher rate limit as a universal solution. This checklist is an offline runbook template.
1. Confirm availability and scope from approved telemetry.2. Assign incident owner and notify network / application owners.3. Review provider mitigation and origin saturation.4. Approve bounded mitigation; record expiry and rollback.5. Verify normal traffic and monitor residual risk.6. Restore or revise policy after review.Use the staged lab to validate assumptions
The package includes a loopback-only static Nginx site with rate limiting in dry-run mode and a synthetic decision classifier. Run the offline tests first. The optional Nginx checks use only ordinary requests, not load generation. The classifier is not a WAF and does not implement vendor detection. A successful syntax check proves parse compatibility only; it cannot establish network protection or application availability under attack. The example command is for an isolated lab after preparing its prefix as described in the README.
python3 verify_offline.pynginx -p "$PWD/" -c nginx.conf -tCheck Your Understanding
Solidify your learning with the interactive assessment directly below this lesson.
Concept Quiz & Questions
Defense evaluation
Evaluate defensive policy with synthetic evidence, privacy-safe telemetry and a coordinated incident runbook.
What does a WAF alert establish?
Which telemetry is appropriate for general edge logs?
What should precede an enforcement change?
Who should be escalated to when the inbound link is saturated?
What does nginx -t prove here?