Hi Federico,
To achieve this, I've modified the
Slack integration script. Attached you'll find the modified version which sends all level 10 alerts to one channel, level 11 to another channel and the remaining level 12 or higher to a third channel.
For this I have created three Webhooks, one for each channel, and set them in the script as variables:
webhook10 = " <!-- Replace with your Slack Webhook -->"
webhook11 = " <!-- Replace with your Slack Webhook -->"
webhook12 = " <!-- Replace with your Slack Webhook -->"
To set this custom integration, follow these steps:
- Modify the attached custom-slack script and set your Webhooks. You may add or remove channels according to your needs. To do so, add or remove Webhook variables and modify the generate_and_send_msg
function accordingly.
- Add your custom-slack script in /var/ossec/integrations/custom-slack
- Change the permissions and ownership:
chown root:wazuh /var/ossec/integrations/custom-slack
chmod 750 /var/ossec/integrations/custom-slack
Note that for Wazuh versions prior 4.3.x, the ownership should be: root:ossec
- In /var/ossec/etc/ossec.conf
configure your custom Slack integration in the following way to receive messages for alerts level 10 and above:
<integration>
<name>custom-slack</name>
<level>10</level>
<alert_format>json</alert_format>
</integration>
- Restart your manager so changes can take effect: systemctl restart wazuh-manager
Hope you find this script useful, let us know if you have any questions.
Best regards,
Sandra.