wazuhdeb/wazuhdebian

108 lines
3.0 KiB
Plaintext
Raw Normal View History

2023-05-16 14:41:09 -06:00
#!/bin/bash
# Obtener la clave de agente del servidor wazuh
echo "Ingrese la key del agente:"
2023-05-16 14:41:09 -06:00
read agent_key
server_ip="140.82.30.232"
# Obtener nombre de la distro
2023-05-16 14:41:09 -06:00
echo "Detectando distro"
2023-05-16 14:41:09 -06:00
distro=$(lsb_release -si)
2023-05-16 14:41:09 -06:00
case "$distro" in
Ubuntu)
echo "Distribucion detectada: Ubuntu"
echo "Familia principal: Debian"
echo "Paqueteria: DEB"
2023-05-16 14:41:09 -06:00
# Descargar e instalar el agente de Wazuh
wget -qO - https://packages.wazuh.com/key/GPG-KEY-WAZUH | apt-key add -
echo "deb https://packages.wazuh.com/4.x/apt/ stable main" | tee /etc/apt/sources.list.d/wazuh.list
apt-get update
WAZUH_MANAGER="$server_ip" apt-get install wazuh-agent
/var/ossec/bin/manage_agents -i $agent_key
2023-05-16 14:41:09 -06:00
# Iniciar el agente de Wazuh
systemctl daemon-reload
systemctl enable wazuh-agent
systemctl start wazuh-agent
# Desactivar las actualizaciones automáticas del agente
echo "Desactivando actualizaciones del wazuh-agent"
sed -i "s/^deb/#deb/" /etc/apt/sources.list.d/wazuh.list
apt-get update
;;
CentOS)
echo "Distribucion detectada: CentOS"
echo "Familia principal: RedHat"
echo "Paqueteria: RPM"
rpm --import https://packages.wazuh.com/key/GPG-KEY-WAZUH
cat > /etc/yum.repos.d/wazuh.repo << EOF
[wazuh]
gpgcheck=1
gpgkey=https://packages.wazuh.com/key/GPG-KEY-WAZUH
enabled=1
name=EL-\$releasever - Wazuh
baseurl=https://packages.wazuh.com/4.x/yum/
protect=1
EOF
WAZUH_MANAGER="$server_ip" yum install wazuh-agent
/var/ossec/bin/manage_agents -i $agent_key
systemctl daemon-reload
systemctl enable wazuh-agent
systemctl start wazuh-agent
echo "Desactivando actualizaciones del wazuh-agent"
sed -i "s/^enabled=1/enabled=0/" /etc/yum.repos.d/wazuh.repo
;;
Fedora)
echo "Distribucion detectada: Fedora"
echo "Familia principal: RedHat"
echo "Paqueteria: RPM"
rpm --import https://packages.wazuh.com/key/GPG-KEY-WAZUH
cat > /etc/yum.repos.d/wazuh.repo << EOF
[wazuh]
gpgcheck=1
gpgkey=https://packages.wazuh.com/key/GPG-KEY-WAZUH
enabled=1
name=EL-\$releasever - Wazuh
baseurl=https://packages.wazuh.com/4.x/yum/
protect=1
EOF
WAZUH_MANAGER="$server_ip" yum install wazuh-agent
/var/ossec/bin/manage_agents -i $agent_key
chkconfig --add wazuh-agent
service wazuh-agent start
echo "Desactivando actualizaciones del wazuh-agent"
sed -i "s/^enabled=1/enabled=0/" /etc/yum.repos.d/wazuh.repo
;;
2023-05-22 12:31:45 -06:00
Arch|ManjaroLinux)
echo "Distribucion detectada: Arch"
echo "Familia principal: Arch"
echo "Paqueteria: Sources"
2023-05-22 12:31:45 -06:00
pacman -Syu --noconfirm curl gcc make sudo wget expect gnupg perl-base perl fakeroot python brotli automake autoconf libtool gawk libsigsegv nodejs base-devel inetutils cmake
curl -Ls https://github.com/wazuh/wazuh/archive/v4.4.2.tar.gz | tar zx
cd wazuh-4.4.2
./install.sh
/var/ossec/bin/manage_agents -i $agent_key
systemctl daemon-reload
systemctl enable wazuh-agent
systemctl start wazuh-agent
;;
esac