Skip to content

Commit

Permalink
chore: Update script to install Wazuh agent
Browse files Browse the repository at this point in the history
  • Loading branch information
bengo237 committed Aug 29, 2024
1 parent d4bd278 commit 16d4f4b
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions scripts/tests/test-script.bats
Original file line number Diff line number Diff line change
@@ -1,5 +1,32 @@
#!/usr/bin/env bats

WAZUH_MANAGER="10.0.0.2"

if [ "$(uname -o)" = "GNU/Linux" ] && command -v groupadd >/dev/null 2>&1; then
apt-get update && apt-get install -y curl gnupg2
(curl -s https://packages.wazuh.com/key/GPG-KEY-WAZUH | gpg --no-default-keyring --keyring gnupg-ring:/usr/share/keyrings/wazuh.gpg --import)
chmod 644 /usr/share/keyrings/wazuh.gpg

# Check if the repository is already added
if ! grep -q "https://packages.wazuh.com/4.x/apt/" /etc/apt/sources.list.d/wazuh.list 2>/dev/null; then
echo "deb [signed-by=/usr/share/keyrings/wazuh.gpg] https://packages.wazuh.com/4.x/apt/ stable main" | tee -a /etc/apt/sources.list.d/wazuh.list
fi

apt-get update
apt-get install wazuh-agent -y
sed -i "s|MANAGER_IP|$WAZUH_MANAGER|g" /var/ossec/etc/ossec.conf
elif [ "$(which apk)" = "/sbin/apk" ]; then
wget -O /etc/apk/keys/[email protected] https://packages.wazuh.com/key/alpine-devel%40wazuh.com-633d7457.rsa.pub
echo "https://packages.wazuh.com/4.x/alpine/v3.12/main" >> /etc/apk/repositories
apk update
apk add wazuh-agent
sed -i "s|MANAGER_IP|$WAZUH_MANAGER|g" /var/ossec/etc/ossec.conf
else
log ERROR "Unsupported OS for creating user."
exit 1
fi


sh /app/scripts/tests/setup.sh

chmod +x /app/scripts/install.sh
Expand Down

0 comments on commit 16d4f4b

Please sign in to comment.