Files
projet_gestion_commande/monitoring/wazuh/generate-certs.sh
T
2026-05-02 18:59:22 +02:00

35 lines
1.3 KiB
Bash
Executable File

#!/bin/bash
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
CERTS_DIR="$SCRIPT_DIR/certs"
mkdir -p "$CERTS_DIR"
cd /tmp
echo "[*] Téléchargement de l'outil de génération de certificats Wazuh..."
curl -sO https://packages.wazuh.com/4.9/wazuh-certs-tool.sh
cp "$SCRIPT_DIR/config/certs.yml" config.yml
echo "[*] Génération des certificats..."
bash wazuh-certs-tool.sh -A
echo "[*] Extraction des certificats..."
tar -xf wazuh-install-files.tar
cp wazuh-install-files/wazuh.indexer.pem "$CERTS_DIR/"
cp wazuh-install-files/wazuh.indexer-key.pem "$CERTS_DIR/"
cp wazuh-install-files/wazuh.manager.pem "$CERTS_DIR/"
cp wazuh-install-files/wazuh.manager-key.pem "$CERTS_DIR/"
cp wazuh-install-files/wazuh.dashboard.pem "$CERTS_DIR/"
cp wazuh-install-files/wazuh.dashboard-key.pem "$CERTS_DIR/"
cp wazuh-install-files/root-ca.pem "$CERTS_DIR/"
cp wazuh-install-files/root-ca.pem "$CERTS_DIR/root-ca-manager.pem"
cp wazuh-install-files/admin.pem "$CERTS_DIR/"
cp wazuh-install-files/admin-key.pem "$CERTS_DIR/"
chmod 640 "$CERTS_DIR"/*.pem
rm -rf /tmp/wazuh-install-files /tmp/wazuh-install-files.tar /tmp/wazuh-certs-tool.sh /tmp/config.yml
echo "[OK] Certificats générés dans $CERTS_DIR"