mirror of
https://github.com/Security-Onion-Solutions/securityonion.git
synced 2025-12-06 09:12:45 +01:00
add AR whitelist for Wazuh
This commit is contained in:
@@ -40,3 +40,21 @@ fi
|
|||||||
|
|
||||||
echo "Adding $IP to the $FULLROLE role. This can take a few seconds"
|
echo "Adding $IP to the $FULLROLE role. This can take a few seconds"
|
||||||
/opt/so/saltstack/pillar/firewall/addfirewall.sh $FULLROLE $IP
|
/opt/so/saltstack/pillar/firewall/addfirewall.sh $FULLROLE $IP
|
||||||
|
|
||||||
|
# Check if Wazuh enabled
|
||||||
|
if grep -q -R "wazuh: 1" /opt/so/saltstack/pillar/*; then
|
||||||
|
# If analyst, add to Wazuh AR whitelist
|
||||||
|
if [ "$FULLROLE" == "analyst" ]; then
|
||||||
|
WAZUH_MGR_CFG="/opt/so/wazuh/etc/ossec.conf"
|
||||||
|
if ! grep -q "<white_list>$IP</white_list>" $WAZUH_MGR_CFG ; then
|
||||||
|
DATE=`date`
|
||||||
|
sed -i 's/<\/ossec_config>//' $WAZUH_MGR_CFG
|
||||||
|
sed -i '/^$/N;/^\n$/D' $WAZUH_MGR_CFG
|
||||||
|
echo -e "<!--Address $IP added by /usr/sbin/so-allow on "$DATE"-->\n <global>\n <white_list>$IP</white_list>\n </global>\n</ossec_config>" >> $WAZUH_MGR_CFG
|
||||||
|
echo "Added whitelist entry for $IP in $WAZUH_MGR_CFG."
|
||||||
|
echo
|
||||||
|
echo "Restarting OSSEC Server..."
|
||||||
|
/usr/sbin/so-wazuh-restart
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user