mirror of
https://github.com/owasp-modsecurity/ModSecurity.git
synced 2025-09-29 19:24:29 +03:00
Merge branch 'v2/master' into v2/pr/ci_log
This commit is contained in:
13
.github/workflows/ci.yml
vendored
13
.github/workflows/ci.yml
vendored
@@ -54,9 +54,20 @@ jobs:
|
||||
# '|| :' handles the case grep doesn't match, otherwise the script exits with 1 (error)
|
||||
errors=$(grep -E ':(?error|warn)[]]' /var/log/apache2/error.log) || :
|
||||
if [[ -z "${errors}" ]]; then exit 0; fi
|
||||
echo "::error::Found errors/warnings in error.log"
|
||||
echo "::error:: Found errors/warnings in error.log"
|
||||
echo "${errors}"
|
||||
exit 1
|
||||
- name: Check error.log
|
||||
run: |
|
||||
# Send requests & check log format
|
||||
# Valid request
|
||||
curl -s http://127.0.01/ > /dev/null || echo $?
|
||||
# Invalid request
|
||||
curl -s http://127.0.01/%2e%2f > /dev/null || echo $?
|
||||
# Check log format
|
||||
grep -F ModSecurity < /var/log/apache2/error.log | grep -vP "^\[[^\]]+\] \[security2:[a-z]+\] \[pid [0-9]+:tid [0-9]+\] (?:\[client [0-9.:]+\] )?ModSecurity" || exit 0
|
||||
# grep -v succeeded => found some lines with invalid format
|
||||
exit 1
|
||||
- name: Show httpd error log
|
||||
if: always()
|
||||
run: sudo cat /var/log/apache2/error.log
|
||||
|
Reference in New Issue
Block a user