Modify Wazuh cert tool generation

This commit is contained in:
vcerenu
2025-09-26 12:14:09 -03:00
parent ed92382ff1
commit ccab3b6d7e
4 changed files with 31 additions and 21 deletions
+2 -2
View File
@@ -1,7 +1,7 @@
# Wazuh Docker Copyright (C) 2017, Wazuh Inc. (License GPLv2) # Wazuh Docker Copyright (C) 2017, Wazuh Inc. (License GPLv2)
FROM ubuntu:focal FROM amazonlinux:2023
RUN apt-get update && apt-get install openssl curl -y RUN yum update -y && yum install openssl curl-minimal -y
WORKDIR / WORKDIR /
+23 -17
View File
@@ -8,29 +8,35 @@
## Variables ## Variables
CERT_TOOL=wazuh-certs-tool.sh CERT_TOOL=wazuh-certs-tool.sh
PASSWORD_TOOL=wazuh-passwords-tool.sh PASSWORD_TOOL=wazuh-passwords-tool.sh
PACKAGES_URL=https://packages.wazuh.com/4.14/ PACKAGES_URL=https://packages.wazuh.com/$CERT_TOOL_VERSION/
PACKAGES_DEV_URL=https://packages-dev.wazuh.com/4.14/ PACKAGES_DEV_URL=https://packages-dev.wazuh.com/$CERT_TOOL_VERSION/
## Check if the cert tool exists in S3 buckets OUTPUT_FILE="/$CERT_TOOL"
CERT_TOOL_PACKAGES=$(curl --silent --head --location --output /dev/null --write-out "%{http_code}" "$PACKAGES_URL$CERT_TOOL")
CERT_TOOL_PACKAGES_DEV=$(curl --silent --head --location --output /dev/null --write-out "%{http_code}" "$PACKAGES_DEV_URL$CERT_TOOL")
## If cert tool exists in some bucket, download it, if not exit 1 download_package() {
if [ "$CERT_TOOL_PACKAGES" = "200" ]; then local url=$1
curl -o $CERT_TOOL $PACKAGES_URL$CERT_TOOL -s echo "Checking $url$CERT_TOOL ..."
echo "The tool to create the certificates exists in the in Packages bucket" if curl -fsSL "$url$CERT_TOOL" -o "$OUTPUT_FILE"; then
elif [ "$CERT_TOOL_PACKAGES_DEV" = "200" ]; then echo "Downloaded $CERT_TOOL from $url"
curl -o $CERT_TOOL $PACKAGES_DEV_URL$CERT_TOOL -s return 0
echo "The tool to create the certificates exists in Packages-dev bucket" 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 else
echo "The tool to create the certificates does not exist in any bucket" echo "The tool to create the certificates does not exist in any bucket"
echo "ERROR: certificates were not created" echo "ERROR: certificates were not created"
exit 1 exit 1
fi fi
cp /config/certs.yml /config.yml cp /config/certs.yml /config.yml
chmod 700 "$OUTPUT_FILE"
chmod 700 /$CERT_TOOL
############################################################################## ##############################################################################
# Creating Cluster certificates # Creating Cluster certificates
+3 -1
View File
@@ -1,8 +1,10 @@
# Wazuh App Copyright (C) 2017, Wazuh Inc. (License GPLv2) # Wazuh App Copyright (C) 2017, Wazuh Inc. (License GPLv2)
services: services:
generator: generator:
image: wazuh/wazuh-certs-generator:0.0.2 image: wazuh/wazuh-certs-generator:0.0.3
hostname: wazuh-certs-generator hostname: wazuh-certs-generator
environment:
- CERT_TOOL_VERSION=4.14
volumes: volumes:
- ./config/wazuh_indexer_ssl_certs/:/certificates/ - ./config/wazuh_indexer_ssl_certs/:/certificates/
- ./config/certs.yml:/config/certs.yml - ./config/certs.yml:/config/certs.yml
+3 -1
View File
@@ -1,8 +1,10 @@
# Wazuh App Copyright (C) 2017, Wazuh Inc. (License GPLv2) # Wazuh App Copyright (C) 2017, Wazuh Inc. (License GPLv2)
services: services:
generator: generator:
image: wazuh/wazuh-certs-generator:0.0.2 image: wazuh/wazuh-certs-generator:0.0.3
hostname: wazuh-certs-generator hostname: wazuh-certs-generator
environment:
- CERT_TOOL_VERSION=4.14
volumes: volumes:
- ./config/wazuh_indexer_ssl_certs/:/certificates/ - ./config/wazuh_indexer_ssl_certs/:/certificates/
- ./config/certs.yml:/config/certs.yml - ./config/certs.yml:/config/certs.yml