diff --git a/.github/workflows/Test_installation_assistant.yml b/.github/workflows/Test_installation_assistant.yml index 45dd7ab..09f9158 100644 --- a/.github/workflows/Test_installation_assistant.yml +++ b/.github/workflows/Test_installation_assistant.yml @@ -1,5 +1,5 @@ run-name: Test installation assistant - ${{ github.run_id }} - ${{ inputs.SYSTEMS }} - Launched by @${{ github.actor }} -name: Test installation assistant +name: Test installation assistant on: pull_request: @@ -20,10 +20,14 @@ on: options: - staging - pre-release + WAZUH_INSTALLATION_ASSISTANT_REFERENCE: + description: 'Branch or tag of the wazuh-installation-assistant repository' + required: true + default: '4.10.2' AUTOMATION_REFERENCE: description: 'Branch or tag of the wazuh-automation repository' required: true - default: '4.10.1' + default: '4.10.2' SYSTEMS: description: 'Operating Systems (list of comma-separated quoted strings enclosed in square brackets)' required: true @@ -62,7 +66,7 @@ permissions: jobs: run-test: - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 strategy: fail-fast: false # If a job fails, the rest of jobs will not be canceled matrix: @@ -71,10 +75,12 @@ jobs: steps: - name: Checkout code uses: actions/checkout@v4 + with: + ref: ${{ inputs.WAZUH_INSTALLATION_ASSISTANT_REFERENCE }} - name: View parameters run: echo "${{ toJson(inputs) }}" - + - name: Set COMPOSITE_NAME variable run: | case "${{ matrix.system }}" in @@ -115,7 +121,7 @@ jobs: - name: Install Ansible run: sudo apt-get update && sudo apt install -y python3 && python3 -m pip install --user ansible-core==2.16 - + - name: Set up AWS credentials uses: aws-actions/configure-aws-credentials@v4 with: @@ -144,7 +150,7 @@ jobs: sed 's/: */=/g' $ALLOCATOR_PATH/inventory.yml > $ALLOCATOR_PATH/inventory_mod.yml sed -i 's/-o StrictHostKeyChecking=no/\"-o StrictHostKeyChecking=no\"/g' $ALLOCATOR_PATH/inventory_mod.yml source $ALLOCATOR_PATH/inventory_mod.yml - + echo "[gha_instance]" > $ALLOCATOR_PATH/inventory echo "$ansible_host ansible_port=$ansible_port ansible_user=$ansible_user ansible_ssh_private_key_file=$ansible_ssh_private_key_file ansible_ssh_common_args='$ansible_ssh_common_args'" >> $ALLOCATOR_PATH/inventory @@ -186,13 +192,13 @@ jobs: -e "logs_path=$LOGS_PATH" \ -e "test_name=$TEST_NAME" \ "${{ inputs.VERBOSITY }}" - + - name: Compress Allocator VM directory id: compress_allocator_files if: always() && steps.allocator_instance.outcome == 'success' && inputs.DESTROY == false run: | zip -P "${{ secrets.ZIP_ARTIFACTS_PASSWORD }}" -r $ALLOCATOR_PATH.zip $ALLOCATOR_PATH - + - name: Upload Allocator VM directory as artifact if: always() && steps.compress_allocator_files.outcome == 'success' && inputs.DESTROY == false uses: actions/upload-artifact@v4 @@ -203,4 +209,4 @@ jobs: - name: Delete allocated VM if: always() && steps.allocator_instance.outcome == 'success' && inputs.DESTROY == true run: python3 wazuh-automation/deployability/modules/allocation/main.py --action delete --track-output $ALLOCATOR_PATH/track.yml - + diff --git a/.github/workflows/Test_installation_assistant_distributed.yml b/.github/workflows/Test_installation_assistant_distributed.yml index 2cb6ea1..75215dc 100644 --- a/.github/workflows/Test_installation_assistant_distributed.yml +++ b/.github/workflows/Test_installation_assistant_distributed.yml @@ -1,5 +1,5 @@ run-name: (Distributed) Test installation assistant - ${{ github.run_id }} - ${{ inputs.SYSTEMS }} - Launched by @${{ github.actor }} -name: (Distributed) Test installation assistant +name: (Distributed) Test installation assistant on: pull_request: @@ -20,10 +20,14 @@ on: options: - staging - pre-release + WAZUH_INSTALLATION_ASSISTANT_REFERENCE: + description: 'Branch or tag of the wazuh-installation-assistant repository' + required: true + default: '4.10.2' AUTOMATION_REFERENCE: description: 'Branch or tag of the wazuh-automation repository' required: true - default: '4.10.1' + default: '4.10.2' SYSTEMS: description: 'Operating Systems (list of comma-separated quoted strings enclosed in square brackets)' required: true @@ -64,7 +68,7 @@ permissions: jobs: run-test: - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 strategy: fail-fast: false # If a job fails, the rest of jobs will not be canceled matrix: @@ -73,10 +77,12 @@ jobs: steps: - name: Checkout code uses: actions/checkout@v4 + with: + ref: ${{ inputs.WAZUH_INSTALLATION_ASSISTANT_REFERENCE }} - name: View parameters run: echo "${{ toJson(inputs) }}" - + - name: Set COMPOSITE_NAME variable run: | case "${{ matrix.system }}" in @@ -117,7 +123,7 @@ jobs: - name: Install Ansible run: sudo apt-get update && sudo apt install -y python3 && python3 -m pip install --user ansible-core==2.16 && pip install pyyaml && ansible-galaxy collection install community.general - + - name: Set up AWS credentials uses: aws-actions/configure-aws-credentials@v4 with: @@ -152,7 +158,7 @@ jobs: echo "[managers]" > $inventory_managers echo "[dashboards]" > $inventory_dashboards echo "[all:vars]" > $inventory_common - + for i in ${!instance_names[@]}; do instance_name=${instance_names[$i]} # Provision instance in parallel @@ -178,7 +184,7 @@ jobs: if [[ $i -eq 0 ]]; then echo "indexer1 ansible_host=$ansible_host private_ip=$private_ip ansible_ssh_private_key_file=$ansible_ssh_private_key_file" >> $inventory_indexers echo "master ansible_host=$ansible_host private_ip=$private_ip ansible_ssh_private_key_file=$ansible_ssh_private_key_file manager_type=master instance_type=indexer_manager" >> $inventory_managers - + echo "ansible_user=$ansible_user" >> $inventory_common echo "ansible_port=$ansible_port" >> $inventory_common echo "ansible_ssh_common_args='$ansible_ssh_common_args'" >> $inventory_common @@ -201,7 +207,7 @@ jobs: cat $inventory_managers >> $inventory_file cat $inventory_dashboards >> $inventory_file cat $inventory_common >> $inventory_file - + - name: Execute provision playbook run: | INSTALL_DEPS=true @@ -218,14 +224,14 @@ jobs: -e "install_python=$INSTALL_PYTHON" \ -e "install_pip_deps=$INSTALL_PIP_DEPS" \ "${{ inputs.VERBOSITY }}" - + - name: Execute certificates generation playbook run: | ANSIBLE_STDOUT_CALLBACK=$ANSIBLE_CALLBACK ansible-playbook .github/workflows/ansible-playbooks/distributed_generate_certificates.yml \ -i $ALLOCATOR_PATH/inventory \ -e "resources_path=$RESOURCES_PATH" \ "${{ inputs.VERBOSITY }}" - + - name: Copy certificates to nodes run: | ANSIBLE_STDOUT_CALLBACK=$ANSIBLE_CALLBACK ansible-playbook .github/workflows/ansible-playbooks/distributed_copy_certificates.yml \ @@ -243,7 +249,7 @@ jobs: -e "tmp_path=$TMP_PATH" \ -e "pkg_repository=$PKG_REPOSITORY" \ "${{ inputs.VERBOSITY }}" - + - name: Execute indexer cluster start playbook run: | INDEXER_ADMIN_PASSWORD="admin" @@ -253,7 +259,7 @@ jobs: -e "tmp_path=$TMP_PATH" \ -e "pkg_repository=$PKG_REPOSITORY" \ "${{ inputs.VERBOSITY }}" - + - name: Execute server installation playbook run: | ANSIBLE_STDOUT_CALLBACK=$ANSIBLE_CALLBACK ansible-playbook .github/workflows/ansible-playbooks/distributed_install_wazuh.yml \ @@ -262,7 +268,7 @@ jobs: -e "tmp_path=$TMP_PATH" \ -e "pkg_repository=$PKG_REPOSITORY" \ "${{ inputs.VERBOSITY }}" - + - name: Execute dashboard installation playbook run: | ANSIBLE_STDOUT_CALLBACK=$ANSIBLE_CALLBACK ansible-playbook .github/workflows/ansible-playbooks/distributed_install_dashboard.yml \ @@ -271,7 +277,7 @@ jobs: -e "tmp_path=$TMP_PATH" \ -e "pkg_repository=$PKG_REPOSITORY" \ "${{ inputs.VERBOSITY }}" - + - name: Execute Python test playbook run: | ANSIBLE_STDOUT_CALLBACK=$ANSIBLE_CALLBACK ansible-playbook .github/workflows/ansible-playbooks/distributed_tests.yml \ @@ -280,13 +286,13 @@ jobs: -e "tmp_path=$TMP_PATH" \ -e "test_name=$TEST_NAME" \ "${{ inputs.VERBOSITY }}" - + - name: Compress Allocator VM directory id: compress_allocator_files if: always() && steps.allocator_instance.outcome == 'success' && inputs.DESTROY == false run: | zip -P "${{ secrets.ZIP_ARTIFACTS_PASSWORD }}" -r $ALLOCATOR_PATH.zip $ALLOCATOR_PATH - + - name: Upload Allocator VM directory as artifact if: always() && steps.compress_allocator_files.outcome == 'success' && inputs.DESTROY == false uses: actions/upload-artifact@v4 @@ -298,13 +304,13 @@ jobs: if: always() && steps.allocator_instance.outcome == 'success' && inputs.DESTROY == true run: | instance_names=($INSTANCE_NAMES) - + for i in ${!instance_names[@]}; do instance_name=${instance_names[$i]} track_file="$ALLOCATOR_PATH/track_${instance_name}.yml" - + echo "Deleting instance: $instance_name using track file $track_file" - + ( # Delete instance python3 wazuh-automation/deployability/modules/allocation/main.py \ diff --git a/.github/workflows/builder_installation_assistant.yml b/.github/workflows/builder_installation_assistant.yml new file mode 100644 index 0000000..2446b8e --- /dev/null +++ b/.github/workflows/builder_installation_assistant.yml @@ -0,0 +1,136 @@ +run-name: Build Installation Assistant ${{ inputs.id }} - Branch ${{ github.ref_name }} - Launched by @${{ github.actor }} +name: Build Installation Assistant + +on: + workflow_dispatch: + inputs: + wazuh_installation_assistant_reference: + description: "Branch or tag of the wazuh-installation-assistant repository." + required: true + default: 4.10.2 + is_stage: + description: "Is stage?" + type: boolean + default: false + checksum: + description: "Add checksum" + type: boolean + default: false + id: + description: "ID used to identify the workflow uniquely." + type: string + required: false + workflow_call: + inputs: + wazuh_installation_assistant_reference: + description: "Branch or tag of the wazuh-installation-assistant repository." + type: string + required: true + default: 4.10.2 + is_stage: + description: "Is stage?" + type: boolean + default: false + checksum: + description: "Add checksum" + type: boolean + default: false + id: + type: string + required: false + +env: + S3_BUCKET: ${{ vars.AWS_S3_BUCKET }} + S3_REPOSITORY_PATH: "development/wazuh/4.x/secondary/installation-assistant" + BUILDER_PATH: "builder.sh" + WAZUH_INSTALL_NAME: "wazuh-install" + WAZUH_CERT_TOOL_NAME: "wazuh-certs-tool" + WAZUH_PASSWORD_TOOL_NAME: "wazuh-passwords-tool" + +permissions: + id-token: write + contents: read + +jobs: + Build_Installation_Assistant: + runs-on: ubuntu-latest + + steps: + - name: View parameters + run: echo "${{ toJson(inputs) }}" + + - name: Checkout wazuh-installation-assistant repository + uses: actions/checkout@v4 + with: + ref: ${{ inputs.wazuh_installation_assistant_reference }} + + - name: Configure aws credentials + uses: aws-actions/configure-aws-credentials@v3 + with: + role-to-assume: ${{ secrets.AWS_IAM_ROLE }} + aws-region: us-east-1 + + - name: Get short sha and wazuh version + run: | + COMMIT_SHORT_SHA=$(git rev-parse --short ${{ github.sha }}) + WAZUH_VERSION=$(grep -oP '(?<=readonly wazuh_version=").*(?=")' ${{github.workspace}}/install_functions/installVariables.sh) + echo "WAZUH_VERSION=$WAZUH_VERSION" >> $GITHUB_ENV + echo "COMMIT_SHORT_SHA=$COMMIT_SHORT_SHA" >> $GITHUB_ENV + + - name: Change files name for stage build + if: ${{ inputs.is_stage == false }} + run: | + sed -i 's|${{ env.WAZUH_INSTALL_NAME }}.sh|${{ env.WAZUH_INSTALL_NAME }}-${{ env.COMMIT_SHORT_SHA }}.sh|g' "${{ env.BUILDER_PATH }}" + sed -i 's|${{ env.WAZUH_CERT_TOOL_NAME }}.sh|${{ env.WAZUH_CERT_TOOL_NAME }}-${{ env.COMMIT_SHORT_SHA }}.sh|g' "${{ env.BUILDER_PATH }}" + sed -i 's|${{ env.WAZUH_PASSWORD_TOOL_NAME }}.sh|${{ env.WAZUH_PASSWORD_TOOL_NAME }}-${{ env.COMMIT_SHORT_SHA }}.sh|g' "${{ env.BUILDER_PATH }}" + + - name: Build Installation Assistant packages + run: bash builder.sh -i -c -p + + - name: Save files name + run: | + WAZUH_INSTALL_NAME=$(ls ${{ github.workspace }}/${{ env.WAZUH_INSTALL_NAME }}*.sh | xargs basename) + WAZUH_CERT_TOOL_NAME=$(ls ${{ github.workspace }}/${{ env.WAZUH_CERT_TOOL_NAME }}*.sh | xargs basename) + WAZUH_PASSWORD_TOOL_NAME=$(ls ${{ github.workspace }}/${{ env.WAZUH_PASSWORD_TOOL_NAME }}*.sh | xargs basename) + echo "WAZUH_INSTALL_NAME=$WAZUH_INSTALL_NAME" >> $GITHUB_ENV + echo "WAZUH_CERT_TOOL_NAME=$WAZUH_CERT_TOOL_NAME" >> $GITHUB_ENV + echo "WAZUH_PASSWORD_TOOL_NAME=$WAZUH_PASSWORD_TOOL_NAME" >> $GITHUB_ENV + + - name: Prepare files + run: | + mkdir -p ${{ github.workspace }}/${{ env.WAZUH_VERSION }} + mv ${{ env.WAZUH_INSTALL_NAME }} ${{ github.workspace }}/${{ env.WAZUH_VERSION }} + mv ${{ env.WAZUH_CERT_TOOL_NAME }} ${{ github.workspace }}/${{ env.WAZUH_VERSION }} + mv ${{ env.WAZUH_PASSWORD_TOOL_NAME }} ${{ github.workspace }}/${{ env.WAZUH_VERSION }} + + - name: Build packages checksum + if: ${{ inputs.checksum == true }} + run: | + sha512sum ${{ github.workspace }}/${{ env.WAZUH_VERSION }}/${{ env.WAZUH_INSTALL_NAME }} > ${{ github.workspace }}/${{ env.WAZUH_VERSION }}/${{ env.WAZUH_INSTALL_NAME }}.sha512 + sha512sum ${{ github.workspace }}/${{ env.WAZUH_VERSION }}/${{ env.WAZUH_CERT_TOOL_NAME }} > ${{ github.workspace }}/${{ env.WAZUH_VERSION }}/${{ env.WAZUH_CERT_TOOL_NAME }}.sha512 + sha512sum ${{ github.workspace }}/${{ env.WAZUH_VERSION }}/${{ env.WAZUH_PASSWORD_TOOL_NAME }} > ${{ github.workspace }}/${{ env.WAZUH_VERSION }}/${{ env.WAZUH_PASSWORD_TOOL_NAME }}.sha512 + + - name: Upload files to S3 + run: | + aws s3 cp ${{ github.workspace }}/${{ env.WAZUH_VERSION }}/${{ env.WAZUH_INSTALL_NAME }} s3://${{ env.S3_BUCKET }}/${{ env.S3_REPOSITORY_PATH }}/${{ env.WAZUH_VERSION }}/ + s3uri="s3://${{ env.S3_BUCKET }}/${{ env.S3_REPOSITORY_PATH }}/${{ env.WAZUH_VERSION }}/${{ env.WAZUH_INSTALL_NAME }}" + echo "S3 wazuh-install URI: ${s3uri}" + aws s3 cp ${{ github.workspace }}/${{ env.WAZUH_VERSION }}/${{ env.WAZUH_CERT_TOOL_NAME }} s3://${{ env.S3_BUCKET }}/${{ env.S3_REPOSITORY_PATH }}/${{ env.WAZUH_VERSION }}/ + s3uri="s3://${{ env.S3_BUCKET }}/${{ env.S3_REPOSITORY_PATH }}/${{ env.WAZUH_VERSION }}/${{ env.WAZUH_CERT_TOOL_NAME }}" + echo "S3 wazuh-certs-tool URI: ${s3uri}" + aws s3 cp ${{ github.workspace }}/${{ env.WAZUH_VERSION }}/${{ env.WAZUH_PASSWORD_TOOL_NAME }} s3://${{ env.S3_BUCKET }}/${{ env.S3_REPOSITORY_PATH }}/${{ env.WAZUH_VERSION }}/ + s3uri="s3://${{ env.S3_BUCKET }}/${{ env.S3_REPOSITORY_PATH }}/${{ env.WAZUH_VERSION }}/${{ env.WAZUH_PASSWORD_TOOL_NAME }}" + echo "S3 wazuh-passwords-tool URI: ${s3uri}" + + - name: Upload checksum files to S3 + if: ${{ inputs.checksum == true }} + run: | + aws s3 cp ${{ github.workspace }}/${{ env.WAZUH_VERSION }}/${{ env.WAZUH_INSTALL_NAME }}.sha512 s3://${{ env.S3_BUCKET }}/${{ env.S3_REPOSITORY_PATH }}/${{ env.WAZUH_VERSION }}/ + s3uri="s3://${{ env.S3_BUCKET }}/${{ env.S3_REPOSITORY_PATH }}/${{ env.WAZUH_VERSION }}/${{ env.WAZUH_INSTALL_NAME }}.sha512" + echo "S3 sha512 wazuh-install checksum URI: ${s3uri}" + aws s3 cp ${{ github.workspace }}/${{ env.WAZUH_VERSION }}/${{ env.WAZUH_CERT_TOOL_NAME }}.sha512 s3://${{ env.S3_BUCKET }}/${{ env.S3_REPOSITORY_PATH }}/${{ env.WAZUH_VERSION }}/ + s3uri="s3://${{ env.S3_BUCKET }}/${{ env.S3_REPOSITORY_PATH }}/${{ env.WAZUH_VERSION }}/${{ env.WAZUH_CERT_TOOL_NAME }}.sha512" + echo "S3 sha512 wazuh-certs-tool checksum URI: ${s3uri}" + aws s3 cp ${{ github.workspace }}/${{ env.WAZUH_VERSION }}/${{ env.WAZUH_PASSWORD_TOOL_NAME }}.sha512 s3://${{ env.S3_BUCKET }}/${{ env.S3_REPOSITORY_PATH }}/${{ env.WAZUH_VERSION }}/ + s3uri="s3://${{ env.S3_BUCKET }}/${{ env.S3_REPOSITORY_PATH }}/${{ env.WAZUH_VERSION }}/${{ env.WAZUH_PASSWORD_TOOL_NAME }}.sha512" + echo "S3 sha512 wazuh-passwords-tool checksum URI: ${s3uri}" diff --git a/.github/workflows/offline-installation.yml b/.github/workflows/offline-installation.yml index ec8b986..915397f 100644 --- a/.github/workflows/offline-installation.yml +++ b/.github/workflows/offline-installation.yml @@ -5,6 +5,11 @@ on: - 'install_functions/wazuh-offline-download.sh' - 'install_functions/wazuh-offline-installation.sh' workflow_dispatch: + inputs: + WAZUH_INSTALLATION_ASSISTANT_REFERENCE: + description: "Branch or tag of the wazuh-installation-assistant repository." + required: true + default: 4.10.2 jobs: Build-wazuh-install-script: @@ -18,6 +23,8 @@ jobs: skip_after_successful_duplicate: 'false' - uses: actions/checkout@v4 + with: + ref: ${{ inputs.WAZUH_INSTALLATION_ASSISTANT_REFERENCE }} - name: Build wazuh-install script and use staging packages run: bash builder.sh -i @@ -33,6 +40,8 @@ jobs: needs: Build-wazuh-install-script steps: - uses: actions/checkout@v4 + with: + ref: ${{ inputs.WAZUH_INSTALLATION_ASSISTANT_REFERENCE }} - uses: actions/download-artifact@v3 with: @@ -49,6 +58,8 @@ jobs: needs: Build-wazuh-install-script steps: - uses: actions/checkout@v4 + with: + ref: ${{ inputs.WAZUH_INSTALLATION_ASSISTANT_REFERENCE }} - uses: actions/download-artifact@v3 with: diff --git a/CHANGELOG.md b/CHANGELOG.md index 0096589..7f10abf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -23,6 +23,10 @@ All notable changes to this project will be documented in this file. ### Changed +- 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)) +- Create GHA workflow to build Wazuh Installation Assistant files. ([#77](https://github.com/wazuh/wazuh-installation-assistant/pull/77)) - Installation assistant distributed test rework and migration. ([#60](https://github.com/wazuh/wazuh-installation-assistant/pull/60)) - Installation assistant test and tier workflow migration ([#46](https://github.com/wazuh/wazuh-installation-assistant/pull/46/)) - Added post-install validations for the Wazuh manager and Filebeat. ([#3059](https://github.com/wazuh/wazuh-packages/pull/3059)) @@ -30,6 +34,7 @@ All notable changes to this project will be documented in this file. ### Fixed +- Changed GitHub Runner version to fix Python error ([#110](https://github.com/wazuh/wazuh-installation-assistant/pull/110)) - Fixed Wazuh API validation ([#29](https://github.com/wazuh/wazuh-installation-assistant/pull/29)) - Fixed token variable empty in Wazuh manager check ([#45](https://github.com/wazuh/wazuh-installation-assistant/pull/45)) - Fixed manager check in distributed deployment ([#52](https://github.com/wazuh/wazuh-installation-assistant/pull/52)) diff --git a/VERSION b/VERSION index ad96464..0216ba3 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -4.10.1 +4.10.2 diff --git a/builder.sh b/builder.sh index 95d1b63..0b7638a 100755 --- a/builder.sh +++ b/builder.sh @@ -16,7 +16,7 @@ readonly resources_certs="${base_path_builder}/cert_tool" readonly resources_passwords="${base_path_builder}/passwords_tool" readonly resources_common="${base_path_builder}/common_functions" readonly resources_download="${base_path_builder}/downloader" -source_branch="v4.10.1" +source_branch="v4.10.2" function getHelp() { diff --git a/install_functions/installMain.sh b/install_functions/installMain.sh index 1ec1541..45e389b 100755 --- a/install_functions/installMain.sh +++ b/install_functions/installMain.sh @@ -123,7 +123,7 @@ function main() { bucket="packages-dev.wazuh.com" repository="${devrepo}" ;; - + "-fd"|"--force-install-dashboard") force=1 shift 1 @@ -257,7 +257,7 @@ function main() { if [ -z "${uninstall}" ] && [ -z "${offline_install}" ]; then installCommon_installCheckDependencies elif [ -n "${offline_install}" ]; then - offline_checkDependencies + offline_checkPrerequisites "wia_offline_dependencies" "${wia_offline_dependencies[@]}" fi common_checkInstalled diff --git a/install_functions/installVariables.sh b/install_functions/installVariables.sh index 591acec..20e4a43 100644 --- a/install_functions/installVariables.sh +++ b/install_functions/installVariables.sh @@ -8,7 +8,7 @@ ## Package vars readonly wazuh_major="4.10" -readonly wazuh_version="4.10.1" +readonly wazuh_version="4.10.2" readonly filebeat_version="7.10.2" readonly wazuh_install_vesion="0.1" source_branch="v${wazuh_version}" @@ -72,4 +72,5 @@ readonly indexer_yum_dependencies=( coreutils ) readonly indexer_apt_dependencies=( debconf adduser procps gnupg apt-transport-https ) readonly dashboard_yum_dependencies=( libcap ) readonly dashboard_apt_dependencies=( debhelper tar curl libcap2-bin gnupg apt-transport-https ) +readonly wia_offline_dependencies=( curl tar gnupg openssl lsof ) wia_dependencies_installed=() diff --git a/install_functions/wazuh-offline-installation.sh b/install_functions/wazuh-offline-installation.sh index 5892202..86457f0 100644 --- a/install_functions/wazuh-offline-installation.sh +++ b/install_functions/wazuh-offline-installation.sh @@ -8,46 +8,34 @@ # License (version 2) as published by the FSF - Free Software # Foundation. -# Checks the necessary dependencies for the installation -function offline_checkDependencies() { - - dependencies=( curl tar gnupg openssl lsof ) - - common_logger "Checking installed dependencies for Offline installation." - for dep in "${dependencies[@]}"; do - if [ "${sys_type}" == "yum" ]; then - eval "yum list installed 2>/dev/null | grep -q -E ^"${dep}"\\." - elif [ "${sys_type}" == "apt-get" ]; then - eval "apt list --installed 2>/dev/null | grep -q -E ^"${dep}"\/" - fi - - if [ "${PIPESTATUS[0]}" != 0 ]; then - common_logger -e "${dep} is necessary for the offline installation." - exit 1 - fi - done - common_logger -d "Offline dependencies are installed." - -} - # Checks the necessary packages needed for a Wazuh component function offline_checkPrerequisites(){ - dependencies=("$@") - common_logger "Checking prerequisites for Offline installation." + dependencies=( "${@}" ) + if [ $1 == "wia_offline_dependencies" ]; then + dependencies=( "${@:2}" ) + common_logger "Checking dependencies for Wazuh installation assistant." + else + common_logger "Checking prerequisites for Offline installation." + fi + for dep in "${dependencies[@]}"; do if [ "${sys_type}" == "yum" ]; then eval "yum list installed 2>/dev/null | grep -q -E ^"${dep}"\\." elif [ "${sys_type}" == "apt-get" ]; then eval "apt list --installed 2>/dev/null | grep -q -E ^"${dep}"\/" fi - + if [ "${PIPESTATUS[0]}" != 0 ]; then common_logger -e "${dep} is necessary for the offline installation." exit 1 fi done - common_logger -d "Offline prerequisites are installed." + if [ $1 == "wia_offline_dependencies" ]; then + common_logger -d "Dependencies for Wazuh installation assistant are installed." + else + common_logger -d "Prerequisites for Offline installation are installed." + fi } # Checks the necessary files for the installation @@ -85,7 +73,7 @@ function offline_extractFiles() { "${offline_files_path}/wazuh-filebeat-*.tar.gz" "${offline_files_path}/wazuh-template.json" ) - + if [ "${sys_type}" == "apt-get" ]; then required_files+=("${offline_packages_path}/filebeat-oss-*.deb" "${offline_packages_path}/wazuh-dashboard_*.deb" "${offline_packages_path}/wazuh-indexer_*.deb" "${offline_packages_path}/wazuh-manager_*.deb") elif [ "${sys_type}" == "rpm" ]; then @@ -120,5 +108,5 @@ function offline_importGPGKey() { fi eval "chmod 644 ${offline_files_path}/GPG-KEY-WAZUH ${debug}" fi - + } diff --git a/tests/unit/suites/test-common.sh b/tests/unit/suites/test-common.sh index eaa898d..faa2d83 100644 --- a/tests/unit/suites/test-common.sh +++ b/tests/unit/suites/test-common.sh @@ -61,7 +61,7 @@ test-04-common_checkInstalled-all-installed-yum() { @mocktrue yum list installed - @mock grep wazuh-manager === @echo wazuh-manager.x86_64 4.10.1-1 @wazuh + @mock grep wazuh-manager === @echo wazuh-manager.x86_64 4.10.2-1 @wazuh @mkdir /var/ossec @mock grep wazuh-indexer === @echo wazuh-indexer.x86_64 1.13.2-1 @wazuh @@ -105,10 +105,10 @@ test-04-common_checkInstalled-all-installed-yum() { } test-05-common_checkInstalled-all-installed-yum-assert() { - @echo "wazuh-manager.x86_64 4.10.1-1 @wazuh" + @echo "wazuh-manager.x86_64 4.10.2-1 @wazuh" @echo 1 - @echo "wazuh-indexer.x86_64 4.6.0-1 @wazuh" + @echo "wazuh-indexer.x86_64 4.10.2-1 @wazuh" @echo 1 @echo "filebeat.x86_64 7.10.2-1 @wazuh" diff --git a/tests/unit/suites/test-dashboard.sh b/tests/unit/suites/test-dashboard.sh index 707d200..d0dfa96 100644 --- a/tests/unit/suites/test-dashboard.sh +++ b/tests/unit/suites/test-dashboard.sh @@ -6,7 +6,7 @@ source "${base_dir}"/bach.sh @setup-test { @ignore common_logger k_certs_path="/etc/wazuh-dashboard/certs/" - wazuh_version="4.10.1" + wazuh_version="4.10.2" elasticsearch_oss_version="7.10.2" wazuh_kibana_plugin_revision="1" repobaseurl="https://packages.wazuh.com/4.x" @@ -55,7 +55,7 @@ test-03-dashboard_install-yum() { load-dashboard_install sys_type="yum" sep="-" - wazuh_version="4.10.1" + wazuh_version="4.10.2" wazuh_revision="1" dashboard_install } @@ -68,7 +68,7 @@ test-ASSERT-FAIL-04-dashboard_install-yum-error() { load-dashboard_install sys_type="yum" sep="-" - wazuh_version="4.10.1" + wazuh_version="4.10.2" wazuh_revision="1" @mockfalse yum install wazuh-dashboard-1.13.2-1 -y dashboard_install @@ -78,7 +78,7 @@ test-05-dashboard_install-apt() { load-dashboard_install sys_type="apt-get" sep="=" - wazuh_version="4.10.1" + wazuh_version="4.10.2" wazuh_revision="1" dashboard_install } @@ -91,7 +91,7 @@ test-ASSERT-FAIL-06-dashboard_install-apt-error() { load-dashboard_install sys_type="apt-get" sep="=" - wazuh_version="4.10.1" + wazuh_version="4.10.2" wazuh_revision="1" @mockfalse apt install wazuh-dashboard=1.13.2-1 -y dashboard_install diff --git a/tests/unit/suites/test-indexer.sh b/tests/unit/suites/test-indexer.sh index cdaf053..808fa44 100644 --- a/tests/unit/suites/test-indexer.sh +++ b/tests/unit/suites/test-indexer.sh @@ -49,7 +49,7 @@ test-03-indexer_install-yum() { load-indexer_install sys_type="yum" sep="-" - wazuh_version="4.10.1" + wazuh_version="4.10.2" wazuh_revision="1" indexer_install } @@ -63,7 +63,7 @@ test-ASSERT-FAIL-04-indexer_install-yum-error() { load-indexer_install sys_type="yum" sep="-" - wazuh_version="4.10.1" + wazuh_version="4.10.2" wazuh_revision="1" @mockfalse yum install wazuh-indexer-1.13.2-1 -y indexer_install @@ -73,7 +73,7 @@ test-05-indexer_install-apt() { load-indexer_install sys_type="apt-get" sep="=" - wazuh_version="4.10.1" + wazuh_version="4.10.2" wazuh_revision="1" indexer_install } @@ -87,7 +87,7 @@ test-ASSERT-FAIL-06-indexer_install-apt-error() { load-indexer_install sys_type="apt-get" sep="=" - wazuh_version="4.10.1" + wazuh_version="4.10.2" wazuh_revision="1" @mockfalse apt install wazuh-indexer=1.13.2-1 -y indexer_install