wazuh / wazuh-packages

Wazuh - Tools for packages creation
https://wazuh.com
GNU General Public License v2.0
105 stars 98 forks source link

`checkFilebeatURL()` does not perform as expected #3099

Closed Enaraque closed 2 months ago

Enaraque commented 2 months ago
Wazuh version Install type Action performed Platform
v4.9.1 Wazuh installation assistant Resource download Amazon Linux 2023

Description

While working on this issue, it has been found that the checkFilebeatURL() function does not act as expected.

This function is responsible for changing the URL of the Filebeat template to master if the URL for the current version tag (source_branch in installVariables.sh) is not found. This URL is the value for the filebeat_wazuh_template variable in installVariables.sh.

When the URL needs to be changed, this never happens, as it is changed after all the variables have been dumped into wazuh-install.sh:

$ ./builder.sh -i -d
Changing Filebeat URL...
$ cat wazuh-install.sh | grep filebeat_wazuh_template=\"https
filebeat_wazuh_template="https://raw.githubusercontent.com/wazuh/wazuh/${source_branch}/extensions/elasticsearch/7.x/wazuh-template.json"

Also, every time it has to verify that the URL can be accessed correctly, it uses the wrong source_branch reference, as it is using the value of the source_branch variable from the current file (builder.sh) instead of the one it actually has to use (installVariables.sh).

$ ./builder.sh -i -d
Inside of checkFilebeatURL
source_branch from builder.sh: WRONG_BRANCH_TEST
source_branch from install_variables.sh: v4.9.0-rc2
Filebeat URL: https://raw.githubusercontent.com/wazuh/wazuh/WRONG_BRANCH_TEST/extensions/elasticsearch/7.x/wazuh-template.json
Changing Filebeat URL...
Outside of checkFilebeatURL

Related issue