From fb60cce9705a3647df017b36cdd79dd0133389a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Santiago=20Padilla=20=C3=81lvarez?= Date: Thu, 27 Jun 2024 12:49:52 +0200 Subject: [PATCH] fix: remove unnecessary repository installation tasks --- .../ansible-wazuh-agent/defaults/main.yml | 1 - .../ansible-wazuh-agent/tasks/Windows.yml | 8 -- .../wazuh/check-packages/defaults/main.yml | 2 - .../check-packages/scripts/check_packages.sh | 80 ------------------- .../roles/wazuh/check-packages/tasks/main.yml | 10 --- .../wazuh/wazuh-dashboard/defaults/main.yml | 1 - 6 files changed, 102 deletions(-) delete mode 100644 provisioning/roles/wazuh/check-packages/defaults/main.yml delete mode 100755 provisioning/roles/wazuh/check-packages/scripts/check_packages.sh delete mode 100644 provisioning/roles/wazuh/check-packages/tasks/main.yml diff --git a/provisioning/roles/wazuh/ansible-wazuh-agent/defaults/main.yml b/provisioning/roles/wazuh/ansible-wazuh-agent/defaults/main.yml index ff732d6f77..81569478fa 100644 --- a/provisioning/roles/wazuh/ansible-wazuh-agent/defaults/main.yml +++ b/provisioning/roles/wazuh/ansible-wazuh-agent/defaults/main.yml @@ -30,7 +30,6 @@ wazuh_winagent_config: check_md5: True md5: a03806b7302767d0470d65d3f103fabb -wazuh_winagent_config_url: https://packages.wazuh.com/4.x/windows/wazuh-agent-4.8.0-1.msi wazuh_winagent_package_name: wazuh-agent-4.8.0-1.msi wazuh_winagent_package_name_generic: wazuh-agent.msi wazuh_dir: "/var/ossec" diff --git a/provisioning/roles/wazuh/ansible-wazuh-agent/tasks/Windows.yml b/provisioning/roles/wazuh/ansible-wazuh-agent/tasks/Windows.yml index d5c12a1e2d..4890b05365 100644 --- a/provisioning/roles/wazuh/ansible-wazuh-agent/tasks/Windows.yml +++ b/provisioning/roles/wazuh/ansible-wazuh-agent/tasks/Windows.yml @@ -23,14 +23,6 @@ path: "{{ wazuh_winagent_config.download_dir }}{{ wazuh_winagent_package_name }}" register: wazuh_package_downloaded -- name: Windows | Download Wazuh Agent package - win_get_url: - url: "{{ wazuh_winagent_config_url }}" - dest: "{{ wazuh_winagent_config.download_dir }}" - when: - - not wazuh_package_downloaded.stat.exists - - not wazuh_custom_packages_installation_agent_enabled - - name: Windows | Verify the Wazuh Agent installer win_stat: path: "{{ wazuh_winagent_config.download_dir }}{{ wazuh_winagent_package_name }}" diff --git a/provisioning/roles/wazuh/check-packages/defaults/main.yml b/provisioning/roles/wazuh/check-packages/defaults/main.yml deleted file mode 100644 index 7a91513886..0000000000 --- a/provisioning/roles/wazuh/check-packages/defaults/main.yml +++ /dev/null @@ -1,2 +0,0 @@ ---- -wazuh_version: 4.8.0 diff --git a/provisioning/roles/wazuh/check-packages/scripts/check_packages.sh b/provisioning/roles/wazuh/check-packages/scripts/check_packages.sh deleted file mode 100755 index 20c6204788..0000000000 --- a/provisioning/roles/wazuh/check-packages/scripts/check_packages.sh +++ /dev/null @@ -1,80 +0,0 @@ -#!/bin/bash - -VERSION=$1 -#echo $VERSION -## Replace VERSION with $VERSION in packages_uri.txt and save it as packages_uri_new.txt -sed 's,VERSION,'$VERSION',g' ../files/packages_uri.txt > ../files/packages_uri_new.txt - -checkPackages(){ - ## Set S3 Bucket URL - if [ $1 == "production" ]; then - echo "production" - PACKAGES_URL=https://packages.wazuh.com/4.x/ - elif [ $1 == "pre-release" ]; then - echo "pre-release" - PACKAGES_URL=https://packages-dev.wazuh.com/pre-release/ - elif [ $1 == "staging" ]; then - echo "staging" - PACKAGES_URL=https://packages-dev.wazuh.com/staging/ - CHECK_WIN_PACKAGE=$(grep windows ../files/packages_uri_new.txt) - echo $CHECK_WIN_PACKAGE - if [ -n "$CHECK_WIN_PACKAGE" ]; then - WIN_AGENT_NAME=$(aws s3 ls s3://packages-dev.wazuh.com/staging/windows/wazuh-agent-$VERSION --region=us-west-1 | tail -1 | awk '{printf $4}') - if [ -z $WIN_AGENT_NAME ]; then - echo "Windows agent package for version " $VERSION " does not exist in the staging repository" - exit 1 - fi - WIN_AGENT_URI="windows/"$WIN_AGENT_NAME - echo $PACKAGES_URL$WIN_AGENT_URI "check" - sed -i 's,windows/.*,'$WIN_AGENT_URI',g' ../files/packages_uri_new.txt - sed -i 's,wazuh_winagent_config_url.*,wazuh_winagent_config_url: \"'$PACKAGES_URL$WIN_AGENT_URI'\",g' ../../vars/repo_staging.yml - sed -i 's,wazuh_winagent_package_name.*,wazuh_winagent_package_name: \"'$WIN_AGENT_NAME'\",g' ../../vars/repo_staging.yml - fi - fi - - ## Set EXISTS to 0 (true) - EXISTS=0 - - ## Loop through the packages_uri_new.txt file - while IFS= read -r URI - do - echo "$URI" - ## Check if the package exists - PACKAGE=$(curl --silent -I $PACKAGES_URL$URI | grep -E "^HTTP" | awk '{print $2}') - ## If it does not exist set EXISTS to 1 (false) - if [ "$PACKAGE" != "200" ]; then - EXISTS=1 - #echo $PACKAGES_URL$URI "does not exist" - return $EXISTS - fi - done < ../files/packages_uri_new.txt - - return $EXISTS -} - -replaceVars(){ - sed -i "s|packages_repository:.*|packages_repository: $1|g" ../../vars/repo_vars.yml - -} - -## Call the checkPackages function for each repository -if checkPackages "production"; then - echo "production" - replaceVars "production" - exit 0 -elif checkPackages "pre-release"; then - echo "pre-release" - replaceVars "pre-release" - exit 0 -elif checkPackages "production"; then - echo "production" - replaceVars "production" - exit 0 -elif checkPackages "staging"; then - echo "staging" - replaceVars "staging" - exit 0 -else - echo "Failed" - exit 1 -fi \ No newline at end of file diff --git a/provisioning/roles/wazuh/check-packages/tasks/main.yml b/provisioning/roles/wazuh/check-packages/tasks/main.yml deleted file mode 100644 index e5950894d1..0000000000 --- a/provisioning/roles/wazuh/check-packages/tasks/main.yml +++ /dev/null @@ -1,10 +0,0 @@ ---- - - name: Check packages - shell: | - ./check_packages.sh {{ wazuh_version }} - args: - warn: false - executable: /bin/bash - chdir: "{{ role_path }}/scripts/" - delegate_to: localhost - become: no diff --git a/provisioning/roles/wazuh/wazuh-dashboard/defaults/main.yml b/provisioning/roles/wazuh/wazuh-dashboard/defaults/main.yml index baa88020c7..13f0527ee9 100644 --- a/provisioning/roles/wazuh/wazuh-dashboard/defaults/main.yml +++ b/provisioning/roles/wazuh/wazuh-dashboard/defaults/main.yml @@ -13,7 +13,6 @@ dashboard_node_name: node-1 dashboard_server_host: "0.0.0.0" dashboard_server_port: "443" dashboard_server_name: "dashboard" -wazuh_version: 4.8.0 indexer_cluster_nodes: - 127.0.0.1