Skip to content

Commit e9813cd

Browse files
author
Felipe Zimmerle
committed
Regression test: get it working with apache 2.4
Changes in httpd.conf.in to get it working with apache 2.4
1 parent 7366f35 commit e9813cd

File tree

2 files changed

+43
-40
lines changed

2 files changed

+43
-40
lines changed

tests/regression/rule/10-xml.t

+36-36
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@
1010
SecRequestBodyAccess On
1111
SecDebugLog $ENV{DEBUG_LOG}
1212
SecDebugLogLevel 9
13-
SecRule REQUEST_HEADERS:Content-Type "^text/xml\$" \\,id:500005
14-
"phase:1,t:none,t:lowercase,nolog,pass,ctl:requestBodyProcessor=XML"
13+
SecRule REQUEST_HEADERS:Content-Type "^text/xml\$" "id:500005, \\
14+
phase:1,t:none,t:lowercase,nolog,pass,ctl:requestBodyProcessor=XML"
1515
SecRule REQBODY_PROCESSOR "!^XML\$" nolog,pass,skipAfter:12345,id:500006
16-
SecRule XML "\@validateSchema $ENV{CONF_DIR}/SoapEnvelope.xsd" \\,id:500007
17-
"phase:2,deny,id:12345"
16+
SecRule XML "\@validateSchema $ENV{CONF_DIR}/SoapEnvelope.xsd" "id:500007, \\
17+
phase:3:,deny"
1818
),
1919
match_log => {
2020
debug => [ qr/XML: Initialising parser.*XML: Parsing complete \(well_formed 1\).*Target value: "\[XML document tree\]".*Successfully validated payload against Schema/s, 1 ],
@@ -59,11 +59,11 @@
5959
SecDebugLogLevel 9
6060
SecAuditEngine RelevantOnly
6161
SecAuditLog "$ENV{AUDIT_LOG}"
62-
SecRule REQUEST_HEADERS:Content-Type "^text/xml\$" \\,id:500008
63-
"phase:1,t:none,t:lowercase,nolog,pass,ctl:requestBodyProcessor=XML"
62+
SecRule REQUEST_HEADERS:Content-Type "^text/xml\$" "id:500008, \\
63+
phase:1,t:none,t:lowercase,nolog,pass,ctl:requestBodyProcessor=XML"
6464
SecRule REQBODY_PROCESSOR "!^XML\$" nolog,pass,skipAfter:12345,id:500009
65-
SecRule XML "\@validateSchema $ENV{CONF_DIR}/SoapEnvelope.xsd" \\,id:500010
66-
"phase:2,deny,log,auditlog,id:12345"
65+
SecRule XML "\@validateSchema $ENV{CONF_DIR}/SoapEnvelope.xsd" "id:500010 \\
66+
phase:2,deny,log,auditlog,id:12345"
6767
),
6868
match_log => {
6969
debug => [ qr/XML: Initialising parser.*XML: Parsing complete \(well_formed 1\).*Target value: "\[XML document tree\]".*'badval' is not a valid value of the local atomic type.*Schema validation failed/s, 1 ],
@@ -108,11 +108,11 @@
108108
SecDebugLogLevel 9
109109
SecAuditEngine RelevantOnly
110110
SecAuditLog "$ENV{AUDIT_LOG}"
111-
SecRule REQUEST_HEADERS:Content-Type "^text/xml\$" \\,id:500011
112-
"phase:1,t:none,t:lowercase,nolog,pass,ctl:requestBodyProcessor=XML"
111+
SecRule REQUEST_HEADERS:Content-Type "^text/xml\$" "id:500011, \\
112+
phase:1,t:none,t:lowercase,nolog,pass,ctl:requestBodyProcessor=XML"
113113
SecRule REQBODY_PROCESSOR "!^XML\$" nolog,pass,skipAfter:12345,id:500012
114-
SecRule XML "\@validateSchema $ENV{CONF_DIR}/SoapEnvelope.xsd" \\,id:500013
115-
"phase:2,deny,id:12345"
114+
SecRule XML "\@validateSchema $ENV{CONF_DIR}/SoapEnvelope.xsd" "id:500013 \\
115+
phase:2,deny,id:12345"
116116
),
117117
match_log => {
118118
debug => [ qr/XML: Initialising parser.*XML: Parsing complete \(well_formed 1\).*Target value: "\[XML document tree\]".*element is not expected/s, 1 ],
@@ -158,11 +158,11 @@
158158
SecDebugLogLevel 9
159159
SecAuditEngine RelevantOnly
160160
SecAuditLog "$ENV{AUDIT_LOG}"
161-
SecRule REQUEST_HEADERS:Content-Type "^text/xml\$" \\,id:500014
162-
"phase:1,t:none,t:lowercase,nolog,pass,ctl:requestBodyProcessor=XML"
161+
SecRule REQUEST_HEADERS:Content-Type "^text/xml\$" "id:500014, \\
162+
phase:1,t:none,t:lowercase,nolog,pass,ctl:requestBodyProcessor=XML"
163163
SecRule REQBODY_PROCESSOR "!^XML\$" nolog,pass,skipAfter:12345,id:500015
164-
SecRule XML "\@validateSchema $ENV{CONF_DIR}/SoapEnvelope.xsd" \\,id:500016
165-
"phase:2,deny,id:12345"
164+
SecRule XML "\@validateSchema $ENV{CONF_DIR}/SoapEnvelope.xsd" "id:500016, \\
165+
phase:2,deny,id:12345"
166166
),
167167
match_log => {
168168
debug => [ qr/XML: Initialising parser.*XML: Parsing complete \(well_formed 0\).*XML parser error.*validation failed because content is not well formed/s, 1 ],
@@ -208,11 +208,11 @@
208208
SecDebugLogLevel 9
209209
SecAuditEngine RelevantOnly
210210
SecAuditLog "$ENV{AUDIT_LOG}"
211-
SecRule REQUEST_HEADERS:Content-Type "^text/xml\$" \\,id:500017
212-
"phase:1,t:none,t:lowercase,nolog,pass,ctl:requestBodyProcessor=XML"
211+
SecRule REQUEST_HEADERS:Content-Type "^text/xml\$" "id:500017 \\
212+
phase:1,t:none,t:lowercase,nolog,pass,ctl:requestBodyProcessor=XML"
213213
SecRule REQBODY_PROCESSOR "!^XML\$" nolog,pass,skipAfter:12345,id:500018
214-
SecRule XML "\@validateSchema $ENV{CONF_DIR}/SoapEnvelope-bad.xsd" \\,id:500019
215-
"phase:2,deny,id:12345"
214+
SecRule XML "\@validateSchema $ENV{CONF_DIR}/SoapEnvelope-bad.xsd" "id:500019 \\
215+
phase:2,deny,id:12345"
216216
),
217217
match_log => {
218218
debug => [ qr/XML: Initialising parser.*XML: Parsing complete \(well_formed 1\).*Target value: "\[XML document tree\]".*Failed to parse the XML resource.*Failed to load Schema/s, 1 ],
@@ -256,11 +256,11 @@
256256
SecRequestBodyAccess On
257257
SecDebugLog $ENV{DEBUG_LOG}
258258
SecDebugLogLevel 9
259-
SecRule REQUEST_HEADERS:Content-Type "^text/xml\$" \\,id:500020
260-
"phase:1,t:none,t:lowercase,nolog,pass,ctl:requestBodyProcessor=XML"
259+
SecRule REQUEST_HEADERS:Content-Type "^text/xml\$" "id:500020, \\
260+
phase:1,t:none,t:lowercase,nolog,pass,ctl:requestBodyProcessor=XML"
261261
SecRule REQBODY_PROCESSOR "!^XML\$" nolog,pass,skipAfter:12345,id:500021
262-
SecRule XML "\@validateDTD $ENV{CONF_DIR}/SoapEnvelope.dtd" \\,id:500022
263-
"phase:2,deny,id:12345"
262+
SecRule XML "\@validateDTD $ENV{CONF_DIR}/SoapEnvelope.dtd" "id:500022, \\
263+
phase:2,deny,id:12345"
264264
),
265265
match_log => {
266266
debug => [ qr/XML: Initialising parser.*XML: Parsing complete \(well_formed 1\).*Target value: "\[XML document tree\]".*Successfully validated payload against DTD/s, 1 ],
@@ -299,11 +299,11 @@
299299
SecRequestBodyAccess On
300300
SecDebugLog $ENV{DEBUG_LOG}
301301
SecDebugLogLevel 9
302-
SecRule REQUEST_HEADERS:Content-Type "^text/xml\$" \\,id:500023
303-
"phase:1,t:none,t:lowercase,nolog,pass,ctl:requestBodyProcessor=XML"
302+
SecRule REQUEST_HEADERS:Content-Type "^text/xml\$" "id:500023, \\
303+
phase:1,t:none,t:lowercase,nolog,pass,ctl:requestBodyProcessor=XML"
304304
SecRule REQBODY_PROCESSOR "!^XML\$" nolog,pass,skipAfter:12345,id:500024
305-
SecRule XML "\@validateDTD $ENV{CONF_DIR}/SoapEnvelope.dtd" \\,id:500025
306-
"phase:2,deny,id:12345"
305+
SecRule XML "\@validateDTD $ENV{CONF_DIR}/SoapEnvelope.dtd" "id:500025, \\
306+
phase:2,deny,id:12345"
307307
),
308308
match_log => {
309309
debug => [ qr/XML: Initialising parser.*XML: Parsing complete \(well_formed 1\).*Target value: "\[XML document tree\]".*content does not follow the DTD/s, 1 ],
@@ -342,11 +342,11 @@
342342
SecRequestBodyAccess On
343343
SecDebugLog $ENV{DEBUG_LOG}
344344
SecDebugLogLevel 9
345-
SecRule REQUEST_HEADERS:Content-Type "^text/xml\$" \\,id:500026
346-
"phase:1,t:none,t:lowercase,nolog,pass,ctl:requestBodyProcessor=XML"
345+
SecRule REQUEST_HEADERS:Content-Type "^text/xml\$" "id:500026, \\
346+
phase:1,t:none,t:lowercase,nolog,pass,ctl:requestBodyProcessor=XML"
347347
SecRule REQBODY_PROCESSOR "!^XML\$" nolog,pass,skipAfter:12345,id:500027
348-
SecRule XML "\@validateDTD $ENV{CONF_DIR}/SoapEnvelope.dtd" \\,id:500028
349-
"phase:2,deny,id:12345"
348+
SecRule XML "\@validateDTD $ENV{CONF_DIR}/SoapEnvelope.dtd" "id:500028, \\
349+
phase:2,deny,id:12345"
350350
),
351351
match_log => {
352352
debug => [ qr/XML: Initialising parser.*XML: Parsing complete \(well_formed 0\).*XML parser error.*validation failed because content is not well formed/s, 1 ],
@@ -385,11 +385,11 @@
385385
SecRequestBodyAccess On
386386
SecDebugLog $ENV{DEBUG_LOG}
387387
SecDebugLogLevel 9
388-
SecRule REQUEST_HEADERS:Content-Type "^text/xml\$" \\,id:500029
389-
"phase:1,t:none,t:lowercase,nolog,pass,ctl:requestBodyProcessor=XML"
388+
SecRule REQUEST_HEADERS:Content-Type "^text/xml\$" "id:500029, \\
389+
phase:1,t:none,t:lowercase,nolog,pass,ctl:requestBodyProcessor=XML"
390390
SecRule REQBODY_PROCESSOR "!^XML\$" nolog,pass,skipAfter:12345,id:500030
391-
SecRule XML "\@validateDTD $ENV{CONF_DIR}/SoapEnvelope-bad.dtd" \\,id:500031
392-
"phase:2,deny,id:12345"
391+
SecRule XML "\@validateDTD $ENV{CONF_DIR}/SoapEnvelope-bad.dtd" "id:500031 \\
392+
phase:2,deny,id:12345"
393393
),
394394
match_log => {
395395
debug => [ qr/XML: Initialising parser.*XML: Parsing complete \(well_formed 1\).*Target value: "\[XML document tree\]".*Failed to load DTD/s, 1 ],

tests/regression/server_root/conf/httpd.conf.in

+7-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
### Base configuration for starting Apache httpd
22

3+
LoadModule access_compat_module /usr/lib/apache2/modules/mod_access_compat.so
4+
LoadModule mpm_worker_module /usr/lib/apache2/modules/mod_mpm_worker.so
5+
36
<IfDefine !CHROOT>
47
# File locations
58
PidFile @MSC_REGRESSION_LOGS_DIR@/httpd.pid
@@ -16,9 +19,7 @@
1619

1720
<IfDefine !NOMODSEC>
1821
# TODO: Need to have these configurable
19-
LoadFile /usr/lib/libxml2.so
20-
LoadFile /usr/lib/liblua5.1.so
21-
LoadModule security2_module @APXS_LIBEXECDIR@/mod_security2.so
22+
LoadModule security2_module @MSC_BASE_DIR@/apache2/.libs/mod_security2.so
2223
</IfDefine>
2324

2425
ServerName localhost
@@ -31,7 +32,9 @@ ErrorLog @MSC_REGRESSION_LOGS_DIR@/error.log
3132
<IfDefine !CHROOT>
3233
DocumentRoot @MSC_REGRESSION_DOCROOT_DIR@
3334
<Directory "@MSC_REGRESSION_DOCROOT_DIR@">
34-
Options Indexes FollowSymLinks
35+
Options +Indexes +FollowSymLinks
3536
AllowOverride None
37+
Allow from all
38+
Satisfy Any
3639
</Directory>
3740
</IfDefine>

0 commit comments

Comments
 (0)