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 /
|
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 /
|
COPY config/entrypoint.sh /
|
||||||
|
|
||||||
RUN chmod 700 /entrypoint.sh && chmod 700 /wazuh-cert-tool.sh
|
RUN chmod 700 /entrypoint.sh
|
||||||
|
|
||||||
ENTRYPOINT ["/entrypoint.sh"]
|
ENTRYPOINT ["/entrypoint.sh"]
|
||||||
@@ -5,22 +5,36 @@
|
|||||||
# Downloading Cert Gen Tool
|
# 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
|
## Check if the cert tool exists in S3 buckets
|
||||||
curl -o $FILE https://packages.wazuh.com/4.x/wazuh-cert-tool.sh
|
CERT_TOOL_PACKAGES=$(curl --silent -I $PACKAGES_URL$CERT_TOOL | grep -E "^HTTP" | awk '{print $2}')
|
||||||
var=`grep NoSuchKey $FILE`
|
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 cert tool exists in some bucket, download it, if not exit 1
|
||||||
if [ ! -z "$var" ]; then
|
if [ "$CERT_TOOL_PACKAGES" = "200" ]; then
|
||||||
curl -o $FILE https://packages-dev.wazuh.com/4.3/wazuh-certs-tool.sh
|
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
|
fi
|
||||||
|
|
||||||
|
chmod 700 /$CERT_TOOL
|
||||||
|
|
||||||
##############################################################################
|
##############################################################################
|
||||||
# Creating Cluster certificates
|
# Creating Cluster certificates
|
||||||
##############################################################################
|
##############################################################################
|
||||||
|
|
||||||
/wazuh-cert-tool.sh
|
/$CERT_TOOL
|
||||||
echo "Moving created certificates to destination directory"
|
echo "Moving created certificates to destination directory"
|
||||||
cp /certs/* /certificates/
|
cp /certs/* /certificates/
|
||||||
echo "changing certificate permissions"
|
echo "changing certificate permissions"
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ nodes:
|
|||||||
|
|
||||||
# Wazuh server nodes
|
# Wazuh server nodes
|
||||||
# Use node_type only with more than one Wazuh manager
|
# Use node_type only with more than one Wazuh manager
|
||||||
wazuh_servers:
|
server:
|
||||||
name: wazuh.master
|
name: wazuh.master
|
||||||
ip: wazuh.master
|
ip: wazuh.master
|
||||||
node_type: master
|
node_type: master
|
||||||
|
|||||||
@@ -25,10 +25,48 @@ rm -rf ${INSTALLATION_DIR}/
|
|||||||
curl -o ${INDEXER_FILE} https://packages.wazuh.com/stack/indexer/base/${BASE_FILE}
|
curl -o ${INDEXER_FILE} https://packages.wazuh.com/stack/indexer/base/${BASE_FILE}
|
||||||
tar -xf ${INDEXER_FILE}
|
tar -xf ${INDEXER_FILE}
|
||||||
|
|
||||||
curl -o wazuh-cert-tool.sh https://packages.wazuh.com/4.x/wazuh-cert-tool.sh
|
## TOOLS
|
||||||
curl -o wazuh-password-tool.sh https://packages.wazuh.com/4.x/wazuh-passwords-tool.sh
|
|
||||||
|
|
||||||
chmod 755 wazuh-cert-tool.sh && bash /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/
|
||||||
|
|
||||||
|
## 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 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"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
## Check if the password tool exists in S3 buckets
|
||||||
|
PASSWORD_TOOL_PACKAGES=$(curl --silent -I $PACKAGES_URL$PASSWORD_TOOL | grep -E "^HTTP" | awk '{print $2}')
|
||||||
|
PASSWORD_TOOL_PACKAGES_DEV=$(curl --silent -I $PACKAGES_DEV_URL$PASSWORD_TOOL | grep -E "^HTTP" | awk '{print $2}')
|
||||||
|
|
||||||
|
## If password tool exists in some bucket, download it, if not exit 1
|
||||||
|
if [ "$PASSWORD_TOOL_PACKAGES" = "200" ]; then
|
||||||
|
curl -o $PASSWORD_TOOL $PACKAGES_URL$PASSWORD_TOOL
|
||||||
|
echo "Password tool exists in Packages bucket"
|
||||||
|
elif [ "$PASSWORD_TOOL_PACKAGES_DEV" = "200" ]; then
|
||||||
|
curl -o $PASSWORD_TOOL $PACKAGES_DEV_URL$PASSWORD_TOOL
|
||||||
|
echo "Password tool exists in Packages-dev bucket"
|
||||||
|
else
|
||||||
|
echo "Password tool does not exist in any bucket"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
chmod 755 $CERT_TOOL && bash /$CERT_TOOL
|
||||||
|
|
||||||
# copy to target
|
# copy to target
|
||||||
mkdir -p ${TARGET_DIR}${INSTALLATION_DIR}
|
mkdir -p ${TARGET_DIR}${INSTALLATION_DIR}
|
||||||
@@ -52,8 +90,8 @@ rm -rf ${BASE_DIR}/usr
|
|||||||
# Copy installation files to final location
|
# Copy installation files to final location
|
||||||
cp -pr ${BASE_DIR}/* ${TARGET_DIR}${INSTALLATION_DIR}
|
cp -pr ${BASE_DIR}/* ${TARGET_DIR}${INSTALLATION_DIR}
|
||||||
# Copy the security tools
|
# Copy the security tools
|
||||||
cp /wazuh-cert-tool.sh ${TARGET_DIR}${INSTALLATION_DIR}/plugins/opensearch-security/tools/
|
cp /$CERT_TOOL ${TARGET_DIR}${INSTALLATION_DIR}/plugins/opensearch-security/tools/
|
||||||
cp /wazuh-password-tool.sh ${TARGET_DIR}${INSTALLATION_DIR}/plugins/opensearch-security/tools/
|
cp /$PASSWORD_TOOL ${TARGET_DIR}${INSTALLATION_DIR}/plugins/opensearch-security/tools/
|
||||||
# Copy Wazuh's config files for the security plugin
|
# Copy Wazuh's config files for the security plugin
|
||||||
cp -pr /roles_mapping.yml ${TARGET_DIR}${INSTALLATION_DIR}/plugins/opensearch-security/securityconfig/
|
cp -pr /roles_mapping.yml ${TARGET_DIR}${INSTALLATION_DIR}/plugins/opensearch-security/securityconfig/
|
||||||
cp -pr /roles.yml ${TARGET_DIR}${INSTALLATION_DIR}/plugins/opensearch-security/securityconfig/
|
cp -pr /roles.yml ${TARGET_DIR}${INSTALLATION_DIR}/plugins/opensearch-security/securityconfig/
|
||||||
|
|||||||
@@ -3,5 +3,5 @@ gpgcheck=1
|
|||||||
gpgkey=https://packages.wazuh.com/key/GPG-KEY-WAZUH
|
gpgkey=https://packages.wazuh.com/key/GPG-KEY-WAZUH
|
||||||
enabled=1
|
enabled=1
|
||||||
name=Wazuh repository
|
name=Wazuh repository
|
||||||
baseurl=https://packages.wazuh.com/pre-release/yum/
|
baseurl=https://packages.wazuh.com/4.x/yum/
|
||||||
protect=1
|
protect=1
|
||||||
|
|||||||
Reference in New Issue
Block a user