Some checks failed
Deployment Verification / deploy-and-test (push) Failing after 29s
171 lines
5.6 KiB
Bash
171 lines
5.6 KiB
Bash
#!/bin/bash
|
|
|
|
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
|
|
|
|
clear
|
|
|
|
#
|
|
# Vérifier si le système est basé sur yum ou apt-get
|
|
#
|
|
|
|
while true; do
|
|
echo "######################################################################################"
|
|
echo "# "
|
|
echo "# Souhaitez-vous configurer Wazuh avec le jeu de règles SOCFortress"
|
|
echo "#"
|
|
echo "# - ATTENTION -"
|
|
echo "#"
|
|
echo "# Ce script remplacera toutes vos règles personnalisées actuelles de Wazuh."
|
|
read -p "# Veuillez procéder avec prudence et il est recommandé de sauvegarder manuellement vos règles... continuer ? " yn
|
|
case $yn in
|
|
[Yy]* ) break;;
|
|
[Nn]* ) exit;;
|
|
* ) echo " # Veuillez répondre par oui ou par non.";;
|
|
esac
|
|
done
|
|
|
|
if [ -n "$(command -v yum)" ]; then
|
|
sys_type="yum"
|
|
sep="-"
|
|
elif [ -n "$(command -v zypper)" ]; then
|
|
sys_type="zypper"
|
|
sep="-"
|
|
elif [ -n "$(command -v apt-get)" ]; then
|
|
sys_type="apt-get"
|
|
sep="="
|
|
fi
|
|
|
|
#
|
|
# log
|
|
#
|
|
|
|
logger() {
|
|
now=$(date +'%m/%d/%Y %H:%M:%S')
|
|
case $1 in
|
|
"-e")
|
|
mtype="INFO:"
|
|
message="$2"
|
|
;;
|
|
"-w")
|
|
mtype="WARNING:"
|
|
message="$2"
|
|
;;
|
|
*)
|
|
mtype="INFO:"
|
|
message="$1"
|
|
;;
|
|
esac
|
|
echo "$now $mtype $message"
|
|
}
|
|
|
|
|
|
while true; do
|
|
OPTION=$(whiptail --title "Menu" --menu "Choisir une option :" 20 70 13 \
|
|
"1" "Mise à jour du système et conditions préalables à l'installation" \
|
|
"2" "Installation Docker" \
|
|
"3" "Installation Wazuh (SIEM)" \
|
|
"4" "Installation Shuffle (SOAR)" \
|
|
"5" "Installation DFIR-IRIS (Plate-forme de réponse aux incidents)" \
|
|
"6" "Configuration Simulation et POC" \
|
|
"7" "Installation MISP" \
|
|
"8" "Setup IRIS <-> Wazuh Integration" \
|
|
"9" "Setup MISP <-> Wazuh Integration" \
|
|
"10" "Afficher l'état" 3>&1 1>&2 2>&3)
|
|
|
|
#
|
|
# En fonction de l'option choisie, exécutez la commande correspondante
|
|
#
|
|
case $OPTION in
|
|
1)
|
|
# Mise à jour du système et conditions préalables à l'installation
|
|
logger -e "Update."
|
|
|
|
sudo apt-get update -y
|
|
sudo apt-get upgrade -y
|
|
sudo apt-get install wget curl nano git unzip -y
|
|
;;
|
|
2)
|
|
# Vérifier si Docker est installé
|
|
logger -e "Update."
|
|
|
|
if command -v docker > /dev/null; then
|
|
logger -e "docker package found. Continuing..."
|
|
|
|
echo "Docker est déjà installé."
|
|
else
|
|
# Installation Docker
|
|
curl -fsSL https://get.docker.com -o get-docker.sh
|
|
sudo sh get-docker.sh
|
|
sudo systemctl enable docker.service && sudo systemctl enable containerd.service
|
|
fi
|
|
;;
|
|
3)
|
|
# Installation Wazuh
|
|
logger -e "Installation Wazuh."
|
|
|
|
cd wazuh
|
|
sudo docker network create shared-network
|
|
sudo docker compose -f generate-indexer-certs.yml run --rm generator
|
|
sudo docker compose up -d
|
|
;;
|
|
4)
|
|
# Installation Shuffle (SOAR)
|
|
cd shuffle
|
|
sudo docker compose up -d
|
|
;;
|
|
5)
|
|
# Installation DFIR-IRIS
|
|
cd iris-web
|
|
sudo docker compose build
|
|
sudo docker compose up -d
|
|
;;
|
|
6)
|
|
# Configuration Simulation et POC
|
|
wget -c https://github.com/danielmiessler/SecLists/archive/master.zip -O SecList.zip \
|
|
&& unzip SecList.zip \
|
|
&& rm -f SecList.zip
|
|
cd examples/poc-wazuh/brute-force
|
|
sudo docker compose build
|
|
sudo docker compose up -d
|
|
;;
|
|
7)
|
|
# Installation MISP
|
|
cd misp
|
|
IP=$(curl -s ip.me -4)
|
|
sed -i "s|BASE_URL=.*|BASE_URL='https://$IP:1443'|" template.env
|
|
cp template.env .env
|
|
sudo docker compose up -d
|
|
;;
|
|
8)
|
|
# Setup IRIS <-> Wazuh Integration
|
|
cp wazuh/custom-integrations/custom-iris.py /var/lib/docker/volumes/wazuh_wazuh_integrations/_data/custom-iris.py
|
|
sudo docker exec -ti wazuh-wazuh.manager-1 chown root:wazuh /var/ossec/integrations/custom-iris.py
|
|
sudo docker exec -ti wazuh-wazuh.manager-1 chmod 750 /var/ossec/integrations/custom-iris.py
|
|
sudo docker exec -ti wazuh-wazuh.manager-1 apt update -y
|
|
sudo docker exec -ti wazuh-wazuh.manager-1 apt install python3-pip -y
|
|
sudo docker exec -ti wazuh-wazuh.manager-1 pip3 install requests
|
|
cd wazuh && sudo docker compose restart
|
|
;;
|
|
9)
|
|
# Setup MISP <-> Wazuh Integration
|
|
cp wazuh/custom-integrations/custom-misp.py /var/lib/docker/volumes/wazuh_wazuh_integrations/_data/custom-misp.py
|
|
sudo docker exec -ti wazuh-wazuh.manager-1 chown root:wazuh /var/ossec/integrations/custom-misp.py
|
|
sudo docker exec -ti wazuh-wazuh.manager-1 chmod 750 /var/ossec/integrations/custom-misp.py
|
|
cp wazuh/custom-integrations/local_rules.xml /var/lib/docker/volumes/wazuh_wazuh_etc/_data/rules/local_rules.xml
|
|
sudo docker exec -ti wazuh-wazuh.manager-1 chown wazuh:wazuh /var/ossec/etc/rules/local_rules.xml
|
|
sudo docker exec -ti wazuh-wazuh.manager-1 chmod 550 /var/ossec/etc/rules/local_rules.xml
|
|
cd wazuh && sudo docker compose restart
|
|
;;
|
|
10)
|
|
# Afficher l'état
|
|
sudo docker ps
|
|
;;
|
|
esac
|
|
# Donne la possibilité de revenir au menu précédent ou de quitter.
|
|
if (whiptail --title "Sortie" --yesno "Voulez-vous quitter le script ?" 8 78); then
|
|
break
|
|
else
|
|
continue
|
|
fi
|
|
done
|