Compare commits

..
Author SHA1 Message Date
Wazuh CI f645653af9 Merge pull request #2340 from wazuh/enhancement/wqa2320-revert-bump-test-revert-option-modified
Revert bump test-revert-option-modified branch
2026-04-24 13:41:08 +02:00
wazuhci 13629cc549 feat: revert test-revert-option-modified references 2026-04-24 11:41:03 +00:00
Wazuh CI fe2fc14a3c Merge pull request #2339 from wazuh/enhancement/wqa2320-bump-test-revert-option-modified
Bump test-revert-option-modified branch
2026-04-24 13:34:48 +02:00
wazuhci 1358738d53 feat: bump test-revert-option-modified 2026-04-24 11:34:43 +00:00
Wazuh CI 0bcd2409ce Merge pull request #2329 from wazuh/enhancement/wqa2320-revert-bump-test-revert-option-modified
Revert bump test-revert-option-modified branch
2026-04-22 21:56:40 +02:00
wazuhci db9406b6d1 feat: revert test-revert-option-modified references 2026-04-22 19:56:35 +00:00
Wazuh CI ec777f0653 Merge pull request #2328 from wazuh/enhancement/wqa2320-bump-test-revert-option-modified
Bump test-revert-option-modified branch
2026-04-22 21:55:41 +02:00
wazuhci e1e8dab086 feat: bump test-revert-option-modified 2026-04-22 19:55:37 +00:00
33 changed files with 840 additions and 556 deletions
-1
View File
@@ -1,4 +1,3 @@
WAZUH_VERSION=5.0.0 WAZUH_VERSION=5.0.0
WAZUH_IMAGE_VERSION=5.0.0 WAZUH_IMAGE_VERSION=5.0.0
WAZUH_REGISTRY=docker.io WAZUH_REGISTRY=docker.io
IMAGE_TAG=5.0.0
+1 -1
View File
@@ -218,4 +218,4 @@ jobs:
echo "Branch: ${{ steps.vars.outputs.branch_name }}" echo "Branch: ${{ steps.vars.outputs.branch_name }}"
echo "PR: ${{ steps.create_pr.outputs.pull_request_url }}" echo "PR: ${{ steps.create_pr.outputs.pull_request_url }}"
echo "Revert bumper scripts logs:" echo "Revert bumper scripts logs:"
cat ${BUMP_LOG_PATH}/repository_bumper*log || true cat ${BUMP_LOG_PATH}/repository_bumper*log || true
+3 -9
View File
@@ -4,7 +4,6 @@ permissions:
id-token: write id-token: write
on: on:
pull_request: pull_request:
types: [opened, synchronize, reopened, ready_for_review]
workflow_dispatch: workflow_dispatch:
inputs: inputs:
docker_reference: docker_reference:
@@ -15,7 +14,6 @@ on:
jobs: jobs:
prepare-variables: prepare-variables:
if: ${{ !github.event.pull_request.draft }}
runs-on: ubuntu-latest runs-on: ubuntu-latest
outputs: outputs:
WAZUH_VERSION: ${{ steps.dotenv.outputs.WAZUH_VERSION }} WAZUH_VERSION: ${{ steps.dotenv.outputs.WAZUH_VERSION }}
@@ -78,7 +76,7 @@ jobs:
uses: aws-actions/amazon-ecr-login@v2 uses: aws-actions/amazon-ecr-login@v2
- name: Execute Goss tests (wazuh-manager) - name: Execute Goss tests (wazuh-manager)
run: dgoss run ${{ env.WAZUH_REGISTRY }}/wazuh/wazuh-manager:${{ env.WAZUH_IMAGE_VERSION }}-latest run: dgoss run ${{ env.WAZUH_REGISTRY }}/wazuh/wazuh-manager:${{ env.WAZUH_IMAGE_VERSION }}
env: env:
GOSS_SLEEP: 30 GOSS_SLEEP: 30
GOSS_FILE: .github/.goss.yaml GOSS_FILE: .github/.goss.yaml
@@ -90,7 +88,7 @@ jobs:
matrix: matrix:
os: [ubuntu-22.04, ubuntu-22.04-arm] os: [ubuntu-22.04, ubuntu-22.04-arm]
fail-fast: false fail-fast: false
needs: [prepare-variables, Execute-Goss-tests] needs: [prepare-variables, Execute-Goss-tests, build-images]
env: env:
WAZUH_IMAGE_VERSION: ${{ needs.prepare-variables.outputs.WAZUH_IMAGE_VERSION }} WAZUH_IMAGE_VERSION: ${{ needs.prepare-variables.outputs.WAZUH_IMAGE_VERSION }}
WAZUH_MINOR_VERSION: ${{ needs.prepare-variables.outputs.WAZUH_MINOR_VERSION }} WAZUH_MINOR_VERSION: ${{ needs.prepare-variables.outputs.WAZUH_MINOR_VERSION }}
@@ -164,7 +162,6 @@ jobs:
if [ -f "$TARGET_FILE" ]; then if [ -f "$TARGET_FILE" ]; then
echo "Updating registry in $TARGET_FILE to: ${{ env.WAZUH_REGISTRY }}" echo "Updating registry in $TARGET_FILE to: ${{ env.WAZUH_REGISTRY }}"
sed -i "s|wazuh/wazuh-|${{ env.WAZUH_REGISTRY }}/wazuh/wazuh-|g" "$TARGET_FILE" sed -i "s|wazuh/wazuh-|${{ env.WAZUH_REGISTRY }}/wazuh/wazuh-|g" "$TARGET_FILE"
sed -i "s/\(.*wazuh\/wazuh-.*:\)${{ env.WAZUH_IMAGE_VERSION }}/\1${{ env.WAZUH_IMAGE_VERSION }}-latest/g" "$TARGET_FILE"
else else
echo "File $TARGET_FILE not found" echo "File $TARGET_FILE not found"
exit 1 exit 1
@@ -287,7 +284,6 @@ jobs:
if [ -f "$TARGET_FILE" ]; then if [ -f "$TARGET_FILE" ]; then
echo "Updating registry in $TARGET_FILE to: ${{ env.WAZUH_REGISTRY }}" echo "Updating registry in $TARGET_FILE to: ${{ env.WAZUH_REGISTRY }}"
sed -i "s|wazuh/wazuh-|${{ env.WAZUH_REGISTRY }}/wazuh/wazuh-|g" "$TARGET_FILE" sed -i "s|wazuh/wazuh-|${{ env.WAZUH_REGISTRY }}/wazuh/wazuh-|g" "$TARGET_FILE"
sed -i "s/\(.*wazuh\/wazuh-.*:\)${{ env.WAZUH_IMAGE_VERSION }}/\1${{ env.WAZUH_IMAGE_VERSION }}-latest/g" "$TARGET_FILE"
else else
echo "File $TARGET_FILE not found" echo "File $TARGET_FILE not found"
exit 1 exit 1
@@ -365,7 +361,7 @@ jobs:
matrix: matrix:
os: [ubuntu-22.04, ubuntu-22.04-arm] os: [ubuntu-22.04, ubuntu-22.04-arm]
fail-fast: false fail-fast: false
needs: [prepare-variables, Execute-Goss-tests] needs: [prepare-variables, Execute-Goss-tests, build-images]
env: env:
WAZUH_IMAGE_VERSION: ${{ needs.prepare-variables.outputs.WAZUH_IMAGE_VERSION }} WAZUH_IMAGE_VERSION: ${{ needs.prepare-variables.outputs.WAZUH_IMAGE_VERSION }}
WAZUH_MINOR_VERSION: ${{ needs.prepare-variables.outputs.WAZUH_MINOR_VERSION }} WAZUH_MINOR_VERSION: ${{ needs.prepare-variables.outputs.WAZUH_MINOR_VERSION }}
@@ -445,7 +441,6 @@ jobs:
if [ -f "$TARGET_FILE" ]; then if [ -f "$TARGET_FILE" ]; then
echo "Updating registry in $TARGET_FILE to: ${{ env.WAZUH_REGISTRY }}" echo "Updating registry in $TARGET_FILE to: ${{ env.WAZUH_REGISTRY }}"
sed -i "s|wazuh/wazuh-|${{ env.WAZUH_REGISTRY }}/wazuh/wazuh-|g" "$TARGET_FILE" sed -i "s|wazuh/wazuh-|${{ env.WAZUH_REGISTRY }}/wazuh/wazuh-|g" "$TARGET_FILE"
sed -i "s/\(.*wazuh\/wazuh-.*:\)${{ env.WAZUH_IMAGE_VERSION }}/\1${{ env.WAZUH_IMAGE_VERSION }}-latest/g" "$TARGET_FILE"
else else
echo "File $TARGET_FILE not found" echo "File $TARGET_FILE not found"
exit 1 exit 1
@@ -578,7 +573,6 @@ jobs:
if [ -f "$TARGET_FILE" ]; then if [ -f "$TARGET_FILE" ]; then
echo "Updating registry in $TARGET_FILE to: ${{ env.WAZUH_REGISTRY }}" echo "Updating registry in $TARGET_FILE to: ${{ env.WAZUH_REGISTRY }}"
sed -i "s|wazuh/wazuh-|${{ env.WAZUH_REGISTRY }}/wazuh/wazuh-|g" "$TARGET_FILE" sed -i "s|wazuh/wazuh-|${{ env.WAZUH_REGISTRY }}/wazuh/wazuh-|g" "$TARGET_FILE"
sed -i "s/\(.*wazuh\/wazuh-.*:\)${{ env.WAZUH_IMAGE_VERSION }}/\1${{ env.WAZUH_IMAGE_VERSION }}-latest/g" "$TARGET_FILE"
else else
echo "File $TARGET_FILE not found" echo "File $TARGET_FILE not found"
exit 1 exit 1
@@ -233,11 +233,6 @@ jobs:
source ${{ env.WORKFLOW_VENV }}/bin/activate source ${{ env.WORKFLOW_VENV }}/bin/activate
WAZUH_COMPONENTS='${{ needs.setup.outputs.WAZUH_COMPONENTS }}' WAZUH_COMPONENTS='${{ needs.setup.outputs.WAZUH_COMPONENTS }}'
COMMIT_LIST='${{ needs.setup.outputs.COMMIT_LIST }}' COMMIT_LIST='${{ needs.setup.outputs.COMMIT_LIST }}'
SCRIPT_PARAMS="--process ${{ env.PRESIGNED_URLS_SCRIPT_PROCESS }} \
--wazuh-version ${{ env.WAZUH_VERSION }} \
--aws-s3-bucket-dev ${{ env.LOCAL_AWS_S3_BUCKET_DEV }} \
--assistant-revision $ASSISTANT_REVISION "
# Parse components and their revisions # Parse components and their revisions
COMPONENTS=($(echo "$WAZUH_COMPONENTS" | jq -r '.[]')) COMPONENTS=($(echo "$WAZUH_COMPONENTS" | jq -r '.[]'))
@@ -256,22 +251,29 @@ jobs:
for i in "${!COMPONENTS[@]}"; do for i in "${!COMPONENTS[@]}"; do
case "${COMPONENTS[$i]}" in case "${COMPONENTS[$i]}" in
wazuh-manager) wazuh-manager)
SCRIPT_PARAMS+="--manager-revision ${REVISIONS[$i]} " MANAGER_REVISION="${REVISIONS[$i]}"
;; ;;
wazuh-dashboard) wazuh-dashboard)
SCRIPT_PARAMS+="--dashboard-revision ${REVISIONS[$i]} " DASHBOARD_REVISION="${REVISIONS[$i]}"
;; ;;
wazuh-indexer) wazuh-indexer)
SCRIPT_PARAMS+="--indexer-revision ${REVISIONS[$i]} " INDEXER_REVISION="${REVISIONS[$i]}"
;; ;;
wazuh-agent) wazuh-agent)
SCRIPT_PARAMS+="--agent-revision ${REVISIONS[$i]} " AGENT_REVISION="${REVISIONS[$i]}"
;; ;;
esac esac
done done
python ${{ env.GENERATE_PRESIGNED_URLS_SCRIPT_PATH }} \ python ${{ env.GENERATE_PRESIGNED_URLS_SCRIPT_PATH }} \
$SCRIPT_PARAMS --process ${{ env.PRESIGNED_URLS_SCRIPT_PROCESS }} \
--wazuh-version ${{ env.WAZUH_VERSION }} \
--aws-s3-bucket-dev ${{ env.LOCAL_AWS_S3_BUCKET_DEV }} \
--indexer-revision $INDEXER_REVISION \
--manager-revision $MANAGER_REVISION \
--dashboard-revision $DASHBOARD_REVISION \
--agent-revision $AGENT_REVISION \
--assistant-revision $ASSISTANT_REVISION
- name: Save presigned URLs file to artifact - name: Save presigned URLs file to artifact
if: ${{ inputs.dev == true }} if: ${{ inputs.dev == true }}
@@ -1,32 +0,0 @@
name: PR Check - Docker Integration Tests
on:
workflow_dispatch:
inputs:
pr_head_ref:
description: 'Branch of wazuh-docker to test'
required: true
type: string
automation_reference:
description: 'Branch of wazuh-automation to use'
required: false
default: 'main'
type: string
deployment_type:
description: 'Deployment type to test'
required: true
type: choice
options:
- single-node
- multi-node
- both
permissions:
id-token: write
contents: read
jobs:
placeholder:
runs-on: ubuntu-latest
steps:
- run: echo "Workflow registered. Use workflow_dispatch selecting the feature branch."
+1 -1
View File
@@ -12,7 +12,7 @@ multi-node/wazuh-certificates/*
multi-node/wazuh-certificates-tool.log multi-node/wazuh-certificates-tool.log
multi-node/wazuh-certs-tool*.sh multi-node/wazuh-certs-tool*.sh
multi-node/config*.yml multi-node/config*.yml
multi-node/config/*/certs multi-node/config/wazuh*
# Documentation # Documentation
docs/book/ docs/book/
+21 -30
View File
@@ -1,22 +1,34 @@
# Change Log # Change Log
All notable changes to this project will be documented in this file. All notable changes to this project will be documented in this file.
## [5.1.0]
### Added
- None
### Changed
- None
### Fixed
- None
### Deleted
- None
## [5.0.0] ## [5.0.0]
### Added ### Added
- Add revert option into bumper workflow ([#2330](https://github.com/wazuh/wazuh-docker/pull/2330)) - None
- Add checks for artifact_urls.yaml download ([#2315](https://github.com/wazuh/wazuh-docker/pull/2315))
- Add set_as_main option ([#2293](https://github.com/wazuh/wazuh-docker/pull/2293))
### Changed ### Changed
- Forbid pr_check workflow execution in draft PRs ([#2399](https://github.com/wazuh/wazuh-docker/pull/2399)) - Add checks for artifact_urls.yaml download ([#2315](https://github.com/wazuh/wazuh-docker/pull/2315))
- Unification of user UID and GID ([#2393](https://github.com/wazuh/wazuh-docker/pull/2393)) - Add set_as_main option ([#2293](https://github.com/wazuh/wazuh-docker/pull/2293))
- Add Wazuh indexer engine start on entrypoint ([#2390](https://github.com/wazuh/wazuh-docker/pull/2390))
- Image build process update ([#2358](https://github.com/wazuh/wazuh-docker/pull/2358))
- Add new path on artifact_urls file ([#2344](https://github.com/wazuh/wazuh-docker/pull/2344))
- Presigned URLs generation enhancement ([#2346](https://github.com/wazuh/wazuh-docker/pull/2346))
- Adapt bumper workflows to change main branch ([#2294](https://github.com/wazuh/wazuh-docker/pull/2294)) - Adapt bumper workflows to change main branch ([#2294](https://github.com/wazuh/wazuh-docker/pull/2294))
- Delete all API user and password references and Wazuh agent references ([#2289](https://github.com/wazuh/wazuh-docker/pull/2289)) - Delete all API user and password references and Wazuh agent references ([#2289](https://github.com/wazuh/wazuh-docker/pull/2289))
- Create certificate directory with default user and group ([#2287](https://github.com/wazuh/wazuh-docker/pull/2287)) - Create certificate directory with default user and group ([#2287](https://github.com/wazuh/wazuh-docker/pull/2287))
@@ -55,8 +67,6 @@ All notable changes to this project will be documented in this file.
### Fixed ### Fixed
- Adapt Wazuh manager healthcheck with local binaries ([#2422](https://github.com/wazuh/wazuh-docker/pull/2422))
- Delete setcap command on deprecated file ([#2345](https://github.com/wazuh/wazuh-docker/pull/2345))
- Modify the choice of a correct tag ([#2313](https://github.com/wazuh/wazuh-docker/pull/2313)) - Modify the choice of a correct tag ([#2313](https://github.com/wazuh/wazuh-docker/pull/2313))
- Artifact URL download fix ([#2306](https://github.com/wazuh/wazuh-docker/pull/2306)) - Artifact URL download fix ([#2306](https://github.com/wazuh/wazuh-docker/pull/2306))
- Change API query method. ([#2275](https://github.com/wazuh/wazuh-docker/pull/2275)) - Change API query method. ([#2275](https://github.com/wazuh/wazuh-docker/pull/2275))
@@ -68,24 +78,6 @@ All notable changes to this project will be documented in this file.
- None - None
## [4.14.7]
### Added
- None
### Changed
- None
### Fixed
- None
### Deleted
- None
## [4.14.6] ## [4.14.6]
### Added ### Added
@@ -98,7 +90,6 @@ All notable changes to this project will be documented in this file.
### Fixed ### Fixed
- Changed update_user function from wazuh.security to wazuh.rbac.orm module ([#2406](https://github.com/wazuh/wazuh-docker/pull/2406))
- GH issue notification fix ([#2312](https://github.com/wazuh/wazuh-docker/pull/2312)) - GH issue notification fix ([#2312](https://github.com/wazuh/wazuh-docker/pull/2312))
### Deleted ### Deleted
+2 -2
View File
@@ -1,4 +1,4 @@
{ {
"version": "5.0.0", "version": "5.1.0",
"stage": "beta2" "stage": "alpha0"
} }
+104 -51
View File
@@ -47,8 +47,6 @@ build() {
WAZUH_STAGE=$(jq -r '.stage' ../VERSION.json) WAZUH_STAGE=$(jq -r '.stage' ../VERSION.json)
# ARTIFACT_URLS_FILE: The name of the artifact URLs file. # ARTIFACT_URLS_FILE: The name of the artifact URLs file.
ARTIFACT_URLS_FILE="artifact_urls.yaml" ARTIFACT_URLS_FILE="artifact_urls.yaml"
# ARTIFACT_URLS_DIR: The name of the artifact URLs directory.
ARTIFACT_URLS_DIR="artifact-urls"
# Check if the artifact file already exists to prevent redundant downloads # Check if the artifact file already exists to prevent redundant downloads
if [[ -f "$ARTIFACT_URLS_FILE" ]]; then if [[ -f "$ARTIFACT_URLS_FILE" ]]; then
@@ -94,7 +92,7 @@ build() {
# Final download using dynamic variables based on the release type. # Final download using dynamic variables based on the release type.
# Pattern: server / stage / major_version.x / filename # Pattern: server / stage / major_version.x / filename
FULL_URL="https://${PACKAGE_URL}/${RELEASE_STAGE}/${WAZUH_MAJOR_VERSION}.x/${ARTIFACT_URLS_DIR}/${ARTIFACT_URLS_DOWNLOAD}" FULL_URL="https://${PACKAGE_URL}/${RELEASE_STAGE}/${WAZUH_MAJOR_VERSION}.x/${ARTIFACT_URLS_DOWNLOAD}"
echo "Attempting to download: $FULL_URL" echo "Attempting to download: $FULL_URL"
curl -fsSL -o "$ARTIFACT_URLS_FILE" "$FULL_URL" || { curl -fsSL -o "$ARTIFACT_URLS_FILE" "$FULL_URL" || {
echo "Error: Failed to download artifact URLs from $FULL_URL" >&2 echo "Error: Failed to download artifact URLs from $FULL_URL" >&2
@@ -166,23 +164,52 @@ build() {
fi fi
# Write the global .env file used by deployment compose files. # Function to get component-specific commit reference
# IMAGE_TAG here reflects a non-dev, non-per-component tag for reference. get_component_commit() {
local base_tag="${WAZUH_IMAGE_VERSION}${WAZUH_DEV_STAGE:+-${WAZUH_DEV_STAGE,,}}" local component=$1
case "${component}" in
wazuh-indexer)
echo "${INDEXER_COMMIT}"
;;
wazuh-manager)
echo "${MANAGER_COMMIT}"
;;
wazuh-dashboard)
echo "${DASHBOARD_COMMIT}"
;;
wazuh-agent)
echo "${AGENT_COMMIT}"
;;
*)
echo ""
;;
esac
}
# Global env file (without IMAGE_TAG - will be component-specific)
echo WAZUH_VERSION=$WAZUH_IMAGE_VERSION > ../.env echo WAZUH_VERSION=$WAZUH_IMAGE_VERSION > ../.env
echo WAZUH_IMAGE_VERSION=$WAZUH_IMAGE_VERSION >> ../.env echo WAZUH_IMAGE_VERSION=$WAZUH_IMAGE_VERSION >> ../.env
echo WAZUH_REGISTRY=$WAZUH_REGISTRY >> ../.env echo WAZUH_REGISTRY=$WAZUH_REGISTRY >> ../.env
echo IMAGE_TAG=${base_tag} >> ../.env
set -a set -a
source ../.env source ../.env
source ./artifacts_env.txt source ./artifacts_env.txt
set +a set +a
# Validate component if a specific one was requested. # Define all available components
if [ -n "${WAZUH_COMPONENT}" ]; then local all_components=("wazuh-indexer" "wazuh-manager" "wazuh-dashboard" "wazuh-agent")
local components_to_build=()
# Determine which components to build
if [ -z "${WAZUH_COMPONENT}" ]; then
echo "No component specified. Building all components..."
components_to_build=("${all_components[@]}")
else
# Validate component
case "${WAZUH_COMPONENT}" in case "${WAZUH_COMPONENT}" in
wazuh-indexer|wazuh-manager|wazuh-dashboard|wazuh-agent) ;; wazuh-indexer|wazuh-manager|wazuh-dashboard|wazuh-agent)
components_to_build=("${WAZUH_COMPONENT}")
;;
*) *)
echo "Error: Unknown component '${WAZUH_COMPONENT}'" >&2 echo "Error: Unknown component '${WAZUH_COMPONENT}'" >&2
clean 1 clean 1
@@ -190,51 +217,77 @@ build() {
esac esac
fi fi
# Generate per-component image tags. # Determine build command and base options
# The commit suffix is only appended when --dev is passed. This ensures:
# dev=false, tag=5.0.0 → 5.0.0
# dev=false, tag=5.0.0-beta1 → 5.0.0-beta1
# dev=true, tag=5.0.0 → 5.0.0-latest
# dev=true, tag=5.0.0-beta1 → 5.0.0-beta1-latest
make_tag() {
local commit=$1
if [ -n "${IS_DEV_BUILD}" ]; then
echo "${WAZUH_IMAGE_VERSION}${WAZUH_DEV_STAGE:+-${WAZUH_DEV_STAGE,,}}-${commit}"
else
echo "${base_tag}"
fi
}
export WAZUH_VERSION="$WAZUH_IMAGE_VERSION"
export MULTIARCH="${MULTIARCH}"
export INDEXER_TAG=$(make_tag "${INDEXER_COMMIT:-latest}")
export MANAGER_TAG=$(make_tag "${MANAGER_COMMIT:-latest}")
export DASHBOARD_TAG=$(make_tag "${DASHBOARD_COMMIT:-latest}")
export AGENT_TAG=$(make_tag "${AGENT_COMMIT:-latest}")
echo "Image tags:"
echo " wazuh-indexer: ${WAZUH_REGISTRY}/wazuh/wazuh-indexer:${INDEXER_TAG}"
echo " wazuh-manager: ${WAZUH_REGISTRY}/wazuh/wazuh-manager:${MANAGER_TAG}"
echo " wazuh-dashboard: ${WAZUH_REGISTRY}/wazuh/wazuh-dashboard:${DASHBOARD_TAG}"
echo " wazuh-agent: ${WAZUH_REGISTRY}/wazuh/wazuh-agent:${AGENT_TAG}"
# Bake options: --push for multi-arch (can't load multi-platform locally),
# --load for single-arch (stores image in local Docker daemon).
local bake_opts="--no-cache"
if [ "${MULTIARCH}" ]; then if [ "${MULTIARCH}" ]; then
bake_opts="${bake_opts} --push" build_cmd="docker buildx build --platform linux/amd64,linux/arm64 --push --no-cache"
else else
bake_opts="${bake_opts} --load" build_cmd="docker build --no-cache"
fi fi
# Build a specific component or the full default group (all 4 in parallel). # Build each component
if [ -z "${WAZUH_COMPONENT}" ]; then for component in "${components_to_build[@]}"; do
echo "Building all components in parallel..." echo "Building ${component} image..."
docker buildx bake ${bake_opts} -f docker-bake.hcl || clean 1
else # Get component-specific commit reference
echo "Building ${WAZUH_COMPONENT}..." COMPONENT_COMMIT=$(get_component_commit "${component}")
docker buildx bake ${bake_opts} -f docker-bake.hcl "${WAZUH_COMPONENT}" || clean 1
fi # Generate component-specific IMAGE_TAG.
# The commit suffix is only appended when --dev was passed, which maps
# directly to inputs.dev=true in the workflow. This ensures:
# dev=false, tag=5.0.0 → 5.0.0
# dev=false, tag=5.0.0-beta1 → 5.0.0-beta1
# dev=true, tag=5.0.0 → 5.0.0-latest
# dev=true, tag=5.0.0-beta1 → 5.0.0-beta1-latest
if [ -n "${IS_DEV_BUILD}" ]; then
IMAGE_TAG="${WAZUH_IMAGE_VERSION}${WAZUH_DEV_STAGE:+-${WAZUH_DEV_STAGE,,}}-${COMPONENT_COMMIT}"
else
IMAGE_TAG="${WAZUH_IMAGE_VERSION}${WAZUH_DEV_STAGE:+-${WAZUH_DEV_STAGE,,}}"
fi
echo "Using IMAGE_TAG: ${IMAGE_TAG} for ${component}"
export IMAGE_TAG="$IMAGE_TAG"
# Build common args (used by all components)
build_args=(
-t "${WAZUH_REGISTRY}/wazuh/${component}:${IMAGE_TAG}"
--build-arg WAZUH_VERSION="${WAZUH_IMAGE_VERSION}"
)
# Add component-specific args
case "${component}" in
wazuh-indexer)
build_args+=(
--build-arg wazuh_indexer_x86_64_rpm="${wazuh_indexer_x86_64_rpm}"
--build-arg wazuh_indexer_aarch64_rpm="${wazuh_indexer_aarch64_rpm}"
--build-arg wazuh_certs_tool="${wazuh_certs_tool}"
--build-arg wazuh_config_yml="${wazuh_config_yml}"
)
;;
wazuh-manager)
build_args+=(
--build-arg wazuh_manager_x86_64_rpm="${wazuh_manager_x86_64_rpm}"
--build-arg wazuh_manager_aarch64_rpm="${wazuh_manager_aarch64_rpm}"
)
;;
wazuh-dashboard)
build_args+=(
--build-arg wazuh_dashboard_x86_64_rpm="${wazuh_dashboard_x86_64_rpm}"
--build-arg wazuh_dashboard_aarch64_rpm="${wazuh_dashboard_aarch64_rpm}"
--build-arg wazuh_certs_tool="${wazuh_certs_tool}"
--build-arg wazuh_config_yml="${wazuh_config_yml}"
)
;;
wazuh-agent)
build_args+=(
--build-arg wazuh_agent_x86_64_rpm="${wazuh_agent_x86_64_rpm}"
--build-arg wazuh_agent_aarch64_rpm="${wazuh_agent_aarch64_rpm}"
)
;;
esac
# Execute build
$build_cmd "${build_args[@]}" ${component}/ || clean 1
echo "${component} image built successfully!"
done
echo "" echo ""
echo "Image build process completed!" echo "Image build process completed!"
+98
View File
@@ -0,0 +1,98 @@
# Wazuh App Copyright (C) 2017, Wazuh Inc. (License GPLv2)
services:
wazuh.manager:
build:
context: wazuh-manager/
args:
WAZUH_VERSION: ${WAZUH_VERSION}
wazuh_manager_x86_64_rpm: ${wazuh_manager_x86_64_rpm}
wazuh_manager_aarch64_rpm: ${wazuh_manager_aarch64_rpm}
wazuh_certs_tool: ${wazuh_certs_tool}
wazuh_config_yml: ${wazuh_config_yml}
image: ${WAZUH_REGISTRY}/wazuh/wazuh-manager:${IMAGE_TAG}
hostname: wazuh.manager
restart: always
ports:
- "1514:1514"
- "1515:1515"
- "514:514/udp"
- "55000:55000"
environment:
- INDEXER_URL=https://wazuh.indexer:9200
- INDEXER_USERNAME=admin
- INDEXER_PASSWORD=admin
volumes:
- wazuh_api_configuration:/var/wazuh-manager/api/configuration
- wazuh_etc:/var/wazuh-manager/etc
- wazuh_logs:/var/wazuh-manager/logs
- wazuh_queue:/var/wazuh-manager/queue
- wazuh_var_multigroups:/var/wazuh-manager/var/multigroups
wazuh.agent:
build:
context: wazuh-agent/
args:
WAZUH_VERSION: ${WAZUH_VERSION}
wazuh_agent_x86_64_rpm: ${wazuh_agent_x86_64_rpm}
wazuh_agent_aarch64_rpm: ${wazuh_agent_aarch64_rpm}
image: ${WAZUH_REGISTRY}/wazuh/wazuh-agent:${IMAGE_TAG}
hostname: wazuh.agent
restart: always
wazuh.indexer:
build:
context: wazuh-indexer/
args:
WAZUH_VERSION: ${WAZUH_VERSION}
wazuh_indexer_x86_64_rpm: ${wazuh_indexer_x86_64_rpm}
wazuh_indexer_aarch64_rpm: ${wazuh_indexer_aarch64_rpm}
wazuh_certs_tool: ${wazuh_certs_tool}
wazuh_config_yml: ${wazuh_config_yml}
image: ${WAZUH_REGISTRY}/wazuh/wazuh-indexer:${IMAGE_TAG}
hostname: wazuh.indexer
restart: always
ports:
- "9200:9200"
environment:
- "OPENSEARCH_JAVA_OPTS=-Xms512m -Xmx512m"
ulimits:
memlock:
soft: -1
hard: -1
nofile:
soft: 65536
hard: 65536
wazuh.dashboard:
build:
context: wazuh-dashboard/
args:
WAZUH_VERSION: ${WAZUH_VERSION}
wazuh_dashboard_x86_64_rpm: ${wazuh_dashboard_x86_64_rpm}
wazuh_dashboard_aarch64_rpm: ${wazuh_dashboard_aarch64_rpm}
wazuh_certs_tool: ${wazuh_certs_tool}
wazuh_config_yml: ${wazuh_config_yml}
image: ${WAZUH_REGISTRY}/wazuh/wazuh-dashboard:${IMAGE_TAG}
hostname: wazuh.dashboard
restart: always
ports:
- 443:443
environment:
- INDEXER_USERNAME=admin
- INDEXER_PASSWORD=admin
- SERVER_SSL_ENABLED=false
- WAZUH_API_URL=https://wazuh.manager
depends_on:
- wazuh.indexer
links:
- wazuh.indexer:wazuh.indexer
- wazuh.manager:wazuh.manager
volumes:
wazuh_api_configuration:
wazuh_etc:
wazuh_logs:
wazuh_queue:
wazuh_var_multigroups:
wazuh_active_response:
-110
View File
@@ -1,110 +0,0 @@
# Wazuh Docker Copyright (C) 2017, Wazuh Inc. (License GPLv2)
#
# Docker Buildx Bake file.
# Builds all Wazuh component images in parallel.
#
# Usage:
# docker buildx bake # build all (local, single-arch)
# docker buildx bake wazuh-manager # build one component
# docker buildx bake --push # push to registry after build
#
# Variables are read automatically from the environment (see build-images.sh).
# ── Global variables ──────────────────────────────────────────────────────────
variable "WAZUH_VERSION" { default = "5.0.0" }
variable "WAZUH_REGISTRY" { default = "docker.io" }
# Set IMAGE_TAG externally to override; defaults to WAZUH_VERSION.
variable "IMAGE_TAG" { default = WAZUH_VERSION }
# MULTIARCH: set to a non-empty value to build linux/amd64 + linux/arm64.
variable "MULTIARCH" { default = "" }
# Per-component tags — all default to IMAGE_TAG.
# In dev builds the shell script sets each one independently to append the
# per-component commit ref (e.g. MANAGER_TAG=5.0.0-beta1-abc1234).
variable "INDEXER_TAG" { default = IMAGE_TAG }
variable "MANAGER_TAG" { default = IMAGE_TAG }
variable "DASHBOARD_TAG" { default = IMAGE_TAG }
variable "AGENT_TAG" { default = IMAGE_TAG }
# ── Artifact URL variables ────────────────────────────────────────────────────
# Populated by build-images.sh from artifacts_env.txt (sourced into env).
variable "wazuh_indexer_x86_64_rpm" { default = "" }
variable "wazuh_indexer_aarch64_rpm" { default = "" }
variable "wazuh_manager_x86_64_rpm" { default = "" }
variable "wazuh_manager_aarch64_rpm" { default = "" }
variable "wazuh_dashboard_x86_64_rpm" { default = "" }
variable "wazuh_dashboard_aarch64_rpm" { default = "" }
variable "wazuh_agent_x86_64_rpm" { default = "" }
variable "wazuh_agent_aarch64_rpm" { default = "" }
variable "wazuh_certs_tool" { default = "" }
variable "wazuh_config_yml" { default = "" }
# ── Default group: builds all components ─────────────────────────────────────
group "default" {
targets = ["wazuh-indexer", "wazuh-manager", "wazuh-dashboard", "wazuh-agent"]
}
# ── Shared base target ────────────────────────────────────────────────────────
# All component targets inherit from here. Not built directly.
target "_common" {
# MULTIARCH=true → build linux/amd64 + linux/arm64 (requires --push, no --load for multi-platform)
# MULTIARCH unset → null means "native platform of the build host" (amd64 on x86, arm64 on ARM)
platforms = MULTIARCH != "" ? ["linux/amd64", "linux/arm64"] : null
args = {
WAZUH_VERSION = WAZUH_VERSION
}
}
# ── Component targets ─────────────────────────────────────────────────────────
target "wazuh-indexer" {
inherits = ["_common"]
context = "wazuh-indexer/"
tags = ["${WAZUH_REGISTRY}/wazuh/wazuh-indexer:${INDEXER_TAG}"]
args = {
wazuh_indexer_x86_64_rpm = wazuh_indexer_x86_64_rpm
wazuh_indexer_aarch64_rpm = wazuh_indexer_aarch64_rpm
wazuh_certs_tool = wazuh_certs_tool
wazuh_config_yml = wazuh_config_yml
}
}
target "wazuh-manager" {
inherits = ["_common"]
context = "wazuh-manager/"
tags = ["${WAZUH_REGISTRY}/wazuh/wazuh-manager:${MANAGER_TAG}"]
args = {
wazuh_manager_x86_64_rpm = wazuh_manager_x86_64_rpm
wazuh_manager_aarch64_rpm = wazuh_manager_aarch64_rpm
wazuh_certs_tool = wazuh_certs_tool
wazuh_config_yml = wazuh_config_yml
}
}
target "wazuh-dashboard" {
inherits = ["_common"]
context = "wazuh-dashboard/"
tags = ["${WAZUH_REGISTRY}/wazuh/wazuh-dashboard:${DASHBOARD_TAG}"]
args = {
wazuh_dashboard_x86_64_rpm = wazuh_dashboard_x86_64_rpm
wazuh_dashboard_aarch64_rpm = wazuh_dashboard_aarch64_rpm
wazuh_certs_tool = wazuh_certs_tool
wazuh_config_yml = wazuh_config_yml
}
}
target "wazuh-agent" {
inherits = ["_common"]
context = "wazuh-agent/"
tags = ["${WAZUH_REGISTRY}/wazuh/wazuh-agent:${AGENT_TAG}"]
args = {
wazuh_agent_x86_64_rpm = wazuh_agent_x86_64_rpm
wazuh_agent_aarch64_rpm = wazuh_agent_aarch64_rpm
}
}
+14 -63
View File
@@ -1,83 +1,34 @@
# Wazuh Docker Copyright (C) 2017, Wazuh Inc. (License GPLv2) # Wazuh Docker Copyright (C) 2017, Wazuh Inc. (License GPLv2)
FROM amazonlinux:2023
################################################################################ RUN rm /bin/sh && ln -s /bin/bash /bin/sh
# Build stage 0 (builder):
# Install Wazuh Agent RPM and download tini (static PID-1 init shim).
################################################################################
FROM amazonlinux:2023 AS builder
ARG WAZUH_VERSION ARG WAZUH_VERSION
ARG TINI_VERSION="v0.19.0" ARG S6_VERSION="v2.2.0.3"
ARG WAZUH_MANAGER='CHANGE_MANAGER_IP' ARG WAZUH_MANAGER='CHANGE_MANAGER_IP'
ARG WAZUH_REGISTRATION_SERVER='CHANGE_ENROLL_IP' ARG WAZUH_REGISTRATION_SERVER='CHANGE_ENROLL_IP'
ARG WAZUH_AGENT_NAME='CHANGE_AGENT_NAME' ARG WAZUH_AGENT_NAME='CHANGE_AGENT_NAME'
ARG TARGETARCH ARG TARGETARCH
ARG wazuh_agent_x86_64_rpm ARG wazuh_agent_x86_64_rpm
ARG wazuh_agent_aarch64_rpm ARG wazuh_agent_aarch64_rpm
ARG WAZUH_UID=101
ARG WAZUH_GID=101
# Install only runtime dependencies RUN RPM_ARCH="x86_64" && \
RUN dnf install procps shadow-utils -y && \
dnf clean all && \
getent group wazuh || groupadd -r -g ${WAZUH_GID} wazuh && \
getent passwd wazuh || useradd --system \
--no-create-home \
--home-dir /var/ossec \
--uid ${WAZUH_UID} \
--gid ${WAZUH_GID} \
--shell /sbin/nologin \
wazuh && \
RPM_ARCH="x86_64" && \
if [ "${TARGETARCH}" = "arm64" ]; then RPM_ARCH="aarch64"; fi && \ if [ "${TARGETARCH}" = "arm64" ]; then RPM_ARCH="aarch64"; fi && \
URL_VAR="wazuh_agent_${RPM_ARCH}_rpm" && \ URL_VAR="wazuh_agent_${RPM_ARCH}_rpm" && \
agent_url="${!URL_VAR}" && \ agent_url="${!URL_VAR}" && \
dnf install curl-minimal tar gzip procps shadow-utils -y && \ dnf install curl-minimal tar gzip procps -y &&\
curl -o /wazuh-agent.rpm "${agent_url}" && \ curl -o /wazuh-agent.rpm "${agent_url}" && \
dnf install /wazuh-agent.rpm -y && \ dnf install /wazuh-agent.rpm -y && \
rm -rf /wazuh-agent.rpm && \ rm -rf /wazuh-agent.rpm && \
dnf clean all && \ dnf clean all && \
sed -i '/<authorization_pass_path>/d' /var/ossec/etc/ossec.conf sed -i '/<authorization_pass_path>/d' /var/ossec/etc/ossec.conf && \
S6_ARCH="amd64" && \
# Download tini static binary (no external library dependencies) if [ "${TARGETARCH}" = "arm64" ]; then S6_ARCH="aarch64"; fi && \
RUN curl --fail --silent -L \ curl --fail --silent -L https://github.com/just-containers/s6-overlay/releases/download/${S6_VERSION}/s6-overlay-${S6_ARCH}.tar.gz \
https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini-static-${TARGETARCH} \ -o /tmp/s6-overlay-${S6_ARCH}.tar.gz && \
-o /usr/local/bin/tini && \ tar xzf /tmp/s6-overlay-${S6_ARCH}.tar.gz -C / --exclude="./bin" && \
chmod +x /usr/local/bin/tini tar xzf /tmp/s6-overlay-${S6_ARCH}.tar.gz -C /usr ./bin && \
rm /tmp/s6-overlay-${S6_ARCH}.tar.gz
################################################################################
# Build stage 1 (the actual Wazuh Agent image):
# Copy Wazuh Agent and tini from builder. Install only runtime dependencies.
################################################################################
FROM amazonlinux:2023
ARG WAZUH_UID=101
ARG WAZUH_GID=101
RUN rm /bin/sh && ln -s /bin/bash /bin/sh
# Install only runtime dependencies
RUN dnf install procps shadow-utils -y && \
dnf clean all && \
getent group wazuh || groupadd -r -g ${WAZUH_GID} wazuh && \
getent passwd wazuh || useradd --system \
--no-create-home \
--home-dir /var/ossec \
--uid ${WAZUH_UID} \
--gid ${WAZUH_GID} \
--shell /sbin/nologin \
wazuh
# Copy Wazuh Agent installation from builder
COPY --from=builder /var/ossec /var/ossec
# Copy tini static binary
COPY --from=builder /usr/local/bin/tini /usr/local/bin/tini
# Copy entrypoint and init scripts
COPY config/entrypoint.sh /entrypoint.sh
COPY config/etc/ /etc/ COPY config/etc/ /etc/
RUN chmod 755 /entrypoint.sh ENTRYPOINT [ "/init" ]
ENTRYPOINT ["/usr/local/bin/tini", "--", "/entrypoint.sh"]
@@ -1,22 +0,0 @@
#!/bin/bash
# Wazuh Docker Copyright (C) 2017, Wazuh Inc. (License GPLv2)
# Run initialization and configuration
bash /etc/cont-init.d/0-wazuh-init
# Start Wazuh Agent (may log warnings if manager address is not configured)
bash /etc/cont-init.d/1-agent
# Tail the main log to stdout so Docker captures it
tail -F /var/ossec/logs/ossec.log &
TAIL_PID=$!
# Graceful shutdown: stop Wazuh and exit cleanly on SIGTERM/SIGINT
_stop() {
echo "Stopping Wazuh Agent..."
/var/ossec/bin/wazuh-control stop 2>/dev/null || true
kill "${TAIL_PID}" 2>/dev/null || true
}
trap _stop SIGTERM SIGINT SIGQUIT
wait "${TAIL_PID}"
@@ -1,4 +1,4 @@
#!/bin/bash #!/usr/bin/with-contenv bash
# Wazuh App Copyright (C) 2017, Wazuh Inc. (License GPLv2) # Wazuh App Copyright (C) 2017, Wazuh Inc. (License GPLv2)
WAZUH_INSTALL_PATH=/var/ossec WAZUH_INSTALL_PATH=/var/ossec
@@ -1,4 +1,4 @@
#!/bin/bash #!/usr/bin/with-contenv bash
############################################################################## ##############################################################################
# Migration sequence # Migration sequence
@@ -1,4 +1,4 @@
#!/bin/sh #!/usr/bin/with-contenv sh
# dumping ossec.log to standard output # dumping ossec.log to standard output
exec tail -F /var/ossec/logs/ossec.log exec tail -F /var/ossec/logs/ossec.log
+14 -35
View File
@@ -7,28 +7,9 @@ ARG TARGETARCH
ARG wazuh_dashboard_x86_64_rpm ARG wazuh_dashboard_x86_64_rpm
ARG wazuh_dashboard_aarch64_rpm ARG wazuh_dashboard_aarch64_rpm
ARG wazuh_config_yml ARG wazuh_config_yml
ARG WAZUH_UID=101
ARG WAZUH_GID=101
# Set environment variables
ENV USER="wazuh-dashboard" \
GROUP="wazuh-dashboard" \
NAME="wazuh-dashboard" \
INSTALL_DIR="/usr/share/wazuh-dashboard"
# Update and install dependencies # Update and install dependencies
RUN yum install shadow-utils -y && \ RUN RPM_ARCH="x86_64" && \
yum clean all && \
getent group $GROUP || groupadd -r -g ${WAZUH_GID} $GROUP && \
useradd --system \
--uid ${WAZUH_UID} \
--no-create-home \
--home-dir $INSTALL_DIR \
--gid $GROUP \
--shell /sbin/nologin \
--comment "$USER user" \
$USER && \
RPM_ARCH="x86_64" && \
if [ "${TARGETARCH}" = "arm64" ]; then RPM_ARCH="aarch64"; fi && \ if [ "${TARGETARCH}" = "arm64" ]; then RPM_ARCH="aarch64"; fi && \
URL_VAR="wazuh_dashboard_${RPM_ARCH}_rpm" && \ URL_VAR="wazuh_dashboard_${RPM_ARCH}_rpm" && \
dashboard_url="${!URL_VAR}" && \ dashboard_url="${!URL_VAR}" && \
@@ -43,6 +24,7 @@ RUN mkdir -p $INSTALL_DIR/data/wazuh && chmod -R 775 $INSTALL_DIR/data/wazuh
RUN mkdir -p $INSTALL_DIR/data/wazuh/config && chmod -R 775 $INSTALL_DIR/data/wazuh/config RUN mkdir -p $INSTALL_DIR/data/wazuh/config && chmod -R 775 $INSTALL_DIR/data/wazuh/config
RUN mkdir -p $INSTALL_DIR/data/wazuh/logs && chmod -R 775 $INSTALL_DIR/data/wazuh/logs RUN mkdir -p $INSTALL_DIR/data/wazuh/logs && chmod -R 775 $INSTALL_DIR/data/wazuh/logs
RUN setcap 'cap_net_bind_service=-ep' /usr/share/wazuh-dashboard/node/bin/node RUN setcap 'cap_net_bind_service=-ep' /usr/share/wazuh-dashboard/node/bin/node
RUN setcap 'cap_net_bind_service=-ep' /usr/share/wazuh-dashboard/node/fallback/bin/node
################################################################################ ################################################################################
# Build stage 1 (the current Wazuh dashboard image): # Build stage 1 (the current Wazuh dashboard image):
@@ -53,9 +35,6 @@ RUN setcap 'cap_net_bind_service=-ep' /usr/share/wazuh-dashboard/node/bin/node
################################################################################ ################################################################################
FROM amazonlinux:2023 FROM amazonlinux:2023
ARG WAZUH_UID=101
ARG WAZUH_GID=101
# Set environment variables # Set environment variables
ENV USER="wazuh-dashboard" \ ENV USER="wazuh-dashboard" \
GROUP="wazuh-dashboard" \ GROUP="wazuh-dashboard" \
@@ -82,25 +61,25 @@ COPY config/wazuh_dashboard_config.sh /
# Update and install dependencies # Update and install dependencies
RUN yum install shadow-utils -y && \ RUN yum install shadow-utils -y && \
yum clean all && \ yum clean all && \
getent group $GROUP || groupadd -r -g ${WAZUH_GID} $GROUP && \ getent group $GROUP || groupadd -r -g 1000 $GROUP && \
useradd --system \ useradd --system \
--uid ${WAZUH_UID} \ --uid 1000 \
--no-create-home \ --no-create-home \
--home-dir $INSTALL_DIR \ --home-dir $INSTALL_DIR \
--gid $GROUP \ --gid $GROUP \
--shell /sbin/nologin \ --shell /sbin/nologin \
--comment "$USER user" \ --comment "$USER user" \
$USER && \ $USER && \
chmod 700 /entrypoint.sh && \ chmod 700 /entrypoint.sh && \
chmod 700 /wazuh_dashboard_config.sh && \ chmod 700 /wazuh_dashboard_config.sh && \
mkdir -p $INSTALL_DIR && \ mkdir -p $INSTALL_DIR && \
chown ${WAZUH_UID}:${WAZUH_GID} $INSTALL_DIR && \ chown 1000:1000 $INSTALL_DIR && \
chown ${WAZUH_UID}:${WAZUH_GID} /*.sh && \ chown 1000:1000 /*.sh && \
mkdir -p /usr/share/wazuh-dashboard/plugins/wazuh/public/assets/custom mkdir -p /usr/share/wazuh-dashboard/plugins/wazuh/public/assets/custom
# Copy Install dir from builder to current image # Copy Install dir from builder to current image
COPY --from=builder $INSTALL_DIR $INSTALL_DIR COPY --from=builder --chown=1000:1000 $INSTALL_DIR $INSTALL_DIR
COPY --from=builder /etc/wazuh-dashboard $INSTALL_DIR/config/ COPY --from=builder --chown=1000:1000 /etc/wazuh-dashboard $INSTALL_DIR/config/
# Set workdir and user # Set workdir and user
WORKDIR $INSTALL_DIR WORKDIR $INSTALL_DIR
+13 -42
View File
@@ -7,28 +7,10 @@ ARG wazuh_indexer_x86_64_rpm
ARG wazuh_indexer_aarch64_rpm ARG wazuh_indexer_aarch64_rpm
ARG wazuh_certs_tool ARG wazuh_certs_tool
ARG wazuh_config_yml ARG wazuh_config_yml
ARG WAZUH_UID=101
ARG WAZUH_GID=101
ENV USER="wazuh-indexer" \
GROUP="wazuh-indexer" \
NAME="wazuh-indexer" \
INSTALL_DIR="/usr/share/wazuh-indexer"
COPY config/config.sh . COPY config/config.sh .
RUN yum install curl-minimal shadow-utils findutils hostname -y && \ RUN RPM_ARCH="x86_64" && \
yum clean all && \
getent group $GROUP || groupadd -r -g ${WAZUH_GID} $GROUP && \
useradd --system \
--uid ${WAZUH_UID} \
--no-create-home \
--home-dir $INSTALL_DIR \
--gid ${WAZUH_GID} \
--shell /sbin/nologin \
--comment "$USER user" \
$USER && \
RPM_ARCH="x86_64" && \
if [ "${TARGETARCH}" = "arm64" ]; then RPM_ARCH="aarch64"; fi && \ if [ "${TARGETARCH}" = "arm64" ]; then RPM_ARCH="aarch64"; fi && \
URL_VAR="wazuh_indexer_${RPM_ARCH}_rpm" && \ URL_VAR="wazuh_indexer_${RPM_ARCH}_rpm" && \
indexer_url="${!URL_VAR}" && \ indexer_url="${!URL_VAR}" && \
@@ -47,14 +29,10 @@ RUN yum install curl-minimal shadow-utils findutils hostname -y && \
################################################################################ ################################################################################
FROM amazonlinux:2023 FROM amazonlinux:2023
ARG WAZUH_UID=101
ARG WAZUH_GID=101
ENV USER="wazuh-indexer" \ ENV USER="wazuh-indexer" \
GROUP="wazuh-indexer" \ GROUP="wazuh-indexer" \
NAME="wazuh-indexer" \ NAME="wazuh-indexer" \
INSTALL_DIR="/usr/share/wazuh-indexer" INSTALL_DIR="/usr/share/wazuh-indexer"
ENV ENGINE_DIR="$INSTALL_DIR/engine"
COPY config/entrypoint.sh / COPY config/entrypoint.sh /
@@ -62,37 +40,30 @@ COPY config/securityadmin.sh /
RUN yum install curl-minimal shadow-utils findutils hostname -y && \ RUN yum install curl-minimal shadow-utils findutils hostname -y && \
yum clean all && \ yum clean all && \
getent group $GROUP || groupadd -r -g ${WAZUH_GID} $GROUP && \ getent group $GROUP || groupadd -r -g 1000 $GROUP && \
useradd --system \ useradd --system \
--uid ${WAZUH_UID} \ --uid 1000 \
--no-create-home \ --no-create-home \
--home-dir $INSTALL_DIR \ --home-dir $INSTALL_DIR \
--gid ${WAZUH_GID} \ --gid $GROUP \
--shell /sbin/nologin \ --shell /sbin/nologin \
--comment "$USER user" \ --comment "$USER user" \
$USER && \ $USER && \
chmod 700 /entrypoint.sh && chmod 700 /securityadmin.sh && \ chmod 700 /entrypoint.sh && chmod 700 /securityadmin.sh && \
mkdir -p $INSTALL_DIR && \ mkdir -p $INSTALL_DIR && \
chown ${WAZUH_UID}:${WAZUH_GID} $INSTALL_DIR && \ chown 1000:1000 $INSTALL_DIR && \
chown ${WAZUH_UID}:${WAZUH_GID} /*.sh && \ chown 1000:1000 /*.sh && \
mkdir -p /var/lib/wazuh-indexer && chown ${WAZUH_UID}:${WAZUH_GID} /var/lib/wazuh-indexer && \ mkdir -p /var/lib/wazuh-indexer && chown 1000:1000 /var/lib/wazuh-indexer && \
mkdir -p $INSTALL_DIR/logs && chown ${WAZUH_UID}:${WAZUH_GID} $INSTALL_DIR/logs && \ mkdir -p $INSTALL_DIR/logs && chown 1000:1000 $INSTALL_DIR/logs && \
mkdir -p /run/wazuh-indexer && chown ${WAZUH_UID}:${WAZUH_GID} /run/wazuh-indexer && \ mkdir -p /run/wazuh-indexer && chown 1000:1000 /run/wazuh-indexer && \
mkdir -p /var/log/wazuh-indexer && chown ${WAZUH_UID}:${WAZUH_GID} /var/log/wazuh-indexer mkdir -p /var/log/wazuh-indexer && chown 1000:1000 /var/log/wazuh-indexer
COPY --from=builder $INSTALL_DIR $INSTALL_DIR COPY --from=builder --chown=1000:1000 $INSTALL_DIR $INSTALL_DIR
RUN chmod 700 $INSTALL_DIR && \ RUN chmod 700 $INSTALL_DIR && \
chmod 700 $INSTALL_DIR/config && \ chmod 700 $INSTALL_DIR/config && \
chmod 600 $INSTALL_DIR/config/jvm.options && \ chmod 600 $INSTALL_DIR/config/jvm.options && \
chmod 600 $INSTALL_DIR/config/opensearch.yml && \ chmod 600 $INSTALL_DIR/config/opensearch.yml
if [ -d "$ENGINE_DIR" ]; then \
find "$ENGINE_DIR" -type d -exec chmod 750 {} + && \
find "$ENGINE_DIR" -type f -exec chmod 640 {} + && \
{ [ -f "$ENGINE_DIR/run_engine.sh" ] && chmod 750 "$ENGINE_DIR/run_engine.sh" || true; } && \
{ [ -f "$ENGINE_DIR/bin/wazuh-engine" ] && chmod 750 "$ENGINE_DIR/bin/wazuh-engine" || true; } && \
{ [ -d "$ENGINE_DIR/sockets" ] && chmod 777 "$ENGINE_DIR/sockets" || true; }; \
fi
USER wazuh-indexer USER wazuh-indexer
WORKDIR $INSTALL_DIR WORKDIR $INSTALL_DIR
@@ -13,9 +13,7 @@ export CONFIG_DIR=${INSTALLATION_DIR}/config
# Modify opensearch.yml config paths # Modify opensearch.yml config paths
if [ -d "/etc/wazuh-indexer" ]; then if [ -d "/etc/wazuh-indexer" ]; then
mkdir -p ${CONFIG_DIR} mkdir -p ${CONFIG_DIR}
chown ${USER}:${GROUP} ${CONFIG_DIR}
mkdir -p ${CONFIG_DIR}/certs mkdir -p ${CONFIG_DIR}/certs
chown ${USER}:${GROUP} ${CONFIG_DIR}/certs
mv /etc/wazuh-indexer/* ${CONFIG_DIR}/ mv /etc/wazuh-indexer/* ${CONFIG_DIR}/
rmdir /etc/wazuh-indexer rmdir /etc/wazuh-indexer
fi fi
@@ -58,12 +58,6 @@ function runOpensearch {
fi fi
done < <(env) done < <(env)
# Start Wazuh Engine
if [ -x "$OPENSEARCH_HOME/engine/run_engine.sh" ]; then
nohup "$OPENSEARCH_HOME/engine/run_engine.sh" > /dev/null 2>&1 &
echo $! > /run/wazuh-indexer/wazuh-engine.pid
fi
# Start opensearch # Start opensearch
exec "$@" "${opensearch_opts[@]}" exec "$@" "${opensearch_opts[@]}"
+26 -74
View File
@@ -1,101 +1,53 @@
# Wazuh Docker Copyright (C) 2017, Wazuh Inc. (License GPLv2) # Wazuh Docker Copyright (C) 2017, Wazuh Inc. (License GPLv2)
FROM amazonlinux:2023
################################################################################ RUN rm /bin/sh && ln -s /bin/bash /bin/sh
# Build stage 0 (builder):
# Install Wazuh Manager RPM, configure directories, prepare permanent data,
# and download tini (static PID-1 init shim).
################################################################################
FROM amazonlinux:2023 AS builder
ARG WAZUH_VERSION ARG WAZUH_VERSION
ARG TINI_VERSION="v0.19.0" ARG S6_VERSION="v2.2.0.3"
ARG TARGETARCH ARG TARGETARCH
ARG wazuh_manager_x86_64_rpm ARG wazuh_manager_x86_64_rpm
ARG wazuh_manager_aarch64_rpm ARG wazuh_manager_aarch64_rpm
ARG WAZUH_UID=101
ARG WAZUH_GID=101
# Prepare permanent data config needed by permanent_data.sh at build time RUN RPM_ARCH="x86_64" && \
COPY config/permanent_data.env config/permanent_data.sh /
RUN dnf install openssl findutils procps shadow-utils -y && \
dnf clean all && \
getent group wazuh-manager || groupadd -r -g ${WAZUH_GID} wazuh-manager && \
getent passwd wazuh-manager || useradd --system \
--no-create-home \
--home-dir /var/wazuh-manager \
--uid ${WAZUH_UID} \
--gid ${WAZUH_GID} \
--shell /sbin/nologin \
wazuh-manager && \
RPM_ARCH="x86_64" && \
if [ "${TARGETARCH}" = "arm64" ]; then RPM_ARCH="aarch64"; fi && \ if [ "${TARGETARCH}" = "arm64" ]; then RPM_ARCH="aarch64"; fi && \
URL_VAR="wazuh_manager_${RPM_ARCH}_rpm" && \ URL_VAR="wazuh_manager_${RPM_ARCH}_rpm" && \
manager_url="${!URL_VAR}" && \ manager_url="${!URL_VAR}" && \
dnf install curl-minimal xz gnupg tar gzip -y && \ dnf install curl-minimal xz gnupg tar gzip openssl findutils procps -y &&\
dnf clean all && \ dnf clean all && \
curl -o /wazuh-manager.rpm "${manager_url}" && \ curl -o /wazuh-manager.rpm "${manager_url}" && \
dnf install /wazuh-manager.rpm -y && \ dnf install /wazuh-manager.rpm -y && \
rm -rf /wazuh-manager.rpm && \ rm -rf /wazuh-manager.rpm && \
dnf clean all && \ dnf clean all && \
# Set up required directories with correct ownership S6_ARCH="amd64" && \
mkdir -p /var/wazuh-manager/var/multigroups && \ if [ "${TARGETARCH}" = "arm64" ]; then S6_ARCH="aarch64"; fi && \
curl --fail --silent -L https://github.com/just-containers/s6-overlay/releases/download/${S6_VERSION}/s6-overlay-${S6_ARCH}.tar.gz \
-o /tmp/s6-overlay-${S6_ARCH}.tar.gz && \
tar xzf /tmp/s6-overlay-${S6_ARCH}.tar.gz -C / --exclude="./bin" && \
tar xzf /tmp/s6-overlay-${S6_ARCH}.tar.gz -C /usr ./bin && \
rm /tmp/s6-overlay-${S6_ARCH}.tar.gz && \
rm -f /var/wazuh-manager/etc/sslmanager.key && \
rm -f /var/wazuh-manager/etc/sslmanager.cert
COPY config/etc/ /etc/
# Prepare permanent data
# Sync calls are due to https://github.com/docker/docker/issues/9547
COPY config/permanent_data.env config/permanent_data.sh /
#Make mount directories for keep permissions
RUN mkdir -p /var/wazuh-manager/var/multigroups && \
chown root:wazuh-manager /var/wazuh-manager/var/multigroups && \ chown root:wazuh-manager /var/wazuh-manager/var/multigroups && \
chmod 770 /var/wazuh-manager/var/multigroups && \ chmod 770 /var/wazuh-manager/var/multigroups && \
mkdir -p /var/wazuh-manager/etc/certs && \ mkdir -p /var/wazuh-manager/etc/certs && \
chown wazuh-manager:wazuh-manager /var/wazuh-manager/etc/certs && \ chown wazuh-manager:wazuh-manager /var/wazuh-manager/etc/certs && \
chmod 500 /var/wazuh-manager/etc/certs && \ chmod 500 /var/wazuh-manager/etc/certs && \
rm -f /var/wazuh-manager/etc/sslmanager.key && \ chmod 755 /permanent_data.sh && \
rm -f /var/wazuh-manager/etc/sslmanager.cert
# Prepare permanent data snapshot (sync calls: https://github.com/docker/docker/issues/9547)
RUN chmod 755 /permanent_data.sh && \
sync && /permanent_data.sh && \ sync && /permanent_data.sh && \
sync && rm /permanent_data.sh sync && rm /permanent_data.sh
# Download tini static binary (no external library dependencies)
RUN curl --fail --silent -L \
https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini-static-${TARGETARCH} \
-o /usr/local/bin/tini && \
chmod +x /usr/local/bin/tini
################################################################################
# Build stage 1 (the actual Wazuh Manager image):
# Copy Wazuh Manager and tini from builder. Install only runtime dependencies.
################################################################################
FROM amazonlinux:2023
ARG WAZUH_UID=101
ARG WAZUH_GID=101
RUN rm /bin/sh && ln -s /bin/bash /bin/sh
# Install only runtime dependencies (no curl, tar, gzip, xz, or full dnf stack)
RUN dnf install openssl findutils procps shadow-utils -y && \
dnf clean all && \
getent group wazuh-manager || groupadd -r -g ${WAZUH_GID} wazuh-manager && \
getent passwd wazuh-manager || useradd --system \
--no-create-home \
--home-dir /var/wazuh-manager \
--uid ${WAZUH_UID} \
--gid ${WAZUH_GID} \
--shell /sbin/nologin \
wazuh-manager
# Copy Wazuh Manager installation (includes permanent data snapshot)
COPY --from=builder /var/wazuh-manager /var/wazuh-manager
# Copy tini static binary
COPY --from=builder /usr/local/bin/tini /usr/local/bin/tini
# Copy entrypoint, init scripts and runtime config
COPY config/entrypoint.sh /entrypoint.sh
COPY config/etc/ /etc/
COPY config/permanent_data.env /
RUN chmod 755 /entrypoint.sh
# Services ports # Services ports
EXPOSE 55000/tcp 1514/tcp 1515/tcp 514/udp 1516/tcp EXPOSE 55000/tcp 1514/tcp 1515/tcp 514/udp 1516/tcp
ENTRYPOINT ["/usr/local/bin/tini", "--", "/entrypoint.sh"] ENTRYPOINT [ "/init" ]
@@ -1,22 +0,0 @@
#!/bin/bash
# Wazuh Docker Copyright (C) 2017, Wazuh Inc. (License GPLv2)
# Run initialization and configuration
bash /etc/cont-init.d/0-wazuh-init
# Start Wazuh Manager (may log warnings in environments without certs)
bash /etc/cont-init.d/1-manager
# Tail the main log to stdout so Docker captures it
tail -F /var/wazuh-manager/logs/wazuh-manager.log &
TAIL_PID=$!
# Graceful shutdown: stop Wazuh and exit cleanly on SIGTERM/SIGINT
_stop() {
echo "Stopping Wazuh Manager..."
/var/wazuh-manager/bin/wazuh-manager-control stop 2>/dev/null || true
kill "${TAIL_PID}" 2>/dev/null || true
}
trap _stop SIGTERM SIGINT SIGQUIT
wait "${TAIL_PID}"
@@ -1,4 +1,4 @@
#!/bin/bash #!/usr/bin/with-contenv bash
# Wazuh App Copyright (C) 2017, Wazuh Inc. (License GPLv2) # Wazuh App Copyright (C) 2017, Wazuh Inc. (License GPLv2)
# Variables # Variables
@@ -252,9 +252,9 @@ configure_permissions() {
############################################################################## ##############################################################################
set_correct_permOwner() { set_correct_permOwner() {
find /var/wazuh-manager/ -group 997 -exec chown :101 {} +; find /var/wazuh-manager/ -group 997 -exec chown :999 {} +;
find /var/wazuh-manager/ -group 999 -exec chown :101 {} +; find /var/wazuh-manager/ -group 101 -exec chown :999 {} +;
find /var/wazuh-manager/ -user 999 -exec chown 101:{} +; find /var/wazuh-manager/ -user 101 -exec chown 999 {} +;
} }
############################################################################## ##############################################################################
@@ -1,4 +1,4 @@
#!/bin/bash #!/usr/bin/with-contenv bash
############################################################################## ##############################################################################
# Migration sequence # Migration sequence
@@ -1,4 +1,4 @@
#!/bin/sh #!/usr/bin/with-contenv sh
# dumping wazuh-manager.log to standard output # dumping wazuh-manager.log to standard output
exec tail -F /var/wazuh-manager/logs/wazuh-manager.log exec tail -F /var/wazuh-manager/logs/wazuh-manager.log
+1 -1
View File
@@ -28,7 +28,7 @@ The folder `wazuh-agent` contains a README explaining how to run a container wit
├── build-docker-images ├── build-docker-images
│   ├── build-images.sh │   ├── build-images.sh
│   ├── docker-bake.hcl │   ├── build-images.yml
│   ├── README.md │   ├── README.md
│   ├── wazuh-agent │   ├── wazuh-agent
│   │   ├── config │   │   ├── config
+1 -1
View File
@@ -38,7 +38,7 @@ The Procedure_push_docker_images.yml workflow builds and pushes multi-architectu
2. **Multi-architecture Build**: 2. **Multi-architecture Build**:
- Uses Docker Buildx with QEMU for cross-platform builds - Uses Docker Buildx with QEMU for cross-platform builds
- Builds for `linux/amd64` and `linux/arm64` - Builds for `linux/amd64` and `linux/arm64`
- Leverages `docker-bake.hcl` for parallel multi-arch build configuration - Leverages `build-images.yml` for build configuration
3. **Image Publishing**: 3. **Image Publishing**:
- Tags images appropriately based on mode - Tags images appropriately based on mode
+283
View File
@@ -0,0 +1,283 @@
# Opendistro data migration to Wazuh indexer on docker.
This procedure explains how to migrate Opendistro data from Opendistro to Wazuh indexer in docker production deployments.
The example is migrating from v4.2 to v4.4.
## Procedure
Assuming that you have a v4.2 production deployment, perform the following steps.
**1. Stop 4.2 environment**
`docker-compose -f production-cluster.yml stop`
**2. List elasticsearch volumes**
`docker volume ls --filter name='wazuh-docker_elastic-data'`
**3. Inspect elasticsearch volume**
`docker volume inspect wazuh-docker_elastic-data-1`
**4. Spin down the 4.2 environment.**
`docker-compose -f production-cluster.yml down`
**Steps 5 and 6 can be done with the volume-migrator.sh script, specifying Docker compose version and project name as parameters.**
Ex: $ multi-node/volume-migrator.sh 1.25.0 multi-node
**5. Run the volume create command:** create new indexer and Wazuh manager volumes using the `com.docker.compose.version` label value from the previous command.
```
docker volume create \
--label com.docker.compose.project=multi-node \
--label com.docker.compose.version=1.25.0 \
--label com.docker.compose.volume=wazuh-indexer-data-1 \
multi-node_wazuh-indexer-data-1
```
```
docker volume create \
--label com.docker.compose.project=multi-node \
--label com.docker.compose.version=1.25.0 \
--label com.docker.compose.volume=wazuh-indexer-data-2 \
multi-node_wazuh-indexer-data-2
```
```
docker volume create \
--label com.docker.compose.project=multi-node \
--label com.docker.compose.version=1.25.0 \
--label com.docker.compose.volume=wazuh-indexer-data-3 \
multi-node_wazuh-indexer-data-3
```
```
docker volume create \
--label com.docker.compose.project=multi-node \
--label com.docker.compose.version=1.25.0 \
--label com.docker.compose.volume=master_wazuh_api_configuration \
multi-node_master_wazuh_api_configuration
```
```
docker volume create \
--label com.docker.compose.project=multi-node \
--label com.docker.compose.version=1.25.0 \
--label com.docker.compose.volume=master_wazuh_etc \
multi-node_docker_wazuh_etc
```
```
docker volume create \
--label com.docker.compose.project=multi-node \
--label com.docker.compose.version=1.25.0 \
--label com.docker.compose.volume=master-wazuh-logs \
multi-node_master-wazuh-logs
```
```
docker volume create \
--label com.docker.compose.project=multi-node \
--label com.docker.compose.version=1.25.0 \
--label com.docker.compose.volume=master-wazuh-queue \
multi-node_master-wazuh-queue
```
```
docker volume create \
--label com.docker.compose.project=multi-node \
--label com.docker.compose.version=1.25.0 \
--label com.docker.compose.volume=master-wazuh-var-multigroups \
multi-node_master-wazuh-var-multigroups
```
```
docker volume create \
--label com.docker.compose.project=multi-node \
--label com.docker.compose.version=1.25.0 \
--label com.docker.compose.volume=master-wazuh-active-response \
multi-node_master-wazuh-active-response
```
```
docker volume create \
--label com.docker.compose.project=multi-node \
--label com.docker.compose.version=1.25.0 \
--label com.docker.compose.volume=master-wazuh-etc \
multi-node_master-wazuh-etc
```
```
docker volume create \
--label com.docker.compose.project=multi-node \
--label com.docker.compose.version=1.25.0 \
--label com.docker.compose.volume=master-wazuh-var \
multi-node_master-wazuh-var
```
```
docker volume create \
--label com.docker.compose.project=multi-node \
--label com.docker.compose.version=1.25.0 \
--label com.docker.compose.volume=worker_wazuh_api_configuration \
multi-node_worker_wazuh_api_configuration
```
```
docker volume create \
--label com.docker.compose.project=multi-node \
--label com.docker.compose.version=1.25.0 \
--label com.docker.compose.volume=worker_wazuh_etc \
multi-node_worker-wazuh-etc
```
```
docker volume create \
--label com.docker.compose.project=multi-node \
--label com.docker.compose.version=1.25.0 \
--label com.docker.compose.volume=worker-wazuh-logs \
multi-node_worker-wazuh-logs
```
```
docker volume create \
--label com.docker.compose.project=multi-node \
--label com.docker.compose.version=1.25.0 \
--label com.docker.compose.volume=worker-wazuh-queue \
multi-node_worker-wazuh-queue
```
```
docker volume create \
--label com.docker.compose.project=multi-node \
--label com.docker.compose.version=1.25.0 \
--label com.docker.compose.volume=worker-wazuh-var-multigroups \
multi-node_worker-wazuh-var-multigroups
```
```
docker volume create \
--label com.docker.compose.project=multi-node \
--label com.docker.compose.version=1.25.0 \
--label com.docker.compose.volume=worker-wazuh-active-response \
multi-node_worker-wazuh-active-response
```
```
docker volume create \
--label com.docker.compose.project=multi-node \
--label com.docker.compose.version=1.25.0 \
--label com.docker.compose.volume=worker-wazuh-etc \
multi-node_worker-wazuh-etc
```
```
docker volume create \
--label com.docker.compose.project=multi-node \
--label com.docker.compose.version=1.25.0 \
--label com.docker.compose.volume=worker-wazuh-var \
multi-node_worker-wazuh-var
```
**6. Copy the volume content from elasticsearch to Wazuh indexer volumes and old Wazuh manager content to new volumes.**
```
docker container run --rm -it \
-v wazuh-docker_elastic-data-1:/from \
-v multi-node_wazuh-indexer-data-1:/to \
alpine ash -c "cd /from ; cp -avp . /to"
```
```
docker container run --rm -it \
-v wazuh-docker_elastic-data-2:/from \
-v multi-node_wazuh-indexer-data-2:/to \
alpine ash -c "cd /from ; cp -avp . /to"
```
```
docker container run --rm -it \
-v wazuh-docker_elastic-data-3:/from \
-v multi-node_wazuh-indexer-data-3:/to \
alpine ash -c "cd /from ; cp -avp . /to"
```
```
docker container run --rm -it \
-v wazuh-docker_ossec-api-configuration:/from \
-v multi-node_master-wazuh-api-configuration:/to \
alpine ash -c "cd /from ; cp -avp . /to"
```
```
docker container run --rm -it \
-v wazuh-docker_ossec-etc:/from \
-v multi-node_master-wazuh-etc:/to \
alpine ash -c "cd /from ; cp -avp . /to"
```
```
docker container run --rm -it \
-v wazuh-docker_ossec-logs:/from \
-v multi-node_master-wazuh-logs:/to \
alpine ash -c "cd /from ; cp -avp . /to"
```
```
docker container run --rm -it \
-v wazuh-docker_ossec-queue:/from \
-v multi-node_master-wazuh-queue:/to \
alpine ash -c "cd /from ; cp -avp . /to"
```
```
docker container run --rm -it \
-v wazuh-docker_ossec-var-multigroups:/from \
-v multi-node_master-wazuh-var-multigroups:/to \
alpine ash -c "cd /from ; cp -avp . /to"
```
```
docker container run --rm -it \
-v wazuh-docker_ossec-active-response:/from \
-v multi-node_master-wazuh-active-response:/to \
alpine ash -c "cd /from ; cp -avp . /to"
```
```
docker container run --rm -it \
-v wazuh-docker-etc:/from \
-v multi-node_master-etc:/to \
alpine ash -c "cd /from ; cp -avp . /to"
```
```
docker container run --rm -it \
-v wazuh-docker-var:/from \
-v multi-node_master-wazuh-var:/to \
alpine ash -c "cd /from ; cp -avp . /to"
```
```
docker container run --rm -it \
-v wazuh-docker_worker-ossec-api-configuration:/from \
-v multi-node_worker-wazuh-api-configuration:/to \
alpine ash -c "cd /from ; cp -avp . /to"
```
```
docker container run --rm -it \
-v wazuh-docker_worker-ossec-etc:/from \
-v multi-node_worker-wazuh-etc:/to \
alpine ash -c "cd /from ; cp -avp . /to"
```
```
docker container run --rm -it \
-v wazuh-docker_worker-ossec-logs:/from \
-v multi-node_worker-wazuh-logs:/to \
alpine ash -c "cd /from ; cp -avp . /to"
```
```
docker container run --rm -it \
-v wazuh-docker_worker-ossec-queue:/from \
-v multi-node_worker-wazuh-queue:/to \
alpine ash -c "cd /from ; cp -avp . /to"
```
```
docker container run --rm -it \
-v wazuh-docker_worker-ossec-var-multigroups:/from \
-v multi-node_worker-wazuh-var-multigroups:/to \
alpine ash -c "cd /from ; cp -avp . /to"
```
```
docker container run --rm -it \
-v wazuh-docker_worker-ossec-active-response:/from \
-v multi-node_worker-wazuh-active-response:/to \
alpine ash -c "cd /from ; cp -avp . /to"
```
```
docker container run --rm -it \
-v wazuh-docker_worker-etc:/from \
-v multi-node_worker-wazuh-etc:/to \
alpine ash -c "cd /from ; cp -avp . /to"
```
```
docker container run --rm -it \
-v wazuh-docker_worker-var:/from \
-v multi-node_worker-wazuh-var:/to \
alpine ash -c "cd /from ; cp -avp . /to"
```
**7. Start the 4.4 environment.**
```
git checkout 4.4
cd multi-node
docker-compose -f generate-indexer-certs.yml run --rm generator
docker-compose up -d
```
**8. Check the access to Wazuh dashboard**: go to the Wazuh dashboard using the web browser and check the data.
+11 -12
View File
@@ -9,11 +9,10 @@ services:
wazuh1.indexer: wazuh1.indexer:
condition: service_healthy condition: service_healthy
healthcheck: healthcheck:
test: [ "CMD-SHELL", "/var/wazuh-manager/bin/wazuh-manager-control status 2>/dev/null | grep -q 'not running' && exit 1 || exit 0" ] test: [ "CMD-SHELL", "curl -k -s -o /dev/null https://localhost:55000 || exit 1" ]
interval: 15s interval: 15s
timeout: 5s timeout: 5s
retries: 5 retries: 5
start_period: 60s
ulimits: ulimits:
memlock: memlock:
soft: -1 soft: -1
@@ -39,7 +38,7 @@ services:
- master-wazuh-logs:/var/wazuh-manager/logs - master-wazuh-logs:/var/wazuh-manager/logs
- master-wazuh-queue:/var/wazuh-manager/queue - master-wazuh-queue:/var/wazuh-manager/queue
- master-wazuh-var-multigroups:/var/wazuh-manager/var/multigroups - master-wazuh-var-multigroups:/var/wazuh-manager/var/multigroups
- ./config/root-ca/certs/root-ca.pem:/var/wazuh-manager/etc/certs/root-ca.pem - ./config/wazuh_master/certs/root-ca.pem:/var/wazuh-manager/etc/certs/root-ca.pem
- ./config/wazuh_master/certs/wazuh.master.pem:/var/wazuh-manager/etc/certs/manager.pem - ./config/wazuh_master/certs/wazuh.master.pem:/var/wazuh-manager/etc/certs/manager.pem
- ./config/wazuh_master/certs/wazuh.master-key.pem:/var/wazuh-manager/etc/certs/manager-key.pem - ./config/wazuh_master/certs/wazuh.master-key.pem:/var/wazuh-manager/etc/certs/manager-key.pem
@@ -49,11 +48,11 @@ services:
container_name: multi-node-wazuh.worker container_name: multi-node-wazuh.worker
restart: always restart: always
healthcheck: healthcheck:
test: [ "CMD-SHELL", "/var/wazuh-manager/bin/wazuh-manager-control status 2>/dev/null | grep -v apid | grep -q 'not running' && exit 1 || exit 0" ] test: [ "CMD-SHELL", "timeout 2 bash -c '</dev/tcp/localhost/1514' || exit 1" ]
interval: 15s interval: 5s
timeout: 5s timeout: 5s
retries: 5 retries: 10
start_period: 60s start_period: 30s
ulimits: ulimits:
memlock: memlock:
soft: -1 soft: -1
@@ -78,7 +77,7 @@ services:
- worker-wazuh-logs:/var/wazuh-manager/logs - worker-wazuh-logs:/var/wazuh-manager/logs
- worker-wazuh-queue:/var/wazuh-manager/queue - worker-wazuh-queue:/var/wazuh-manager/queue
- worker-wazuh-var-multigroups:/var/wazuh-manager/var/multigroups - worker-wazuh-var-multigroups:/var/wazuh-manager/var/multigroups
- ./config/root-ca/certs/root-ca.pem:/var/wazuh-manager/etc/certs/root-ca.pem - ./config/wazuh_worker/certs/root-ca.pem:/var/wazuh-manager/etc/certs/root-ca.pem
- ./config/wazuh_worker/certs/wazuh.worker.pem:/var/wazuh-manager/etc/certs/manager.pem - ./config/wazuh_worker/certs/wazuh.worker.pem:/var/wazuh-manager/etc/certs/manager.pem
- ./config/wazuh_worker/certs/wazuh.worker-key.pem:/var/wazuh-manager/etc/certs/manager-key.pem - ./config/wazuh_worker/certs/wazuh.worker-key.pem:/var/wazuh-manager/etc/certs/manager-key.pem
@@ -114,7 +113,7 @@ services:
start_period: 60s start_period: 60s
volumes: volumes:
- wazuh-indexer-data-1:/var/lib/wazuh-indexer - wazuh-indexer-data-1:/var/lib/wazuh-indexer
- ./config/root-ca/certs/root-ca.pem:/usr/share/wazuh-indexer/config/certs/root-ca.pem - ./config/wazuh1_indexer/certs/root-ca.pem:/usr/share/wazuh-indexer/config/certs/root-ca.pem
- ./config/wazuh1_indexer/certs/wazuh1.indexer-key.pem:/usr/share/wazuh-indexer/config/certs/indexer-key.pem - ./config/wazuh1_indexer/certs/wazuh1.indexer-key.pem:/usr/share/wazuh-indexer/config/certs/indexer-key.pem
- ./config/wazuh1_indexer/certs/wazuh1.indexer.pem:/usr/share/wazuh-indexer/config/certs/indexer.pem - ./config/wazuh1_indexer/certs/wazuh1.indexer.pem:/usr/share/wazuh-indexer/config/certs/indexer.pem
- ./config/wazuh1_indexer/certs/admin.pem:/usr/share/wazuh-indexer/config/certs/admin.pem - ./config/wazuh1_indexer/certs/admin.pem:/usr/share/wazuh-indexer/config/certs/admin.pem
@@ -154,7 +153,7 @@ services:
start_period: 60s start_period: 60s
volumes: volumes:
- wazuh-indexer-data-2:/var/lib/wazuh-indexer - wazuh-indexer-data-2:/var/lib/wazuh-indexer
- ./config/root-ca/certs/root-ca.pem:/usr/share/wazuh-indexer/config/certs/root-ca.pem - ./config/wazuh2_indexer/certs/root-ca.pem:/usr/share/wazuh-indexer/config/certs/root-ca.pem
- ./config/wazuh2_indexer/certs/wazuh2.indexer-key.pem:/usr/share/wazuh-indexer/config/certs/indexer-key.pem - ./config/wazuh2_indexer/certs/wazuh2.indexer-key.pem:/usr/share/wazuh-indexer/config/certs/indexer-key.pem
- ./config/wazuh2_indexer/certs/wazuh2.indexer.pem:/usr/share/wazuh-indexer/config/certs/indexer.pem - ./config/wazuh2_indexer/certs/wazuh2.indexer.pem:/usr/share/wazuh-indexer/config/certs/indexer.pem
@@ -192,7 +191,7 @@ services:
start_period: 60s start_period: 60s
volumes: volumes:
- wazuh-indexer-data-3:/var/lib/wazuh-indexer - wazuh-indexer-data-3:/var/lib/wazuh-indexer
- ./config/root-ca/certs/root-ca.pem:/usr/share/wazuh-indexer/config/certs/root-ca.pem - ./config/wazuh3_indexer/certs/root-ca.pem:/usr/share/wazuh-indexer/config/certs/root-ca.pem
- ./config/wazuh3_indexer/certs/wazuh3.indexer-key.pem:/usr/share/wazuh-indexer/config/certs/indexer-key.pem - ./config/wazuh3_indexer/certs/wazuh3.indexer-key.pem:/usr/share/wazuh-indexer/config/certs/indexer-key.pem
- ./config/wazuh3_indexer/certs/wazuh3.indexer.pem:/usr/share/wazuh-indexer/config/certs/indexer.pem - ./config/wazuh3_indexer/certs/wazuh3.indexer.pem:/usr/share/wazuh-indexer/config/certs/indexer.pem
@@ -224,7 +223,7 @@ services:
volumes: volumes:
- ./config/wazuh_dashboard/certs/wazuh.dashboard.pem:/usr/share/wazuh-dashboard/config/certs/wazuh-dashboard.pem - ./config/wazuh_dashboard/certs/wazuh.dashboard.pem:/usr/share/wazuh-dashboard/config/certs/wazuh-dashboard.pem
- ./config/wazuh_dashboard/certs/wazuh.dashboard-key.pem:/usr/share/wazuh-dashboard/config/certs/wazuh-dashboard-key.pem - ./config/wazuh_dashboard/certs/wazuh.dashboard-key.pem:/usr/share/wazuh-dashboard/config/certs/wazuh-dashboard-key.pem
- ./config/root-ca/certs/root-ca.pem:/usr/share/wazuh-dashboard/config/certs/root-ca.pem - ./config/wazuh_dashboard/certs/root-ca.pem:/usr/share/wazuh-dashboard/config/certs/root-ca.pem
- wazuh-dashboard-config:/usr/share/wazuh-dashboard/config - wazuh-dashboard-config:/usr/share/wazuh-dashboard/config
- wazuh-dashboard-custom:/usr/share/wazuh-dashboard/plugins/wazuh/public/assets/custom - wazuh-dashboard-custom:/usr/share/wazuh-dashboard/plugins/wazuh/public/assets/custom
depends_on: depends_on:
+213
View File
@@ -0,0 +1,213 @@
docker volume create \
--label com.docker.compose.project=$2 \
--label com.docker.compose.version=$1 \
--label com.docker.compose.volume=wazuh-indexer-data-1 \
$2_wazuh-indexer-data-1
docker volume create \
--label com.docker.compose.project=$2 \
--label com.docker.compose.version=$1 \
--label com.docker.compose.volume=wazuh-indexer-data-2 \
$2_wazuh-indexer-data-2
docker volume create \
--label com.docker.compose.project=$2 \
--label com.docker.compose.version=$1 \
--label com.docker.compose.volume=wazuh-indexer-data-3 \
$2_wazuh-indexer-data-3
docker volume create \
--label com.docker.compose.project=$2 \
--label com.docker.compose.version=$1 \
--label com.docker.compose.volume=master_wazuh_api_configuration \
$2_master_wazuh_api_configuration
docker volume create \
--label com.docker.compose.project=$2 \
--label com.docker.compose.version=$1 \
--label com.docker.compose.volume=master_wazuh_etc \
$2_docker_wazuh_etc
docker volume create \
--label com.docker.compose.project=$2 \
--label com.docker.compose.version=$1 \
--label com.docker.compose.volume=master-wazuh-logs \
$2_master-wazuh-logs
docker volume create \
--label com.docker.compose.project=$2 \
--label com.docker.compose.version=$1 \
--label com.docker.compose.volume=master-wazuh-queue \
$2_master-wazuh-queue
docker volume create \
--label com.docker.compose.project=$2 \
--label com.docker.compose.version=$1 \
--label com.docker.compose.volume=master-wazuh-var-multigroups \
$2_master-wazuh-var-multigroups
docker volume create \
--label com.docker.compose.project=$2 \
--label com.docker.compose.version=$1 \
--label com.docker.compose.volume=master-wazuh-active-response \
$2_master-wazuh-active-response
docker volume create \
--label com.docker.compose.project=$2 \
--label com.docker.compose.version=$1 \
--label com.docker.compose.volume=master-wazuh-etc \
$2_master-wazuh-etc
docker volume create \
--label com.docker.compose.project=$2 \
--label com.docker.compose.version=$1 \
--label com.docker.compose.volume=master-wazuh-var \
$2_master-wazuh-var
docker volume create \
--label com.docker.compose.project=$2 \
--label com.docker.compose.version=$1 \
--label com.docker.compose.volume=worker_wazuh_api_configuration \
$2_worker_wazuh_api_configuration
docker volume create \
--label com.docker.compose.project=$2 \
--label com.docker.compose.version=$1 \
--label com.docker.compose.volume=worker_wazuh_etc \
$2_worker-wazuh-etc
docker volume create \
--label com.docker.compose.project=$2 \
--label com.docker.compose.version=$1 \
--label com.docker.compose.volume=worker-wazuh-logs \
$2_worker-wazuh-logs
docker volume create \
--label com.docker.compose.project=$2 \
--label com.docker.compose.version=$1 \
--label com.docker.compose.volume=worker-wazuh-queue \
$2_worker-wazuh-queue
docker volume create \
--label com.docker.compose.project=$2 \
--label com.docker.compose.version=$1 \
--label com.docker.compose.volume=worker-wazuh-var-multigroups \
$2_worker-wazuh-var-multigroups
docker volume create \
--label com.docker.compose.project=$2 \
--label com.docker.compose.version=$1 \
--label com.docker.compose.volume=worker-wazuh-active-response \
$2_worker-wazuh-active-response
docker volume create \
--label com.docker.compose.project=$2 \
--label com.docker.compose.version=$1 \
--label com.docker.compose.volume=worker-wazuh-etc \
$2_worker-wazuh-etc
docker volume create \
--label com.docker.compose.project=$2 \
--label com.docker.compose.version=$1 \
--label com.docker.compose.volume=worker-wazuh-var \
$2_worker-wazuh-var
docker container run --rm -it \
-v wazuh-docker_worker-var:/from \
-v $2_worker-wazuh-var:/to \
alpine ash -c "cd /from ; cp -avp . /to"
docker container run --rm -it \
-v wazuh-docker_elastic-data-1:/from \
-v $2_wazuh-indexer-data-1:/to \
alpine ash -c "cd /from ; cp -avp . /to"
docker container run --rm -it \
-v wazuh-docker_elastic-data-2:/from \
-v $2_wazuh-indexer-data-2:/to \
alpine ash -c "cd /from ; cp -avp . /to"
docker container run --rm -it \
-v wazuh-docker_elastic-data-3:/from \
-v $2_wazuh-indexer-data-3:/to \
alpine ash -c "cd /from ; cp -avp . /to"
docker container run --rm -it \
-v wazuh-docker_ossec-api-configuration:/from \
-v $2_master-wazuh-api-configuration:/to \
alpine ash -c "cd /from ; cp -avp . /to"
docker container run --rm -it \
-v wazuh-docker_ossec-etc:/from \
-v $2_master-wazuh-etc:/to \
alpine ash -c "cd /from ; cp -avp . /to"
docker container run --rm -it \
-v wazuh-docker_ossec-logs:/from \
-v $2_master-wazuh-logs:/to \
alpine ash -c "cd /from ; cp -avp . /to"
docker container run --rm -it \
-v wazuh-docker_ossec-queue:/from \
-v $2_master-wazuh-queue:/to \
alpine ash -c "cd /from ; cp -avp . /to"
docker container run --rm -it \
-v wazuh-docker_ossec-var-multigroups:/from \
-v $2_master-wazuh-var-multigroups:/to \
alpine ash -c "cd /from ; cp -avp . /to"
docker container run --rm -it \
-v wazuh-docker_ossec-active-response:/from \
-v $2_master-wazuh-active-response:/to \
alpine ash -c "cd /from ; cp -avp . /to"
docker container run --rm -it \
-v wazuh-docker-etc:/from \
-v $2_master-wazuh-etc:/to \
alpine ash -c "cd /from ; cp -avp . /to"
docker container run --rm -it \
-v wazuh-docker-var:/from \
-v $2_master-wazuh-var:/to \
alpine ash -c "cd /from ; cp -avp . /to"
docker container run --rm -it \
-v wazuh-docker_worker-ossec-api-configuration:/from \
-v $2_worker-wazuh-api-configuration:/to \
alpine ash -c "cd /from ; cp -avp . /to"
docker container run --rm -it \
-v wazuh-docker_worker-ossec-etc:/from \
-v $2_worker-wazuh-etc:/to \
alpine ash -c "cd /from ; cp -avp . /to"
docker container run --rm -it \
-v wazuh-docker_worker-ossec-logs:/from \
-v $2_worker-wazuh-logs:/to \
alpine ash -c "cd /from ; cp -avp . /to"
docker container run --rm -it \
-v wazuh-docker_worker-ossec-queue:/from \
-v $2_worker-wazuh-queue:/to \
alpine ash -c "cd /from ; cp -avp . /to"
docker container run --rm -it \
-v wazuh-docker_worker-ossec-var-multigroups:/from \
-v $2_worker-wazuh-var-multigroups:/to \
alpine ash -c "cd /from ; cp -avp . /to"
docker container run --rm -it \
-v wazuh-docker_worker-ossec-active-response:/from \
-v $2_worker-wazuh-active-response:/to \
alpine ash -c "cd /from ; cp -avp . /to"
docker container run --rm -it \
-v wazuh-docker_worker-etc:/from \
-v $2_worker-wazuh-etc:/to \
alpine ash -c "cd /from ; cp -avp . /to"
docker container run --rm -it \
-v wazuh-docker_worker-var:/from \
-v $2_worker-wazuh-var:/to \
alpine ash -c "cd /from ; cp -avp . /to"
+4 -5
View File
@@ -9,11 +9,10 @@ services:
wazuh.indexer: wazuh.indexer:
condition: service_healthy condition: service_healthy
healthcheck: healthcheck:
test: [ "CMD-SHELL", "/var/wazuh-manager/bin/wazuh-manager-control status 2>/dev/null | grep -q 'not running' && exit 1 || exit 0" ] test: [ "CMD-SHELL", "curl -k -s -o /dev/null https://localhost:55000 || exit 1" ]
interval: 15s interval: 15s
timeout: 5s timeout: 5s
retries: 5 retries: 5
start_period: 60s
ulimits: ulimits:
memlock: memlock:
soft: -1 soft: -1
@@ -39,7 +38,7 @@ services:
- wazuh_logs:/var/wazuh-manager/logs - wazuh_logs:/var/wazuh-manager/logs
- wazuh_queue:/var/wazuh-manager/queue - wazuh_queue:/var/wazuh-manager/queue
- wazuh_var_multigroups:/var/wazuh-manager/var/multigroups - wazuh_var_multigroups:/var/wazuh-manager/var/multigroups
- ./config/root-ca/certs/root-ca.pem:/var/wazuh-manager/etc/certs/root-ca.pem - ./config/wazuh_manager/certs/root-ca.pem:/var/wazuh-manager/etc/certs/root-ca.pem
- ./config/wazuh_manager/certs/wazuh.manager.pem:/var/wazuh-manager/etc/certs/manager.pem - ./config/wazuh_manager/certs/wazuh.manager.pem:/var/wazuh-manager/etc/certs/manager.pem
- ./config/wazuh_manager/certs/wazuh.manager-key.pem:/var/wazuh-manager/etc/certs/manager-key.pem - ./config/wazuh_manager/certs/wazuh.manager-key.pem:/var/wazuh-manager/etc/certs/manager-key.pem
@@ -74,7 +73,7 @@ services:
start_period: 60s start_period: 60s
volumes: volumes:
- wazuh-indexer-data:/var/lib/wazuh-indexer - wazuh-indexer-data:/var/lib/wazuh-indexer
- ./config/root-ca/certs/root-ca.pem:/usr/share/wazuh-indexer/config/certs/root-ca.pem - ./config/wazuh_indexer/certs/root-ca.pem:/usr/share/wazuh-indexer/config/certs/root-ca.pem
- ./config/wazuh_indexer/certs/wazuh.indexer-key.pem:/usr/share/wazuh-indexer/config/certs/indexer-key.pem - ./config/wazuh_indexer/certs/wazuh.indexer-key.pem:/usr/share/wazuh-indexer/config/certs/indexer-key.pem
- ./config/wazuh_indexer/certs/wazuh.indexer.pem:/usr/share/wazuh-indexer/config/certs/indexer.pem - ./config/wazuh_indexer/certs/wazuh.indexer.pem:/usr/share/wazuh-indexer/config/certs/indexer.pem
- ./config/wazuh_indexer/certs/admin.pem:/usr/share/wazuh-indexer/config/certs/admin.pem - ./config/wazuh_indexer/certs/admin.pem:/usr/share/wazuh-indexer/config/certs/admin.pem
@@ -108,7 +107,7 @@ services:
volumes: volumes:
- ./config/wazuh_dashboard/certs/wazuh.dashboard.pem:/usr/share/wazuh-dashboard/config/certs/dashboard.pem - ./config/wazuh_dashboard/certs/wazuh.dashboard.pem:/usr/share/wazuh-dashboard/config/certs/dashboard.pem
- ./config/wazuh_dashboard/certs/wazuh.dashboard-key.pem:/usr/share/wazuh-dashboard/config/certs/dashboard-key.pem - ./config/wazuh_dashboard/certs/wazuh.dashboard-key.pem:/usr/share/wazuh-dashboard/config/certs/dashboard-key.pem
- ./config/root-ca/certs/root-ca.pem:/usr/share/wazuh-dashboard/config/certs/root-ca.pem - ./config/wazuh_dashboard/certs/root-ca.pem:/usr/share/wazuh-dashboard/config/certs/root-ca.pem
- wazuh-dashboard-config:/usr/share/wazuh-dashboard/config - wazuh-dashboard-config:/usr/share/wazuh-dashboard/config
- wazuh-dashboard-custom:/usr/share/wazuh-dashboard/plugins/wazuh/public/assets/custom - wazuh-dashboard-custom:/usr/share/wazuh-dashboard/plugins/wazuh/public/assets/custom
depends_on: depends_on:
-1
View File
@@ -1 +0,0 @@
Test file for issue #7202 - upward merge test
+9 -14
View File
@@ -77,8 +77,6 @@ node_to_dir() {
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
# Parse config.yml # Parse config.yml
export WAZUH_UID=101
export WAZUH_GID=101
if $DO_COPY || $DO_PRIV; then if $DO_COPY || $DO_PRIV; then
if [ ! -f "$CONFIG_FILE" ]; then if [ ! -f "$CONFIG_FILE" ]; then
echo "Error: Configuration file $CONFIG_FILE not found." echo "Error: Configuration file $CONFIG_FILE not found."
@@ -104,6 +102,7 @@ if $DO_COPY; then
echo "Copying certificates for indexer: $node -> config/$dir_name/certs/" echo "Copying certificates for indexer: $node -> config/$dir_name/certs/"
mkdir -p "./config/$dir_name/certs" mkdir -p "./config/$dir_name/certs"
cp "$OUTPUT_DIR/${node}"* "./config/$dir_name/certs/" cp "$OUTPUT_DIR/${node}"* "./config/$dir_name/certs/"
cp "$OUTPUT_DIR"/root-ca* "./config/$dir_name/certs/"
if $FIRST_INDEXER; then if $FIRST_INDEXER; then
cp "$OUTPUT_DIR"/admin* "./config/$dir_name/certs/" cp "$OUTPUT_DIR"/admin* "./config/$dir_name/certs/"
FIRST_INDEXER=false FIRST_INDEXER=false
@@ -115,6 +114,7 @@ if $DO_COPY; then
echo "Copying certificates for manager: $node -> config/$dir_name/certs/" echo "Copying certificates for manager: $node -> config/$dir_name/certs/"
mkdir -p "./config/$dir_name/certs" mkdir -p "./config/$dir_name/certs"
cp "$OUTPUT_DIR/${node}"* "./config/$dir_name/certs/" cp "$OUTPUT_DIR/${node}"* "./config/$dir_name/certs/"
cp "$OUTPUT_DIR"/root-ca* "./config/$dir_name/certs/"
done done
for node in "${DASHBOARD_NODES[@]}"; do for node in "${DASHBOARD_NODES[@]}"; do
@@ -122,37 +122,32 @@ if $DO_COPY; then
echo "Copying certificates for dashboard: $node -> config/$dir_name/certs/" echo "Copying certificates for dashboard: $node -> config/$dir_name/certs/"
mkdir -p "./config/$dir_name/certs" mkdir -p "./config/$dir_name/certs"
cp "$OUTPUT_DIR/${node}"* "./config/$dir_name/certs/" cp "$OUTPUT_DIR/${node}"* "./config/$dir_name/certs/"
cp "$OUTPUT_DIR"/root-ca* "./config/$dir_name/certs/"
done done
echo "Copying root-ca certificates -> config/root-ca/certs/"
mkdir -p "./config/root-ca/certs"
cp "$OUTPUT_DIR"/root-ca* "./config/root-ca/certs/"
fi fi
# 3. Set ownership and permissions # 3. Set ownership and permissions
if $DO_PRIV; then if $DO_PRIV; then
for node in "${INDEXER_NODES[@]}"; do for node in "${INDEXER_NODES[@]}"; do
dir_name=$(node_to_dir "$node") dir_name=$(node_to_dir "$node")
echo "Setting permissions for indexer $node (${WAZUH_UID}:${WAZUH_GID})" echo "Setting permissions for indexer $node (1000:1000)"
chown -R ${WAZUH_UID}:${WAZUH_GID} "./config/$dir_name/certs" chown -R 1000:1000 "./config/$dir_name/certs"
chmod 400 "./config/$dir_name/certs/"* chmod 400 "./config/$dir_name/certs/"*
done done
for node in "${MANAGER_NODES[@]}"; do for node in "${MANAGER_NODES[@]}"; do
dir_name=$(node_to_dir "$node") dir_name=$(node_to_dir "$node")
echo "Setting permissions for manager $node (${WAZUH_UID}:${WAZUH_GID})" echo "Setting permissions for manager $node (999:999)"
chown -R ${WAZUH_UID}:${WAZUH_GID} "./config/$dir_name/certs" chown -R 999:999 "./config/$dir_name/certs"
chmod 400 "./config/$dir_name/certs/"* chmod 400 "./config/$dir_name/certs/"*
done done
for node in "${DASHBOARD_NODES[@]}"; do for node in "${DASHBOARD_NODES[@]}"; do
dir_name=$(node_to_dir "$node") dir_name=$(node_to_dir "$node")
echo "Setting permissions for dashboard $node (${WAZUH_UID}:${WAZUH_GID})" echo "Setting permissions for dashboard $node (1000:1000)"
chown -R ${WAZUH_UID}:${WAZUH_GID} "./config/$dir_name/certs" chown -R 1000:1000 "./config/$dir_name/certs"
chmod 400 "./config/$dir_name/certs/"* chmod 400 "./config/$dir_name/certs/"*
done done
echo "Setting permissions for root-ca certificates (${WAZUH_UID}:${WAZUH_GID})"
chown -R ${WAZUH_UID}:${WAZUH_GID} "./config/root-ca/certs"
chmod 400 "./config/root-ca/certs/"*
fi fi
echo "Process completed." echo "Process completed."