暫無描述

config.sh 1.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. # Wazuh Docker Copyright (C) 2017, Wazuh Inc. (License GPLv2)
  2. # This has to be exported to make some magic below work.
  3. export DH_OPTIONS
  4. export NAME=wazuh-dashboard
  5. export TARGET_DIR=${CURDIR}/debian/${NAME}
  6. export INSTALLATION_DIR=/usr/share/${NAME}
  7. export CONFIG_DIR=${INSTALLATION_DIR}/config
  8. ## Variables
  9. CERT_TOOL=wazuh-certs-tool.sh
  10. PACKAGES_URL=https://packages.wazuh.com/4.14/
  11. PACKAGES_DEV_URL=https://packages-dev.wazuh.com/4.14/
  12. ## Check if the cert tool exists in S3 buckets
  13. CERT_TOOL_PACKAGES=$(curl --silent -I $PACKAGES_URL$CERT_TOOL | grep -E "^HTTP" | awk '{print $2}')
  14. CERT_TOOL_PACKAGES_DEV=$(curl --silent -I $PACKAGES_DEV_URL$CERT_TOOL | grep -E "^HTTP" | awk '{print $2}')
  15. ## If cert tool exists in some bucket, download it, if not exit 1
  16. if [ "$CERT_TOOL_PACKAGES" = "200" ]; then
  17. curl -o $CERT_TOOL $PACKAGES_URL$CERT_TOOL
  18. echo "Cert tool exists in Packages bucket"
  19. elif [ "$CERT_TOOL_PACKAGES_DEV" = "200" ]; then
  20. curl -o $CERT_TOOL $PACKAGES_DEV_URL$CERT_TOOL
  21. echo "Cert tool exists in Packages-dev bucket"
  22. else
  23. echo "Cert tool does not exist in any bucket"
  24. exit 1
  25. fi
  26. chmod 755 $CERT_TOOL && bash /$CERT_TOOL -A
  27. # Create certs directory
  28. mkdir -p ${CONFIG_DIR}/certs
  29. # Copy Wazuh dashboard certs to install config dir
  30. cp /wazuh-certificates/demo.dashboard.pem ${CONFIG_DIR}/certs/dashboard.pem
  31. cp /wazuh-certificates/demo.dashboard-key.pem ${CONFIG_DIR}/certs/dashboard-key.pem
  32. cp /wazuh-certificates/root-ca.pem ${CONFIG_DIR}/certs/root-ca.pem
  33. chmod -R 500 ${CONFIG_DIR}/certs
  34. chmod -R 400 ${CONFIG_DIR}/certs/*