fix: keel-overlay-coraza: an audit log that names the rule, and Anubis's challenge by IP #27
No reviewers
Labels
No labels
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Keel-Linux/common!27
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "fix/web-waf-anubis-audit"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Two Keel Web bugs from the maintainer's test screenshots, both in
keel-overlay-coraza(0.1.2).098: the WAF log did not name the rule
Nginx's error log only says
Coraza: Access denied with code 403, unique_id "...".keel-rules.confnow has Coraza write/var/log/coraza/audit.log:SecAuditLogFormat JSON,RelevantOnly), for each blocked request and for each 4xx or 5xx answer except 404;messages[].error_messagein ModSecurity's format ([id "941100"] [msg "..."] [data "..."] [severity "..."]), so CrowdSec can parse it later;transaction.idis the error log'sunique_id.The workers create the WAF and write the file as
www-data. A worker that cannot open the file dies with its WAF, so the directory (www-data:adm 0750) comes from a tmpfiles.d entry and is made at every boot. Coraza keeps the file open, so logrotate copies and truncates it daily. A purge deletes it. A request served normally writes nothing, even when a rule only warned.113: the WAF blocked Anubis's pass-challenge when the site is opened by IP
On a site opened by IP, Anubis's challenge page sends the browser to
/.within.website/x/cmd/anubis/api/pass-challenge?...&redir=<the URL with the IP>. That reached the blocking score of 5 in two ways:attack-rfi);https://[2001:db8::1]/as a shell glob.920350 ("Host header is a numeric IP") is not the cause: it only warns, with a score of 3, and the page by IP was served. The new
keel-exclusions.confis read before the rule set. On paths under/.within.website/only, rule 10001 removesARGS:redirfrom theattack-rfirules and from 932130. No rule is turned off globally. Every other rule still readsredir, and every other argument and path keeps all the rules.Evidence (LXC container of the step7b Web image, cloud_simple, these packages installed)
pass-challengeanswers 302 each time.redirwith an IP on/, another argument on Anubis's path, and<script>or;cat /etc/passwdinredirall still get 403.overlay-web.batswith these tests plus the Coraza on/off and gzip tests: 8/8 passed (with keel-web's front unlinked, as on the CI machine).Test plan
packages / web(overlay-web.bats in the trixie LXC container) greenpackages / build