Dernière activité 1737288662

Malin's Avatar Malin a révisé ce gist 1737288661. Aller à la révision

1 file changed, 45 insertions

wz.sh(fichier créé)

@@ -0,0 +1,45 @@
1 + #!/bin/bash
2 +
3 + # Check if running as root
4 + if [ "$EUID" -ne 0 ]; then
5 + echo "Please run as root"
6 + exit 1
7 + fi
8 +
9 + # Check if curl is installed
10 + if ! command -v curl &> /dev/null; then
11 + echo "curl is not installed. Installing curl..."
12 + apt-get update
13 + apt-get install -y curl
14 + fi
15 +
16 + # Add Wazuh repository
17 + curl -s https://packages.wazuh.com/key/GPG-KEY-WAZUH | gpg --no-default-keyring --keyring gnupg-ring:/usr/share/keyrings/wazuh.gpg --import
18 + chmod 644 /usr/share/keyrings/wazuh.gpg
19 +
20 + # Add repository
21 + echo "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
24 + apt-get update
25 +
26 + # Install Wazuh agent
27 + apt-get install -y wazuh-agent
28 +
29 + # Configure Wazuh agent with multiple manager IPs
30 + sed -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
33 + systemctl daemon-reload
34 + systemctl enable wazuh-agent
35 + systemctl start wazuh-agent
36 +
37 + # Check status
38 + echo "Agent status:"
39 + systemctl status wazuh-agent
40 +
41 + # Show agent information
42 + echo -e "\nAgent version information:"
43 + /var/ossec/bin/wazuh-control info
44 +
45 + echo -e "\nInstallation completed. Please check the status above to verify the connection."
Plus récent Plus ancien