mirror of
https://github.com/wazuh/wazuh-docker.git
synced 2025-10-23 06:11:57 +00:00
Compare commits
5 Commits
ed92382ff1
...
652a7cfe9a
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
652a7cfe9a | ||
|
|
c910773076 | ||
|
|
901f29b68f | ||
|
|
2d56895f47 | ||
|
|
ccab3b6d7e |
@@ -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
|
||||
|
||||
|
||||
@@ -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 /
|
||||
|
||||
|
||||
@@ -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 .
|
||||
```
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user