Skip to content

Commit 4d7d1ba

Browse files
author
Felipe "Zimmerle" Costa
committed
iis: Adds listing dependencies script
This script could be used in order to verify all ModSecurity run time dependencies. It is now part of ModSecurity folder in Program menu. Cosmetics changes in the installer
1 parent 619758c commit 4d7d1ba

File tree

2 files changed

+123
-24
lines changed

2 files changed

+123
-24
lines changed

iis/installer.wxs

Lines changed: 44 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -81,14 +81,14 @@
8181
</Property>
8282
<Property Id="MSIUSEREALADMINDETECTION" Value="1" />
8383
<Condition Message="This setup requires IIS 6.0, 7.0 or 8.0 is installed."><![CDATA[(IIS="#7") OR (IIS="#6") OR (IIS="#8")]]></Condition>
84-
<!-- Version 2.7.6 had an uninstall issue that leaves some files behind. Asking the user to manually hash this out. -->
84+
<!-- Version 2.7.5 had an uninstall issue that leaves some files behind. Asking the user to manually hash this out. -->
8585
<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>
8686
<Condition Message="64-bit operating system was detected, please use the 64-bit installer.">
8787
<?if $(var.Win64) = "yes" ?>
88-
VersionNT64
89-
<?else ?>
90-
NOT VersionNT64
91-
<?endif ?></Condition>
88+
VersionNT64
89+
<?else ?>
90+
NOT VersionNT64
91+
<?endif ?></Condition>
9292
<Media Id="1" Cabinet="simple.cab" EmbedCab="yes" />
9393
<Directory Id="TARGETDIR" Name="SourceDir">
9494
<?if $(var.Win64) = "yes" ?>
@@ -296,6 +296,11 @@
296296
<Shortcut Id="UninstallProduct" Name="Uninstall" Description="Uninstalls the ModSecurity IIS" Target="[System64Folder]msiexec.exe" Arguments="/x [ProductCode]" />
297297
<Shortcut Id="EULA" Name="EULA" Description="EULA" Target="[INSTALLFOLDER]EULA.rtf" WorkingDirectory="INSTALLFOLDER" />
298298
<Shortcut Id="Readme" Name="EULA" Description="EULA" Target="[INSTALLFOLDER]README.TXT" WorkingDirectory="INSTALLFOLDER" />
299+
<?if $(var.Win64) = "yes" ?>
300+
<Shortcut Id="List_Dependencies" Name="List Dependencies (Debug)" Description="Check for missing dependencies" Target="[INSTALLFOLDER]list_dependencies.bat" Arguments="&quot;[inetsrv64]libapr-1.dll&quot; &quot;[inetsrv64]libapriconv-1.dll&quot; &quot;[inetsrv64]libaprutil-1.dll&quot; &quot;[inetsrv64]libcurl.dll&quot; &quot;[inetsrv64]libxml2.dll&quot; &quot;[inetsrv64]lua5.1.dll&quot; &quot;[inetsrv64]mlogc.exe&quot; &quot;[inetsrv64]ModSecurityIIS.dll&quot; &quot;[inetsrv64]pcre.dll&quot; &quot;[inetsrv64]zlib1.dll&quot; &quot;[inetsrv32]libapr-1.dll&quot; &quot;[inetsrv32]libapriconv-1.dll&quot; &quot;[inetsrv32]libaprutil-1.dll&quot; &quot;[inetsrv32]libcurl.dll&quot; &quot;[inetsrv32]libxml2.dll&quot; &quot;[inetsrv32]lua5.1.dll&quot; &quot;[inetsrv32]mlogc.exe&quot; &quot;[inetsrv32]ModSecurityIIS.dll&quot; &quot;[inetsrv32]pcre.dll&quot; &quot;[inetsrv32]zlib1.dll&quot;" WorkingDirectory="INSTALLFOLDER" />
301+
<?else ?>
302+
<Shortcut Id="List_Dependencies" Name="List Dependencies (Debug)" Description="Check for missing dependencies" Target="[INSTALLFOLDER]list_dependencies.bat" Arguments="&quot;[inetsrv32]libapr-1.dll&quot; &quot;[inetsrv32]libapriconv-1.dll&quot; &quot;[inetsrv32]libaprutil-1.dll&quot; &quot;[inetsrv32]libcurl.dll&quot; &quot;[inetsrv32]libxml2.dll&quot; &quot;[inetsrv32]lua5.1.dll&quot; &quot;[inetsrv32]mlogc.exe&quot; &quot;[inetsrv32]ModSecurityIIS.dll&quot; &quot;[inetsrv32]pcre.dll&quot; &quot;[inetsrv32]zlib1.dll&quot;" WorkingDirectory="INSTALLFOLDER" />
303+
<?endif ?>
299304
</Component>
300305
</Directory>
301306
</Directory>
@@ -307,6 +312,7 @@
307312
<File Id="modsecurity.conf" Name="modsecurity.conf" Source="wix\modsecurity.conf" />
308313
<File Id="modsecurity_iis.conf" Name="modsecurity_iis.conf" Source="wix\modsecurity_iis.conf" />
309314
<File Id="modsecurity_crs_10_setup.conf" Name="modsecurity_crs_10_setup.conf" Source="wix\modsecurity_crs_10_setup.conf" />
315+
<File Id="LIST_DEPENDENCIES.BAT" Name="list_dependencies.bat" Source="wix\list_dependencies.bat" />
310316
</Component>
311317
</DirectoryRef>
312318
<?if $(var.Win64) = "yes" ?>
@@ -402,8 +408,13 @@
402408
<UI Id="WixUI_FeatureTreeCustom">
403409
<Dialog Id="CustomizeDlgModSec" Width="370" Height="270" Title="!(loc.CustomizeDlg_Title)" TrackDiskSpace="yes">
404410
<Control Id="Tree" Type="SelectionTree" X="25" Y="85" Width="175" Height="115" Property="_BrowseProperty" Sunken="yes" TabSkip="no" Text="!(loc.CustomizeDlgTree)">
411+
<?if $(var.Win64) = "yes" ?>
405412
<Publish Property="DisableButton" Value="1">(NOT &amp;ModSec64=3) AND (NOT &amp;ModSec32=3)</Publish>
406413
<Publish Property="DisableButton" Value="0">&amp;ModSec64=3 OR &amp;ModSec32=3</Publish>
414+
<?else ?>
415+
<Publish Property="DisableButton" Value="1">(NOT &amp;ModSec32=3)</Publish>
416+
<Publish Property="DisableButton" Value="0">&amp;ModSec32=3</Publish>
417+
<?endif ?>
407418
</Control>
408419
<Control Id="Browse" Type="PushButton" X="294" Y="210" Width="66" Height="17" Text="!(loc.CustomizeDlgBrowse)">
409420
<Publish Event="SelectionBrowse" Value="BrowseDlg">1</Publish>
@@ -450,8 +461,8 @@
450461
<Condition Action="hide">Installed</Condition>
451462
</Control>
452463
</Dialog>
453-
<Property Id="CONFIGURE_IIS" Secure="yes" Value="1">
454-
<RegistrySearch Id="ConfigureIISRegistrySearch" Type="raw" Root="HKLM" Key="SOFTWARE\ModSecurity\ModSecurity" Name="ConfigureIIS" />
464+
<Property Id="CONFIGURE_MODSECURITY_IIS">
465+
<RegistrySearch Id="ConfigureIISRegistrySearch" Type="raw" Root="HKLM" Key="SOFTWARE\ModSecurity\ModSecurityConfigureIIS" Name="ModSecurityConfigureIIS" />
455466
</Property>
456467
<Dialog Id="RegisterDlg" Width="370" Height="270" Title="!(loc.VerifyReadyDlg_Title)" TrackDiskSpace="yes">
457468
<Control Id="Cancel" Type="PushButton" X="304" Y="243" Width="56" Height="17" Cancel="yes" Text="!(loc.WixUICancel)">
@@ -469,7 +480,7 @@
469480
<Control Id="Title" Type="Text" X="15" Y="6" Width="210" Height="15" Transparent="yes" NoPrefix="yes" Text="{\WixUI_Font_Title}IIS Setup" />
470481
<Control Id="Description" Type="Text" X="25" Y="23" Width="280" Height="15" Transparent="yes" NoPrefix="yes" Text="Choose to configure ModSecurity on IIS or not." />
471482
<Control Id="Text" Type="Text" X="25" Y="55" Width="320" Height="50" Text="ModSecurityIIS needs to be configured under IIS as a module. It is recommended to perform this configuration during the installation. However, if you are facing problems in the installation, the recomendation is to disable this step. This will facilitate the debugging process since the files will be installed in place. Note that some scripts will be installed along with ModSecurity common files that can be later used to help this configuration/debugging process." />
472-
<Control Type="CheckBox" Id="ConfigureIIS" Width="200" Height="14" X="25" Y="124" CheckBoxValue="1" Property="CONFIGURE_IIS" Text="Perform ModSecurityIIS configuration." />
483+
<Control Type="CheckBox" Id="ConfigureIIS" Width="200" Height="14" X="25" Y="124" CheckBoxValue="1" Property="CONFIGURE_MODSECURITY_IIS" Text="Perform ModSecurityIIS configuration." />
473484
<Control Type="Text" Id="troubleshooting" Width="314" Height="37" X="26" Y="161" Text="For further information about problems during the installation, have a look at ModSecurityIIS Troubleshooting guide. Available at: https://github.com/SpiderLabs/ModSecurity/wiki/IIS-Troubleshooting" />
474485
</Dialog>
475486
<Binary Id="bannrbmp" SourceFile="wix\banner.jpg" />
@@ -502,7 +513,7 @@
502513
<Publish Dialog="RegisterDlg" Control="Back" Event="NewDialog" Value="CustomizeDlgModSec" Order="1">NOT Installed OR WixUI_InstallMode = "Change"</Publish>
503514
<Publish Dialog="RegisterDlg" Control="Next" Event="NewDialog" Value="VerifyReadyDlg" Order="2">NOT Installed OR WixUI_InstallMode = "Change"</Publish>
504515
<Publish Dialog="RegisterDlg" Control="Next" Event="NewDialog" Value="WelcomeDlg" Order="3">Installed AND PATCH</Publish>
505-
<Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="CustomizeDlgModSec" Order="1">NOT Installed OR WixUI_InstallMode = "Change"</Publish>
516+
<Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="RegisterDlg" Order="1">NOT Installed OR WixUI_InstallMode = "Change"</Publish>
506517
<Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="MaintenanceTypeDlg" Order="2">Installed AND NOT PATCH</Publish>
507518
<Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="WelcomeDlg" Order="3">Installed AND PATCH</Publish>
508519
<Publish Dialog="MaintenanceWelcomeDlg" Control="Next" Event="NewDialog" Value="MaintenanceTypeDlg">1</Publish>
@@ -516,32 +527,41 @@
516527
<WixVariable Id="WixUIBannerBmp" Value="wix\banner.jpg" />
517528
<WixVariable Id="WixUIDialogBmp" Value="wix\dialog.jpg" />
518529
<InstallUISequence>
519-
<Custom Action="SetCONFIGURE_IIS" Before="AppSearch">NOT Installed AND NOT OLDERVERSIONDETECTED</Custom>
530+
<Custom Action="SetCONFIGURE_MODSECURITY_IIS" Before="AppSearch">NOT Installed AND NOT OLDERVERSIONDETECTED</Custom>
520531
</InstallUISequence>
521532
<InstallExecuteSequence>
522-
<Custom Action="SetCONFIGURE_IIS" Before="AppSearch">NOT Installed AND NOT OLDERVERSIONDETECTED</Custom>
533+
<Custom Action="SetCONFIGURE_MODSECURITY_IIS" Before="AppSearch">NOT Installed AND NOT OLDERVERSIONDETECTED</Custom>
523534
</InstallExecuteSequence>
524-
<CustomAction Id="SetCONFIGURE_IIS" Property="CONFIGURE_IIS" Value="1" Execute="firstSequence" />
535+
<CustomAction Id="SetCONFIGURE_MODSECURITY_IIS" Property="CONFIGURE_MODSECURITY_IIS" Value="1" Execute="firstSequence" />
525536
<InstallExecuteSequence>
526537
<?if $(var.Win64) = "yes" ?>
527-
<Custom Action="InstallModule64" Before="InstallFinalize"><![CDATA[NOT Installed AND CONFIGURE_IIS]]></Custom>
528-
<Custom Action="InstallModule32" After="InstallModule64"><![CDATA[NOT Installed AND CONFIGURE_IIS]]></Custom>
529-
<Custom Action="InstallConf" After="InstallModule32"><![CDATA[NOT Installed AND CONFIGURE_IIS]]></Custom>
530-
<Custom Action="UninstallConf" Before="RemoveFiles"><![CDATA[Installed AND CONFIGURE_IIS]]></Custom>
531-
<Custom Action="UninstallModule32" After="UninstallConf"><![CDATA[Installed AND CONFIGURE_IIS]]></Custom>
532-
<Custom Action="UninstallModule64" After="UninstallModule32"><![CDATA[Installed AND CONFIGURE_IIS]]></Custom>
538+
<Custom Action="InstallModule64" Before="InstallFinalize"><![CDATA[NOT Installed AND CONFIGURE_MODSECURITY_IIS]]></Custom>
539+
<Custom Action="InstallModule32" After="InstallModule64"><![CDATA[NOT Installed AND CONFIGURE_MODSECURITY_IIS]]></Custom>
540+
<Custom Action="InstallConf" After="InstallModule32"><![CDATA[NOT Installed AND CONFIGURE_MODSECURITY_IIS]]></Custom>
541+
<Custom Action="UninstallConf" Before="RemoveFiles"><![CDATA[Installed AND CONFIGURE_MODSECURITY_IIS]]></Custom>
542+
<Custom Action="UninstallModule32" After="UninstallConf"><![CDATA[Installed AND CONFIGURE_MODSECURITY_IIS]]></Custom>
543+
<Custom Action="UninstallModule64" After="UninstallModule32"><![CDATA[Installed AND CONFIGURE_MODSECURITY_IIS]]></Custom>
533544
<?else ?>
534-
<Custom Action="InstallModule32" Before="InstallFinalize"><![CDATA[NOT Installed AND CONFIGURE_IIS]]></Custom>
535-
<Custom Action="InstallConf" After="InstallModule32"><![CDATA[NOT Installed AND CONFIGURE_IIS]]></Custom>
536-
<Custom Action="UninstallConf" Before="RemoveFiles"><![CDATA[Installed AND CONFIGURE_IIS]]></Custom>
537-
<Custom Action="UninstallModule32" After="UninstallConf"><![CDATA[Installed AND CONFIGURE_IIS]]></Custom>
545+
<Custom Action="InstallModule32" Before="InstallFinalize"><![CDATA[NOT Installed AND CONFIGURE_MODSECURITY_IIS]]></Custom>
546+
<Custom Action="InstallConf" After="InstallModule32"><![CDATA[NOT Installed AND CONFIGURE_MODSECURITY_IIS]]></Custom>
547+
<Custom Action="UninstallConf" Before="RemoveFiles"><![CDATA[Installed AND CONFIGURE_MODSECURITY_IIS]]></Custom>
548+
<Custom Action="UninstallModule32" After="UninstallConf"><![CDATA[Installed AND CONFIGURE_MODSECURITY_IIS]]></Custom>
538549
<?endif ?>
539550
</InstallExecuteSequence>
540551
<?if $(var.Win64) = "yes" ?>
541-
<CustomAction Id="InstallModule32" Execute="deferred" Impersonate="no" Return="check" Directory="INSTALLFOLDER" ExeCommand="&quot;[System64Folder]inetsrv\appcmd.exe&quot; install module /name:&quot;ModSecurity IIS (32bits)&quot; /image:&quot;%SystemRoot%\System32\inetsrv\ModSecurityIIS.dll&quot;" />
542-
<CustomAction Id="InstallModule64" Execute="deferred" Impersonate="no" Return="check" Directory="INSTALLFOLDER" ExeCommand="&quot;[System64Folder]inetsrv\appcmd.exe&quot; install module /name:&quot;ModSecurity IIS (64bits)&quot; /image:&quot;%SystemRoot%\SysWOW64\inetsrv\ModSecurityIIS.dll&quot;" />
552+
<?if $(var.Win64) = "yes" ?>
553+
<CustomAction Id="InstallModule32" Execute="deferred" Impersonate="no" Return="check" Directory="INSTALLFOLDER" ExeCommand="&quot;[System64Folder]inetsrv\appcmd.exe&quot; install module /name:&quot;ModSecurity IIS (64bits)&quot; /image:&quot;%SystemRoot%\System32\inetsrv\ModSecurityIIS.dll&quot; /preCondition:&quot;bitness64&quot;" />
554+
<?else ?>
555+
<CustomAction Id="InstallModule32" Execute="deferred" Impersonate="no" Return="check" Directory="INSTALLFOLDER" ExeCommand="&quot;[SystemFolder]inetsrv\appcmd.exe&quot; install module /name:&quot;ModSecurity IIS (32bits)&quot; /image:&quot;%SystemRoot%\System32\inetsrv\ModSecurityIIS.dll&quot;" />
556+
<?endif ?>
557+
<CustomAction Id="InstallModule64" Execute="deferred" Impersonate="no" Return="check" Directory="INSTALLFOLDER" ExeCommand="&quot;[System64Folder]inetsrv\appcmd.exe&quot; install module /name:&quot;ModSecurity IIS (32bits)&quot; /image:&quot;%SystemRoot%\SysWOW64\inetsrv\ModSecurityIIS.dll&quot; /preCondition:&quot;bitness32&quot;" />
558+
<?if $(var.Win64) = "yes" ?>
543559
<CustomAction Id="UninstallModule32" Execute="deferred" Impersonate="no" Return="check" Directory="INSTALLFOLDER" ExeCommand="&quot;[System64Folder]inetsrv\appcmd.exe&quot; uninstall module /module.name:&quot;ModSecurity IIS (32bits)&quot;" />
544560
<CustomAction Id="UninstallModule64" Execute="deferred" Impersonate="no" Return="check" Directory="INSTALLFOLDER" ExeCommand="&quot;[System64Folder]inetsrv\appcmd.exe&quot; uninstall module /module.name:&quot;ModSecurity IIS (64bits)&quot;" />
561+
<?else ?>
562+
<CustomAction Id="UninstallModule32" Execute="deferred" Impersonate="no" Return="check" Directory="INSTALLFOLDER" ExeCommand="&quot;[SystemFolder]inetsrv\appcmd.exe&quot; uninstall module /module.name:&quot;ModSecurity IIS (32bits)&quot;" />
563+
<CustomAction Id="UninstallModule64" Execute="deferred" Impersonate="no" Return="check" Directory="INSTALLFOLDER" ExeCommand="&quot;[System64Folder]inetsrv\appcmd.exe&quot; uninstall module /module.name:&quot;ModSecurity IIS (64bits)&quot;" />
564+
<?endif ?>
545565
<CustomAction Id="InstallConf" Execute="deferred" Impersonate="no" Return="check" Directory="INSTALLFOLDER" ExeCommand="&quot;[System64Folder]inetsrv\appcmd.exe&quot; set config /section:&quot;system.webServer/ModSecurity&quot; /&quot;enabled:true&quot; /&quot;configFile:[INSTALLFOLDER]modsecurity_iis.conf&quot;" />
546566
<CustomAction Id="UninstallConf" Execute="deferred" Impersonate="no" Return="check" Directory="INSTALLFOLDER" ExeCommand="&quot;[System64Folder]inetsrv\appcmd.exe&quot; clear config -section:&quot;system.webServer/ModSecurity&quot;" />
547567
<?else ?>

iis/wix/list_dependencies.bat

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
2+
@echo off
3+
4+
echo *
5+
echo *
6+
echo * ModSecurityIIS - list dependencies
7+
echo *
8+
echo *
9+
echo * This script is likely to be used as part as a debugging process.
10+
echo *
11+
echo *
12+
echo * The main function of this script is to list all ModSecurityIIS runtime
13+
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
15+
echo * ModSecurityIIS refuses to register as IIS module or if IIS refuses to
16+
echo * start.
17+
echo *
18+
echo *
19+
echo *
20+
21+
pause
22+
23+
:LOOP_FILE
24+
SET /a log_file=%RANDOM%+100000
25+
SET log_file=%TEMP%\ModSecurityIIS-depedencies-%log_file:~-5%.TXT
26+
IF EXIST %log_file% GOTO LOOP_FILE
27+
28+
echo Saving logs at: %log_file%
29+
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"
32+
33+
for %%i in (%POSSIBLE_PATHS_X86%) do (
34+
echo Checking for dumpbin x86... %%i
35+
echo Checking for dumpbin x86... %%i >> %log_file%
36+
if exist %%i (
37+
SET DUMPBIN_X86=%%i
38+
goto found_x86
39+
)
40+
)
41+
:found_x86
42+
43+
for %%i in (%POSSIBLE_PATHS_X64%) do (
44+
echo Checking for dumpbin x64... %%i
45+
echo Checking for dumpbin x64... %%i >> %log_file%
46+
if exist %%i (
47+
SET DUMPBIN_X64=%%i
48+
goto found_x64
49+
)
50+
)
51+
:found_x64
52+
53+
if "%DUMPBIN_X86:~1,-1%" == "" (
54+
echo Dumpbin x86 not found.
55+
echo Dumpbin x86 not found. >> %log_file%
56+
) else (
57+
echo Using dumpbin x86: %DUMPBIN_X86%
58+
echo Using dumpbin x86: %DUMPBIN_X86% >> %log_file%
59+
%DUMPBIN_X86% /imports /dependents %* >> %log_file%
60+
)
61+
)
62+
63+
if "%DUMPBIN_X64:~1,-1%" == "" (
64+
echo Dumpbin x64 not found.
65+
echo Dumpbin x64 not found. >> %log_file%
66+
) else (
67+
echo Using dumpbin x64: %DUMPBIN_X64%
68+
echo Using dumpbin x64: %DUMPBIN_X64% >> %log_file%
69+
%DUMPBIN_X64% /imports /dependents %* >> %log_file%
70+
)
71+
72+
goto exit
73+
74+
:exit
75+
echo Logs were saved at: %log_file%.
76+
echo Trying to open it with explorer...
77+
explorer %log_file%
78+
echo Done.
79+
pause

0 commit comments

Comments
 (0)