Skip to content

Commit f6d6cea

Browse files
author
Felipe Zimmerle
committed
IIS: Creates IIS_VERSION definition
This definition is currently used in two different circumstances: Report with accuracy that the server is an IIS (status call), and also show the amount of loaded remote rules on the windows logs. Different from Apache which loads the rules twice, IIS just do it once.
1 parent 6c0cdab commit f6d6cea

File tree

4 files changed

+17
-1
lines changed

4 files changed

+17
-1
lines changed

apache2/Makefile.win

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,11 @@ LIBS = $(APACHE)\lib\libhttpd.lib \
1919
###########################################################################
2020
###########################################################################
2121

22+
23+
!IF "$(IIS_BUILD)" == "yes"
24+
DEFS=$(DEFS) -DVERSION_IIS
25+
!ENDIF
26+
2227
CC = CL
2328

2429
MT = mt

apache2/mod_security2.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -768,9 +768,16 @@ static int hook_post_config(apr_pool_t *mp, apr_pool_t *mp_log, apr_pool_t *mp_t
768768
* Checking if it is not the first time that we are in this very function.
769769
* We want to show the messages below during the start and the reload.
770770
*
771+
* Turns out that IIS version does not hit it twice, thus, we have to show
772+
* the message in the first (and unique) opportunity.
771773
*/
774+
#ifdef VERSION_IIS
775+
if (first_time == 1)
776+
{
777+
#else
772778
if (first_time != 1)
773779
{
780+
#endif
774781
#ifdef WITH_REMOTE_RULES
775782
if (remote_rules_server != NULL)
776783
{

apache2/msc_status_engine.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,11 @@ 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
353+
apache = "IIS";
354+
#else
352355
apache = real_server_signature;
356+
#endif
353357

354358
/* 6 represents: strlen("(null)") */
355359
beacon_string_len = (modsec ? strlen(modsec) : 6) +

iis/build_modsecurity.bat

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ set CURRENT_DIR=%cd%
1515
cd ..\apache2
1616
del *.obj *.dll *.lib
1717
del libinjection\*.obj libinjection\*.dll libinjection\*.lib
18-
NMAKE -f Makefile.win APACHE=..\iis\%DEPENDENCIES_DIR%\Apache24 PCRE=..\iis\%DEPENDENCIES_DIR%\pcre LIBXML2=..\iis\%DEPENDENCIES_DIR%\libxml2 LUA=..\iis\%DEPENDENCIES_DIR%\lua\src VERSION=VERSION_IIS YAJL=..\iis\%DEPENDENCIES_DIR%\yajl\build\yajl-2.0.1 SSDEEP=..\iis\%DEPENDENCIES_DIR%\ssdeep CURL=..\iis\%DEPENDENCIES_DIR%\curl
18+
NMAKE -f Makefile.win APACHE=..\iis\%DEPENDENCIES_DIR%\Apache24 PCRE=..\iis\%DEPENDENCIES_DIR%\pcre LIBXML2=..\iis\%DEPENDENCIES_DIR%\libxml2 LUA=..\iis\%DEPENDENCIES_DIR%\lua\src VERSION=VERSION_IIS YAJL=..\iis\%DEPENDENCIES_DIR%\yajl\build\yajl-2.0.1 SSDEEP=..\iis\%DEPENDENCIES_DIR%\ssdeep CURL=..\iis\%DEPENDENCIES_DIR%\curl IIS_BUILD=yes
1919
@if NOT (%ERRORLEVEL%) == (0) goto build_failed
2020

2121
@echo mlogc...

0 commit comments

Comments
 (0)