Skip to content

Commit b0dd255

Browse files
committed
chore: remove deprecated method using msm files
Signed-off-by: Felipe Zipitria <felipe.zipitria@owasp.org>
1 parent d1b1956 commit b0dd255

File tree

7 files changed

+62
-21
lines changed

7 files changed

+62
-21
lines changed

iis/installer.wxs

Lines changed: 32 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,25 @@
2929
<Property Id="IIS">
3030
<RegistrySearch Id="IISInstalledVersion" Root="HKLM" Key="SOFTWARE\Microsoft\InetStp" Type="raw" Name="MajorVersion" />
3131
</Property>
32+
<!-- Detect Visual C++ 2019 Redistributable (VC142) -->
33+
<?if $(var.Win64) = "yes" ?>
34+
<Property Id="VC142X64INSTALLED">
35+
<RegistrySearch Id="FindVC142X64" Root="HKLM"
36+
Key="SOFTWARE\Microsoft\VisualStudio\14.0\VC\Runtimes\x64"
37+
Name="Installed" Type="raw" Win64="yes" />
38+
</Property>
39+
<Property Id="VC142X86INSTALLED">
40+
<RegistrySearch Id="FindVC142X86" Root="HKLM"
41+
Key="SOFTWARE\Microsoft\VisualStudio\14.0\VC\Runtimes\x86"
42+
Name="Installed" Type="raw" Win64="yes" />
43+
</Property>
44+
<?else?>
45+
<Property Id="VC142X86INSTALLED">
46+
<RegistrySearch Id="FindVC142X86" Root="HKLM"
47+
Key="SOFTWARE\Microsoft\VisualStudio\14.0\VC\Runtimes\x86"
48+
Name="Installed" Type="raw" Win64="no" />
49+
</Property>
50+
<?endif?>
3251
<!-- Detect if ModSecurity IIS module and its dependent DLL files exist -->
3352
<Property Id="FILEEXISTS" Secure="yes">
3453
<DirectorySearch Id="CheckFileDir1" Path="C:\Windows\System32\inetsrv" Depth="0">
@@ -97,6 +116,19 @@
97116
<Property Id="MSIUSEREALADMINDETECTION" Value="1" />
98117
<!-- Define installation conditions -->
99118
<Condition Message="This setup requires IIS 7.0, 8.0 or 10.0. If that's the case, please ensure that the installer is running as administrator or try running it from the 'Apps and features' or 'Add/Remove Programs' menu"><![CDATA[(IIS="#7") OR (IIS="#8") OR (IIS="#10")]]></Condition>
119+
<!-- Check for required Visual C++ 2019 Redistributables -->
120+
<?if $(var.Win64) = "yes" ?>
121+
<Condition Message="This application requires Microsoft Visual C++ 2019 Redistributable (x64). Please download and install from: https://aka.ms/vs/17/release/vc_redist.x64.exe">
122+
<![CDATA[Installed OR VC142X64INSTALLED]]>
123+
</Condition>
124+
<Condition Message="This application requires Microsoft Visual C++ 2019 Redistributable (x86) for 32-bit support. Please download and install from: https://aka.ms/vs/17/release/vc_redist.x86.exe">
125+
<![CDATA[Installed OR VC142X86INSTALLED]]>
126+
</Condition>
127+
<?else?>
128+
<Condition Message="This application requires Microsoft Visual C++ 2019 Redistributable (x86). Please download and install from: https://aka.ms/vs/17/release/vc_redist.x86.exe">
129+
<![CDATA[Installed OR VC142X86INSTALLED]]>
130+
</Condition>
131+
<?endif?>
100132
<!-- Version 2.7.5 had an uninstall issue that leaves some files behind. Asking the user to manually hash this out. -->
101133
<Condition Message="A older version of ModSecurityIIS was found in your computer. Please complete uninstall by removing the following file: [FILEEXISTS]. You may have to remove ModSecurity module from IIS, use the IIS Manager to do so."><![CDATA[(NOT FILEEXISTS) OR (Installed)]]></Condition>
102134
<Condition Message="64-bit operating system was detected, please use the 64-bit installer.">
@@ -205,14 +237,6 @@
205237
<?endif?>
206238
<ComponentRef Id="StartMenuShortcuts" />
207239
</Feature>
208-
<Feature Id="VCRedist" Title="Visual C++ 14.2 Runtime (VS2019)" AllowAdvertise="no" Display="hidden" Level="1">
209-
<?if $(var.Win64) = "yes" ?>
210-
<MergeRef Id="VCRedist142_64" />
211-
<MergeRef Id="VCRedist142_32" />
212-
<?else?>
213-
<MergeRef Id="VCRedist142_32" />
214-
<?endif?>
215-
</Feature>
216240
<?if $(var.Win64) = "yes" ?>
217241
<Feature Id="ModSec64" Title="ModSecurity IIS (64 bits)" Level="1" InstallDefault="local" Display="expand" AllowAdvertise="no" Description="This option will install ModSecurityIIS 64bits with all the necessary dependencies.">
218242
<ComponentRef Id="ModSec64" />
@@ -408,13 +432,5 @@
408432
<?else?>
409433
<CustomAction Id="UninstallConf" Execute="deferred" Impersonate="no" Return="check" Directory="INSTALLFOLDER" ExeCommand="&quot;[SystemFolder]inetsrv\appcmd.exe&quot; clear config -section:&quot;system.webServer/ModSecurity&quot;" />
410434
<?endif?>
411-
<DirectoryRef Id="TARGETDIR">
412-
<?if $(var.Win64) = "yes" ?>
413-
<Merge Id="VCRedist142_64" SourceFile="wix\Microsoft_VC142_CRT_x64.msm" DiskId="1" Language="0" />
414-
<Merge Id="VCRedist142_32" SourceFile="wix\Microsoft_VC142_CRT_x86.msm" DiskId="1" Language="0" />
415-
<?else?>
416-
<Merge Id="VCRedist142_32" SourceFile="wix\Microsoft_VC142_CRT_x86.msm" DiskId="1" Language="0" />
417-
<?endif?>
418-
</DirectoryRef>
419435
</Product>
420436
</Wix>
-728 KB
Binary file not shown.
-748 KB
Binary file not shown.
-784 KB
Binary file not shown.
-788 KB
Binary file not shown.

iis/wix/README.TXT

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,16 @@
11
Please note that installing ModSecurity for IIS requires IIS to be installed and enabled.
22

3+
PREREQUISITES:
4+
5+
ModSecurity for IIS requires the Microsoft Visual C++ 2019 Redistributable to be installed:
6+
- For 64-bit systems: Install both x64 and x86 versions (for 32-bit application pool support)
7+
- x64: https://aka.ms/vs/17/release/vc_redist.x64.exe
8+
- x86: https://aka.ms/vs/17/release/vc_redist.x86.exe
9+
- For 32-bit systems: Install x86 version only
10+
- x86: https://aka.ms/vs/17/release/vc_redist.x86.exe
11+
12+
The installer will check for these prerequisites and provide download links if they are missing.
13+
314

415
After installing ModSecurity for IIS, the module will be running in all websites by default. To remove from a website add to web.config:
516

iis/wix/modsecurity.conf

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,23 @@ SecStreamInBodyInspection On
2323
# Enable XML request body parser.
2424
# Initiate XML Processor in case of xml content-type
2525
#
26-
SecRule REQUEST_HEADERS:Content-Type "(?:application(?:/soap\+|/)|text/)xml" \
26+
SecRule REQUEST_HEADERS:Content-Type "^(?:application(?:/soap\+|/)|text/)xml" \
2727
"id:'200000',phase:1,t:none,t:lowercase,pass,nolog,ctl:requestBodyProcessor=XML"
2828

2929
# Enable JSON request body parser.
3030
# Initiate JSON Processor in case of JSON content-type; change accordingly
3131
# if your application does not use 'application/json'
3232
#
33-
SecRule REQUEST_HEADERS:Content-Type "application/json" \
33+
SecRule REQUEST_HEADERS:Content-Type "^application/json" \
3434
"id:'200001',phase:1,t:none,t:lowercase,pass,nolog,ctl:requestBodyProcessor=JSON"
3535

36+
# Sample rule to enable JSON request body parser for more subtypes.
37+
# Uncomment or adapt this rule if you want to engage the JSON
38+
# Processor for "+json" subtypes
39+
#
40+
#SecRule REQUEST_HEADERS:Content-Type "^application/[a-z0-9.-]+[+]json" \
41+
# "id:'200006',phase:1,t:none,t:lowercase,pass,nolog,ctl:requestBodyProcessor=JSON"
42+
3643
# Maximum request body size we will accept for buffering. If you support
3744
# file uploads then the value given on the first line has to be as large
3845
# as the largest file you are willing to accept. The second value refers
@@ -55,6 +62,11 @@ SecRequestBodyInMemoryLimit 131072
5562
#
5663
SecRequestBodyLimitAction Reject
5764

65+
# Maximum parsing depth allowed for JSON objects. You want to keep this
66+
# value as low as practical.
67+
#
68+
SecRequestBodyJsonDepthLimit 512
69+
5870
# Verify that we've correctly processed the request body.
5971
# As a rule of thumb, when failing to process a request body
6072
# you should reject the request (when deployed in blocking mode)
@@ -101,7 +113,7 @@ SecPcreMatchLimitRecursion 1000
101113
# MSC_PCRE_LIMITS_EXCEEDED: PCRE match limits were exceeded.
102114
#
103115
SecRule TX:/^MSC_/ "!@streq 0" \
104-
"id:'200005',phase:2,t:none,deny,msg:'ModSecurity internal error flagged: %{MATCHED_VAR_NAME}'"
116+
"id:'200005',phase:2,t:none,log,deny,msg:'ModSecurity internal error flagged: %{MATCHED_VAR_NAME}'"
105117

106118

107119
# -- Response body handling --------------------------------------------------
@@ -194,7 +206,7 @@ SecAuditLogParts ABIJDEFHZ
194206
# assumes that you will use the audit log only ocassionally.
195207
#
196208
SecAuditLogType Serial
197-
#SecAuditLog c:\inetpub\logs\modsec_audit.log
209+
SecAuditLog c:\inetpub\logs\modsec_audit.log
198210

199211
# Specify the path for concurrent audit logging.
200212
#SecAuditLogStorageDir c:\inetpub\logs\
@@ -226,5 +238,7 @@ SecUnicodeMapFile unicode.mapping 20127
226238
# The following information will be shared: ModSecurity version,
227239
# Web Server version, APR version, PCRE version, Lua version, Libxml2
228240
# version, Anonymous unique id for host.
229-
SecStatusEngine On
241+
# NB: As of April 2022, there is no longer any advantage to turning this
242+
# setting On, as there is no active receiver for the information.
243+
SecStatusEngine Off
230244

0 commit comments

Comments
 (0)