Actualizado reconocimiento de distro para la instalcion
This commit is contained in:
parent
650c610137
commit
1e29b2a556
@ -1,16 +1,25 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Obtener la clave de agente del servidor wazuh
|
||||||
|
echo "Ingrese la key del agente:"
|
||||||
|
read agent_key
|
||||||
|
server_ip="140.82.30.232"
|
||||||
|
# Obtener nombre de la distro
|
||||||
|
|
||||||
|
echo "Detectando distro"
|
||||||
|
|
||||||
|
distro=$(lsb_release -si)
|
||||||
|
|
||||||
|
case "$distro" in
|
||||||
|
Ubuntu)
|
||||||
|
echo "Distribucion detectada: Ubuntu"
|
||||||
|
echo "Familia principal: Debian"
|
||||||
|
echo "Paqueteria: DEB"
|
||||||
|
|
||||||
# Descargar e instalar el agente de Wazuh
|
# Descargar e instalar el agente de Wazuh
|
||||||
wget -qO - https://packages.wazuh.com/key/GPG-KEY-WAZUH | apt-key add -
|
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
|
echo "deb https://packages.wazuh.com/4.x/apt/ stable main" | tee /etc/apt/sources.list.d/wazuh.list
|
||||||
apt-get update
|
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
|
|
||||||
|
|
||||||
WAZUH_MANAGER="$server_ip" apt-get install wazuh-agent
|
WAZUH_MANAGER="$server_ip" apt-get install wazuh-agent
|
||||||
/var/ossec/bin/manage_agents -i $agent_key
|
/var/ossec/bin/manage_agents -i $agent_key
|
||||||
|
|
||||||
@ -23,5 +32,76 @@ systemctl start wazuh-agent
|
|||||||
echo "Desactivando actualizaciones del wazuh-agent"
|
echo "Desactivando actualizaciones del wazuh-agent"
|
||||||
sed -i "s/^deb/#deb/" /etc/apt/sources.list.d/wazuh.list
|
sed -i "s/^deb/#deb/" /etc/apt/sources.list.d/wazuh.list
|
||||||
apt-get update
|
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
|
||||||
|
@ -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-----
|
||||||
|
Loading…
Reference in New Issue
Block a user