github.com/crowdsecurity/crowdsec@v1.6.1/windows/installer/product.wxs (about)

     1  <?xml version="1.0"?>
     2  
     3  <?if $(sys.BUILDARCH)="x86"?>
     4  <?define Program_Files="ProgramFilesFolder"?>
     5  <?elseif $(sys.BUILDARCH)="x64"?>
     6  <?define Program_Files="ProgramFiles64Folder"?>
     7  <?else ?>
     8  <?error Unsupported value of sys.BUILDARCH=$(sys.BUILDARCH)?>
     9  <?endif ?>
    10  
    11  <?define ProductName="CrowdSec"?>
    12  
    13  <Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
    14  
    15     <Product Id="*" UpgradeCode="8eab6970-25e3-4b7d-882f-5b7efa311afc" Name="$(var.ProductName)" Version="$(var.Version)" Manufacturer="CrowdSecurity" Language="1033">
    16  
    17        <Package InstallerVersion="200" Compressed="yes" Comments="Crowdsec Installer Package" InstallScope="perMachine" />
    18        <Media Id="1" Cabinet="product.cab" EmbedCab="yes" />
    19        <MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." Schedule="afterInstallExecute" />
    20  
    21        <SetProperty After="AppSearch" Id="WIXUI_EXITDIALOGOPTIONALTEXT" Value="LAPI is disabled and no agents credentials were generated.Please register your agent in your LAPI instance, update C:\ProgramData\CrowdSec\config\local_api_credentials.yaml, and configure the CrowdSec service to start on boot." >
    22           AGENT_ONLY
    23         </SetProperty>
    24  
    25        <Directory Id="TARGETDIR" Name="SourceDir">
    26           <Directory Id="$(var.Program_Files)">
    27              <Directory Id="INSTALLDIR" Name="$(var.ProductName)">
    28                 <Component Id="Crowdsec" Guid="200299fc-e728-4749-a283-cfbd20c02a59">
    29                    <File Id="crowdsec.exe" Source="cmd\crowdsec\crowdsec.exe" />
    30                    <Condition>NOT AGENT_ONLY</Condition>
    31                    <ServiceInstall Id="CrowdsecService" Name="Crowdsec" DisplayName="Crowdsec" Description="Crowdsec IPS/IDS" Start="auto" Type="ownProcess" ErrorControl="normal" Account="LocalSystem" Vital="yes" Interactive="no" />
    32                    <ServiceControl Id="CrowdsecService" Name="Crowdsec" Start="install" Stop="both" Remove="uninstall" Wait="yes" />
    33                 </Component>
    34                 <Component Id="CrowdsecNoStart" Guid="a9fac892-a7ea-4a3b-9a00-4f4bf2205de9">
    35                    <File Id="crowdsec2.exe" Source="cmd\crowdsec\crowdsec.exe" />
    36                    <Condition>AGENT_ONLY</Condition>
    37                    <ServiceInstall Id="CrowdsecService2" Name="Crowdsec" DisplayName="Crowdsec" Description="Crowdsec IPS/IDS" Start="disabled" Type="ownProcess" ErrorControl="normal" Account="LocalSystem" Vital="yes" Interactive="no" />
    38                    <ServiceControl Id="CrowdsecService2" Name="Crowdsec" Stop="both" Remove="uninstall" Wait="yes" />
    39                 </Component>
    40                 <Component Id="Cscli" Guid="b3da82cb-d111-4205-b0ee-5499b34dd57b">
    41                    <File Id="cscli.exe" Source="cmd\crowdsec-cli\cscli.exe" />
    42                    <Environment Id="UpdatePath" Name="PATH" Value="[INSTALLDIR]" Part="last" Action="set" System="yes" />
    43                 </Component>
    44              </Directory>
    45           </Directory>
    46           <Directory Id="CommonAppDataFolder">
    47              <Directory Id="CrowdSecCommonDir" Name="CrowdSec">
    48                 <Directory Id="ConfigDir" Name="config">
    49                    <Component Id="AcquisConfig" Guid="08bfc6fd-4811-48ed-b63e-035acb1f69d8">
    50                       <File Id="acquis.yaml" Source="config\acquis_win.yaml" Name="acquis.yaml" />
    51                    </Component>
    52                    <Component Id="LocalCreds" Guid="fea92471-ba4b-4067-a92a-19af0d581b60">
    53                       <File Id="local_api_credentials.yaml" Source="config\local_api_credentials.yaml">
    54                          <PermissionEx Sddl="D:PAI(A;;FA;;;SY)(A;;FA;;;BA)"/>
    55                       </File>
    56                    </Component>
    57                    <Directory Id="ConsoleDir" Name="console">
    58                       <Component Id="ConsoleContextFile" Guid="f146e12a-8f02-4129-9029-577807966e92">
    59                          <File Id="context.yaml" Source="config\context.yaml" />
    60                       </Component>
    61                    </Directory>
    62                    <Component Id="OnlineCreds" Guid="a652a6cb-d464-40b1-8f50-78dce0135d20">
    63                       <File Id="online_api_credentials.yaml" Source="config\online_api_credentials.yaml">
    64                          <PermissionEx Sddl="D:PAI(A;;FA;;;SY)(A;;FA;;;BA)"/>
    65                       </File>
    66                    </Component>
    67                    <Component Id="ProfilesConfig" Guid="8d6fca04-b3be-4a52-a9df-278139d0498e">
    68                       <File Id="profiles.yaml" Source="config\profiles.yaml" />
    69                    </Component>
    70                    <Component Id="SimulationConfig" Guid="a27346e6-af4a-4ee6-aea9-d783b036cd21">
    71                       <File Id="simulation.yaml" Source="config\simulation.yaml" />
    72                    </Component>
    73                    <Component Id="ConsoleConfig" Guid="8393e488-18d5-4578-9e4c-99b54f7b2bb6">
    74                       <File Id="console.yaml" Source="config\console.yaml" />
    75                    </Component>
    76                    <Component Id="Csconfig_lapi" Guid="a99bd70c-61af-43ca-8394-6dc789cec566">
    77                       <Condition>
    78                          NOT AGENT_ONLY
    79                       </Condition>
    80                       <File Id="config.yaml" Source="config\config_win.yaml" Name="config.yaml"/>
    81                    </Component>
    82                    <Component Id="Csconfig_no_lapi" Guid="494d2e56-9db0-4d31-bde4-826f28a5683c">
    83                       <Condition>
    84                          AGENT_ONLY
    85                       </Condition>
    86                       <File Id="config_no_lapi.yaml" Source="config\config_win_no_lapi.yaml" Name="config.yaml"/>
    87                    </Component>
    88                    <Directory Id="NotifConfigDir" Name="notifications">
    89                       <Component Id="NotifConfig" Guid="4d04a852-e876-408f-95a7-a7effa7762c4">
    90                          <File Id="slack.yaml" Source="cmd\notification-slack\slack.yaml" Name="slack.yaml">
    91                             <PermissionEx Sddl="D:PAI(A;;FA;;;SY)(A;;FA;;;BA)"/>
    92                          </File>
    93                          <File Id="http.yaml" Source="cmd\notification-http\http.yaml" Name="http.yaml">
    94                             <PermissionEx Sddl="D:PAI(A;;FA;;;SY)(A;;FA;;;BA)"/>
    95                          </File>
    96                          <File Id="email.yaml" Source="cmd\notification-email\email.yaml" Name="email.yaml">
    97                             <PermissionEx Sddl="D:PAI(A;;FA;;;SY)(A;;FA;;;BA)"/>
    98                          </File>
    99                          <File Id="splunk.yaml" Source="cmd\notification-splunk\splunk.yaml" Name="splunk.yaml">
   100                             <PermissionEx Sddl="D:PAI(A;;FA;;;SY)(A;;FA;;;BA)"/>
   101                          </File>
   102                          <File Id="sentinel.yaml" Source="cmd\notification-sentinel\sentinel.yaml" Name="sentinel.yaml">
   103                             <PermissionEx Sddl="D:PAI(A;;FA;;;SY)(A;;FA;;;BA)"/>
   104                          </File>
   105                       </Component>
   106                    </Directory>
   107                    <Directory Id="PatternsDir" Name="patterns" />
   108                 </Directory>
   109                 <Directory Id="logCrowdsec" Name="log">
   110                    <Component Id="CreateLog" Guid="bfb37d14-10c4-40fb-bafa-2a29f95e4a53">
   111                       <CreateFolder />
   112                    </Component>
   113                 </Directory>
   114                 <Directory Id="hubCrowdsec" Name="hub">
   115                    <Component Id="CreateHub" Guid="ac528dd2-49f7-4448-a9e7-91c66061404b">
   116                       <CreateFolder />
   117                    </Component>
   118                 </Directory>
   119                 <Directory Id="CrowdsecDataDir" Name="data">
   120                    <Component Id="CreateCrowdsecDataDir" Guid="de529565-a499-4327-948d-2a318f8e822a">
   121                       <CreateFolder />
   122                    </Component>
   123                 </Directory>
   124                 <Directory Id="CrowdsecPluginsDir" Name="plugins">
   125                    <Component Id="CreateCrowdsecPluginsDir" Guid="bb7c8f19-8457-44b9-a538-aed494ec575d">
   126                       <File Id="notification_slack.exe" Source="cmd\notification-slack\notification-slack.exe" />
   127                       <File Id="notification_email.exe" Source="cmd\notification-email\notification-email.exe" />
   128                       <File Id="notification_http.exe" Source="cmd\notification-http\notification-http.exe" />
   129                       <File Id="notification_splunk.exe" Source="cmd\notification-splunk\notification-splunk.exe" />
   130                       <File Id="notification_sentinel.exe" Source="cmd\notification-sentinel\notification-sentinel.exe" />
   131                    </Component>
   132                 </Directory>
   133              </Directory>
   134           </Directory>
   135        </Directory>
   136  
   137  
   138        <SetProperty Id="HubUpdate" Value="&quot;[INSTALLDIR]\cscli.exe&quot; hub update" Sequence="execute" Before="HubUpdate" />
   139        <CustomAction Id="HubUpdate" BinaryKey="WixCA" DllEntry="WixQuietExec" Execute="deferred" Return="ignore" Impersonate="no" />
   140        <SetProperty Id="InstallWinCollection" Value="&quot;[INSTALLDIR]\cscli.exe&quot; collections install crowdsecurity/windows crowdsecurity/windows-firewall crowdsecurity/iis crowdsecurity/mssql" Sequence="execute" Before="InstallWinCollection" />
   141        <CustomAction Id="InstallWinCollection" BinaryKey="WixCA" DllEntry="WixQuietExec" Execute="deferred" Return="ignore" Impersonate="no" />
   142        <SetProperty Id="FixPermissionsCreds" Value="&quot;icacls.exe&quot; C:\ProgramData\CrowdSec\config\*_api_credentials.yaml /inheritance:r /grant:r *S-1-5-32-544:(F)" Sequence="execute" Before="FixPermissionsCreds" />
   143        <CustomAction Id="FixPermissionsCreds" BinaryKey="WixCA" DllEntry="WixQuietExec" Execute="deferred" Return="check" Impersonate="no" />
   144        <SetProperty Id="FixPermissionsNotif" Value="&quot;icacls.exe&quot; C:\ProgramData\CrowdSec\config\notifications\*.yaml /inheritance:r /grant:r *S-1-5-32-544:(F)" Sequence="execute" Before="FixPermissionsNotif" />
   145        <CustomAction Id="FixPermissionsNotif" BinaryKey="WixCA" DllEntry="WixQuietExec" Execute="deferred" Return="check" Impersonate="no" />
   146        <SetProperty Id="RegisterMachine" Value="&quot;[INSTALLDIR]\cscli.exe&quot; machines add -a --force" Sequence="execute" Before="RegisterMachine" />
   147        <CustomAction Id="RegisterMachine" BinaryKey="WixCA" DllEntry="WixQuietExec" Execute="deferred" Return="ignore" Impersonate="no" />
   148        <SetProperty Id="RegisterCAPI" Value="&quot;[INSTALLDIR]\cscli.exe&quot; capi register" Sequence="execute" Before="RegisterMachine" />
   149        <CustomAction Id="RegisterCAPI" BinaryKey="WixCA" DllEntry="WixQuietExec" Execute="deferred" Return="ignore" Impersonate="no" />
   150        <InstallExecuteSequence>
   151           <WriteEnvironmentStrings />
   152           <Custom Action="HubUpdate" After="InstallFiles">NOT Installed AND NOT REMOVE</Custom>
   153           <Custom Action="InstallWinCollection" After="HubUpdate">NOT Installed AND NOT REMOVE</Custom>
   154           <Custom Action="FixPermissionsCreds" After="InstallWinCollection">NOT REMOVE</Custom>
   155           <Custom Action="FixPermissionsNotif" After="FixPermissionsCreds">NOT REMOVE</Custom>
   156           <Custom Action="RegisterMachine" After="FixPermissionsNotif">NOT Installed AND NOT REMOVE AND NOT AGENT_ONLY AND NOT WIX_UPGRADE_DETECTED</Custom>
   157           <Custom Action="RegisterCAPI" After="RegisterMachine">NOT Installed AND NOT REMOVE AND NOT AGENT_ONLY AND NOT WIX_UPGRADE_DETECTED</Custom>
   158        </InstallExecuteSequence>
   159  
   160        <Feature Id="DefaultFeature" Level="1">
   161           <ComponentRef Id="Crowdsec" />
   162           <ComponentRef Id="CrowdsecNoStart" />
   163           <ComponentRef Id="Cscli" />
   164           <ComponentRef Id="AcquisConfig"/>
   165           <ComponentRef Id="LocalCreds"/>
   166           <ComponentRef Id="OnlineCreds"/>
   167           <ComponentRef Id="ProfilesConfig"/>
   168           <ComponentRef Id="SimulationConfig"/>
   169           <ComponentRef Id="ConsoleConfig"/>
   170           <ComponentRef Id="CreateLog" />
   171           <ComponentRef Id="CreateHub" />
   172           <ComponentRef Id="NotifConfig" />
   173           <ComponentRef Id="CreateCrowdsecPluginsDir"/>
   174           <ComponentRef Id="CreateCrowdsecDataDir" />
   175           <ComponentRef Id="ConsoleContextFile"/>
   176           <ComponentRef Id="Csconfig_lapi" />
   177           <ComponentRef Id="Csconfig_no_lapi" />
   178           <ComponentGroupRef Id="CrowdsecPatterns" />
   179        </Feature>
   180  
   181        <UI>
   182           <UIRef Id="WixUI_HK" />
   183        </UI>
   184  
   185        <Property Id="WIXUI_INSTALLDIR" Value="INSTALLDIR" />
   186        <Property Id="MsiLogging" Value="voicewarmupx!" />
   187  
   188        <!-- this should help to propagate env var changes -->
   189        <CustomActionRef Id="WixBroadcastEnvironmentChange" />
   190  
   191     </Product>
   192  
   193  </Wix>