|
13 | 13 | <?if $(sys.BUILDARCH) = x64 ?> |
14 | 14 | <?define Win64 ="yes" ?> |
15 | 15 | <?define PlatformProgramFilesFolder ="ProgramFiles64Folder" ?> |
| 16 | + <?define ConfigFile ="[inetsrv64]Config\applicationHost.config" ?> |
| 17 | + <PropertyId="IIS_SETUP"> |
| 18 | + <RegistrySearchId="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 | + <PropertyId="IIS_SETUP"> |
| 25 | + <RegistrySearchId="ConfigureIISRegistrySearch"Type="raw"Root="HKLM"Key="SOFTWARE\ModSecurity\ModSecurity"Name="ModSecurityConfigureIIS"Win64="no" /> |
| 26 | + </Property> |
19 | 27 | <?endif ?> |
20 | 28 | <PropertyId="IIS"> |
21 | 29 | <RegistrySearchId="IISInstalledVersion"Root="HKLM"Key="SOFTWARE\Microsoft\InetStp"Type="raw"Name="MajorVersion" /> |
|
93 | 101 | <DirectoryId="TARGETDIR"Name="SourceDir"> |
94 | 102 | <?if $(var.Win64) ="yes" ?> |
95 | 103 | <DirectoryId="SystemFolder"Name="SystemFolder"> |
96 | | - <DirectoryId="inetsrv32"Name="inetsrv" /> |
| 104 | + <DirectoryId="inetsrv32"Name="inetsrv"> |
| 105 | + <DirectoryId="SystemFolderConfig32"Name="config"> |
| 106 | + <DirectoryId="SystemFolderConfigSchema32"Name="schema" /> |
| 107 | + </Directory> |
| 108 | + </Directory> |
97 | 109 | </Directory> |
98 | 110 | <DirectoryId="System64Folder"Name="SystemFolder"> |
99 | | - <DirectoryId="inetsrv64"Name="inetsrv" /> |
| 111 | + <DirectoryId="inetsrv64"Name="inetsrv"> |
| 112 | + <DirectoryId="SystemFolderConfig64"Name="config"> |
| 113 | + <DirectoryId="SystemFolderConfigSchema64"Name="schema" /> |
| 114 | + </Directory> |
| 115 | + </Directory> |
100 | 116 | </Directory> |
101 | 117 | <?else ?> |
102 | 118 | <DirectoryId="SystemFolder"Name="SystemFolder"> |
103 | | - <DirectoryId="inetsrv32"Name="inetsrv" /> |
| 119 | + <DirectoryId="inetsrv32"Name="inetsrv"> |
| 120 | + <DirectoryId="SystemFolderConfig32"Name="config"> |
| 121 | + <DirectoryId="SystemFolderConfigSchema32"Name="schema" /> |
| 122 | + </Directory> |
| 123 | + </Directory> |
104 | 124 | </Directory> |
105 | 125 | <?endif ?> |
106 | 126 | <DirectoryId="$(var.PlatformProgramFilesFolder)"> |
|
313 | 333 | <FileId="modsecurity_iis.conf"Name="modsecurity_iis.conf"Source="wix\modsecurity_iis.conf" /> |
314 | 334 | <FileId="modsecurity_crs_10_setup.conf"Name="modsecurity_crs_10_setup.conf"Source="wix\modsecurity_crs_10_setup.conf" /> |
315 | 335 | <FileId="LIST_DEPENDENCIES.BAT"Name="list_dependencies.bat"Source="wix\list_dependencies.bat" /> |
| 336 | + <FileId="ModSecurity.xml"Name="ModSecurity.xml"Source="ModSecurity.xml" /> |
| 337 | +<!-- Modify ApplicationHost.config--> |
| 338 | + <util:XmlConfigId="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:XmlConfigId="appHostEntryName"File="$(var.ConfigFile)"ElementPath="appHostEntry"Name="name"Value="ModSecurity"Sequence="2" /> |
| 340 | + <util:XmlConfigId="appHostEntryOverrideMode"File="$(var.ConfigFile)"ElementPath="appHostEntry"Name="overrideModeDefault"Value="Deny"Sequence="3" /> |
| 341 | + <util:XmlConfigId="appHostEntryAllowDefinition"File="$(var.ConfigFile)"ElementPath="appHostEntry"Name="allowDefinition"Value="Everywhere"Sequence="4" /> |
| 342 | + <util:XmlConfigId="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:XmlConfigId="removeAppHostEntry2"File="$(var.ConfigFile)"Action="delete"ElementPath="/configuration/system.webServer"Node="element"VerifyPath="/configuration/system.webServer/ModSecurity"Name="section"On="uninstall"Sequence="2" /> |
| 344 | + <RegistryKeyRoot="HKLM"Key="SOFTWARE\ModSecurity\ModSecurity"Action="createAndRemoveOnUninstall"> |
| 345 | + <RegistryValueType="string"Name="ModSecurityConfigureIIS"Value="[IIS_SETUP]"KeyPath="yes" /> |
| 346 | + </RegistryKey> |
316 | 347 | </Component> |
317 | 348 | </DirectoryRef> |
318 | 349 | <?if $(var.Win64) ="yes" ?> |
|
346 | 377 | <FileId="_32_ZLIB1"Name="zlib1.dll"Source="Release\x86\zlib1.dll" /> |
347 | 378 | </Component> |
348 | 379 | </DirectoryRef> |
| 380 | + <DirectoryRefId="SystemFolderConfigSchema32"> |
| 381 | + <ComponentId="ConfigSchema32"Guid="514A81F0-2413-42EF-B19F-E2613125EC11"Location="local"Win64="no"> |
| 382 | + <FileId="_32_ConfigSchema"Name="ModSecurity.xml"Source="ModSecurity.xml" /> |
| 383 | + </Component> |
| 384 | + </DirectoryRef> |
| 385 | + <DirectoryRefId="SystemFolderConfigSchema64"> |
| 386 | + <ComponentId="ConfigSchema64"Guid="514A81F0-2413-42EF-B19F-E2613125EC22"Location="local"Win64="yes"> |
| 387 | + <FileId="_64_ConfigSchema"Name="ModSecurity.xml"Source="ModSecurity.xml" /> |
| 388 | + </Component> |
| 389 | + </DirectoryRef> |
349 | 390 | <?else ?> |
350 | 391 | <DirectoryRefId="inetsrv32"> |
351 | 392 | <ComponentId="ModSec32"DiskId="1"Guid="514A81F0-2413-42EF-B19F-E2613125ECE1"Win64="no"Location="local"> |
|
362 | 403 | <FileId="_32_ZLIB1"Name="zlib1.dll"Source="Release\x86\zlib1.dll" /> |
363 | 404 | </Component> |
364 | 405 | </DirectoryRef> |
365 | | -<?endif ?> |
| 406 | + <DirectoryRefId="SystemFolderConfigSchema32"> |
| 407 | + <ComponentId="ConfigSchema32"Guid="514A81F0-2413-42EF-B19F-E2613125EC11"Location="local"Win64="no"> |
| 408 | + <FileId="_32_ConfigSchema"Name="ModSecurity.xml"Source="ModSecurity.xml" /> |
| 409 | + </Component> |
| 410 | + </DirectoryRef> |
| 411 | + <?endif ?> |
366 | 412 | <FeatureId="DefaultFeature"Title="ModSecurity IIS Common files"Level="1"InstallDefault="local"Absent="disallow"Display="expand"AllowAdvertise="no"Description="Configuration and common files"> |
367 | 413 | <ComponentRefId="ModSecCommon" /> |
| 414 | + <ComponentRefId="ConfigSchema32" /> |
| 415 | + <?if $(var.Win64) ="yes" ?> |
| 416 | + <ComponentRefId="ConfigSchema64" /> |
| 417 | + <?endif ?> |
368 | 418 | <ComponentRefId="StartMenuShortcuts" /> |
369 | 419 | <FeatureId="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 | <ComponentRefId="OWASP_CRS_V_2_2_8" /> |
|
461 | 511 | <ConditionAction="hide">Installed</Condition> |
462 | 512 | </Control> |
463 | 513 | </Dialog> |
464 | | - <PropertyId="CONFIGURE_MODSECURITY_IIS"> |
465 | | - <RegistrySearchId="ConfigureIISRegistrySearch"Type="raw"Root="HKLM"Key="SOFTWARE\ModSecurity\ModSecurityConfigureIIS"Name="ModSecurityConfigureIIS" /> |
466 | | - </Property> |
467 | 514 | <DialogId="RegisterDlg"Width="370"Height="270"Title="!(loc.VerifyReadyDlg_Title)"TrackDiskSpace="yes"> |
468 | 515 | <ControlId="Cancel"Type="PushButton"X="304"Y="243"Width="56"Height="17"Cancel="yes"Text="!(loc.WixUICancel)"> |
469 | 516 | <PublishEvent="SpawnDialog"Value="CancelDlg">1</Publish> |
|
480 | 527 | <ControlId="Title"Type="Text"X="15"Y="6"Width="210"Height="15"Transparent="yes"NoPrefix="yes"Text="{\WixUI_Font_Title}IIS Setup" /> |
481 | 528 | <ControlId="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 | <ControlId="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 | | - <ControlType="CheckBox"Id="ConfigureIIS"Width="200"Height="14"X="25"Y="124"CheckBoxValue="1"Property="CONFIGURE_MODSECURITY_IIS"Text="Perform ModSecurityIIS configuration." /> |
| 530 | + <ControlType="CheckBox"Id="ConfigureIIS"Width="200"Height="14"X="25"Y="124"CheckBoxValue="1"Property="IIS_SETUP"Text="Perform ModSecurityIIS configuration." /> |
484 | 531 | <ControlType="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 | <BinaryId="bannrbmp"SourceFile="wix\banner.jpg" /> |
|
526 | 573 | <WixVariableId="WixUILicenseRtf"Value="wix\EULA.rtf" /> |
527 | 574 | <WixVariableId="WixUIBannerBmp"Value="wix\banner.jpg" /> |
528 | 575 | <WixVariableId="WixUIDialogBmp"Value="wix\dialog.jpg" /> |
| 576 | + <CustomActionId="SetIISConfigure"Property="IIS_SETUP"Value="1"Execute="firstSequence" /> |
529 | 577 | <InstallUISequence> |
530 | | - <CustomAction="SetCONFIGURE_MODSECURITY_IIS"Before="AppSearch">NOT Installed AND NOT OLDERVERSIONDETECTED</Custom> |
| 578 | + <CustomAction="SetIISConfigure"Before="AppSearch">NOT Installed</Custom> |
531 | 579 | </InstallUISequence> |
532 | | - <InstallExecuteSequence> |
533 | | - <CustomAction="SetCONFIGURE_MODSECURITY_IIS"Before="AppSearch">NOT Installed AND NOT OLDERVERSIONDETECTED</Custom> |
534 | | - </InstallExecuteSequence> |
535 | | - <CustomActionId="SetCONFIGURE_MODSECURITY_IIS"Property="CONFIGURE_MODSECURITY_IIS"Value="1"Execute="firstSequence" /> |
536 | 580 | <InstallExecuteSequence> |
537 | 581 | <?if $(var.Win64) ="yes" ?> |
538 | | - <CustomAction="InstallModule64"Before="InstallFinalize"><![CDATA[NOT Installed AND CONFIGURE_MODSECURITY_IIS]]></Custom> |
539 | | - <CustomAction="InstallModule32"After="InstallModule64"><![CDATA[NOT Installed AND CONFIGURE_MODSECURITY_IIS]]></Custom> |
540 | | - <CustomAction="InstallConf"After="InstallModule32"><![CDATA[NOT Installed AND CONFIGURE_MODSECURITY_IIS]]></Custom> |
541 | | - <CustomAction="UninstallConf"Before="RemoveFiles"><![CDATA[Installed AND CONFIGURE_MODSECURITY_IIS]]></Custom> |
542 | | - <CustomAction="UninstallModule32"After="UninstallConf"><![CDATA[Installed AND CONFIGURE_MODSECURITY_IIS]]></Custom> |
543 | | - <CustomAction="UninstallModule64"After="UninstallModule32"><![CDATA[Installed AND CONFIGURE_MODSECURITY_IIS]]></Custom> |
| 582 | + <CustomAction="SetIISConfigure"Before="AppSearch">NOT Installed</Custom> |
| 583 | + <CustomAction="InstallModule64"Before="InstallFinalize"><![CDATA[NOT Installed AND IIS_SETUP]]></Custom> |
| 584 | + <CustomAction="InstallModule32"After="InstallModule64"><![CDATA[NOT Installed AND IIS_SETUP]]></Custom> |
| 585 | + <CustomAction="InstallConf"After="InstallModule32"><![CDATA[NOT Installed AND IIS_SETUP]]></Custom> |
| 586 | + <CustomAction="UninstallConf"Before="RemoveFiles"><![CDATA[Installed AND IIS_SETUP]]></Custom> |
| 587 | + <CustomAction="UninstallModule32"Before="UninstallConf"><![CDATA[Installed AND IIS_SETUP]]></Custom> |
| 588 | + <CustomAction="UninstallModule64"Before="UninstallModule32"><![CDATA[Installed AND IIS_SETUP]]></Custom> |
544 | 589 | <?else ?> |
545 | | - <CustomAction="InstallModule32"Before="InstallFinalize"><![CDATA[NOT Installed AND CONFIGURE_MODSECURITY_IIS]]></Custom> |
546 | | - <CustomAction="InstallConf"After="InstallModule32"><![CDATA[NOT Installed AND CONFIGURE_MODSECURITY_IIS]]></Custom> |
547 | | - <CustomAction="UninstallConf"Before="RemoveFiles"><![CDATA[Installed AND CONFIGURE_MODSECURITY_IIS]]></Custom> |
548 | | - <CustomAction="UninstallModule32"After="UninstallConf"><![CDATA[Installed AND CONFIGURE_MODSECURITY_IIS]]></Custom> |
| 590 | + <CustomAction="SetIISConfigure"Before="AppSearch">NOT Installed</Custom> |
| 591 | + <CustomAction="InstallModule32"Before="InstallFinalize"><![CDATA[NOT Installed AND IIS_SETUP]]></Custom> |
| 592 | + <CustomAction="InstallConf"After="InstallModule32"><![CDATA[NOT Installed AND IIS_SETUP]]></Custom> |
| 593 | + <CustomAction="UninstallConf"Before="RemoveFiles"><![CDATA[Installed AND IIS_SETUP]]></Custom> |
| 594 | + <CustomAction="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 | <CustomActionId="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 | + <CustomActionId="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 | <CustomActionId="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 | | - <CustomActionId="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 | <CustomActionId="UninstallModule32"Execute="deferred"Impersonate="no"Return="check"Directory="INSTALLFOLDER"ExeCommand=""[System64Folder]inetsrv\appcmd.exe" uninstall module /module.name:"ModSecurity IIS (32bits)"" /> |
560 | 605 | <CustomActionId="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 | <CustomActionId="UninstallModule32"Execute="deferred"Impersonate="no"Return="check"Directory="INSTALLFOLDER"ExeCommand=""[SystemFolder]inetsrv\appcmd.exe" uninstall module /module.name:"ModSecurity IIS (32bits)"" /> |
563 | | - <CustomActionId="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 | <CustomActionId="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 | | - <CustomActionId="UninstallConf"Execute="deferred"Impersonate="no"Return="check"Directory="INSTALLFOLDER"ExeCommand=""[System64Folder]inetsrv\appcmd.exe" clear config -section:"system.webServer/ModSecurity"" /> |
567 | 611 | <?else ?> |
568 | | - <CustomActionId="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 | | - <CustomActionId="UninstallModule32"Execute="deferred"Impersonate="no"Return="check"Directory="INSTALLFOLDER"ExeCommand=""[SystemFolder]inetsrv\appcmd.exe" uninstall module /module.name:"ModSecurity IIS (32bits)"" /> |
570 | 612 | <CustomActionId="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 | + <CustomActionId="UninstallConf"Execute="deferred"Impersonate="no"Return="check"Directory="INSTALLFOLDER"ExeCommand=""[System64Folder]inetsrv\appcmd.exe" clear config -section:"system.webServer/ModSecurity"" /> |
| 616 | + <?else ?> |
571 | 617 | <CustomActionId="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 | <DirectoryRefId="TARGETDIR"> |
|