ntop / ntopng

Web-based Traffic and Security Network Traffic Monitoring
http://www.ntop.org
GNU General Public License v3.0
6.05k stars 640 forks source link

I cant send email from NtopNG #8174

Open cabefe opened 6 months ago

cabefe commented 6 months ago

I have probed with differents configurations SMTP: Google, Microsoft, .... But NtopNG dont send email. Please, help me. Thanks.

NicoMaio commented 6 months ago

Hi @cabefe , Could you please provide the ntopng logs?

dlk3 commented 5 months ago

I just set this up for the first time myself. Nothing worked until I entered the mail server address like this: "smtps://mail.domain.com". The mail server port should be 465, or whatever the server's SMTPS port is. It seems that ntopng does not do STARTTLS so I could not use my normal STARTTLS port 587. The documentation says nothing about any of this. I figured it out when I saw in the logs that ntopng was trying to send mail to "smtp://mail.domain.com" which meant it was trying to make a non-TLS connection, something that my server doesn't support.

cabefe commented 5 months ago

Hi @cabefe , Could you please provide the ntopng logs?

19/Jan/2024 13:46:17 [Utils.cpp:2007] WARNING Unable to send email to (smtps://mail.us.es:465/us.es): Timeout was reached. Run ntopng with -v6 for more details. 19/Jan/2024 13:42:46 [Utils.cpp:2007] WARNING Unable to send email to (smtps://mail.us.es:465/us.es): Timeout was reached. Run ntopng with -v6 for more details. 19/Jan/2024 13:37:06 [Utils.cpp:2007] WARNING Unable to send email to (smtps://mail.us.es:465/us.es): Timeout was reached. Run ntopng with -v6 for more details. 19/Jan/2024 13:34:16 [Utils.cpp:2007] WARNING Unable to send email to (smtps://mail.us.es:465/us.es): Timeout was reached. Run ntopng with -v6 for more details. 19/Jan/2024 13:11:56 [notifications.lua:25] [recipients.lua:1159] ERROR Error while sending notifications via Informática IBIS Unable to send mails 19/Jan/2024 13:11:56 [Utils.cpp:2007] WARNING Unable to send email to (smtps://mail.us.es:465/us.es): Timeout was reached. Run ntopng with -v6 for more details. 19/Jan/2024 13:07:30 [Utils.cpp:2007] WARNING Unable to send email to (smtps://mail.us.es:465/us.es): Timeout was reached. Run ntopng with -v6 for more details. 19/Jan/2024 13:04:40 [Utils.cpp:2007] WARNING Unable to send email to (smtps://mail.us.es:465/us.es): Timeout was reached. Run ntopng with -v6 for more details. 19/Jan/2024 13:01:56 [Utils.cpp:2007] WARNING Unable to send email to (smtps://mail.us.es:465/us.es): Timeout was reached. Run ntopng with -v6 for more details. 19/Jan/2024 12:45:35 [Utils.cpp:2007] WARNING Unable to send email to (smtps://mail.us.es:587/us.es): SSL connect error. Run ntopng with -v6 for more details. 19/Jan/2024 12:41:54 [Utils.cpp:2007] WARNING Unable to send email to (smtps://mail.us.es:465/us.es): Timeout was reached. Run ntopng with -v6 for more details. 19/Jan/2024 12:38:13 [Utils.cpp:2007] WARNING Unable to send email to (smtp://mail.us.es:465/us.es): Timeout was reached. Run ntopng with -v6 for more details. 19/Jan/2024 12:36:53 [Utils.cpp:2007] WARNING Unable to send email to (smtp://mail.us.es:465/us.es): Timeout was reached. Run ntopng with -v6 for more details. 19/Jan/2024 12:31:06 [notifications.lua:25] [recipients.lua:1159] ERROR Error while sending notifications via Informática IBIS Unable to send mails 19/Jan/2024 12:31:06 [Utils.cpp:2007] WARNING Unable to send email to (smtp://mail.us.es:587/us.es): Failed sending data to the peer. Run ntopng with -v6 for more details. 19/Jan/2024 12:04:22 [Utils.cpp:2007] WARNING Unable to send email to (smtp://mail.us.es:587/us.es): Failed sending data to the peer. Run ntopng with -v6 for more details. 19/Jan/2024 11:59:55 [Utils.cpp:2007] WARNING Unable to send email to (smtp://mail.us.es:587/us.es): Failed sending data to the peer. Run ntopng with -v6 for more details. 19/Jan/2024 11:53:45 [Utils.cpp:2007] WARNING Unable to send email to (smtp://mail.us.es:587/us.es): Failed sending data to the peer. Run ntopng with -v6 for more details. 19/Jan/2024 11:34:15 [Utils.cpp:2007] WARNING Unable to send email to (smtp://mail.us.es:587/us.es): Failed sending data to the peer. Run ntopng with -v6 for more details. 19/Jan/2024 11:27:12 [notifications.lua:25] [recipients.lua:1159] ERROR Error while sending notifications via Informática IBIS Unable to send mails 19/Jan/2024 11:27:12 [Utils.cpp:2007] WARNING Unable to send email to (smtp://mail.us.es:587/us.es): Failed sending data to the peer. Run ntopng with -v6 for more details. 19/Jan/2024 11:26:12 [Utils.cpp:2007] WARNING Unable to send email to (smtp://mail.us.es:587/us.es): Failed sending data to the peer. Run ntopng with -v6 for more details. 19/Jan/2024 11:19:21 [Utils.cpp:2007] WARNING Unable to send email to (smtp://mail.us.es:587/us.es): Failed sending data to the peer. Run ntopng with -v6 for more details. 19/Jan/2024 11:03:42 [Utils.cpp:2007] WARNING Unable to send email to (smtp://mail.us.es:587/us.es): Failed sending data to the peer. Run ntopng with -v6 for more details. 19/Jan/2024 10:59:49 [Utils.cpp:2007] WARNING Unable to send email to (smtp://mail.us.es:587/us.es): Fa

cabefe commented 5 months ago

I just set this up for the first time myself. Nothing worked until I entered the mail server address like this: "smtps://mail.domain.com". The mail server port should be 465, or whatever the server's SMTPS port is. It seems that ntopng does not do STARTTLS so I could not use my normal STARTTLS port 587. The documentation says nothing about any of this. I figured it out when I saw in the logs that ntopng was trying to send mail to "smtp://mail.domain.com" which meant it was trying to make a non-TLS connection, something that my server doesn't support.

I think our server does not support port 465 :(

dlk3 commented 5 months ago

You could check what ports the server supports by telneting to them. This will let you see if the port is open to connections. For example: telnet mail.us.es 465

EDIT On second thought, I went ahead and tested this myself. It looks like you are correct, port 465 isn't open on mail.us.es. Port 587 is the only working mail port I could find. That means ntopng would need to support STARTTLS to use that server and I don't think that it does. Try a different mail server perhaps?

ALSO From the log entries, it looks like you might not have the "Email Sender" value correct in the endpoint configuration. Some mail servers care about this and some don't. If your server cares then this might need to be a valid e-mail address in the form "someone@us.es" not just "us.es". The client sends this to the mail server as part of its ELHO greeting. Some servers are configured to drop the connection if they can't validate this email address.

bigjohns97 commented 3 weeks ago

I just set this up for the first time myself. Nothing worked until I entered the mail server address like this: "smtps://mail.domain.com". The mail server port should be 465, or whatever the server's SMTPS port is. It seems that ntopng does not do STARTTLS so I could not use my normal STARTTLS port 587. The documentation says nothing about any of this. I figured it out when I saw in the logs that ntopng was trying to send mail to "smtp://mail.domain.com" which meant it was trying to make a non-TLS connection, something that my server doesn't support.

This resolved the issue for me, crazy they don't have this documented somewhere, I was troubleshooting for a while.