Compare commits

...

5 Commits

Author SHA1 Message Date
Gonzalo Acuña
652a7cfe9a Merge pull request #2027 from wazuh/enhancement/1934-wazuh-cert-tool-generator
Wazuh cert tool generator improvements
2025-09-26 16:01:19 -03:00
vcerenu
c910773076 Modify readme 2025-09-26 15:52:09 -03:00
vcerenu
901f29b68f Add changelog 2025-09-26 15:37:33 -03:00
vcerenu
2d56895f47 Improve error messages 2025-09-26 15:33:42 -03:00
vcerenu
ccab3b6d7e Modify Wazuh cert tool generation 2025-09-26 12:14:09 -03:00
6 changed files with 33 additions and 23 deletions

View File

@@ -9,7 +9,7 @@ All notable changes to this project will be documented in this file.
### Changed
- None
- Wazuh cert tool generator improvements ([#2027](https://github.com/wazuh/wazuh-docker/pull/2027))
### Fixed

View File

@@ -1,7 +1,7 @@
# 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 /

View File

@@ -5,5 +5,5 @@ The dockerfile hosted in this directory is used to build the image used to boot
To create the image, the following command must be executed:
```
$ docker build -t wazuh/wazuh-certs-generator:0.0.2 .
$ docker build -t wazuh/wazuh-certs-generator:0.0.3 .
```

View File

@@ -8,29 +8,35 @@
## Variables
CERT_TOOL=wazuh-certs-tool.sh
PASSWORD_TOOL=wazuh-passwords-tool.sh
PACKAGES_URL=https://packages.wazuh.com/4.14/
PACKAGES_DEV_URL=https://packages-dev.wazuh.com/4.14/
PACKAGES_URL=https://packages.wazuh.com/$CERT_TOOL_VERSION/
PACKAGES_DEV_URL=https://packages-dev.wazuh.com/$CERT_TOOL_VERSION/
## Check if the cert tool exists in S3 buckets
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")
OUTPUT_FILE="/$CERT_TOOL"
## If cert tool exists in some bucket, download it, if not exit 1
if [ "$CERT_TOOL_PACKAGES" = "200" ]; then
curl -o $CERT_TOOL $PACKAGES_URL$CERT_TOOL -s
echo "The tool to create the certificates exists in the in Packages bucket"
elif [ "$CERT_TOOL_PACKAGES_DEV" = "200" ]; then
curl -o $CERT_TOOL $PACKAGES_DEV_URL$CERT_TOOL -s
echo "The tool to create the certificates exists in Packages-dev bucket"
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
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 /$CERT_TOOL
chmod 700 "$OUTPUT_FILE"
##############################################################################
# Creating Cluster certificates

View File

@@ -1,8 +1,10 @@
# Wazuh App Copyright (C) 2017, Wazuh Inc. (License GPLv2)
services:
generator:
image: wazuh/wazuh-certs-generator:0.0.2
image: wazuh/wazuh-certs-generator:0.0.3
hostname: wazuh-certs-generator
environment:
- CERT_TOOL_VERSION=4.14
volumes:
- ./config/wazuh_indexer_ssl_certs/:/certificates/
- ./config/certs.yml:/config/certs.yml

View File

@@ -1,8 +1,10 @@
# Wazuh App Copyright (C) 2017, Wazuh Inc. (License GPLv2)
services:
generator:
image: wazuh/wazuh-certs-generator:0.0.2
image: wazuh/wazuh-certs-generator:0.0.3
hostname: wazuh-certs-generator
environment:
- CERT_TOOL_VERSION=4.14
volumes:
- ./config/wazuh_indexer_ssl_certs/:/certificates/
- ./config/certs.yml:/config/certs.yml