Skip to content

Commit 462308b

Browse files
author
Felipe Zimmerle
committed
Improves the accuracy of version identification on status calls
Trying to differentiate among IIS, Apache, NGINX, and Standalone builds.
1 parent a235b53 commit 462308b

File tree

2 files changed

+53
-1
lines changed

2 files changed

+53
-1
lines changed

apache2/msc_status_engine.c

+3-1
Original file line numberDiff line numberDiff line change
@@ -349,8 +349,10 @@ int DSOLOCAL msc_beacon_string (char *beacon_string, int beacon_string_max_len)
349349
#endif
350350
libxml = LIBXML_DOTTED_VERSION;
351351
modsec = MODSEC_VERSION;
352-
#ifdef IIS_VERSION
352+
#ifdef VERSION_IIS
353353
apache = "IIS";
354+
#elif VERSION_NGINX
355+
apache = "nginx";
354356
#else
355357
apache = real_server_signature;
356358
#endif

tests/regression/misc/20-status-engine.t

+50
Original file line numberDiff line numberDiff line change
@@ -70,4 +70,54 @@
7070
"arg1=val1&arg2=val2",
7171
),
7272
},
73+
# On and SecServerSignature
74+
{
75+
type => "misc",
76+
comment => "SecStatusEngine On/SecServerSignature - checking signature",
77+
conf => qq(
78+
SecRuleEngine On
79+
SecServerSignature "SpiderServer v0.1a"
80+
SecStatusEngine On
81+
),
82+
match_log => {
83+
error => {
84+
apache => [ qr/StatusEngine call: \"[0-9]+.[0-9]+.[0-9]+[-RC]*[0-9]*\,Apache/, 1],
85+
nginx => [ qr/StatusEngine call: \"[0-9]+.[0-9]+.[0-9]+[-RC]*[0-9]*\,nginx/, 1],
86+
}
87+
},
88+
match_response => {
89+
status => qr/^200$/,
90+
},
91+
request => new HTTP::Request(
92+
POST => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt",
93+
[
94+
"Content-Type" => "application/x-www-form-urlencoded",
95+
],
96+
"arg1=val1&arg2=val2",
97+
),
98+
},
99+
# On and SecServerSignature
100+
{
101+
type => "misc",
102+
comment => "SecStatusEngine On - checking signature",
103+
conf => qq(
104+
SecStatusEngine On
105+
),
106+
match_log => {
107+
error => {
108+
apache => [ qr/StatusEngine call: \"[0-9]+.[0-9]+.[0-9]+[-RC]*[0-9]*\,Apache/, 1],
109+
nginx => [ qr/StatusEngine call: \"[0-9]+.[0-9]+.[0-9]+[-RC]*[0-9]*\,nginx/, 1],
110+
}
111+
},
112+
match_response => {
113+
status => qr/^200$/,
114+
},
115+
request => new HTTP::Request(
116+
POST => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt",
117+
[
118+
"Content-Type" => "application/x-www-form-urlencoded",
119+
],
120+
"arg1=val1&arg2=val2",
121+
),
122+
},
73123

0 commit comments

Comments
 (0)