forked from wazuh/wazuh-docker
Tools download logic updated
This commit is contained in:
@@ -5,10 +5,8 @@ RUN apt-get update && apt-get install openssl curl -y
|
||||
|
||||
WORKDIR /
|
||||
|
||||
#RUN curl -o wazuh-cert-tool.sh https://s3.us-west-1.amazonaws.com/packages.wazuh.com/4.x/wazuh-cert-tool.sh
|
||||
|
||||
COPY config/entrypoint.sh /
|
||||
|
||||
RUN chmod 700 /entrypoint.sh && chmod 700 /wazuh-cert-tool.sh
|
||||
RUN chmod 700 /entrypoint.sh
|
||||
|
||||
ENTRYPOINT ["/entrypoint.sh"]
|
||||
@@ -5,22 +5,36 @@
|
||||
# Downloading Cert Gen Tool
|
||||
##############################################################################
|
||||
|
||||
FILE=wazuh-cert-tool.sh
|
||||
## Variables
|
||||
CERT_TOOL=wazuh-certs-tool.sh
|
||||
PASSWORD_TOOL=wazuh-passwords-tool.sh
|
||||
PACKAGES_URL=https://packages.wazuh.com/resources/4.3/
|
||||
PACKAGES_DEV_URL=https://packages-dev.wazuh.com/resources/4.3/
|
||||
|
||||
#Download from packages.wazuh.com with first parameter
|
||||
curl -o $FILE https://packages.wazuh.com/4.x/wazuh-cert-tool.sh
|
||||
var=`grep NoSuchKey $FILE`
|
||||
## Check if the cert tool exists in S3 buckets
|
||||
CERT_TOOL_PACKAGES=$(curl --silent -I $PACKAGES_URL$CERT_TOOL | grep -E "^HTTP" | awk '{print $2}')
|
||||
CERT_TOOL_PACKAGES_DEV=$(curl --silent -I $PACKAGES_DEV_URL$CERT_TOOL | grep -E "^HTTP" | awk '{print $2}')
|
||||
|
||||
#If the content of the file contains NoSuchKey, download from packages-dev.wazuh.com
|
||||
if [ ! -z "$var" ]; then
|
||||
curl -o $FILE https://packages-dev.wazuh.com/4.3/wazuh-certs-tool.sh
|
||||
## 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
|
||||
echo "Cert tool exists in Packages bucket"
|
||||
elif [ "$CERT_TOOL_PACKAGES_DEV" = "200" ]; then
|
||||
curl -o $CERT_TOOL $PACKAGES_DEV_URL$CERT_TOOL
|
||||
echo "Cert tool exists in Packages-dev bucket"
|
||||
else
|
||||
echo "Cert tool does not exist in any bucket"
|
||||
echo "ERROR: certificates were not created"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
chmod 700 /$CERT_TOOL
|
||||
|
||||
##############################################################################
|
||||
# Creating Cluster certificates
|
||||
##############################################################################
|
||||
|
||||
/wazuh-cert-tool.sh
|
||||
/$CERT_TOOL
|
||||
echo "Moving created certificates to destination directory"
|
||||
cp /certs/* /certificates/
|
||||
echo "changing certificate permissions"
|
||||
|
||||
Reference in New Issue
Block a user