Actualizado reconocimiento de distro para la instalcion

This commit is contained in:
Kevin Muñoz 2023-05-19 10:55:05 -05:00
parent 650c610137
commit 1e29b2a556
No known key found for this signature in database
GPG Key ID: 2F287937155A4380
2 changed files with 103 additions and 23 deletions

View File

@ -1,27 +1,107 @@
#!/bin/bash #!/bin/bash
# Descargar e instalar el agente de Wazuh # Obtener la clave de agente del servidor wazuh
wget -qO - https://packages.wazuh.com/key/GPG-KEY-WAZUH | apt-key add - echo "Ingrese la key del agente:"
echo "deb https://packages.wazuh.com/4.x/apt/ stable main" | tee /etc/apt/sources.list.d/wazuh.list
apt-get update
# Obtener la clave del agente del servidor Wazuh
echo "Ingrese la dirección IP o nombre de host del servidor Wazuh: "
read server_ip
echo "Ingrese el key del agente: "
read agent_key read agent_key
server_ip="140.82.30.232"
# Obtener nombre de la distro
WAZUH_MANAGER="$server_ip" apt-get install wazuh-agent echo "Detectando distro"
/var/ossec/bin/manage_agents -i $agent_key
# Iniciar el agente de Wazuh distro=$(lsb_release -si)
systemctl daemon-reload
systemctl enable wazuh-agent
systemctl start wazuh-agent
# Desactivar las actualizaciones automáticas del agente case "$distro" in
echo "Desactivando actualizaciones del wazuh-agent" Ubuntu)
sed -i "s/^deb/#deb/" /etc/apt/sources.list.d/wazuh.list echo "Distribucion detectada: Ubuntu"
apt-get update echo "Familia principal: Debian"
echo "Paqueteria: DEB"
# 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
# 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
;;
Arch)
echo "Distribucion detectada: Arch"
echo "Familia principal: Arch"
echo "Paqueteria: Sources"
pacman --noconfirm -Syu 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

View File

@ -1,7 +1,7 @@
-----BEGIN PGP SIGNATURE----- -----BEGIN PGP SIGNATURE-----
iIoEABYIADIWIQRFi3VFYtlWy+Zyp4AvKHk3FVpDgAUCZF/R3RQca211bm96QGNv iIoEABYIADIWIQRFi3VFYtlWy+Zyp4AvKHk3FVpDgAUCZGebnRQca211bm96QGNv
bmRvcmJzLm5ldAAKCRAvKHk3FVpDgNUMAP9bIAm7BbxhpGP8Tu0mSCym3/XMP60b bmRvcmJzLm5ldAAKCRAvKHk3FVpDgAv9AQCZ0q9j14Mw0sdy2/AHqn9Jdi3due2w
jOozQTpXcISbEwEAzMw228QzvfLLk5s6AFZECb4B7231da4FVagJIdmbEQs= CcN/c4rSkGPNXwEA8VnDM7aBl08puUOuJK/2U0K0NmeqlayI2Qj05e0IRgc=
=E2UD =ZKfF
-----END PGP SIGNATURE----- -----END PGP SIGNATURE-----