From 651efb9f9e43a489f6c43cbeb2a2c0caa3f9244b Mon Sep 17 00:00:00 2001 From: c-bordon Date: Thu, 7 Nov 2024 09:25:04 -0300 Subject: [PATCH 1/2] Removed check functions for Wazuh manager and Filebeat --- install_functions/filebeat.sh | 13 --------- install_functions/installMain.sh | 4 --- install_functions/manager.sh | 46 +------------------------------- 3 files changed, 1 insertion(+), 62 deletions(-) diff --git a/install_functions/filebeat.sh b/install_functions/filebeat.sh index 30f039f..266c725 100644 --- a/install_functions/filebeat.sh +++ b/install_functions/filebeat.sh @@ -6,19 +6,6 @@ # License (version 2) as published by the FSF - Free Software # Foundation. -function filebeat_checkService() { - common_logger "Checking Filebeat connection" - - if filebeat test output | grep -q -i -w "ERROR"; then - common_logger -e "Filebeat connection Error." - eval "filebeat test output x ${debug}" - installCommon_rollBack - exit 1 - else - common_logger "Filebeat connection successful" - fi -} - function filebeat_configure(){ common_logger -d "Configuring Filebeat." diff --git a/install_functions/installMain.sh b/install_functions/installMain.sh index 1e27b85..cecebaf 100755 --- a/install_functions/installMain.sh +++ b/install_functions/installMain.sh @@ -394,12 +394,10 @@ function main() { manager_startCluster fi installCommon_startService "wazuh-manager" - manager_checkService filebeat_install filebeat_configure installCommon_changePasswords installCommon_startService "filebeat" - filebeat_checkService installCommon_removeWIADependencies fi @@ -416,11 +414,9 @@ function main() { manager_install manager_configure installCommon_startService "wazuh-manager" - manager_checkService filebeat_install filebeat_configure installCommon_startService "filebeat" - filebeat_checkService common_logger "--- Wazuh dashboard ---" dashboard_install dashboard_configure diff --git a/install_functions/manager.sh b/install_functions/manager.sh index e20b9dc..c3d8415 100644 --- a/install_functions/manager.sh +++ b/install_functions/manager.sh @@ -42,50 +42,6 @@ function manager_startCluster() { } -function manager_checkService() { - common_logger "Checking Wazuh API connection" - - max_attempts=15 - attempt=0 - seconds=5 - api_password="wazuh-wui" - token_command="curl -k -s -X POST -u \"wazuh-wui:${api_password}\" https://127.0.0.1:55000/security/user/authenticate/run_as?raw=true -d '{\"user_name\":\"wzread\"}' -H \"content-type:application/json\"" - TOKEN=$(eval "${token_command}") - - # Wait for the API to be ready - while [[ -z "${TOKEN}" && "${attempt}" -lt "${max_attempts}" ]]; do - attempt=$((attempt+1)) - common_logger "Attempt $attempt: Checking the Wazuh API to be ready" - sleep "${seconds}" - TOKEN=$(eval "${token_command}") - done - common_logger "Wazuh API is ready to receive requests." - - # Change curl credentials in case the master node has changed the passwords - if [[ "${TOKEN}" =~ "Invalid credentials" && "${server_node_types[pos]}" == "worker" ]]; then - api_password=$(tar -axf "${tar_file}" wazuh-install-files/wazuh-passwords.txt -O | grep -P "'wazuh-wui'" -A 1 | awk 'NR==2 { print $2 }' | sed "s/'//g") - token_command="curl -k -s -X POST -u \"wazuh-wui:${api_password}\" https://127.0.0.1:55000/security/user/authenticate/run_as?raw=true -d '{\"user_name\":\"wzread\"}' -H \"content-type:application/json\"" - TOKEN=$(eval "${token_command}") - fi - - if [[ -z "${TOKEN}" ]]; then - common_logger -e "Failed to obtain Wazuh API token after $max_attempts attempts." - installCommon_rollBack - exit 1 - fi - - wm_error=$(curl -k -s -X GET "https://127.0.0.1:55000/agents/outdated?pretty=true" -H "Authorization: Bearer ${TOKEN}") - - if [[ ${wm_error,,} =~ '"error": 0' ]]; then - common_logger "Wazuh API connection successful" - else - common_logger -e "Wazuh API connection Error. $wm_error" - eval "/var/ossec/bin/wazuh-control status ${debug}" - installCommon_rollBack - exit 1 - fi -} - function manager_configure(){ common_logger -d "Configuring Wazuh manager." @@ -107,7 +63,7 @@ function manager_configure(){ eval "sed -i s/filebeat-key.pem/${server_node_names[0]}-key.pem/ /var/ossec/etc/ossec.conf ${debug}" common_logger -d "Setting provisional Wazuh indexer password." eval "/var/ossec/bin/wazuh-keystore -f indexer -k username -v admin" - eval "/var/ossec/bin/wazuh-keystore -f indexer -k password -v admin" + eval "/var/ossec/bin/wazuh-keystore -f indexer -k password -v admin" common_logger "Wazuh manager vulnerability detection configuration finished." } From c5721bf5208e4a50fd424414618853aeeb6386ce Mon Sep 17 00:00:00 2001 From: c-bordon Date: Thu, 7 Nov 2024 10:08:53 -0300 Subject: [PATCH 2/2] Updated changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 693ec55..7277e2e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ All notable changes to this project will be documented in this file. ### Changed +- Removed check functions for Wazuh manager and Filebeat. ([#138](https://github.com/wazuh/wazuh-installation-assistant/pull/138)) - Add checksum input and update the upload files to S3 steps ([#106](https://github.com/wazuh/wazuh-installation-assistant/pull/106)) - Deleted the offline_checkDependencies function and unified logic in offline_checkPrerequisites function. ([#99](https://github.com/wazuh/wazuh-installation-assistant/pull/99)) - Add input for wazuh installation assistant reference in workflows. ([#98](https://github.com/wazuh/wazuh-installation-assistant/pull/98))