Skip to content

Commit e9c84a6

Browse files
committed
fix: update dependencies howto to reflect changes
Signed-off-by: Felipe Zipitria <felipe.zipitria@owasp.org>
1 parent b0dd255 commit e9c84a6

2 files changed

Lines changed: 210 additions & 35 deletions

File tree

iis/dependencies/howto.txt

Lines changed: 104 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -5,48 +5,127 @@ So the build process was refactored to make it easier for users to create their
55
* build_msi.bat -> Creates the MSI self-installer for easy deploy / removal / distribution
66

77
* build_dependencies.bat -> Sets (and downloads if needed) all required dependencies
8-
* build_modsecurity.bat -> Builds ModSecurity (requires all depenedencies being set)
8+
* build_modsecurity.bat -> Builds ModSecurity (requires all dependencies being set)
99

1010
* download_files.bat -> Downloads all required dependencies to the default Downloads folder
1111
** This script is disabled by default. If you want to enable it, uncomment the "@call download_files.bat" line on build_dependencies.bat
1212

13-
The dependencies folder also includes a set o batch scripts which sets each dependency
13+
The dependencies folder also includes a set of batch scripts which sets each dependency
1414
on its own. These scripts are called by the build_dependencies.bat script.
1515

16-
Using the same versions of libraries as listed below is recommended.
16+
Using the same versions of libraries as listed below is recommended.
1717
--------------------------------------
1818
Compilation Prerequisites:
1919

20-
* Windows 7 x86_x64 (Should work on newer versions of Windows too)
21-
* Vistual Studio 2013 Express (Other versions should work, but you need to set the correct path for vcvars.bat scripts)
22-
* IIS enabled/installed
23-
* 7-Zip
20+
* Windows 10/11 or Windows Server 2016+ (64-bit recommended)
21+
* Visual Studio 2019 or 2022 with C++ development tools
22+
- Desktop development with C++
23+
- Windows 10/11 SDK
24+
- MSVC v142 (VS2019) or v143 (VS2022) build tools
25+
- C++ ATL for latest build tools
26+
* IIS 7.0 or later enabled/installed
27+
* 7-Zip (for dependency extraction)
28+
* WiX Toolset 3.x (for building MSI installer)
29+
30+
--------------------------------------
31+
32+
Runtime Prerequisites (for installer deployment):
33+
34+
* Microsoft Visual C++ 2019 Redistributable (x64): https://aka.ms/vs/17/release/vc_redist.x64.exe
35+
* Microsoft Visual C++ 2019 Redistributable (x86): https://aka.ms/vs/17/release/vc_redist.x86.exe
36+
- Both x64 and x86 are required on 64-bit systems for 32-bit application pool support
37+
- The MSI installer will check for these prerequisites and provide download links if missing
38+
39+
Note: The installer now uses redistributable packages instead of merge modules,
40+
following Microsoft's recommended deployment practices. This allows Windows Update
41+
to automatically patch security vulnerabilities in the Visual C++ runtime.
2442

2543
--------------------------------------
2644

2745
The latest versions of ModSecurity dependencies known to work well are the following:
2846

29-
cmake-3.8.2-win32-x86
30-
pcre-8.40 (patch required and included on file "patch-pcre-8.40.vbs")
31-
zlib-1.2.11
32-
libxml2-2.9.4
33-
lua-5.3.4
34-
curl-7.54.1
35-
httpd-2.4.27 (bin-VC11)
47+
cmake-3.8.2-win32-x86 (or later)
48+
pcre2-10.x (PCRE2 is now the default, PCRE 8.x is deprecated)
49+
- Note: PCRE2 provides better performance and is actively maintained
50+
zlib-1.2.11 (or later)
51+
libxml2-2.9.4 (or later)
52+
lua-5.3.4 (or later)
53+
curl-7.54.1 (or later)
54+
httpd-2.4.27 (bin-VC15 or later for VS2019/2022)
3655
yajl-2.1.0
37-
ssdeep-2.13
56+
ssdeep-2.13 (or later)
57+
58+
--------------------------------------
59+
60+
Build Instructions:
61+
62+
1. Create working directory (e.g. c:\work) and clone/extract ModSecurity v2 from GitHub:
63+
https://github.com/owasp-modsecurity/ModSecurity/archive/v2/master.zip
64+
65+
2. Initialize git submodules (important for dependencies like libinjection):
66+
git submodule update --init --recursive
67+
68+
3. Make sure the prerequisites mentioned above are all set:
69+
- Visual Studio 2019/2022 installed with C++ tools
70+
- IIS enabled/installed
71+
- 7-Zip available in PATH
72+
- WiX Toolset installed (for MSI building)
73+
74+
4. If you haven't downloaded the dependency files before, uncomment the
75+
"@call download_files.bat" line in build_dependencies.bat to have them
76+
downloaded automatically.
77+
78+
5. Open a Visual Studio Developer Command Prompt (recommended) or regular
79+
command prompt and navigate to the "iis" folder inside ModSecurity working
80+
directory:
81+
cd c:\work\ModSecurity\iis
82+
83+
6. If you need to modify anything (e.g. paths, versions, etc.), carefully
84+
edit the batch files. Key files to review:
85+
- build_dependencies.bat (dependency paths/versions)
86+
- build_modsecurity.bat (compiler settings)
87+
- build_msi.bat (MSI configuration)
88+
89+
7. Run the main build script:
90+
build_release.bat
91+
92+
8. When done, the binaries, lib and pdb files should appear under:
93+
- c:\work\ModSecurity\iis\release\x86 (32-bit)
94+
- c:\work\ModSecurity\iis\release\amd64 (64-bit)
95+
96+
* At this point, if you have a previous installation of ModSecurity and
97+
would like to test, you can manually place:
98+
- x86 files to "C:\Windows\SysWOW64\inetsrv"
99+
- x64 files to "C:\Windows\System32\inetsrv"
100+
101+
9. If all went well, you can build the MSI installer by running:
102+
build_msi.bat
103+
104+
The MSI will be created in the release folder.
105+
106+
--------------------------------------
107+
108+
MSI Installer Features:
109+
110+
* Automatically places files to the correct system folders
111+
* Configures the ModSecurity IIS native module for both 32-bit and 64-bit
112+
* Registers the module with IIS application configuration
113+
* Checks for required Visual C++ 2019 Redistributables
114+
* Provides clear error messages with download links if prerequisites are missing
115+
* Supports both x86 and x64 architectures
116+
* Allows selective installation of 32-bit and/or 64-bit modules
38117

39118
--------------------------------------
40119

41-
1. Create working directory (e.g. c:\work) and drop the latest clone from ModSecurity's 2.x Github (https://github.com/owasp-modsecurity/ModSecurity/archive/v2/master.zip)
42-
2. Make sure the prerequisites mentioned above are all set
43-
3. If you haven't download the dependency files before, uncomment the "@call download_files.bat" line on build_dependencies.bat to have them downloaded prior
44-
4. Open a command prompt (cmd.exe) and head to the "iis" folder inside ModSecurity tree working directory (e.g. cd c:\work\ModSecurity\iis)
45-
5. If you need to modify anything (e.g. paths, versions etc), carefully edit the batch files.
46-
6. Run build_release.bat
47-
7. When done, the binaries, lib and pdb files should appear under c:\work\ModSecurity\iis\release\x86 (32-bit) and c:\work\ModSecurity\iis\release\amd64 (64-bit)
48-
* At this point, if you had a previous installation of ModSecurity and would like to test you can place the x86 files to "C:\Windows\SysWOW64\inetsrv" and x64 files to "C:\Windows\System32\inetsrv"
120+
Troubleshooting:
121+
122+
* If the installer fails with missing DLL errors, ensure the VC++ 2019
123+
Redistributables are installed (see Runtime Prerequisites above)
49124

50-
8. If all went well, you can build the MSI installer by running the build_msi.bat script.
125+
* Use the included list_dependencies.bat script in the wix folder to check:
126+
- VC++ 2019 Redistributable installation status
127+
- ModSecurity DLL dependencies
128+
- Missing libraries
51129

52-
* The built installable package places the files to the correct folders, automatically configures the ModSecurity IIS native module and configures web.config to enable ModSecurity for all IIS sites.
130+
* For detailed troubleshooting, see:
131+
https://github.com/owasp-modsecurity/ModSecurity/wiki/IIS-Troubleshooting

iis/wix/list_dependencies.bat

Lines changed: 106 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,24 +11,71 @@ echo *
1111
echo *
1212
echo * The main function of this script is to list all ModSecurityIIS runtime
1313
echo * dependencies, including system dependencies, to check if there is a
14-
echo * missing library or a version mismatch. This can be very usefull in case
14+
echo * missing library or a version mismatch. This can be very useful in case
1515
echo * ModSecurityIIS refuses to register as IIS module or if IIS refuses to
1616
echo * start.
17-
echo *
1817
echo *
1918
echo *
19+
echo *
20+
21+
echo.
22+
echo Checking prerequisites...
23+
echo.
2024

25+
REM Check for Visual C++ 2019 Redistributable (x64)
26+
reg query "HKLM\SOFTWARE\Microsoft\VisualStudio\14.0\VC\Runtimes\x64" /v Installed 2>nul | find "0x1" >nul
27+
if %errorlevel% equ 0 (
28+
echo [OK] Visual C++ 2019 Redistributable ^(x64^) is installed
29+
) else (
30+
echo [MISSING] Visual C++ 2019 Redistributable ^(x64^) is NOT installed
31+
echo Download from: https://aka.ms/vs/17/release/vc_redist.x64.exe
32+
)
33+
34+
REM Check for Visual C++ 2019 Redistributable (x86)
35+
reg query "HKLM\SOFTWARE\Microsoft\VisualStudio\14.0\VC\Runtimes\x86" /v Installed 2>nul | find "0x1" >nul
36+
if %errorlevel% equ 0 (
37+
echo [OK] Visual C++ 2019 Redistributable ^(x86^) is installed
38+
) else (
39+
echo [MISSING] Visual C++ 2019 Redistributable ^(x86^) is NOT installed
40+
echo Download from: https://aka.ms/vs/17/release/vc_redist.x86.exe
41+
)
42+
43+
echo.
2144
pause
2245

2346
:LOOP_FILE
2447
SET /a log_file=%RANDOM%+100000
25-
SET log_file=%TEMP%\ModSecurityIIS-depedencies-%log_file:~-5%.TXT
48+
SET log_file=%TEMP%\ModSecurityIIS-dependencies-%log_file:~-5%.TXT
2649
IF EXIST %log_file% GOTO LOOP_FILE
2750

2851
echo Saving logs at: %log_file%
52+
echo.
53+
54+
REM Log prerequisite checks to file
55+
echo ================================================ >> %log_file%
56+
echo Visual C++ 2019 Redistributable Check >> %log_file%
57+
echo ================================================ >> %log_file%
58+
59+
reg query "HKLM\SOFTWARE\Microsoft\VisualStudio\14.0\VC\Runtimes\x64" /v Installed 2>nul | find "0x1" >nul
60+
if %errorlevel% equ 0 (
61+
echo [OK] Visual C++ 2019 Redistributable (x64) is installed >> %log_file%
62+
) else (
63+
echo [MISSING] Visual C++ 2019 Redistributable (x64) is NOT installed >> %log_file%
64+
echo Download from: https://aka.ms/vs/17/release/vc_redist.x64.exe >> %log_file%
65+
)
66+
67+
reg query "HKLM\SOFTWARE\Microsoft\VisualStudio\14.0\VC\Runtimes\x86" /v Installed 2>nul | find "0x1" >nul
68+
if %errorlevel% equ 0 (
69+
echo [OK] Visual C++ 2019 Redistributable (x86) is installed >> %log_file%
70+
) else (
71+
echo [MISSING] Visual C++ 2019 Redistributable (x86) is NOT installed >> %log_file%
72+
echo Download from: https://aka.ms/vs/17/release/vc_redist.x86.exe >> %log_file%
73+
)
74+
echo. >> %log_file%
2975

30-
set POSSIBLE_PATHS_X86="C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\dumpbin.exe" "C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin\dumpbin.exe"
31-
set POSSIBLE_PATHS_X64="C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin\x86_amd64\dumpbin.exe"
76+
REM Updated paths to include Visual Studio 2019 and 2022
77+
set POSSIBLE_PATHS_X86="C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\*\bin\Hostx86\x86\dumpbin.exe" "C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\*\bin\Hostx86\x86\dumpbin.exe" "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\*\bin\Hostx86\x86\dumpbin.exe" "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\*\bin\Hostx86\x86\dumpbin.exe" "C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\*\bin\Hostx86\x86\dumpbin.exe" "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\*\bin\Hostx86\x86\dumpbin.exe" "C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\dumpbin.exe" "C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin\dumpbin.exe"
78+
set POSSIBLE_PATHS_X64="C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\*\bin\Hostx64\x64\dumpbin.exe" "C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\*\bin\Hostx64\x64\dumpbin.exe" "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\*\bin\Hostx64\x64\dumpbin.exe" "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\*\bin\Hostx64\x64\dumpbin.exe" "C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\*\bin\Hostx64\x64\dumpbin.exe" "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\*\bin\Hostx64\x64\dumpbin.exe" "C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin\x86_amd64\dumpbin.exe"
3279

3380
for %%i in (%POSSIBLE_PATHS_X86%) do (
3481
echo Checking for dumpbin x86... %%i
@@ -50,23 +97,72 @@ for %%i in (%POSSIBLE_PATHS_X64%) do (
5097
)
5198
:found_x64
5299

100+
echo ================================================ >> %log_file%
101+
echo ModSecurity IIS Dependency Analysis >> %log_file%
102+
echo ================================================ >> %log_file%
103+
echo. >> %log_file%
104+
105+
REM Check ModSecurity DLL locations
106+
echo Checking ModSecurity DLL locations... >> %log_file%
107+
if exist "%SystemRoot%\System32\inetsrv\ModSecurityIIS.dll" (
108+
echo [FOUND] %SystemRoot%\System32\inetsrv\ModSecurityIIS.dll >> %log_file%
109+
) else (
110+
echo [MISSING] %SystemRoot%\System32\inetsrv\ModSecurityIIS.dll >> %log_file%
111+
)
112+
113+
if exist "%SystemRoot%\SysWOW64\inetsrv\ModSecurityIIS.dll" (
114+
echo [FOUND] %SystemRoot%\SysWOW64\inetsrv\ModSecurityIIS.dll >> %log_file%
115+
) else (
116+
echo [MISSING] %SystemRoot%\SysWOW64\inetsrv\ModSecurityIIS.dll >> %log_file%
117+
)
118+
echo. >> %log_file%
119+
53120
if "%DUMPBIN_X86:~1,-1%" == "" (
54121
echo Dumpbin x86 not found.
55122
echo Dumpbin x86 not found. >> %log_file%
123+
echo NOTE: Install Visual Studio 2019/2022 with C++ tools to use dumpbin. >> %log_file%
56124
) else (
57125
echo Using dumpbin x86: %DUMPBIN_X86%
58-
echo Using dumpbin x86: %DUMPBIN_X86% >> %log_file%
59-
%DUMPBIN_X86% /imports /dependents %* >> %log_file%
126+
echo Using dumpbin x86: %DUMPBIN_X86% >> %log_file%
127+
echo. >> %log_file%
128+
if exist "%SystemRoot%\System32\inetsrv\ModSecurityIIS.dll" (
129+
echo ================================================ >> %log_file%
130+
echo 32-bit ModSecurityIIS.dll dependencies: >> %log_file%
131+
echo ================================================ >> %log_file%
132+
%DUMPBIN_X86% /imports /dependents "%SystemRoot%\System32\inetsrv\ModSecurityIIS.dll" >> %log_file% 2>&1
133+
)
134+
if not "%*" == "" (
135+
echo. >> %log_file%
136+
echo ================================================ >> %log_file%
137+
echo Additional files specified: >> %log_file%
138+
echo ================================================ >> %log_file%
139+
%DUMPBIN_X86% /imports /dependents %* >> %log_file% 2>&1
60140
)
61141
)
62142

143+
echo. >> %log_file%
144+
63145
if "%DUMPBIN_X64:~1,-1%" == "" (
64146
echo Dumpbin x64 not found.
65-
echo Dumpbin x64 not found. >> %log_file%
147+
echo Dumpbin x64 not found. >> %log_file%
148+
echo NOTE: Install Visual Studio 2019/2022 with C++ tools to use dumpbin. >> %log_file%
66149
) else (
67150
echo Using dumpbin x64: %DUMPBIN_X64%
68-
echo Using dumpbin x64: %DUMPBIN_X64% >> %log_file%
69-
%DUMPBIN_X64% /imports /dependents %* >> %log_file%
151+
echo Using dumpbin x64: %DUMPBIN_X64% >> %log_file%
152+
echo. >> %log_file%
153+
if exist "%SystemRoot%\SysWOW64\inetsrv\ModSecurityIIS.dll" (
154+
echo ================================================ >> %log_file%
155+
echo 64-bit ModSecurityIIS.dll dependencies: >> %log_file%
156+
echo ================================================ >> %log_file%
157+
%DUMPBIN_X64% /imports /dependents "%SystemRoot%\SysWOW64\inetsrv\ModSecurityIIS.dll" >> %log_file% 2>&1
158+
)
159+
if not "%*" == "" (
160+
echo. >> %log_file%
161+
echo ================================================ >> %log_file%
162+
echo Additional files specified: >> %log_file%
163+
echo ================================================ >> %log_file%
164+
%DUMPBIN_X64% /imports /dependents %* >> %log_file% 2>&1
165+
)
70166
)
71167

72168
goto exit

0 commit comments

Comments
 (0)