Hi rukender,
To send email alerts with SMTP authentication you have to configure a server relay. We recommend using postfix but Sendmail should work as well. After testing your issue I think that your Sendmail server is sending emails correctly but is refusing incoming requests from outside (Wazuh Manager). In order to configure Sendmail to accept requests from Wazuh Manager follow the next steps on your EC2 instance where the Sendmail is installed.
Create your own access list:
Open /etc/mail/access and add the following to the end of the file:
<manager-ip> RELAY
After that recreate access.db file: makemap hash /etc/mail/access.db < /etc/mail/access
Make sure you are accepting requests from Wazuh Manager address, on file /etc/mail/sendmail.mc.
You can add the Wazuh Manager IP or none to accept requests from every single address.
If your SMTP requires authentication, create a file with credentials:
mkdir -m 700 /etc/mail/authinfoCreate the hashmap: makemap hash /etc/mail/authinfo/smtp-auth < /etc/mail/authinfo/smtp-auth
Add access features to conf file /etc/mail/sendmail.mc. Before MAILER_DEFINITIONS.
Change <smtp-server-domain> with your aws smtp server, if it uses a different port from default 587 change it as well.
Make new config and restart service:
make -C /etc/mailIn my case sendmail-smtp is the domain name of my SMTP server. You can test that with ping
user@wazuh-manager:/home/user# ping sendmail-smtpRestart Wazuh Manager after changing config file: systemctl restart wazuh-manager.
Finally try to generate an alert on and check if a email notification is sent checking logs on SMTP EC2 instance. In my case on sendmail-smtp machine.
First make sure an alert is generated on wazuh-manager: tail -f /var/ossec/logs/alerts/alerts.json :
Now on EC2 SMTP instance: tail -f /var/log/mail.log
vagrant@d10postfix:~$ sudo netstat -tulpn | grep :25
tcp 0 0 0.0.0.0:25 0.0.0.0:* LISTEN 1890/master
tcp6 0 0 :::25 :::* LISTEN 1890/master
vagrant@d10postfix:~$ ps -aux | grep 1890
root 1890 0.0 0.3 43472 3992 ? Ss 06:57 0:00 /usr/lib/postfix/sbin/master -w
vagrant 1904 0.0 0.0 6076 888 pts/0 S+ 07:05 0:00 grep 1890
In our case postfix is using port 25, so we should stop it before starting Sendmail. Stop the service,
make sure that port 25 is free and restart Sendmail:
vagrant@d10postfix:~$ sudo systemctl stop postfix
vagrant@d10postfix:~$ sudo netstat -tulpn | grep :25
vagrant@d10postfix:~$ sudo systemctl restart sendmail
Regards,
Víctor.
--
You received this message because you are subscribed to the Google Groups "Wazuh mailing list" group.
To unsubscribe from this group and stop receiving emails from it, send an email to wazuh+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/wazuh/6d94cb8e-41a5-4dd5-80e0-5725582954cen%40googlegroups.com.