Closed rauldpm closed 2 months ago
The only way to meet this requirement is to add a new variable reflecting the current version tag.
[!IMPORTANT] With this, whenever we have to bump a version we will need to change the new tag reference.
After adding the corresponding variable to the tag and building the wazuh-install.sh
with the development option (-d), tests have been done to check its correct functioning.
As we can see, when trying to download the template, it works correctly:
$ ./wazuh-install.sh -dw rpm
04/09/2024 10:21:27 INFO: Starting Wazuh installation assistant. Wazuh version: 4.9.0
04/09/2024 10:21:27 INFO: Verbose logging redirected to /var/log/wazuh-install.log
04/09/2024 10:21:28 INFO: --- Dependencies ---
04/09/2024 10:21:28 INFO: Installing curl.
04/09/2024 10:21:29 INFO: Verifying that your system meets the recommended minimum hardware requirements.
04/09/2024 10:21:29 INFO: --- Download Packages ---
04/09/2024 10:21:29 INFO: Starting Wazuh packages download.
04/09/2024 10:21:29 INFO: Downloading Wazuh rpm packages for x86_64.
04/09/2024 10:21:38 INFO: The manager package was downloaded.
04/09/2024 10:21:39 INFO: The filebeat package was downloaded.
04/09/2024 10:21:43 INFO: The indexer package was downloaded.
04/09/2024 10:21:50 INFO: The dashboard package was downloaded.
04/09/2024 10:21:50 INFO: The packages are in wazuh-offline/wazuh-packages
04/09/2024 10:21:50 INFO: Downloading configuration files and assets.
04/09/2024 10:21:51 INFO: The resource https://packages-dev.wazuh.com/key/GPG-KEY-WAZUH was downloaded.
04/09/2024 10:21:51 INFO: The resource https://packages-dev.wazuh.com/4.9/tpl/wazuh/filebeat/filebeat.yml was downloaded.
04/09/2024 10:21:51 INFO: The resource https://raw.githubusercontent.com/wazuh/wazuh/v4.9.0-rc2/extensions/elasticsearch/7.x/wazuh-template.json was downloaded.
04/09/2024 10:21:51 INFO: The resource https://packages-dev.wazuh.com/pre-release/filebeat/wazuh-filebeat-0.4.tar.gz was downloaded.
04/09/2024 10:21:51 INFO: The configuration files and assets are in wazuh-offline.tar.gz
04/09/2024 10:23:11 INFO: You can follow the installation guide here https://documentation.wazuh.com/current/deployment-options/offline-installation.html
04/09/2024 10:21:51 INFO: The resource https://raw.githubusercontent.com/wazuh/wazuh/v4.9.0-rc2/extensions/elasticsearch/7.x/wazuh-template.json was downloaded.
When doing the installation, it installs successfully.
The way the Filebeat URL is evaluated has been changed. Previously a variable was created so that a tag was used instead of a branch. After discussion with the team, we have come to the conclusion that there may be times when it is necessary to use the branch instead of the tag.
For that, a condition has been added inside builder.sh
where, if in the source_branch
variable of installVariables.sh
, the character -
exists, it is concluded that its value refers to a tag. This means that the value of that variable, when building, changes from v{wazuh_version}
to {wazuh_version}
only when we are not testing a stage.
We have also changed the value of the source_branch
variable in builder.sh
so that instead of referring to a branch, it refers to a tag. This variable was used to know the path to the dist-detect.sh
script. Previously the branch was used as a reference, but as with the Filebeat path, it is better to use the tag instead.
After these changes everything is still working correctly.
$ ./wazuh-install.sh -dw rpm
05/09/2024 11:12:52 INFO: Starting Wazuh installation assistant. Wazuh version: 4.9.0
05/09/2024 11:12:52 INFO: Verbose logging redirected to /var/log/wazuh-install.log
05/09/2024 11:12:52 INFO: --- Dependencies ---
05/09/2024 11:12:52 INFO: Installing curl.
05/09/2024 11:12:53 INFO: Verifying that your system meets the recommended minimum hardware requirements.
05/09/2024 11:12:53 INFO: --- Download Packages ---
05/09/2024 11:12:53 INFO: Starting Wazuh packages download.
05/09/2024 11:12:53 INFO: Downloading Wazuh rpm packages for x86_64.
05/09/2024 11:12:57 INFO: The manager package was downloaded.
05/09/2024 11:12:57 INFO: The filebeat package was downloaded.
05/09/2024 11:13:01 INFO: The indexer package was downloaded.
05/09/2024 11:13:02 INFO: The dashboard package was downloaded.
05/09/2024 11:13:02 INFO: The packages are in wazuh-offline/wazuh-packages
05/09/2024 11:13:02 INFO: Downloading configuration files and assets.
05/09/2024 11:13:03 INFO: The resource https://packages-dev.wazuh.com/key/GPG-KEY-WAZUH was downloaded.
05/09/2024 11:13:03 INFO: The resource https://packages-dev.wazuh.com/4.9/tpl/wazuh/filebeat/filebeat.yml was downloaded.
05/09/2024 11:13:03 INFO: The resource https://raw.githubusercontent.com/wazuh/wazuh/v4.9.0-rc2/extensions/elasticsearch/7.x/wazuh-template.json was downloaded.
05/09/2024 11:13:04 INFO: The resource https://packages-dev.wazuh.com/pre-release/filebeat/wazuh-filebeat-0.4.tar.gz was downloaded.
05/09/2024 11:13:04 INFO: The configuration files and assets are in wazuh-offline.tar.gz
05/09/2024 11:14:24 INFO: You can follow the installation guide here https://documentation.wazuh.com/current/deployment-options/offline-installation.html
05/09/2024 11:13:03 INFO: The resource https://raw.githubusercontent.com/wazuh/wazuh/v4.9.0-rc2/extensions/elasticsearch/7.x/wazuh-template.json
The Wazuh installation assistant is using the wrong GitHub reference to download the Filebeat template, as it is using the
4.9.0
branch instead of thev4.9.0-rc2
tag, this could lead to an undesired situation if the branch is updated with a fix when the script is being used, invalidating the testingWe should change the script to use the tag instead of a branch like the production script does when the script is generated with a repository tag
Related issue: https://github.com/wazuh/wazuh/issues/25502
source_branch
in unattended_installer/builder.sh