Last active 1737288662

wz.sh Raw
1#!/bin/bash
2
3# Check if running as root
4if [ "$EUID" -ne 0 ]; then
5 echo "Please run as root"
6 exit 1
7fi
8
9# Check if curl is installed
10if ! command -v curl &> /dev/null; then
11 echo "curl is not installed. Installing curl..."
12 apt-get update
13 apt-get install -y curl
14fi
15
16# Add Wazuh repository
17curl -s https://packages.wazuh.com/key/GPG-KEY-WAZUH | gpg --no-default-keyring --keyring gnupg-ring:/usr/share/keyrings/wazuh.gpg --import
18chmod 644 /usr/share/keyrings/wazuh.gpg
19
20# Add repository
21echo "deb [signed-by=/usr/share/keyrings/wazuh.gpg] https://packages.wazuh.com/4.x/apt/ stable main" | tee /etc/apt/sources.list.d/wazuh.list
22
23# Update package index
24apt-get update
25
26# Install Wazuh agent
27apt-get install -y wazuh-agent
28
29# Configure Wazuh agent with multiple manager IPs
30sed -i "s/MANAGER_IP/192.168.0.17,194.56.239.153/g" /var/ossec/etc/ossec.conf
31
32# Enable and start Wazuh agent
33systemctl daemon-reload
34systemctl enable wazuh-agent
35systemctl start wazuh-agent
36
37# Check status
38echo "Agent status:"
39systemctl status wazuh-agent
40
41# Show agent information
42echo -e "\nAgent version information:"
43/var/ossec/bin/wazuh-control info
44
45echo -e "\nInstallation completed. Please check the status above to verify the connection."