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 {
74
74
}
75
75
}
76
76
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
+ }
77
90
}
78
91
Original file line number Diff line number Diff line change @@ -140,6 +140,28 @@ jobs:
140
140
echo "FAIL"
141
141
exit 1
142
142
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
143
165
- name : Start Nginx with redir
144
166
run : |
145
167
sudo killall nginx
@@ -320,4 +342,4 @@ jobs:
320
342
md temp
321
343
set TEMP=temp
322
344
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