wazuh / wazuh-installation-assistant

Wazuh - Installation assistant
https://wazuh.com/
GNU General Public License v2.0
0 stars 3 forks source link

Deleted the offline_checkDependencies function and unified logic in offline_checkPrerequisites function #99

Closed CarlosALgit closed 1 week ago

CarlosALgit commented 1 week ago

Related issue

Closes https://github.com/wazuh/wazuh-installation-assistant/issues/96

Description

The aim of this PR is to unify the offline_checkDependencies and offline_checkPrerequisites functions due to they were using almost the same logic.

To unify them, we had to change how the dependencies array is treated inside the function and differentiating when the function is used to check the Wazuh Installation Assistant dependencies or the Wazuh Offline dependencies.

Tests

We have performed an Offline installation using the Assistant in both rpm and deb package managers:

[!NOTE]
There are some logs in the test that shows which dependencies are being taken in the function. This logs won't be in the final version, they're just on a trial basis.

Amazon Linux 2023: ```shellsession [root@ip-172-31-46-248 wazuh-installation-assistant]# ./wazuh-install.sh -dw rpm 09/10/2024 08:56:50 INFO: Starting Wazuh installation assistant. Wazuh version: 4.9.0 09/10/2024 08:56:50 INFO: Verbose logging redirected to /var/log/wazuh-install.log 09/10/2024 08:56:50 INFO: --- Dependencies --- 09/10/2024 08:56:50 INFO: Installing curl. 09/10/2024 08:56:51 INFO: Verifying that your system meets the recommended minimum hardware requirements. 09/10/2024 08:56:51 INFO: --- Download Packages --- 09/10/2024 08:56:51 INFO: Starting Wazuh packages download. 09/10/2024 08:56:51 INFO: Downloading Wazuh rpm packages for x86_64. 09/10/2024 08:56:54 INFO: The manager package was downloaded. 09/10/2024 08:56:54 INFO: The filebeat package was downloaded. 09/10/2024 08:56:57 INFO: The indexer package was downloaded. 09/10/2024 08:56:58 INFO: The dashboard package was downloaded. 09/10/2024 08:56:58 INFO: The packages are in wazuh-offline/wazuh-packages 09/10/2024 08:56:58 INFO: Downloading configuration files and assets. 09/10/2024 08:56:58 INFO: The resource https://packages.wazuh.com/key/GPG-KEY-WAZUH was downloaded. 09/10/2024 08:56:58 INFO: The resource https://packages.wazuh.com/4.9/tpl/wazuh/filebeat/filebeat.yml was downloaded. 09/10/2024 08:56:58 INFO: The resource https://raw.githubusercontent.com/wazuh/wazuh/v4.9.0/extensions/elasticsearch/7.x/wazuh-template.json was downloaded. 09/10/2024 08:56:58 INFO: The resource https://packages.wazuh.com/4.x/filebeat/wazuh-filebeat-0.4.tar.gz was downloaded. 09/10/2024 08:56:58 INFO: The configuration files and assets are in wazuh-offline.tar.gz 09/10/2024 08:58:07 INFO: You can follow the installation guide here https://documentation.wazuh.com/current/deployment-options/offline-installation.html [root@ip-172-31-46-248 wazuh-installation-assistant]# curl -sO https://packages.wazuh.com/4.9/config.yml [root@ip-172-31-46-248 wazuh-installation-assistant]# nano config.yml [root@ip-172-31-46-248 wazuh-installation-assistant]# ./wazuh-install.sh -g 09/10/2024 09:00:17 INFO: Starting Wazuh installation assistant. Wazuh version: 4.9.0 09/10/2024 09:00:17 INFO: Verbose logging redirected to /var/log/wazuh-install.log 09/10/2024 09:00:18 INFO: Verifying that your system meets the recommended minimum hardware requirements. 09/10/2024 09:00:18 INFO: --- Configuration files --- 09/10/2024 09:00:18 INFO: Generating configuration files. 09/10/2024 09:00:18 INFO: Generating the root certificate. 09/10/2024 09:00:18 INFO: Generating Admin certificates. 09/10/2024 09:00:19 INFO: Generating Wazuh indexer certificates. 09/10/2024 09:00:19 INFO: Generating Filebeat certificates. 09/10/2024 09:00:19 INFO: Generating Wazuh dashboard certificates. 09/10/2024 09:00:20 INFO: Created wazuh-install-files.tar. It contains the Wazuh cluster key, certificates, and passwords necessary for installation. [root@ip-172-31-46-248 wazuh-installation-assistant]# bash wazuh-install.sh --offline-installation --wazuh-indexer node-1 09/10/2024 09:08:36 INFO: Starting Wazuh installation assistant. Wazuh version: 4.9.0 09/10/2024 09:08:36 INFO: Verbose logging redirected to /var/log/wazuh-install.log In offline_checkPrerequisites: Dependencies: curl tar gnupg openssl lsof 09/10/2024 09:08:36 INFO: Checking dependencies for Wazuh installation assistant. 09/10/2024 09:08:39 INFO: Verifying that your system meets the recommended minimum hardware requirements. In offline_checkPrerequisites: Dependencies: coreutils 09/10/2024 09:08:39 INFO: Checking prerequisites for Offline installation. 09/10/2024 09:08:39 INFO: Checking wazuh-offline.tar.gz file. 09/10/2024 09:08:53 INFO: --- Wazuh indexer --- 09/10/2024 09:08:53 INFO: Starting Wazuh indexer installation. 09/10/2024 09:09:14 INFO: Wazuh indexer installation finished. 09/10/2024 09:09:14 INFO: Wazuh indexer post-install configuration finished. 09/10/2024 09:09:14 INFO: Starting service wazuh-indexer. 09/10/2024 09:09:40 INFO: wazuh-indexer service started. 09/10/2024 09:09:40 INFO: Initializing Wazuh indexer cluster security settings. 09/10/2024 09:09:41 INFO: Wazuh indexer cluster initialized. 09/10/2024 09:09:41 INFO: Installation finished. [root@ip-172-31-46-248 wazuh-installation-assistant]# bash wazuh-install.sh --offline-installation --start-cluster 09/10/2024 09:12:09 INFO: Starting Wazuh installation assistant. Wazuh version: 4.9.0 09/10/2024 09:12:09 INFO: Verbose logging redirected to /var/log/wazuh-install.log In offline_checkPrerequisites: Dependencies: curl tar gnupg openssl lsof 09/10/2024 09:12:09 INFO: Checking dependencies for Wazuh installation assistant. 09/10/2024 09:12:12 INFO: Verifying that your system meets the recommended minimum hardware requirements. 09/10/2024 09:12:12 INFO: Checking wazuh-offline.tar.gz file. 09/10/2024 09:12:19 INFO: Wazuh indexer cluster security configuration initialized. 09/10/2024 09:12:35 INFO: Updating the internal users. 09/10/2024 09:12:39 INFO: A backup of the internal users has been saved in the /etc/wazuh-indexer/internalusers-backup folder. 09/10/2024 09:12:57 INFO: Wazuh indexer cluster started. [root@ip-172-31-46-248 wazuh-installation-assistant]# bash wazuh-install.sh --offline-installation --wazuh-server wazuh-1 09/10/2024 09:14:35 INFO: Starting Wazuh installation assistant. Wazuh version: 4.9.0 09/10/2024 09:14:36 INFO: Verbose logging redirected to /var/log/wazuh-install.log In offline_checkPrerequisites: Dependencies: curl tar gnupg openssl lsof 09/10/2024 09:14:36 INFO: Checking dependencies for Wazuh installation assistant. 09/10/2024 09:14:38 INFO: Verifying that your system meets the recommended minimum hardware requirements. 09/10/2024 09:14:38 INFO: Checking wazuh-offline.tar.gz file. 09/10/2024 09:14:39 INFO: --- Wazuh server --- 09/10/2024 09:14:39 INFO: Starting the Wazuh manager installation. 09/10/2024 09:15:48 INFO: Wazuh manager installation finished. 09/10/2024 09:15:49 INFO: Wazuh manager vulnerability detection configuration finished. 09/10/2024 09:15:49 INFO: Starting service wazuh-manager. 09/10/2024 09:16:09 INFO: wazuh-manager service started. 09/10/2024 09:16:09 INFO: Checking Wazuh API connection 09/10/2024 09:16:09 INFO: Attempt 1: Checking the Wazuh API to be ready 09/10/2024 09:16:15 INFO: Wazuh API is ready to receive requests. 09/10/2024 09:16:15 INFO: Wazuh API connection successful 09/10/2024 09:16:15 INFO: Starting Filebeat installation. 09/10/2024 09:16:33 INFO: Filebeat installation finished. 09/10/2024 09:16:37 INFO: Filebeat post-install configuration finished. 09/10/2024 09:16:38 INFO: The filebeat.yml file has been updated to use the Filebeat Keystore username and password. 09/10/2024 09:17:10 INFO: Starting service filebeat. 09/10/2024 09:17:12 INFO: filebeat service started. 09/10/2024 09:17:12 INFO: Checking Filebeat connection 09/10/2024 09:17:12 INFO: Filebeat connection successful 09/10/2024 09:17:12 INFO: Installation finished. [root@ip-172-31-46-248 wazuh-installation-assistant]# bash wazuh-install.sh --offline-installation --wazuh-dashboard dashboard 09/10/2024 09:18:36 INFO: Starting Wazuh installation assistant. Wazuh version: 4.9.0 09/10/2024 09:18:36 INFO: Verbose logging redirected to /var/log/wazuh-install.log In offline_checkPrerequisites: Dependencies: curl tar gnupg openssl lsof 09/10/2024 09:18:36 INFO: Checking dependencies for Wazuh installation assistant. 09/10/2024 09:18:42 INFO: Verifying that your system meets the recommended minimum hardware requirements. 09/10/2024 09:18:42 INFO: Wazuh web interface port will be 443. In offline_checkPrerequisites: Dependencies: libcap 09/10/2024 09:18:43 INFO: Checking prerequisites for Offline installation. 09/10/2024 09:18:43 INFO: Checking wazuh-offline.tar.gz file. 09/10/2024 09:18:44 INFO: --- Wazuh dashboard ---- 09/10/2024 09:18:44 INFO: Starting Wazuh dashboard installation. 09/10/2024 09:21:00 INFO: Wazuh dashboard installation finished. 09/10/2024 09:21:00 INFO: Wazuh dashboard post-install configuration finished. 09/10/2024 09:21:00 INFO: Starting service wazuh-dashboard. 09/10/2024 09:21:01 INFO: wazuh-dashboard service started. 09/10/2024 09:21:19 INFO: Initializing Wazuh dashboard web application. 09/10/2024 09:21:20 INFO: Wazuh dashboard web application initialized. 09/10/2024 09:21:20 INFO: --- Summary --- 09/10/2024 09:21:20 INFO: You can access the web interface https://:443 User: admin Password: +2cFWEpN+QcvhifAMx*3o5d?iDcl+DQ6 09/10/2024 09:21:20 INFO: Installation finished. ``` - Wazuh Dashboard landing page: ![landing-al2023](https://github.com/user-attachments/assets/95cd5b34-be9c-466d-a136-30383943582b) - Wazuh About: ![about-al2023](https://github.com/user-attachments/assets/b6e7e904-8ffa-4b14-a16f-87625df1eab4)
Ubuntu 22: ```shellsession root@ip-172-31-42-19:/home/ubuntu/wazuh-installation-assistant# ./wazuh-install.sh -dw deb 09/10/2024 08:57:04 INFO: Starting Wazuh installation assistant. Wazuh version: 4.9.0 09/10/2024 08:57:04 INFO: Verbose logging redirected to /var/log/wazuh-install.log 09/10/2024 08:57:28 INFO: Verifying that your system meets the recommended minimum hardware requirements. 09/10/2024 08:57:28 INFO: --- Download Packages --- 09/10/2024 08:57:28 INFO: Starting Wazuh packages download. 09/10/2024 08:57:28 INFO: Downloading Wazuh deb packages for x86_64. 09/10/2024 08:57:31 INFO: The manager package was downloaded. 09/10/2024 08:57:31 INFO: The filebeat package was downloaded. 09/10/2024 08:57:34 INFO: The indexer package was downloaded. 09/10/2024 08:57:35 INFO: The dashboard package was downloaded. 09/10/2024 08:57:35 INFO: The packages are in wazuh-offline/wazuh-packages 09/10/2024 08:57:35 INFO: Downloading configuration files and assets. 09/10/2024 08:57:35 INFO: The resource https://packages.wazuh.com/key/GPG-KEY-WAZUH was downloaded. 09/10/2024 08:57:35 INFO: The resource https://packages.wazuh.com/4.9/tpl/wazuh/filebeat/filebeat.yml was downloaded. 09/10/2024 08:57:35 INFO: The resource https://raw.githubusercontent.com/wazuh/wazuh/v4.9.0/extensions/elasticsearch/7.x/wazuh-template.json was downloaded. 09/10/2024 08:57:36 INFO: The resource https://packages.wazuh.com/4.x/filebeat/wazuh-filebeat-0.4.tar.gz was downloaded. 09/10/2024 08:57:36 INFO: The configuration files and assets are in wazuh-offline.tar.gz 09/10/2024 08:58:41 INFO: You can follow the installation guide here https://documentation.wazuh.com/current/deployment-options/offline-installation.html root@ip-172-31-42-19:/home/ubuntu/wazuh-installation-assistant# curl -sO https://packages.wazuh.com/4.9/config.yml root@ip-172-31-42-19:/home/ubuntu/wazuh-installation-assistant# nano config root@ip-172-31-42-19:/home/ubuntu/wazuh-installation-assistant# nano config.yml root@ip-172-31-42-19:/home/ubuntu/wazuh-installation-assistant# ./wazuh-install.sh -g 09/10/2024 09:00:22 INFO: Starting Wazuh installation assistant. Wazuh version: 4.9.0 09/10/2024 09:00:22 INFO: Verbose logging redirected to /var/log/wazuh-install.log 09/10/2024 09:00:30 INFO: Verifying that your system meets the recommended minimum hardware requirements. 09/10/2024 09:00:30 INFO: --- Configuration files --- 09/10/2024 09:00:30 INFO: Generating configuration files. 09/10/2024 09:00:31 INFO: Generating the root certificate. 09/10/2024 09:00:31 INFO: Generating Admin certificates. 09/10/2024 09:00:31 INFO: Generating Wazuh indexer certificates. 09/10/2024 09:00:31 INFO: Generating Filebeat certificates. 09/10/2024 09:00:32 INFO: Generating Wazuh dashboard certificates. 09/10/2024 09:00:33 INFO: Created wazuh-install-files.tar. It contains the Wazuh cluster key, certificates, and passwords necessary for installation. root@ip-172-31-42-19:/home/ubuntu/wazuh-installation-assistant# bash wazuh-install.sh --offline-installation --wazuh-indexer node-1 09/10/2024 09:10:05 INFO: Starting Wazuh installation assistant. Wazuh version: 4.9.0 09/10/2024 09:10:05 INFO: Verbose logging redirected to /var/log/wazuh-install.log In offline_checkPrerequisites: Dependencies: curl tar gnupg openssl lsof 09/10/2024 09:10:05 INFO: Checking dependencies for Wazuh installation assistant. 09/10/2024 09:10:10 INFO: Verifying that your system meets the recommended minimum hardware requirements. In offline_checkPrerequisites: Dependencies: debconf adduser procps gnupg apt-transport-https 09/10/2024 09:10:11 INFO: Checking prerequisites for Offline installation. 09/10/2024 09:10:13 INFO: Checking wazuh-offline.tar.gz file. 09/10/2024 09:10:24 INFO: --- Wazuh indexer --- 09/10/2024 09:10:24 INFO: Starting Wazuh indexer installation. 09/10/2024 09:10:53 INFO: Wazuh indexer installation finished. 09/10/2024 09:10:54 INFO: Wazuh indexer post-install configuration finished. 09/10/2024 09:10:54 INFO: Starting service wazuh-indexer. 09/10/2024 09:11:17 INFO: wazuh-indexer service started. 09/10/2024 09:11:17 INFO: Initializing Wazuh indexer cluster security settings. 09/10/2024 09:11:20 INFO: Wazuh indexer cluster initialized. 09/10/2024 09:11:20 INFO: Installation finished. root@ip-172-31-42-19:/home/ubuntu/wazuh-installation-assistant# bash wazuh-install.sh --offline-installation --start-cluster 09/10/2024 09:12:06 INFO: Starting Wazuh installation assistant. Wazuh version: 4.9.0 09/10/2024 09:12:06 INFO: Verbose logging redirected to /var/log/wazuh-install.log In offline_checkPrerequisites: Dependencies: curl tar gnupg openssl lsof 09/10/2024 09:12:06 INFO: Checking dependencies for Wazuh installation assistant. 09/10/2024 09:12:10 INFO: Verifying that your system meets the recommended minimum hardware requirements. 09/10/2024 09:12:10 INFO: Checking wazuh-offline.tar.gz file. 09/10/2024 09:12:16 INFO: Wazuh indexer cluster security configuration initialized. 09/10/2024 09:12:29 INFO: Updating the internal users. 09/10/2024 09:12:33 INFO: A backup of the internal users has been saved in the /etc/wazuh-indexer/internalusers-backup folder. 09/10/2024 09:12:49 INFO: Wazuh indexer cluster started. root@ip-172-31-42-19:/home/ubuntu/wazuh-installation-assistant# bash wazuh-install.sh --offline-installation --wazuh-server wazuh-1 09/10/2024 09:14:32 INFO: Starting Wazuh installation assistant. Wazuh version: 4.9.0 09/10/2024 09:14:32 INFO: Verbose logging redirected to /var/log/wazuh-install.log In offline_checkPrerequisites: Dependencies: curl tar gnupg openssl lsof 09/10/2024 09:14:32 INFO: Checking dependencies for Wazuh installation assistant. 09/10/2024 09:14:37 INFO: Verifying that your system meets the recommended minimum hardware requirements. In offline_checkPrerequisites: Dependencies: apt-transport-https libcap2-bin software-properties-common gnupg 09/10/2024 09:14:38 INFO: Checking prerequisites for Offline installation. 09/10/2024 09:14:40 INFO: Checking wazuh-offline.tar.gz file. 09/10/2024 09:14:40 INFO: --- Wazuh server --- 09/10/2024 09:14:40 INFO: Starting the Wazuh manager installation. 09/10/2024 09:15:59 INFO: Wazuh manager installation finished. 09/10/2024 09:15:59 INFO: Wazuh manager vulnerability detection configuration finished. 09/10/2024 09:15:59 INFO: Starting service wazuh-manager. 09/10/2024 09:16:22 INFO: wazuh-manager service started. 09/10/2024 09:16:22 INFO: Checking Wazuh API connection 09/10/2024 09:16:22 INFO: Attempt 1: Checking the Wazuh API to be ready 09/10/2024 09:16:28 INFO: Wazuh API is ready to receive requests. 09/10/2024 09:16:28 INFO: Wazuh API connection successful 09/10/2024 09:16:28 INFO: Starting Filebeat installation. 09/10/2024 09:16:46 INFO: Filebeat installation finished. 09/10/2024 09:16:47 INFO: Filebeat post-install configuration finished. 09/10/2024 09:16:52 INFO: The filebeat.yml file has been updated to use the Filebeat Keystore username and password. 09/10/2024 09:17:19 INFO: Starting service filebeat. 09/10/2024 09:17:21 INFO: filebeat service started. 09/10/2024 09:17:21 INFO: Checking Filebeat connection 09/10/2024 09:17:21 INFO: Filebeat connection successful 09/10/2024 09:17:21 INFO: Installation finished. root@ip-172-31-42-19:/home/ubuntu/wazuh-installation-assistant# bash wazuh-install.sh --offline-installation --wazuh-dashboard dashboard 09/10/2024 09:27:43 INFO: Starting Wazuh installation assistant. Wazuh version: 4.9.0 09/10/2024 09:27:43 INFO: Verbose logging redirected to /var/log/wazuh-install.log In offline_checkPrerequisites: Dependencies: curl tar gnupg openssl lsof 09/10/2024 09:27:43 INFO: Checking dependencies for Wazuh installation assistant. 09/10/2024 09:27:48 INFO: Verifying that your system meets the recommended minimum hardware requirements. 09/10/2024 09:27:48 INFO: Wazuh web interface port will be 443. In offline_checkPrerequisites: Dependencies: debhelper tar curl libcap2-bin gnupg apt-transport-https 09/10/2024 09:27:49 INFO: Checking prerequisites for Offline installation. 09/10/2024 09:27:52 INFO: Checking wazuh-offline.tar.gz file. 09/10/2024 09:27:53 INFO: --- Wazuh dashboard ---- 09/10/2024 09:27:53 INFO: Starting Wazuh dashboard installation. 09/10/2024 09:28:57 INFO: Wazuh dashboard installation finished. 09/10/2024 09:28:57 INFO: Wazuh dashboard post-install configuration finished. 09/10/2024 09:28:57 INFO: Starting service wazuh-dashboard. 09/10/2024 09:28:58 INFO: wazuh-dashboard service started. 09/10/2024 09:29:22 INFO: Initializing Wazuh dashboard web application. 09/10/2024 09:29:24 INFO: Wazuh dashboard web application initialized. 09/10/2024 09:29:24 INFO: --- Summary --- 09/10/2024 09:29:24 INFO: You can access the web interface https://:443 User: admin Password: 2QrGiU7eHSxbJ3hopLLG.Z8pPfXtM8Ze 09/10/2024 09:29:24 INFO: Installation finished. ``` - Wazuh Dashboard landing page: ![landing-ubuntu22](https://github.com/user-attachments/assets/b2240437-cd63-4e2c-9651-affc34232364) - Wazuh About: ![about-ubuntu22](https://github.com/user-attachments/assets/477420aa-5601-473c-9a02-4dcd909f2abe)