From e4e41ef4bac3b69b3f522725c92cd9fa7430fa0f Mon Sep 17 00:00:00 2001 From: Jesus Garcia Date: Mon, 22 Dec 2025 09:54:24 -0500 Subject: [PATCH] Add shebang to build-images.sh script, enhance script structure, update push.yml workflow file to use working-directory, and remove indexer-certs-creator directory --- .github/workflows/push.yml | 3 +- build-docker-images/build-images.sh | 16 ++--- indexer-certs-creator/Dockerfile | 12 ---- indexer-certs-creator/config/entrypoint.sh | 68 ---------------------- 4 files changed, 11 insertions(+), 88 deletions(-) delete mode 100644 indexer-certs-creator/Dockerfile delete mode 100644 indexer-certs-creator/config/entrypoint.sh diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index 75e3cf97..0fb975b3 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -11,7 +11,8 @@ jobs: uses: actions/checkout@v4 - name: Build Wazuh images - run: build-docker-images/build-images.sh + run: ./build-images.sh + working-directory: ./build-docker-images - name: Create enviroment variables run: cat .env > $GITHUB_ENV diff --git a/build-docker-images/build-images.sh b/build-docker-images/build-images.sh index 5e558e2c..1a0802fc 100755 --- a/build-docker-images/build-images.sh +++ b/build-docker-images/build-images.sh @@ -1,10 +1,4 @@ -WAZUH_IMAGE_VERSION=5.0.0 -IMAGE_TAG=5.0.0 -WAZUH_VERSION=$(echo $WAZUH_IMAGE_VERSION | sed -e 's/\.//g') -WAZUH_TAG_REVISION=1 -WAZUH_CURRENT_VERSION=$(curl --silent https://api.github.com/repos/wazuh/wazuh/releases/latest | grep '["]tag_name["]:' | sed -E 's/.*\"([^\"]+)\".*/\1/' | cut -c 2- | sed -e 's/\.//g') -IMAGE_VERSION=${WAZUH_IMAGE_VERSION} -WAZUH_REGISTRY=docker.io +#!/bin/bash # Wazuh package generator # Copyright (C) 2023, Wazuh Inc. @@ -14,6 +8,14 @@ WAZUH_REGISTRY=docker.io # License (version 2) as published by the FSF - Free Software # Foundation. +WAZUH_IMAGE_VERSION=5.0.0 +IMAGE_TAG=5.0.0 +WAZUH_VERSION=$(echo $WAZUH_IMAGE_VERSION | sed -e 's/\.//g') +WAZUH_TAG_REVISION=1 +WAZUH_CURRENT_VERSION=$(curl --silent https://api.github.com/repos/wazuh/wazuh/releases/latest | grep '["]tag_name["]:' | sed -E 's/.*\"([^\"]+)\".*/\1/' | cut -c 2- | sed -e 's/\.//g') +IMAGE_VERSION=${WAZUH_IMAGE_VERSION} +WAZUH_REGISTRY=docker.io + WAZUH_IMAGE_VERSION="5.0.0" WAZUH_TAG_REVISION="1" WAZUH_DEV_STAGE="" diff --git a/indexer-certs-creator/Dockerfile b/indexer-certs-creator/Dockerfile deleted file mode 100644 index b9772abf..00000000 --- a/indexer-certs-creator/Dockerfile +++ /dev/null @@ -1,12 +0,0 @@ -# Wazuh Docker Copyright (C) 2017, Wazuh Inc. (License GPLv2) -FROM amazonlinux:2023 - -RUN yum update -y && yum install openssl curl-minimal -y - -WORKDIR / - -COPY config/entrypoint.sh / - -RUN chmod 700 /entrypoint.sh - -ENTRYPOINT ["/entrypoint.sh"] \ No newline at end of file diff --git a/indexer-certs-creator/config/entrypoint.sh b/indexer-certs-creator/config/entrypoint.sh deleted file mode 100644 index a222a5b9..00000000 --- a/indexer-certs-creator/config/entrypoint.sh +++ /dev/null @@ -1,68 +0,0 @@ -#!/bin/bash -# Wazuh Docker Copyright (C) 2017, Wazuh Inc. (License GPLv2) - -############################################################################## -# Downloading Cert Gen Tool -############################################################################## - -## Variables -CERT_TOOL=wazuh-certs-tool.sh -PASSWORD_TOOL=wazuh-passwords-tool.sh -PACKAGES_URL=https://packages.wazuh.com/$CERT_TOOL_VERSION/ -PACKAGES_DEV_URL=https://packages-dev.wazuh.com/$CERT_TOOL_VERSION/ - -OUTPUT_FILE="/$CERT_TOOL" - -download_package() { - local url=$1 - echo "Checking $url$CERT_TOOL ..." - if curl -fsL "$url$CERT_TOOL" -o "$OUTPUT_FILE"; then - echo "Downloaded $CERT_TOOL from $url" - return 0 - else - return 1 - fi -} - -# Try first the prod URL, if it fails try the dev URL -if download_package "$PACKAGES_URL"; then - : -elif download_package "$PACKAGES_DEV_URL"; then - : -else - echo "The tool to create the certificates does not exist in any bucket" - echo "ERROR: certificates were not created" - exit 1 -fi - -cp /config/certs.yml /config.yml -chmod 700 "$OUTPUT_FILE" - -############################################################################## -# Creating Cluster certificates -############################################################################## - -## Execute cert tool and parsin cert.yml to set UID permissions -source /$CERT_TOOL -A -nodes_server=$( cert_parseYaml /config.yml | grep -E "nodes[_]+server[_]+[0-9]+=" | sed -e 's/nodes__server__[0-9]=//' | sed 's/"//g' ) -node_names=($nodes_server) - -echo "Moving created certificates to the destination directory" -cp /wazuh-certificates/* /certificates/ -echo "Changing certificate permissions" -chmod -R 500 /certificates -chmod -R 400 /certificates/* -echo "Setting UID indexer and dashboard" -chown 1000:1000 /certificates/* -echo "Setting UID for wazuh manager and worker" -cp /certificates/root-ca.pem /certificates/root-ca-manager.pem -cp /certificates/root-ca.key /certificates/root-ca-manager.key -chown 999:999 /certificates/root-ca-manager.pem -chown 999:999 /certificates/root-ca-manager.key - -for i in ${node_names[@]}; -do - chown 999:999 "/certificates/${i}.pem" - chown 999:999 "/certificates/${i}-key.pem" -done -