diff --git a/build-docker-images/wazuh-dashboard/config/config.sh b/build-docker-images/wazuh-dashboard/config/config.sh index 4b6a2fcd..2d1d0ee4 100644 --- a/build-docker-images/wazuh-dashboard/config/config.sh +++ b/build-docker-images/wazuh-dashboard/config/config.sh @@ -13,12 +13,23 @@ export CONFIG_DIR=${INSTALLATION_DIR}/config # Variables for certificate generation CERT_TOOL="wazuh-certs-tool.sh" CERT_CONFIG_FILE="config.yml" +download_package() { + local url=$1 + local package=$2 + if curl -fsL "$url" -o "$package"; then + echo "Downloaded $package" + return 0 + else + echo "Error downloading $package from $url" + return 1 + fi +} # Download the tool to create the certificates echo "Downloading the tool to create the certificates..." -curl -fsL "$wazuh_cert_tool" -o $CERT_TOOL +download_package "$wazuh_cert_tool" $CERT_TOOL # Download the config file for the certificate tool echo "Downloading the config file for the certificate tool..." -curl -fsL "$wazuh_config_yml" -o $CERT_CONFIG_FILE +download_package "$wazuh_config_yml" $CERT_CONFIG_FILE # Modify the config file to set the IP to localhost sed -i 's/ ip:.*/ ip: "127.0.0.1"/' $CERT_CONFIG_FILE diff --git a/build-docker-images/wazuh-indexer/config/config.sh b/build-docker-images/wazuh-indexer/config/config.sh index 7bcd68de..abcf257b 100644 --- a/build-docker-images/wazuh-indexer/config/config.sh +++ b/build-docker-images/wazuh-indexer/config/config.sh @@ -21,12 +21,23 @@ export CONFIG_DIR=${INSTALLATION_DIR}/config # Variables for certificate generation CERT_TOOL="wazuh-certs-tool.sh" CERT_CONFIG_FILE="config.yml" +download_package() { + local url=$1 + local package=$2 + if curl -fsL "$url" -o "$package"; then + echo "Downloaded $package" + return 0 + else + echo "Error downloading $package from $url" + return 1 + fi +} # Download the tool to create the certificates echo "Downloading the tool to create the certificates..." -curl -fsL "$wazuh_cert_tool" -o $CERT_TOOL +download_package "$wazuh_cert_tool" $CERT_TOOL # Download the config file for the certificate tool echo "Downloading the config file for the certificate tool..." -curl -fsL "$wazuh_config_yml" -o $CERT_CONFIG_FILE +download_package "$wazuh_config_yml" $CERT_CONFIG_FILE # Modify the config file to set the IP to localhost sed -i 's/ ip:.*/ ip: "127.0.0.1"/' $CERT_CONFIG_FILE diff --git a/build-docker-images/wazuh-manager/config/config.sh b/build-docker-images/wazuh-manager/config/config.sh index 5bfd2d4c..d5359904 100644 --- a/build-docker-images/wazuh-manager/config/config.sh +++ b/build-docker-images/wazuh-manager/config/config.sh @@ -5,12 +5,23 @@ CERT_TOOL="wazuh-certs-tool.sh" CERT_CONFIG_FILE="config.yml" CERT_DIR=/var/ossec/etc/certs/ +download_package() { + local url=$1 + local package=$2 + if curl -fsL "$url" -o "$package"; then + echo "Downloaded $package" + return 0 + else + echo "Error downloading $package from $url" + return 1 + fi +} # Download the tool to create the certificates echo "Downloading the tool to create the certificates..." -curl -fsL "$wazuh_cert_tool" -o $CERT_TOOL +download_package "$wazuh_cert_tool" $CERT_TOOL # Download the config file for the certificate tool echo "Downloading the config file for the certificate tool..." -curl -fsL "$wazuh_config_yml" -o $CERT_CONFIG_FILE +download_package "$wazuh_config_yml" $CERT_CONFIG_FILE # Modify the config file to set the IP to localhost sed -i 's/ ip:.*/ ip: "127.0.0.1"/' $CERT_CONFIG_FILE