Closed davidcr01 closed 5 months ago
After talking this issue with the team, we decided not to make the script interactive. The proposed approach is to inform the user about the dependencies that need to be installed and stop the execution of the script (if the --install-dependencies
parameter is not specified).
With this, we avoid making the script interactive (that can be bothersome to the user), but the Installation assistant will require a confirmation to install the dependencies by specifying the new parameter).
As the dependencies installation is done, the previous approach had conflicts with the openssl
and lsof
packages, which are treated as "special dependencies" and are installed separately. These dependencies would make not inform the user about the rest of the dependencies that are going to be installed.
After talking with @c-bordon, we reached the conclusion to rework the way the Installation assistant installs the dependencies and solve this problem as effectively as possible.
The approach is:
Currently working on the dependencies installation workflow.
installCommon_aptInstallList
and installCommon_yumInstallList
is unified in installCommon_installList
It is necessary to develop a function that installs the scanned dependencies, depending on which are going to be installed: assistant or wazuh dependencies.
The following tests aim to check if the new parameter is working correctly. It is checked that the needed dependencies are correctly informed, with a proper format, and that the script exits.
root@ubuntu22:/home/vagrant# bash wazuh-install.sh -a -i -v
03/06/2024 16:27:03 DEBUG: Checking root permissions.
03/06/2024 16:27:03 DEBUG: Checking sudo package.
03/06/2024 16:27:03 INFO: Starting Wazuh Using the script assistant. Wazuh version: 5.0.0
03/06/2024 16:27:03 INFO: Verbose logging redirected to /var/log/wazuh-install.log
03/06/2024 16:27:03 DEBUG: APT package manager will be used.
03/06/2024 16:27:03 DEBUG: Checking system distribution.
03/06/2024 16:27:03 DEBUG: Detected distribution name: ubuntu
03/06/2024 16:27:03 DEBUG: Detected distribution version: 22
03/06/2024 16:27:03 DEBUG: Checking Wazuh Using the script.
03/06/2024 16:27:04 DEBUG: Checking system architecture.
03/06/2024 16:27:06 WARNING: To perform the installation, the following package/s must be installed: apt-transport-https, debhelper, lsof, openssl, software-properties-common. The following package/s will be removed after the Using the script: lsof, openssl. Add the -id|--install-dependencies parameter to install them automatically or install them manually.
root@ubuntu22:/home/vagrant# bash wazuh-install.sh -g -i -v
03/06/2024 16:27:35 DEBUG: Checking root permissions.
03/06/2024 16:27:35 DEBUG: Checking sudo package.
03/06/2024 16:27:35 INFO: Starting Wazuh Using the script assistant. Wazuh version: 5.0.0
03/06/2024 16:27:35 INFO: Verbose logging redirected to /var/log/wazuh-install.log
03/06/2024 16:27:35 DEBUG: APT package manager will be used.
03/06/2024 16:27:35 DEBUG: Checking system distribution.
03/06/2024 16:27:36 DEBUG: Detected distribution name: ubuntu
03/06/2024 16:27:36 DEBUG: Detected distribution version: 22
03/06/2024 16:27:36 DEBUG: Checking Wazuh Using the script.
03/06/2024 16:27:36 DEBUG: Checking system architecture.
03/06/2024 16:27:37 WARNING: To perform the installation, the following package/s must be installed: openssl. The following package/s will be removed after the Using the script: openssl. Add the -id|--install-dependencies parameter to install them automatically or install them manually.
root@ubuntu22:/home/vagrant#
root@ubuntu22:/home/vagrant# bash wazuh-install.sh -a -i -v
03/06/2024 16:32:28 DEBUG: Checking root permissions.
03/06/2024 16:32:28 DEBUG: Checking sudo package.
03/06/2024 16:32:28 INFO: Starting Wazuh Using the script assistant. Wazuh version: 5.0.0
03/06/2024 16:32:28 INFO: Verbose logging redirected to /var/log/wazuh-install.log
03/06/2024 16:32:28 DEBUG: APT package manager will be used.
03/06/2024 16:32:28 DEBUG: Checking system distribution.
03/06/2024 16:32:28 DEBUG: Detected distribution name: ubuntu
03/06/2024 16:32:28 DEBUG: Detected distribution version: 22
03/06/2024 16:32:28 DEBUG: Checking Wazuh Using the script.
03/06/2024 16:32:30 DEBUG: Checking system architecture.
03/06/2024 16:32:36 WARNING: To perform the installation, the following package/s must be installed: apt-transport-https, debhelper, software-properties-common. Add the -id|--install-dependencies parameter to install them automatically or install them manually.
root@ubuntu22:/home/vagrant# bash wazuh-install.sh -g -i -v
03/06/2024 16:33:19 DEBUG: Checking root permissions.
03/06/2024 16:33:19 DEBUG: Checking sudo package.
03/06/2024 16:33:19 INFO: Starting Wazuh Using the script assistant. Wazuh version: 5.0.0
03/06/2024 16:33:19 INFO: Verbose logging redirected to /var/log/wazuh-install.log
03/06/2024 16:33:19 DEBUG: APT package manager will be used.
03/06/2024 16:33:19 DEBUG: Checking system distribution.
03/06/2024 16:33:19 DEBUG: Detected distribution name: ubuntu
03/06/2024 16:33:19 DEBUG: Detected distribution version: 22
03/06/2024 16:33:19 DEBUG: Checking Wazuh Using the script.
03/06/2024 16:33:21 DEBUG: Checking system architecture.
03/06/2024 16:33:24 WARNING: Hardware and system checks ignored.
03/06/2024 16:33:24 INFO: --- Configuration files ---
03/06/2024 16:33:24 INFO: Generating configuration files.
03/06/2024 16:33:24 DEBUG: Checking if OpenSSL is installed.
03/06/2024 16:33:24 DEBUG: Creating Wazuh certificates.
03/06/2024 16:33:24 DEBUG: Reading configuration file.
03/06/2024 16:33:24 DEBUG: Checking if 127.0.0.1 is private.
03/06/2024 16:33:24 DEBUG: Checking if 127.0.0.1 is private.
03/06/2024 16:33:24 DEBUG: Checking if 127.0.0.1 is private.
03/06/2024 16:33:24 INFO: Generating the root certificate.
03/06/2024 16:33:24 INFO: Generating Admin certificates.
03/06/2024 16:33:24 DEBUG: Generating Admin private key.
03/06/2024 16:33:25 DEBUG: Converting Admin private key to PKCS8 format.
03/06/2024 16:33:25 DEBUG: Generating Admin CSR.
03/06/2024 16:33:25 DEBUG: Creating Admin certificate.
03/06/2024 16:33:25 INFO: Generating Wazuh indexer certificates.
03/06/2024 16:33:25 DEBUG: Creating the certificates for wazuh-indexer indexer node.
03/06/2024 16:33:25 DEBUG: Generating certificate configuration.
03/06/2024 16:33:25 DEBUG: Creating the Wazuh indexer tmp key pair.
03/06/2024 16:33:25 DEBUG: Creating the Wazuh indexer certificates.
03/06/2024 16:33:25 INFO: Generating Filebeat certificates.
03/06/2024 16:33:25 DEBUG: Generating the certificates for wazuh-server server node.
03/06/2024 16:33:25 DEBUG: Generating certificate configuration.
03/06/2024 16:33:25 DEBUG: Creating the Wazuh server tmp key pair.
03/06/2024 16:33:25 DEBUG: Creating the Wazuh server certificates.
03/06/2024 16:33:25 INFO: Generating Wazuh dashboard certificates.
03/06/2024 16:33:25 DEBUG: Generating certificate configuration.
03/06/2024 16:33:25 DEBUG: Creating the Wazuh dashboard tmp key pair.
03/06/2024 16:33:26 DEBUG: Creating the Wazuh dashboard certificates.
03/06/2024 16:33:26 DEBUG: Cleaning certificate files.
03/06/2024 16:33:26 DEBUG: Generating password file.
03/06/2024 16:33:26 DEBUG: Generating random passwords.
03/06/2024 16:33:26 INFO: Created wazuh-install-files.tar. It contains the Wazuh cluster key, certificates, and passwords necessary for Using the script.
root@ubuntu22:/home/vagrant#
The installation is interrupted because a port is being used.
root@ip-172-31-71-48:/home/ubuntu# lsof -sTCP:LISTEN -i:443
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
python3 184635 root 3u IPv4 2075684 0t0 TCP *:https (LISTEN)
root@ip-172-31-71-48:/home/ubuntu# bash wazuh-install.sh -a -i -v -id
05/06/2024 10:18:11 DEBUG: Checking root permissions.
05/06/2024 10:18:11 DEBUG: Checking sudo package.
05/06/2024 10:18:11 INFO: Starting Wazuh installation assistant. Wazuh version: 4.8.0
05/06/2024 10:18:11 INFO: Verbose logging redirected to /var/log/wazuh-install.log
05/06/2024 10:18:11 DEBUG: APT package manager will be used.
05/06/2024 10:18:11 DEBUG: Checking system distribution.
05/06/2024 10:18:11 DEBUG: Detected distribution name: ubuntu
05/06/2024 10:18:11 DEBUG: Detected distribution version: 22
05/06/2024 10:18:11 DEBUG: Checking Wazuh installation.
05/06/2024 10:18:13 DEBUG: Checking system architecture.
05/06/2024 10:18:21 WARNING: Hardware and system checks ignored.
05/06/2024 10:18:21 INFO: Wazuh web interface port will be 443.
05/06/2024 10:18:22 DEBUG: Checking ports availability.
05/06/2024 10:18:23 ERROR: Port 443 is being used by another process. Please, check it before installing Wazuh.
05/06/2024 10:18:23 INFO: The installation can not continue due to port usage by other processes.
05/06/2024 10:18:23 INFO: --- Removing existing Wazuh installation ---
05/06/2024 10:18:23 DEBUG: Removing GPG key from system.
05/06/2024 10:18:23 INFO: Wazuh GPG key not found in the system
05/06/2024 10:18:23 INFO: Installation cleaned. Check the /var/log/wazuh-install.log file to learn more about the issue.
root@ip-172-31-71-48:/home/ubuntu#
Here, I fixed a bug. It consisted in specifying the wrong used ports when installing the Wazuh manager. I specified the indexer ones instead of the manager ones.
Here, I fixed a bug. It consisted in specifying the wrong used ports when installing the Wazuh manager. I specified the indexer ones instead of the manager ones.
I detected a bug that consisted in uninstalling a dependency when it is not installed. This case happens when the assistant tries to install a dependency, it fails and then, in the rollback, it tries to uninstalling it, failing again because it wasn't installed previously.
A fix was added and the following testing was performed. Check that in the APT test, the software-properties-common was installed as a Wazuh dependency, so then it was not uninstalled after, but the Assistant dependencies were uninstalled as expected:
New tests have been performed in order to check that the change port is done successfully.
In the following screenshoots, it is proved that the web interface port change was successful (notice the URL)
Ubuntu 22
root@ip-172-31-71-48:/home/ubuntu# lsof -sTCP:LISTEN -i:1443
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
node 166678 wazuh-dashboard 18u IPv4 1108355 0t0 TCP *:1443 (LISTEN)
RHEL9
[root@ip-172-31-71-82 ec2-user]# lsof -sTCP:LISTEN -i:1443
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
node 26550 wazuh-dashboard 18u IPv4 3418656 0t0 TCP *:ies-lm (LISTEN)
The following PRs belong to this development. It should be desirable to merge them simultaneously in order to avoid unexpected behaviors.
wazuh-packages: https://github.com/wazuh/wazuh-packages/pull/3002 wazuh-packages - OVA: https://github.com/wazuh/wazuh-packages/pull/3003 wazuh-jenkins - OVA and AMI: https://github.com/wazuh/wazuh-jenkins/pull/6601 wazuh-jenkins - Assistant tests and pipelines: https://github.com/wazuh/wazuh-jenkins/pull/6602 wazuh-documentation: https://github.com/wazuh/wazuh-documentation/pull/7397
Apart from this, the following issue has been opened to adapt the QA modules: https://github.com/wazuh/wazuh-qa/issues/5497
Need to resolve conflicts.
Description
Context
Currently, the Wazuh installation assistant installs two types of dependencies:
Feature request
It is necessary to implement a new logic that avoids installing dependencies without permission. This new logic is divided in:
--asume-yes
,-y
,--install-dependencies
, etcSteps before development
Steps after development
Test_unattended_tier
,Test_unattended
,Test_unattended_distributed
andTest_unattended_distributed_cases
will be deprecated: https://github.com/wazuh/wazuh-jenkins/pull/6602testing
andprovision
modules. https://github.com/wazuh/wazuh-qa/issues/5497