|
13 | 13 | <?if $(sys.BUILDARCH) = x64 ?>
|
14 | 14 | <?define Win64 = "yes" ?>
|
15 | 15 | <?define PlatformProgramFilesFolder = "ProgramFiles64Folder" ?>
|
| 16 | + <?define ConfigFile = "[inetsrv64]Config\applicationHost.config" ?> |
| 17 | + <Property Id="IIS_SETUP"> |
| 18 | + <RegistrySearch Id="ConfigureIISRegistrySearch" Type="raw" Root="HKLM" Key="SOFTWARE\ModSecurity\ModSecurity" Name="ModSecurityConfigureIIS" Win64="yes" /> |
| 19 | + </Property> |
16 | 20 | <?else ?>
|
17 | 21 | <?define Win64 = "no" ?>
|
18 | 22 | <?define PlatformProgramFilesFolder = "ProgramFilesFolder" ?>
|
| 23 | + <?define ConfigFile = "[inetsrv32]Config\applicationHost.config" ?> |
| 24 | + <Property Id="IIS_SETUP"> |
| 25 | + <RegistrySearch Id="ConfigureIISRegistrySearch" Type="raw" Root="HKLM" Key="SOFTWARE\ModSecurity\ModSecurity" Name="ModSecurityConfigureIIS" Win64="no" /> |
| 26 | + </Property> |
19 | 27 | <?endif ?>
|
20 | 28 | <Property Id="IIS">
|
21 | 29 | <RegistrySearch Id="IISInstalledVersion" Root="HKLM" Key="SOFTWARE\Microsoft\InetStp" Type="raw" Name="MajorVersion" />
|
|
93 | 101 | <Directory Id="TARGETDIR" Name="SourceDir">
|
94 | 102 | <?if $(var.Win64) = "yes" ?>
|
95 | 103 | <Directory Id="SystemFolder" Name="SystemFolder">
|
96 |
| - <Directory Id="inetsrv32" Name="inetsrv" /> |
| 104 | + <Directory Id="inetsrv32" Name="inetsrv"> |
| 105 | + <Directory Id="SystemFolderConfig32" Name="config"> |
| 106 | + <Directory Id="SystemFolderConfigSchema32" Name="schema" /> |
| 107 | + </Directory> |
| 108 | + </Directory> |
97 | 109 | </Directory>
|
98 | 110 | <Directory Id="System64Folder" Name="SystemFolder">
|
99 |
| - <Directory Id="inetsrv64" Name="inetsrv" /> |
| 111 | + <Directory Id="inetsrv64" Name="inetsrv"> |
| 112 | + <Directory Id="SystemFolderConfig64" Name="config"> |
| 113 | + <Directory Id="SystemFolderConfigSchema64" Name="schema" /> |
| 114 | + </Directory> |
| 115 | + </Directory> |
100 | 116 | </Directory>
|
101 | 117 | <?else ?>
|
102 | 118 | <Directory Id="SystemFolder" Name="SystemFolder">
|
103 |
| - <Directory Id="inetsrv32" Name="inetsrv" /> |
| 119 | + <Directory Id="inetsrv32" Name="inetsrv"> |
| 120 | + <Directory Id="SystemFolderConfig32" Name="config"> |
| 121 | + <Directory Id="SystemFolderConfigSchema32" Name="schema" /> |
| 122 | + </Directory> |
| 123 | + </Directory> |
104 | 124 | </Directory>
|
105 | 125 | <?endif ?>
|
106 | 126 | <Directory Id="$(var.PlatformProgramFilesFolder)">
|
|
313 | 333 | <File Id="modsecurity_iis.conf" Name="modsecurity_iis.conf" Source="wix\modsecurity_iis.conf" />
|
314 | 334 | <File Id="modsecurity_crs_10_setup.conf" Name="modsecurity_crs_10_setup.conf" Source="wix\modsecurity_crs_10_setup.conf" />
|
315 | 335 | <File Id="LIST_DEPENDENCIES.BAT" Name="list_dependencies.bat" Source="wix\list_dependencies.bat" />
|
| 336 | + <File Id="ModSecurity.xml" Name="ModSecurity.xml" Source="ModSecurity.xml" /> |
| 337 | + <!-- Modify ApplicationHost.config --> |
| 338 | + <util:XmlConfig Id="appHostEntry" File="$(var.ConfigFile)" Action="create" ElementPath="//configuration/configSections/sectionGroup[\[]@name='system.webServer'[\]]" VerifyPath="section[\[]@name='ModSecurity'[\]]" Name="section" Node="element" Sequence="1" On="install" /> |
| 339 | + <util:XmlConfig Id="appHostEntryName" File="$(var.ConfigFile)" ElementPath="appHostEntry" Name="name" Value="ModSecurity" Sequence="2" /> |
| 340 | + <util:XmlConfig Id="appHostEntryOverrideMode" File="$(var.ConfigFile)" ElementPath="appHostEntry" Name="overrideModeDefault" Value="Deny" Sequence="3" /> |
| 341 | + <util:XmlConfig Id="appHostEntryAllowDefinition" File="$(var.ConfigFile)" ElementPath="appHostEntry" Name="allowDefinition" Value="Everywhere" Sequence="4" /> |
| 342 | + <util:XmlConfig Id="removeAppHostEntry" File="$(var.ConfigFile)" Action="delete" ElementPath="/configuration/configSections/sectionGroup[\[]@name='system.webServer'[\]]" Node="element" VerifyPath="section[\[]@name='ModSecurity'[\]]" On="uninstall" Sequence="1" /> |
| 343 | + <util:XmlConfig Id="removeAppHostEntry2" File="$(var.ConfigFile)" Action="delete" ElementPath="/configuration/system.webServer" Node="element" VerifyPath="/configuration/system.webServer/ModSecurity" Name="section" On="uninstall" Sequence="2" /> |
| 344 | + <RegistryKey Root="HKLM" Key="SOFTWARE\ModSecurity\ModSecurity" Action="createAndRemoveOnUninstall"> |
| 345 | + <RegistryValue Type="string" Name="ModSecurityConfigureIIS" Value="[IIS_SETUP]" KeyPath="yes" /> |
| 346 | + </RegistryKey> |
316 | 347 | </Component>
|
317 | 348 | </DirectoryRef>
|
318 | 349 | <?if $(var.Win64) = "yes" ?>
|
|
346 | 377 | <File Id="_32_ZLIB1" Name="zlib1.dll" Source="Release\x86\zlib1.dll" />
|
347 | 378 | </Component>
|
348 | 379 | </DirectoryRef>
|
| 380 | + <DirectoryRef Id="SystemFolderConfigSchema32"> |
| 381 | + <Component Id="ConfigSchema32" Guid="514A81F0-2413-42EF-B19F-E2613125EC11" Location="local" Win64="no"> |
| 382 | + <File Id="_32_ConfigSchema" Name="ModSecurity.xml" Source="ModSecurity.xml" /> |
| 383 | + </Component> |
| 384 | + </DirectoryRef> |
| 385 | + <DirectoryRef Id="SystemFolderConfigSchema64"> |
| 386 | + <Component Id="ConfigSchema64" Guid="514A81F0-2413-42EF-B19F-E2613125EC22" Location="local" Win64="yes"> |
| 387 | + <File Id="_64_ConfigSchema" Name="ModSecurity.xml" Source="ModSecurity.xml" /> |
| 388 | + </Component> |
| 389 | + </DirectoryRef> |
349 | 390 | <?else ?>
|
350 | 391 | <DirectoryRef Id="inetsrv32">
|
351 | 392 | <Component Id="ModSec32" DiskId="1" Guid="514A81F0-2413-42EF-B19F-E2613125ECE1" Win64="no" Location="local">
|
|
362 | 403 | <File Id="_32_ZLIB1" Name="zlib1.dll" Source="Release\x86\zlib1.dll" />
|
363 | 404 | </Component>
|
364 | 405 | </DirectoryRef>
|
365 |
| - <?endif ?> |
| 406 | + <DirectoryRef Id="SystemFolderConfigSchema32"> |
| 407 | + <Component Id="ConfigSchema32" Guid="514A81F0-2413-42EF-B19F-E2613125EC11" Location="local" Win64="no"> |
| 408 | + <File Id="_32_ConfigSchema" Name="ModSecurity.xml" Source="ModSecurity.xml" /> |
| 409 | + </Component> |
| 410 | + </DirectoryRef> |
| 411 | + <?endif ?> |
366 | 412 | <Feature Id="DefaultFeature" Title="ModSecurity IIS Common files" Level="1" InstallDefault="local" Absent="disallow" Display="expand" AllowAdvertise="no" Description="Configuration and common files">
|
367 | 413 | <ComponentRef Id="ModSecCommon" />
|
| 414 | + <ComponentRef Id="ConfigSchema32" /> |
| 415 | + <?if $(var.Win64) = "yes" ?> |
| 416 | + <ComponentRef Id="ConfigSchema64" /> |
| 417 | + <?endif ?> |
368 | 418 | <ComponentRef Id="StartMenuShortcuts" />
|
369 | 419 | <Feature Id="OWASP_ModSecurity_CRS_v2.2.8" Level="1" Title="OWASP ModSecurity CRS v2.2.8" InstallDefault="local" Display="expand" AllowAdvertise="no" Description="Install OWASP CRS v2.2.8">
|
370 | 420 | <ComponentRef Id="OWASP_CRS_V_2_2_8" />
|
|
461 | 511 | <Condition Action="hide">Installed</Condition>
|
462 | 512 | </Control>
|
463 | 513 | </Dialog>
|
464 |
| - <Property Id="CONFIGURE_MODSECURITY_IIS"> |
465 |
| - <RegistrySearch Id="ConfigureIISRegistrySearch" Type="raw" Root="HKLM" Key="SOFTWARE\ModSecurity\ModSecurityConfigureIIS" Name="ModSecurityConfigureIIS" /> |
466 |
| - </Property> |
467 | 514 | <Dialog Id="RegisterDlg" Width="370" Height="270" Title="!(loc.VerifyReadyDlg_Title)" TrackDiskSpace="yes">
|
468 | 515 | <Control Id="Cancel" Type="PushButton" X="304" Y="243" Width="56" Height="17" Cancel="yes" Text="!(loc.WixUICancel)">
|
469 | 516 | <Publish Event="SpawnDialog" Value="CancelDlg">1</Publish>
|
|
480 | 527 | <Control Id="Title" Type="Text" X="15" Y="6" Width="210" Height="15" Transparent="yes" NoPrefix="yes" Text="{\WixUI_Font_Title}IIS Setup" />
|
481 | 528 | <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." />
|
482 | 529 | <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." />
|
483 |
| - <Control Type="CheckBox" Id="ConfigureIIS" Width="200" Height="14" X="25" Y="124" CheckBoxValue="1" Property="CONFIGURE_MODSECURITY_IIS" Text="Perform ModSecurityIIS configuration." /> |
| 530 | + <Control Type="CheckBox" Id="ConfigureIIS" Width="200" Height="14" X="25" Y="124" CheckBoxValue="1" Property="IIS_SETUP" Text="Perform ModSecurityIIS configuration." /> |
484 | 531 | <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" />
|
485 | 532 | </Dialog>
|
486 | 533 | <Binary Id="bannrbmp" SourceFile="wix\banner.jpg" />
|
|
526 | 573 | <WixVariable Id="WixUILicenseRtf" Value="wix\EULA.rtf" />
|
527 | 574 | <WixVariable Id="WixUIBannerBmp" Value="wix\banner.jpg" />
|
528 | 575 | <WixVariable Id="WixUIDialogBmp" Value="wix\dialog.jpg" />
|
| 576 | + <CustomAction Id="SetIISConfigure" Property="IIS_SETUP" Value="1" Execute="firstSequence" /> |
529 | 577 | <InstallUISequence>
|
530 |
| - <Custom Action="SetCONFIGURE_MODSECURITY_IIS" Before="AppSearch">NOT Installed AND NOT OLDERVERSIONDETECTED</Custom> |
| 578 | + <Custom Action="SetIISConfigure" Before="AppSearch">NOT Installed</Custom> |
531 | 579 | </InstallUISequence>
|
532 |
| - <InstallExecuteSequence> |
533 |
| - <Custom Action="SetCONFIGURE_MODSECURITY_IIS" Before="AppSearch">NOT Installed AND NOT OLDERVERSIONDETECTED</Custom> |
534 |
| - </InstallExecuteSequence> |
535 |
| - <CustomAction Id="SetCONFIGURE_MODSECURITY_IIS" Property="CONFIGURE_MODSECURITY_IIS" Value="1" Execute="firstSequence" /> |
536 | 580 | <InstallExecuteSequence>
|
537 | 581 | <?if $(var.Win64) = "yes" ?>
|
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> |
| 582 | + <Custom Action="SetIISConfigure" Before="AppSearch">NOT Installed</Custom> |
| 583 | + <Custom Action="InstallModule64" Before="InstallFinalize"><![CDATA[NOT Installed AND IIS_SETUP]]></Custom> |
| 584 | + <Custom Action="InstallModule32" After="InstallModule64"><![CDATA[NOT Installed AND IIS_SETUP]]></Custom> |
| 585 | + <Custom Action="InstallConf" After="InstallModule32"><![CDATA[NOT Installed AND IIS_SETUP]]></Custom> |
| 586 | + <Custom Action="UninstallConf" Before="RemoveFiles"><![CDATA[Installed AND IIS_SETUP]]></Custom> |
| 587 | + <Custom Action="UninstallModule32" Before="UninstallConf"><![CDATA[Installed AND IIS_SETUP]]></Custom> |
| 588 | + <Custom Action="UninstallModule64" Before="UninstallModule32"><![CDATA[Installed AND IIS_SETUP]]></Custom> |
544 | 589 | <?else ?>
|
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> |
| 590 | + <Custom Action="SetIISConfigure" Before="AppSearch">NOT Installed</Custom> |
| 591 | + <Custom Action="InstallModule32" Before="InstallFinalize"><![CDATA[NOT Installed AND IIS_SETUP]]></Custom> |
| 592 | + <Custom Action="InstallConf" After="InstallModule32"><![CDATA[NOT Installed AND IIS_SETUP]]></Custom> |
| 593 | + <Custom Action="UninstallConf" Before="RemoveFiles"><![CDATA[Installed AND IIS_SETUP]]></Custom> |
| 594 | + <Custom Action="UninstallModule32" After="UninstallConf"><![CDATA[Installed AND IIS_SETUP]]></Custom> |
549 | 595 | <?endif ?>
|
550 | 596 | </InstallExecuteSequence>
|
551 | 597 | <?if $(var.Win64) = "yes" ?>
|
552 |
| - <?if $(var.Win64) = "yes" ?> |
553 | 598 | <CustomAction Id="InstallModule32" Execute="deferred" Impersonate="no" Return="check" Directory="INSTALLFOLDER" ExeCommand=""[System64Folder]inetsrv\appcmd.exe" install module /name:"ModSecurity IIS (64bits)" /image:"%SystemRoot%\System32\inetsrv\ModSecurityIIS.dll" /preCondition:"bitness64"" />
|
| 599 | + <CustomAction Id="InstallModule64" Execute="deferred" Impersonate="no" Return="check" Directory="INSTALLFOLDER" ExeCommand=""[System64Folder]inetsrv\appcmd.exe" install module /name:"ModSecurity IIS (32bits)" /image:"%SystemRoot%\SysWOW64\inetsrv\ModSecurityIIS.dll" /preCondition:"bitness32"" /> |
554 | 600 | <?else ?>
|
555 | 601 | <CustomAction Id="InstallModule32" Execute="deferred" Impersonate="no" Return="check" Directory="INSTALLFOLDER" ExeCommand=""[SystemFolder]inetsrv\appcmd.exe" install module /name:"ModSecurity IIS (32bits)" /image:"%SystemRoot%\System32\inetsrv\ModSecurityIIS.dll"" />
|
556 | 602 | <?endif ?>
|
557 |
| - <CustomAction Id="InstallModule64" Execute="deferred" Impersonate="no" Return="check" Directory="INSTALLFOLDER" ExeCommand=""[System64Folder]inetsrv\appcmd.exe" install module /name:"ModSecurity IIS (32bits)" /image:"%SystemRoot%\SysWOW64\inetsrv\ModSecurityIIS.dll" /preCondition:"bitness32"" /> |
558 | 603 | <?if $(var.Win64) = "yes" ?>
|
559 | 604 | <CustomAction Id="UninstallModule32" Execute="deferred" Impersonate="no" Return="check" Directory="INSTALLFOLDER" ExeCommand=""[System64Folder]inetsrv\appcmd.exe" uninstall module /module.name:"ModSecurity IIS (32bits)"" />
|
560 | 605 | <CustomAction Id="UninstallModule64" Execute="deferred" Impersonate="no" Return="check" Directory="INSTALLFOLDER" ExeCommand=""[System64Folder]inetsrv\appcmd.exe" uninstall module /module.name:"ModSecurity IIS (64bits)"" />
|
561 | 606 | <?else ?>
|
562 | 607 | <CustomAction Id="UninstallModule32" Execute="deferred" Impersonate="no" Return="check" Directory="INSTALLFOLDER" ExeCommand=""[SystemFolder]inetsrv\appcmd.exe" uninstall module /module.name:"ModSecurity IIS (32bits)"" />
|
563 |
| - <CustomAction Id="UninstallModule64" Execute="deferred" Impersonate="no" Return="check" Directory="INSTALLFOLDER" ExeCommand=""[System64Folder]inetsrv\appcmd.exe" uninstall module /module.name:"ModSecurity IIS (64bits)"" /> |
564 | 608 | <?endif ?>
|
| 609 | + <?if $(var.Win64) = "yes" ?> |
565 | 610 | <CustomAction Id="InstallConf" Execute="deferred" Impersonate="no" Return="check" Directory="INSTALLFOLDER" ExeCommand=""[System64Folder]inetsrv\appcmd.exe" set config /section:"system.webServer/ModSecurity" /"enabled:true" /"configFile:[INSTALLFOLDER]modsecurity_iis.conf"" />
|
566 |
| - <CustomAction Id="UninstallConf" Execute="deferred" Impersonate="no" Return="check" Directory="INSTALLFOLDER" ExeCommand=""[System64Folder]inetsrv\appcmd.exe" clear config -section:"system.webServer/ModSecurity"" /> |
567 | 611 | <?else ?>
|
568 |
| - <CustomAction Id="InstallModule32" Execute="deferred" Impersonate="no" Return="check" Directory="INSTALLFOLDER" ExeCommand=""[SystemFolder]inetsrv\appcmd.exe" install module /name:"ModSecurity IIS (32bits)" /image:"%SystemRoot%\System32\inetsrv\ModSecurityIIS.dll"" /> |
569 |
| - <CustomAction Id="UninstallModule32" Execute="deferred" Impersonate="no" Return="check" Directory="INSTALLFOLDER" ExeCommand=""[SystemFolder]inetsrv\appcmd.exe" uninstall module /module.name:"ModSecurity IIS (32bits)"" /> |
570 | 612 | <CustomAction Id="InstallConf" Execute="deferred" Impersonate="no" Return="check" Directory="INSTALLFOLDER" ExeCommand=""[SystemFolder]inetsrv\appcmd.exe" set config /section:"system.webServer/ModSecurity" /"enabled:true" /"configFile:[INSTALLFOLDER]modsecurity_iis.conf"" />
|
| 613 | + <?endif ?> |
| 614 | + <?if $(var.Win64) = "yes" ?> |
| 615 | + <CustomAction Id="UninstallConf" Execute="deferred" Impersonate="no" Return="check" Directory="INSTALLFOLDER" ExeCommand=""[System64Folder]inetsrv\appcmd.exe" clear config -section:"system.webServer/ModSecurity"" /> |
| 616 | + <?else ?> |
571 | 617 | <CustomAction Id="UninstallConf" Execute="deferred" Impersonate="no" Return="check" Directory="INSTALLFOLDER" ExeCommand=""[SystemFolder]inetsrv\appcmd.exe" clear config -section:"system.webServer/ModSecurity"" />
|
572 | 618 | <?endif ?>
|
573 | 619 | <DirectoryRef Id="TARGETDIR">
|
|
0 commit comments