Wazuh: Upgrading by WPK doesn't work in Windows custom directory

Created on 30 Jan 2019  路  3Comments  路  Source: wazuh/wazuh

Bug report

OS
_Windows_

Wazuh version
_3.8.2-3814_

Wazuh API version
_3.8.2-3814_

Install type
_agent_

Install method
_packages_

Log sample

Manager ossec.log:
WARNING: Sending request to agent '001'.
2019/01/30 17:01:53 ossec-remoted: WARNING: Sending request to agent '001'.
2019/01/30 17:01:58 ossec-remoted: WARNING: Sending request to agent '001'.
2019/01/30 17:02:03 ossec-remoted: WARNING: Sending request to agent '001'.
2019/01/30 17:02:08 ossec-remoted: WARNING: Sending request to agent '001'.
2019/01/30 17:02:13 ossec-remoted: WARNING: Sending request to agent '001'.
2019/01/30 17:02:18 ossec-remoted: WARNING: Sending request to agent '001'.
2019/01/30 17:02:23 ossec-remoted: WARNING: Sending request to agent '001'.
Manager: /var/ossec/bin/agent_upgrade -a 002 -r https://s3-us-west-1.amazonaws.com/packages-dev.wazuh.com/pre-release/wpk/ 

MSG SENT: 001 com upgrade_result
RESPONSE: err Cannot send request
MSG SENT: 001 com upgrade_result
RESPONSE: err Cannot send request
Error 1716: Error upgrading agent: Cannot send request
Traceback (most recent call last):
  File "/var/ossec/bin/agent_upgrade", line 166, in <module>
    main()
  File "/var/ossec/bin/agent_upgrade", line 138, in main
    upgrade_result = agent.upgrade_result(debug=args.debug)
  File "/var/ossec/bin/../framework/wazuh/agent.py", line 2295, in upgrade_result
    raise WazuhException(1716, data.replace("err ",""))
wazuh.exception.WazuhException: Error 1716 - Error upgrading agent: Cannot send request
Agent installer.log
MSI (s) (98:24) [08:20:00:984]: Product: Wazuh Agent -- Installation completed successfully.

MSI (s) (98:24) [08:20:00:984]: Windows Installer installed the product. Product Name: Wazuh Agent. Product Version: 3.8.2. Product Language: 1033. Manufacturer: Wazuh, Inc.. Installation success or error status: 0.

=== Logging stopped: 1/30/2019  8:20:00 ===

Bug description

When upgrading an agent that has been installed on a custom directory (C:/wazuh) using a Windows WPK, the process fails and deletes most of the binaries of the current Windows agent. I realized that this process goes fine when the agent is installed on the predetermined directory.

Cheers

bug

Most helpful comment

Hi there. Thanks for reporting this bug.

This issue is related to the WiX Toolset template used to generate the MSI installer. It currently uses hardcoded paths for some installation tasks, thus when the upgrade procedure is performed, some files are deleted from the custom directory and seemingly nothing else occurs.

Additionally, Wazuh can be re-installed to the default directory. This was the result when I tried to reproduce the bug.

All 3 comments

Hi there. Thanks for reporting this bug.

This issue is related to the WiX Toolset template used to generate the MSI installer. It currently uses hardcoded paths for some installation tasks, thus when the upgrade procedure is performed, some files are deleted from the custom directory and seemingly nothing else occurs.

Additionally, Wazuh can be re-installed to the default directory. This was the result when I tried to reproduce the bug.

Related issues: https://github.com/wazuh/wazuh/issues/3262 https://github.com/wazuh/wazuh/issues/2853

Thanks for the reports to @agentsofshield and @mi-cha-el

The fix submitted at #2534 has been merged so it will be available in the next released version.

Closing this issue.

Regards.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

vikman90 picture vikman90  路  4Comments

Zenidd picture Zenidd  路  3Comments

gagantous picture gagantous  路  3Comments

iasdeoupxe picture iasdeoupxe  路  4Comments

BraulioV picture BraulioV  路  3Comments