diff --git a/.github/workflows/Procedure_push_docker_images.yml b/.github/workflows/Procedure_push_docker_images.yml index 8813f1d4..235cab02 100644 --- a/.github/workflows/Procedure_push_docker_images.yml +++ b/.github/workflows/Procedure_push_docker_images.yml @@ -181,3 +181,89 @@ jobs: exit 1 fi working-directory: ./build-docker-images + + - name: Image exists validation + if: ${{ inputs.dev == false }} + id: validation + run: | + IMAGE_TAG=${{ inputs.image_tag }} + PURPOSE="" + + if [[ "$IMAGE_TAG" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then + if docker manifest inspect $IMAGE_REGISTRY/wazuh/wazuh-manager:$IMAGE_TAG > /dev/null 2>&1; then + PURPOSE="regeneration" + echo "Image wazuh/wazuh-manager:$IMAGE_TAG exists. Setting PURPOSE to 'regeneration'" + else + PURPOSE="new release" + echo "Image wazuh/wazuh-manager:$IMAGE_TAG does NOT exist. Setting PURPOSE to 'new release'" + fi + echo "✅ Release tag: '$IMAGE_TAG'" + elif [[ "$IMAGE_TAG" =~ ^[0-9]+\.[0-9]+\.[0-9]+-(alpha|beta|rc)[0-9]+$ ]]; then + PURPOSE="new stage" + echo "✅ Stage tag: '$IMAGE_TAG'. Setting PURPOSE to 'new stage'" + else + echo "❌ No release or stage tag ('$IMAGE_TAG'), the GH issue will not be created" + fi + + echo "purpose=$PURPOSE" >> $GITHUB_OUTPUT + + - name: GH issue notification + if: ${{ inputs.dev == false && steps.validation.outputs.purpose != '' }} + run: | + IMAGE_TAG=${{ inputs.image_tag }} + GH_TITLE="" + GH_MESSAGE="" + PURPOSE="${{ steps.validation.outputs.purpose }}" + + ## Setting GH issue title + GH_TITLE="Artifactory vulnerabilities update \`v$IMAGE_TAG\`" + + ## Setting GH issue body + GH_MESSAGE=$(cat <<- EOF | tr -d '\r' | sed 's/^[[:space:]]*//' + ### Description + - [ ] Update the [Artifactory vulnerabilities](${{ secrets.NOTIFICATION_SHEET_URL }}) sheet with the \`v$IMAGE_TAG\` vulnerabilities. + + **Purpose**: $PURPOSE + >[!NOTE] + >To update the \`Tentative Release\` column, follow these steps: + https://github.com/wazuh/${{ secrets.NOTIFICATION_REPO }}/issues/2049#issuecomment-2671590268 + EOF + ) + + # Print the GH Variables content + echo "--- Variable Content ---" + echo "$GH_TITLE" + echo "------------------------" + + echo "--- Variable Content ---" + echo "$GH_MESSAGE" + echo "------------------------" + + ## GH issue creation + ISSUE_URL=$(gh issue create \ + -R wazuh/${{ secrets.NOTIFICATION_REPO }} \ + --title "$GH_TITLE" \ + --body "$GH_MESSAGE" \ + --label "level/task" \ + --label "type/maintenance" \ + --label "request/operational") + + ## Adding the issue to the team project + PROJECT_ITEM_ID=$(gh project item-add \ + ${{ secrets.NOTIFICATION_PROJECT_NUMBER }} \ + --url $ISSUE_URL \ + --owner wazuh \ + --format json \ + | jq -r '.id') + + ## Setting Objective + gh project item-edit --id $PROJECT_ITEM_ID --project-id ${{ secrets.NOTIFICATION_PROJECT_ID }} --field-id ${{ secrets.NOTIFICATION_PROJECT_OBJECTIVE_ID }} --text "Security scans" + ## Setting Priority + gh project item-edit --id $PROJECT_ITEM_ID --project-id ${{ secrets.NOTIFICATION_PROJECT_ID }} --field-id ${{ secrets.NOTIFICATION_PROJECT_PRIORITY_ID }} --single-select-option-id ${{ secrets.NOTIFICATION_PROJECT_PRIORITY_OPTION_ID }} + ## Setting Size + gh project item-edit --id $PROJECT_ITEM_ID --project-id ${{ secrets.NOTIFICATION_PROJECT_ID }} --field-id ${{ secrets.NOTIFICATION_PROJECT_SIZE_ID }} --single-select-option-id ${{ secrets.NOTIFICATION_PROJECT_SIZE_OPTION_ID }} + ## Setting Subteam + gh project item-edit --id $PROJECT_ITEM_ID --project-id ${{ secrets.NOTIFICATION_PROJECT_ID }} --field-id ${{ secrets.NOTIFICATION_PROJECT_SUBTEAM_ID }} --single-select-option-id ${{ secrets.NOTIFICATION_PROJECT_SUBTEAM_OPTION_ID }} + + env: + GH_TOKEN: ${{ secrets.NOTIFICATION_GH_ARTIFACT_TOKEN }} diff --git a/CHANGELOG.md b/CHANGELOG.md index 2b4bccec..96f4a5c8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,16 +9,16 @@ All notable changes to this project will be documented in this file. ### Changed -- Update documentation for Wazuh Docker image builder and workflow usage ([#2136](https://github.com/wazuh/wazuh-puppet/issues/2136)) -- Configure deployment with environment variables ([#2081](https://github.com/wazuh/wazuh-puppet/issues/2081)) -- Modify Wazuh components install method ([#2058](https://github.com/wazuh/wazuh-puppet/issues/2058)) -- Image builder Workflow Rebuild ([#2054](https://github.com/wazuh/wazuh-puppet/issues/2054)) -- Wazuh server clean-up ([#2030](https://github.com/wazuh/wazuh-puppet/issues/2030)) -- Fix OpenSearch deprecated settings ([#1366](https://github.com/wazuh/wazuh-puppet/issues/1366)) +- Update documentation for Wazuh Docker image builder and workflow usage ([#2136](https://github.com/wazuh/wazuh-docker/issues/2136)) +- Configure deployment with environment variables ([#2081](https://github.com/wazuh/wazuh-docker/pull/2081)) +- Modify Wazuh components install method ([#2058](https://github.com/wazuh/wazuh-docker/pull/2058)) +- Image builder Workflow Rebuild ([#2054](https://github.com/wazuh/wazuh-docker/pull/2054)) +- Wazuh server clean-up ([#2030](https://github.com/wazuh/wazuh-docker/pull/2030)) +- Fix OpenSearch deprecated settings ([#1899](https://github.com/wazuh/wazuh-docker/pull/1899)) ### Fixed -- None + Delete etc/lists references ([#2129](https://github.com/wazuh/wazuh-docker/pull/2129)) ### Deleted @@ -32,7 +32,8 @@ All notable changes to this project will be documented in this file. ### Changed -- None +- Agent group parameter added ([#2127](https://github.com/wazuh/wazuh-docker/pull/2127)) +- Adapt to multi architecture build ([#2120](https://github.com/wazuh/wazuh-docker/pull/2120)) ### Fixed diff --git a/build-docker-images/wazuh-agent/config/etc/cont-init.d/0-wazuh-init b/build-docker-images/wazuh-agent/config/etc/cont-init.d/0-wazuh-init index 2fcf4a88..a50b4662 100644 --- a/build-docker-images/wazuh-agent/config/etc/cont-init.d/0-wazuh-init +++ b/build-docker-images/wazuh-agent/config/etc/cont-init.d/0-wazuh-init @@ -9,6 +9,7 @@ WAZUH_REGISTRATION_SERVER=${WAZUH_REGISTRATION_SERVER:-$WAZUH_MANAGER_SERVER} WAZUH_REGISTRATION_PORT=${WAZUH_REGISTRATION_PORT:-"1515"} WAZUH_REGISTRATION_PASSWORD=$WAZUH_REGISTRATION_PASSWORD WAZUH_AGENT_NAME=${WAZUH_AGENT_NAME:-"wazuh-agent-$HOSTNAME"} +WAZUH_AGENT_GROUPS=${WAZUH_AGENT_GROUPS:-"default"} ############################################################################## # Aux functions @@ -66,7 +67,8 @@ set_manager_conn() { sed -i "s#CHANGE_MANAGER_PORT#$WAZUH_MANAGER_PORT#g" ${WAZUH_INSTALL_PATH}/etc/ossec.conf sed -i "s#CHANGE_ENROLL_IP#$WAZUH_REGISTRATION_SERVER#g" ${WAZUH_INSTALL_PATH}/etc/ossec.conf sed -i "s#CHANGE_ENROLL_PORT#$WAZUH_REGISTRATION_PORT#g" ${WAZUH_INSTALL_PATH}/etc/ossec.conf - sed -i "s#CHANGEE_AGENT_NAME#$WAZUH_AGENT_NAME#g" ${WAZUH_INSTALL_PATH}/etc/ossec.conf + sed -i "s#CHANGE_AGENT_NAME#$WAZUH_AGENT_NAME#g" ${WAZUH_INSTALL_PATH}/etc/ossec.conf + sed -i "s#CHANGE_AGENT_GROUPS#$WAZUH_AGENT_GROUPS#g" ${WAZUH_INSTALL_PATH}/etc/ossec.conf [ -n "$WAZUH_REGISTRATION_PASSWORD" ] && \ echo "$WAZUH_REGISTRATION_PASSWORD" > ${WAZUH_INSTALL_PATH}/etc/authd.pass && \ chown root:wazuh ${WAZUH_INSTALL_PATH}/etc/authd.pass && \ diff --git a/build-docker-images/wazuh-manager/config/etc/cont-init.d/0-wazuh-init b/build-docker-images/wazuh-manager/config/etc/cont-init.d/0-wazuh-init index 32eba0a0..4e06e49e 100644 --- a/build-docker-images/wazuh-manager/config/etc/cont-init.d/0-wazuh-init +++ b/build-docker-images/wazuh-manager/config/etc/cont-init.d/0-wazuh-init @@ -245,7 +245,6 @@ echo "Wazuh manager config modified successfully." configure_permissions() { chown -R wazuh:wazuh /var/ossec/queue/rids - chown -R wazuh:wazuh /var/ossec/etc/lists } ############################################################################## diff --git a/docs/ref/configuration/environment-variables.md b/docs/ref/configuration/environment-variables.md index 003ad165..eac90d9e 100644 --- a/docs/ref/configuration/environment-variables.md +++ b/docs/ref/configuration/environment-variables.md @@ -4,11 +4,14 @@ This document outlines the environment variables applicable to the Wazuh Docker ## Table of Contents -- [Wazuh Manager](#wazuh-manager) -- [Wazuh Indexer](#wazuh-indexer) -- [Wazuh Dashboard](#wazuh-dashboard) -- [Wazuh Agent](#wazuh-agent) -- [Overriding Configuration Files with Environment Variables](#overriding-configuration-files-with-environment-variables) +- [Environment Variables in Wazuh Docker Deployment](#environment-variables-in-wazuh-docker-deployment) + - [Table of Contents](#table-of-contents) + - [Wazuh Manager](#wazuh-manager) + - [Wazuh Indexer](#wazuh-indexer) + - [Wazuh Dashboard](#wazuh-dashboard) + - [Wazuh Agent](#wazuh-agent) + - [Overriding Configuration Files with Environment Variables](#overriding-configuration-files-with-environment-variables) + - [Examples:](#examples) --- @@ -88,6 +91,7 @@ environment: - WAZUH_REGISTRATION_SERVER=wazuh.manager - WAZUH_REGISTRATION_PORT=1515 - WAZUH_AGENT_NAME=my-agent + - WAZUH_AGENT_GROUPS=default - WAZUH_REGISTRATION_PASSWORD=StrongPassword ``` diff --git a/wazuh-agent/config/wazuh-agent-conf b/wazuh-agent/config/wazuh-agent-conf index 51fd9b0f..ad0d8ece 100644 --- a/wazuh-agent/config/wazuh-agent-conf +++ b/wazuh-agent/config/wazuh-agent-conf @@ -20,8 +20,9 @@ yes CHANGE_ENROLL_IP CHANGE_ENROLL_PORT - CHANGEE_AGENT_NAME + CHANGE_AGENT_NAME etc/authd.pass + CHANGE_AGENT_GROUPS