|
95 | 95 | <RegistrySearch Id="Local" Root="HKLM" Key="[%agent_regpath%]" Name="local" Type="raw"/>
|
96 | 96 | </Property>
|
97 | 97 | <SetProperty Id="CMDLINE_LOCAL" Before="AppSearch" Value="[LOCAL]" />
|
98 |
| - <!-- Also compare to ProgramFiles64Folder to fix wrongly set LOCAL in 1.7.2 --> |
| 98 | + <!-- Also compare to INSTALLDIR to fix wrongly set LOCAL in 1.7.2 --> |
99 | 99 | <SetProperty Id="LOCAL" After="AppSearch" Value="[CMDLINE_LOCAL]"><![CDATA[CMDLINE_LOCAL<>"" OR LOCAL=INSTALLDIR OR CMDLINE_CONFIG="reset"]]></SetProperty>
|
100 | 100 | <SetDirectory Id="_LOCALDIR" Before="CostFinalize" Value="[LOCAL]" />
|
101 | 101 |
|
|
407 | 407 | <CustomAction Id="SetDefaultLogFile" Property="LOGFILE" Value="[INSTALLDIR]logs\glpi-agent.log" Execute="firstSequence" />
|
408 | 408 | <CustomAction Id="SetDefaultVarDir" Property="VARDIR" Value="[INSTALLDIR]var" Execute="firstSequence" />
|
409 | 409 |
|
| 410 | +[%- IF bits==32 %] |
410 | 411 | <CustomAction Id="SetDeleteFirewallExceptionCmd" Property="DeleteFirewallException" Value=""[SystemFolder]netsh.exe" advfirewall firewall delete rule name="!(loc.FirewallExceptionName)"" Execute="immediate" />
|
| 412 | +[%- ELSE %] |
| 413 | + <CustomAction Id="SetDeleteFirewallExceptionCmd" Property="DeleteFirewallException" Value=""[System64Folder]netsh.exe" advfirewall firewall delete rule name="!(loc.FirewallExceptionName)"" Execute="immediate" /> |
| 414 | +[%- END %] |
411 | 415 | <CustomAction Id="DeleteFirewallException" BinaryKey="WixCA" DllEntry="WixQuietExec" Execute="deferred" Return="ignore" Impersonate="no"/>
|
| 416 | +[%- IF bits==32 %] |
412 | 417 | <CustomAction Id="SetAddFirewallExceptionInCmd" Property="AddFirewallExceptionIn" Value=""[SystemFolder]netsh.exe" advfirewall firewall add rule name="!(loc.FirewallExceptionName)" program="[#f_agent_exe]" description="!(loc.FirewallExceptionDescription)" protocol=TCP dir=in localport=[HTTPD_PORT] action=allow" Execute="immediate" />
|
| 418 | +[%- ELSE %] |
| 419 | + <CustomAction Id="SetAddFirewallExceptionInCmd" Property="AddFirewallExceptionIn" Value=""[System64Folder]netsh.exe" advfirewall firewall add rule name="!(loc.FirewallExceptionName)" program="[#f_agent_exe]" description="!(loc.FirewallExceptionDescription)" protocol=TCP dir=in localport=[HTTPD_PORT] action=allow" Execute="immediate" /> |
| 420 | +[%- END %] |
413 | 421 | <CustomAction Id="AddFirewallExceptionIn" BinaryKey="WixCA" DllEntry="WixQuietExec" Execute="deferred" Return="ignore" Impersonate="no"/>
|
| 422 | +[%- IF bits==32 %] |
414 | 423 | <CustomAction Id="SetAddFirewallExceptionOutCmd" Property="AddFirewallExceptionOut" Value=""[SystemFolder]netsh.exe" advfirewall firewall add rule name="!(loc.FirewallExceptionName)" program="[#f_agent_exe]" description="!(loc.OutgoingFirewallExceptionDescription)" dir=out action=allow" Execute="immediate" />
|
| 424 | +[%- ELSE %] |
| 425 | + <CustomAction Id="SetAddFirewallExceptionOutCmd" Property="AddFirewallExceptionOut" Value=""[System64Folder]netsh.exe" advfirewall firewall add rule name="!(loc.FirewallExceptionName)" program="[#f_agent_exe]" description="!(loc.OutgoingFirewallExceptionDescription)" dir=out action=allow" Execute="immediate" /> |
| 426 | +[%- END %] |
415 | 427 | <CustomAction Id="AddFirewallExceptionOut" BinaryKey="WixCA" DllEntry="WixQuietExec" Execute="deferred" Return="ignore" Impersonate="no"/>
|
416 | 428 |
|
417 | 429 | <!-- GLPI Agent 1.0 to 1.2 installers was creating wrongly named firewall rules, prepare CustomAction to clean up them -->
|
| 430 | +[%- IF bits==32 %] |
418 | 431 | <CustomAction Id="SetDeleteWrongFirewallRuleInCmd" Property="DeleteFirewallWrongIn" Value=""[SystemFolder]netsh.exe" advfirewall firewall delete rule name="program=description= embedded HTTP server incoming traffic"" Execute="immediate" />
|
| 432 | +[%- ELSE %] |
| 433 | + <CustomAction Id="SetDeleteWrongFirewallRuleInCmd" Property="DeleteFirewallWrongIn" Value=""[System64Folder]netsh.exe" advfirewall firewall delete rule name="program=description= embedded HTTP server incoming traffic"" Execute="immediate" /> |
| 434 | +[%- END %] |
419 | 435 | <CustomAction Id="DeleteFirewallWrongIn" BinaryKey="WixCA" DllEntry="WixQuietExec" Execute="deferred" Return="ignore" Impersonate="no"/>
|
| 436 | +[%- IF bits==32 %] |
420 | 437 | <CustomAction Id="SetDeleteWrongFirewallRuleOutCmd" Property="DeleteFirewallWrongOut" Value=""[SystemFolder]netsh.exe" advfirewall firewall delete rule name="program=description= outgoing traffic"" Execute="immediate" />
|
| 438 | +[%- ELSE %] |
| 439 | + <CustomAction Id="SetDeleteWrongFirewallRuleOutCmd" Property="DeleteFirewallWrongOut" Value=""[System64Folder]netsh.exe" advfirewall firewall delete rule name="program=description= outgoing traffic"" Execute="immediate" /> |
| 440 | +[%- END %] |
421 | 441 | <CustomAction Id="DeleteFirewallWrongOut" BinaryKey="WixCA" DllEntry="WixQuietExec" Execute="deferred" Return="ignore" Impersonate="no"/>
|
| 442 | +[%- IF bits==32 %] |
422 | 443 | <CustomAction Id="SetDeleteWrongFirewallRuleExeCmd" Property="DeleteFirewallWrongExe" Value=""[SystemFolder]netsh.exe" advfirewall firewall delete rule name="program=[#f_agent_exe]"" Execute="immediate" />
|
| 444 | +[%- ELSE %] |
| 445 | + <CustomAction Id="SetDeleteWrongFirewallRuleExeCmd" Property="DeleteFirewallWrongExe" Value=""[System64Folder]netsh.exe" advfirewall firewall delete rule name="program=[#f_agent_exe]"" Execute="immediate" /> |
| 446 | +[%- END %] |
423 | 447 | <CustomAction Id="DeleteFirewallWrongExe" BinaryKey="WixCA" DllEntry="WixQuietExec" Execute="deferred" Return="ignore" Impersonate="no"/>
|
424 | 448 |
|
425 | 449 | <CustomAction Id="SetForceRun" Property="ForceRun" Value=""[#f_glpiagent]" --set-forcerun" Execute="immediate" />
|
426 | 450 | <CustomAction Id="ForceRun" BinaryKey="WixCA" DllEntry="WixQuietExec" Execute="deferred" Return="ignore" Impersonate="no"/>
|
427 | 451 | <CustomAction Id="SetRunNow" Property="RunNow" Value=""[#f_glpiagent]" --force" Execute="immediate" />
|
428 | 452 | <CustomAction Id="RunNow" BinaryKey="WixCA" DllEntry="WixQuietExec" Execute="deferred" Return="ignore" Impersonate="no"/>
|
429 | 453 |
|
| 454 | +[%- IF bits==32 %] |
430 | 455 | <CustomAction Id="SetEndTask" Property="EndTask" Value=""[SystemFolder]schtasks.exe" /tn "$(var.AgentName)" /end" Execute="immediate" />
|
| 456 | +[%- ELSE %] |
| 457 | + <CustomAction Id="SetEndTask" Property="EndTask" Value=""[System64Folder]schtasks.exe" /tn "$(var.AgentName)" /end" Execute="immediate" /> |
| 458 | +[%- END %] |
431 | 459 | <CustomAction Id="EndTask" BinaryKey="WixCA" DllEntry="WixQuietExec" Execute="deferred" Return="ignore" Impersonate="no"/>
|
| 460 | +[%- IF bits==32 %] |
432 | 461 | <CustomAction Id="SetDeleteTask" Property="DeleteTask" Value=""[SystemFolder]schtasks.exe" /f /tn "$(var.AgentName)" /delete" Execute="immediate" />
|
| 462 | +[%- ELSE %] |
| 463 | + <CustomAction Id="SetDeleteTask" Property="DeleteTask" Value=""[System64Folder]schtasks.exe" /f /tn "$(var.AgentName)" /delete" Execute="immediate" /> |
| 464 | +[%- END %] |
433 | 465 | <CustomAction Id="DeleteTask" BinaryKey="WixCA" DllEntry="WixQuietExec" Execute="deferred" Return="ignore" Impersonate="no"/>
|
| 466 | +[%- IF bits==32 %] |
434 | 467 | <CustomAction Id="SetTaskMinute" Property="TaskMinute" Value=""[SystemFolder]schtasks.exe" /f /tn "$(var.AgentName)" /create /ru system /tr '"[#f_glpiagent]"' /sc minute /mo [TASK_MINUTE_MODIFIER]" Execute="immediate" />
|
| 468 | +[%- ELSE %] |
| 469 | + <CustomAction Id="SetTaskMinute" Property="TaskMinute" Value=""[System64Folder]schtasks.exe" /f /tn "$(var.AgentName)" /create /ru system /tr '"[#f_glpiagent]"' /sc minute /mo [TASK_MINUTE_MODIFIER]" Execute="immediate" /> |
| 470 | +[%- END %] |
435 | 471 | <CustomAction Id="TaskMinute" BinaryKey="WixCA" DllEntry="WixQuietExec" Execute="deferred" Return="ignore" Impersonate="no"/>
|
| 472 | +[%- IF bits==32 %] |
436 | 473 | <CustomAction Id="SetTaskHourly" Property="TaskHourly" Value=""[SystemFolder]schtasks.exe" /f /tn "$(var.AgentName)" /create /ru system /tr '"[#f_glpiagent]"' /sc hourly /mo [TASK_HOURLY_MODIFIER]" Execute="immediate" />
|
| 474 | +[%- ELSE %] |
| 475 | + <CustomAction Id="SetTaskHourly" Property="TaskHourly" Value=""[System64Folder]schtasks.exe" /f /tn "$(var.AgentName)" /create /ru system /tr '"[#f_glpiagent]"' /sc hourly /mo [TASK_HOURLY_MODIFIER]" Execute="immediate" /> |
| 476 | +[%- END %] |
437 | 477 | <CustomAction Id="TaskHourly" BinaryKey="WixCA" DllEntry="WixQuietExec" Execute="deferred" Return="ignore" Impersonate="no"/>
|
| 478 | +[%- IF bits==32 %] |
438 | 479 | <CustomAction Id="SetTaskDaily" Property="TaskDaily" Value=""[SystemFolder]schtasks.exe" /f /tn "$(var.AgentName)" /create /ru system /tr '"[#f_glpiagent]"' /sc daily /mo [TASK_DAILY_MODIFIER]" Execute="immediate" />
|
| 480 | +[%- ELSE %] |
| 481 | + <CustomAction Id="SetTaskDaily" Property="TaskDaily" Value=""[System64Folder]schtasks.exe" /f /tn "$(var.AgentName)" /create /ru system /tr '"[#f_glpiagent]"' /sc daily /mo [TASK_DAILY_MODIFIER]" Execute="immediate" /> |
| 482 | +[%- END %] |
439 | 483 | <CustomAction Id="TaskDaily" BinaryKey="WixCA" DllEntry="WixQuietExec" Execute="deferred" Return="ignore" Impersonate="no"/>
|
440 | 484 |
|
| 485 | + <!-- Support dedicated CustomActions to handle CVE-2024-28241 --> |
| 486 | +[%- IF bits==32 %] |
441 | 487 | <CustomAction Id="SetFixInstallDir" Property="FixInstallDir" Value=""[SystemFolder]icacls.exe" "[INSTALLDIR]." /inheritance:r" Execute="immediate" />
|
| 488 | +[%- ELSE %] |
| 489 | + <CustomAction Id="SetFixInstallDir" Property="FixInstallDir" Value=""[System64Folder]icacls.exe" "[INSTALLDIR]." /inheritance:r" Execute="immediate" /> |
| 490 | +[%- END %] |
442 | 491 | <CustomAction Id="FixInstallDir" BinaryKey="WixCA" DllEntry="WixQuietExec" Execute="deferred" Return="check" Impersonate="no"/>
|
443 | 492 | <CustomAction Id="UpdateLocalDir" Property="LOCAL" Value="[LOCAL]\" Execute="immediate" />
|
| 493 | +[%- IF bits==32 %] |
444 | 494 | <CustomAction Id="SetFixLocalDir" Property="FixLocalDir" Value=""[SystemFolder]icacls.exe" "[LOCAL]." /inheritance:r" Execute="immediate" />
|
| 495 | +[%- ELSE %] |
| 496 | + <CustomAction Id="SetFixLocalDir" Property="FixLocalDir" Value=""[System64Folder]icacls.exe" "[LOCAL]." /inheritance:r" Execute="immediate" /> |
| 497 | +[%- END %] |
445 | 498 | <CustomAction Id="FixLocalDir" BinaryKey="WixCA" DllEntry="WixQuietExec" Execute="deferred" Return="check" Impersonate="no"/>
|
446 | 499 |
|
447 | 500 | <CustomAction Id="SetCheckRunningAsAdmin" Property="WixQuietExecCmdLine" Value=""[SystemFolder]net.exe" file" Execute="immediate" />
|
|
464 | 517 | <LaunchConditions Sequence="200" />
|
465 | 518 |
|
466 | 519 | [%- IF bits==32 %]
|
467 |
| - <Custom Action="SchedSecureObjects" After="CreateFolders"><![CDATA[NOT INSTALLDIR<<ProgramFilesFolder AND NOT REMOVE~="ALL"]]></Custom> |
468 |
| - <Custom Action="SetFixInstallDir" After="SchedSecureObjects"><![CDATA[NOT INSTALLDIR<<ProgramFilesFolder AND NOT REMOVE~="ALL"]]></Custom> |
469 |
| - <Custom Action="FixInstallDir" After="SetFixInstallDir"><![CDATA[NOT INSTALLDIR<<ProgramFilesFolder AND NOT REMOVE~="ALL"]]></Custom> |
470 |
| - <Custom Action="SetFixLocalDir" After="SchedSecureObjects"><![CDATA[LOCAL<>"" AND NOT LOCAL<<ProgramFilesFolder AND NOT REMOVE~="ALL"]]></Custom> |
471 |
| - <Custom Action="FixLocalDir" After="SetFixLocalDir"><![CDATA[LOCAL<>"" AND NOT LOCAL<<ProgramFilesFolder AND NOT REMOVE~="ALL"]]></Custom> |
| 520 | + <Custom Action="SchedSecureObjects" After="CreateFolders"><![CDATA[NOT (INSTALLDIR<<ProgramFilesFolder AND (NOT LOCAL OR LOCAL<<ProgramFilesFolder)) AND NOT REMOVE~="ALL"]]></Custom> |
| 521 | + <Custom Action="SetFixInstallDir" After="SchedSecureObjects"><![CDATA[NOT (INSTALLDIR<<ProgramFilesFolder AND (NOT LOCAL OR LOCAL<<ProgramFilesFolder)) AND NOT REMOVE~="ALL"]]></Custom> |
| 522 | + <Custom Action="FixInstallDir" After="SetFixInstallDir"><![CDATA[NOT (INSTALLDIR<<ProgramFilesFolder AND (NOT LOCAL OR LOCAL<<ProgramFilesFolder)) AND NOT REMOVE~="ALL"]]></Custom> |
| 523 | + <Custom Action="SetFixLocalDir" After="SchedSecureObjects"><![CDATA[LOCAL<>"" AND NOT (INSTALLDIR<<ProgramFilesFolder AND LOCAL<<ProgramFilesFolder) AND NOT REMOVE~="ALL"]]></Custom> |
| 524 | + <Custom Action="FixLocalDir" After="SetFixLocalDir"><![CDATA[LOCAL<>"" AND NOT (INSTALLDIR<<ProgramFilesFolder AND LOCAL<<ProgramFilesFolder) AND NOT REMOVE~="ALL"]]></Custom> |
472 | 525 | [%- ELSE %]
|
473 |
| - <Custom Action="SchedSecureObjects_x64" After="CreateFolders"><![CDATA[NOT INSTALLDIR<<ProgramFiles64Folder AND NOT REMOVE~="ALL"]]></Custom> |
474 |
| - <Custom Action="SetFixInstallDir" After="SchedSecureObjects_x64"><![CDATA[NOT INSTALLDIR<<ProgramFiles64Folder AND NOT REMOVE~="ALL"]]></Custom> |
475 |
| - <Custom Action="FixInstallDir" After="SetFixInstallDir"><![CDATA[NOT INSTALLDIR<<ProgramFiles64Folder AND NOT REMOVE~="ALL"]]></Custom> |
476 |
| - <Custom Action="SetFixLocalDir" After="SchedSecureObjects_x64"><![CDATA[LOCAL<>"" AND NOT LOCAL<<ProgramFiles64Folder AND NOT REMOVE~="ALL"]]></Custom> |
477 |
| - <Custom Action="FixLocalDir" After="SetFixLocalDir"><![CDATA[LOCAL<>"" AND NOT LOCAL<<ProgramFilesFolder AND NOT REMOVE~="ALL"]]></Custom> |
| 526 | + <Custom Action="SchedSecureObjects_x64" After="CreateFolders"><![CDATA[NOT (INSTALLDIR<<ProgramFiles64Folder AND (NOT LOCAL OR LOCAL<<ProgramFiles64Folder)) AND NOT REMOVE~="ALL"]]></Custom> |
| 527 | + <Custom Action="SetFixInstallDir" After="SchedSecureObjects_x64"><![CDATA[NOT (INSTALLDIR<<ProgramFiles64Folder AND (NOT LOCAL OR LOCAL<<ProgramFiles64Folder)) AND NOT REMOVE~="ALL"]]></Custom> |
| 528 | + <Custom Action="FixInstallDir" After="SetFixInstallDir"><![CDATA[NOT (INSTALLDIR<<ProgramFiles64Folder AND (NOT LOCAL OR LOCAL<<ProgramFiles64Folder)) AND NOT REMOVE~="ALL"]]></Custom> |
| 529 | + <Custom Action="SetFixLocalDir" After="SchedSecureObjects_x64"><![CDATA[LOCAL<>"" AND NOT (INSTALLDIR<<ProgramFiles64Folder AND LOCAL<<ProgramFiles64Folder) AND NOT REMOVE~="ALL"]]></Custom> |
| 530 | + <Custom Action="FixLocalDir" After="SetFixLocalDir"><![CDATA[LOCAL<>"" AND NOT (INSTALLDIR<<ProgramFiles64Folder AND LOCAL<<ProgramFiles64Folder) AND NOT REMOVE~="ALL"]]></Custom> |
478 | 531 | [%- END %]
|
479 | 532 | <Custom Action="UpdateLocalDir" Before="CostFinalize"><![CDATA[LOCAL<>"" AND NOT LOCAL>>"\" AND NOT REMOVE~="ALL"]]></Custom>
|
480 | 533 |
|
|
0 commit comments