Wazuh - agent install for CentOS

This commit is contained in:
Wes Lambert
2018-12-07 13:36:11 +00:00
parent f5e2b7f210
commit e11aadf730
2 changed files with 341 additions and 26 deletions

View File

@@ -893,17 +893,34 @@ update_sudoers() {
wazuh_agent_install() {
# Get key
curl -s https://packages.wazuh.com/key/GPG-KEY-WAZUH | apt-key add -
# Add repo
echo "deb https://packages.wazuh.com/3.x/apt/ stable main" | tee /etc/apt/sources.list.d/wazuh.list
apt-get update -y
# Install
apt-get install -y wazuh-agent
# Prevent automatic updates
sed -i "s/^deb/#deb/" /etc/apt/sources.list.d/wazuh.list
# Set package state to "hold"
echo "wazuh-agent hold" | sudo dpkg --set-selections
if [ $OS == 'centos' ]; then
# Add repo
cat > /etc/yum.repos.d/wazuh.repo <<\EOF
[wazuh_repo]
gpgcheck=1
gpgkey=https://packages.wazuh.com/key/GPG-KEY-WAZUH
enabled=1
name=Wazuh repository
baseurl=https://packages.wazuh.com/3.x/yum/
protect=1
EOF
# Install agent
yum install -y wazuh-agent
# Prevent automatic upates
sed -i "s/^enabled=1/enabled=0/" /etc/yum.repos.d/wazuh.repo
else
# Get key
curl -s https://packages.wazuh.com/key/GPG-KEY-WAZUH | apt-key add -
# Add repo
echo "deb https://packages.wazuh.com/3.x/apt/ stable main" | tee /etc/apt/sources.list.d/wazuh.list
apt-get update -y
# Install
apt-get install -y wazuh-agent
# Prevent automatic updates
sed -i "s/^deb/#deb/" /etc/apt/sources.list.d/wazuh.list
# Set package state to "hold"
echo "wazuh-agent hold" | sudo dpkg --set-selections
fi
}