File tree Expand file tree Collapse file tree 2 files changed +36
-1
lines changed Expand file tree Collapse file tree 2 files changed +36
-1
lines changed Original file line number Diff line number Diff line change @@ -74,5 +74,18 @@ http {
7474 }
7575 }
7676
77+ server {
78+ listen 80 ;
79+ server_name modsecurity_disable_error_log;
80+
81+ modsecurity on;
82+ modsecurity_disable_error_log on;
83+ modsecurity_rules_file /home/runner/work/ModSecurity-nginx/ModSecurity-nginx/ModSecurity-nginx/.github/nginx/modsecurity.conf;
84+ root /usr/local/nginx/html/;
85+
86+ location / {
87+ try_files $uri /index .html;
88+ }
89+ }
7790}
7891
Original file line number Diff line number Diff line change @@ -140,6 +140,28 @@ jobs:
140140 echo "FAIL"
141141 exit 1
142142 fi
143+ - name : Check attack log vhost 2 (modsecurity_disable_error_log off(default))
144+ run : |
145+ if ( grep -q "modsectest2" /usr/local/nginx/logs/error.log ); then
146+ echo "OK"
147+ else
148+ echo "FAIL"
149+ exit 1
150+ fi
151+ - name : Check attack log vhost 3 (modsecurity_disable_error_log on)
152+ run : |
153+ status=$(curl -sSo /dev/null -w %{http_code} -I -X GET -H "Host: modsecurity_disable_error_log" "http://localhost/?q=attack")
154+ if [ "${status}" == "403" ]; then
155+ if ( grep -q "modsecurity_disable_error_log" /usr/local/nginx/logs/error.log ); then
156+ echo "FAIL"
157+ exit 1
158+ else
159+ echo "OK"
160+ fi
161+ else
162+ echo "FAIL"
163+ exit 1
164+ fi
143165 - name : Start Nginx with redir
144166 run : |
145167 sudo killall nginx
@@ -320,4 +342,4 @@ jobs:
320342 md temp
321343 set TEMP=temp
322344 set TEST_NGINX_BINARY=..\objs\nginx.exe
323- prove modsecurity*.t
345+ prove modsecurity*.t
You can’t perform that action at this time.
0 commit comments