Emails not getting generated after 2FA enablement

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
User avatar
pbroste
Posts: 1288
Joined: Tue Jun 01, 2021 1:27 pm

Re: Emails not getting generated after 2FA enablement

Post by pbroste »

Hello @pavan509

Thanks for following up, we see from the screenshot that port 25 is configured.

When TLS or SSL is used for SMTP we typically see port 465 (or 587). Please check with your team to verify which port they are receiving emails on.

Thanks,
Perry
pavan509
Posts: 72
Joined: Fri Apr 30, 2021 7:07 am

Re: Emails not getting generated after 2FA enablement

Post by pavan509 »

Hello Perry,

I have checked with my SMTP team and they were using the 587 port for the SMTP server. Please find the settings as well as the error message as attached. Please check and let me know where I am doing wrong.
You do not have the required permissions to view the files attached to this post.
Thanks, Pavan
User avatar
pbroste
Posts: 1288
Joined: Tue Jun 01, 2021 1:27 pm

Re: Emails not getting generated after 2FA enablement

Post by pbroste »

Hello @pavan509

You probably toggled between TLS and SSL with the same results; what do you get if we test response from command:

Code: Select all

openssl s_client -connect alerts.se.com:587 -starttls smtp
We should see a Verify return 'ok'

Are you able to hit your SMTP server from your Nagios XI server:

Code: Select all

nc -vz alerts.se.com 587
We should see Ncat: Connected to XXXX

If not please check to see if anything is blocking.

Thanks,
Perry
pavan509
Posts: 72
Joined: Fri Apr 30, 2021 7:07 am

Re: Emails not getting generated after 2FA enablement

Post by pavan509 »

Hello Perry,

Yes, I am able to hit the SMTP server smtp.se.com. Below are the outputs for the commands which you provided.

[root@SocAvailMonitor2 ~]# openssl s_client -connect smtp.se.com:587 -starttls smtp
CONNECTED(00000003)

Start Time: 1630048063
Timeout : 300 (sec)
Verify return code: 0 (ok)
---
250 STARTTLS


[root@SocAvailMonitor2 ~]# nc -vz smtp.se.com 587
Ncat: Version 7.50 ( https://nmap.org/ncat )
Ncat: Connected to xx.xxx.xxx.xxx:587.
Ncat: 0 bytes sent, 0 bytes received in 0.07 seconds.
Thanks, Pavan
User avatar
pbroste
Posts: 1288
Joined: Tue Jun 01, 2021 1:27 pm

Re: Emails not getting generated after 2FA enablement

Post by pbroste »

Hello @pavan509,

Thanks for providing the info, at least we know that we are able to get to the SMTP server on port 587. Want to check to see if it is related to the version of php or time?

First let's take a look at the phpmailer.log, make sure that you enable logging of mail sent with the internal mail component (PHPMailer) on the web console > Admin > Email Settings

Code: Select all

cat /usr/local/nagiosxi/tmp/phpmailer.log
What is the current php version:

Code: Select all

php --version
Make sure that the date/time/timezone match system:

Code: Select all

php -r "echo date_default_timezone_get();" #timezone
php -r " echo date('Y-m-d H:i:s');"        #date
php -r " echo gmdate('Y-m-d H:i:s');"      #time
date
ls -l /etc/localtime
Let me know the results,
Perry
pavan509
Posts: 72
Joined: Fri Apr 30, 2021 7:07 am

Re: Emails not getting generated after 2FA enablement

Post by pavan509 »

Hello Perry,

The attached image consists of email settings in the admin console. Please find below outputs for the requested commands.

[SESA615438@SocAvailMonitor2 ~]$ php --version
PHP 5.4.16 (cli) (built: Oct 29 2019 09:56:22)
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2013 Zend Technologies
[SESA615438@SocAvailMonitor2 ~]$
[SESA615438@SocAvailMonitor2 ~]$ php -r "echo date_default_timezone_get();"
America/Los_Angeles
[SESA615438@SocAvailMonitor2 ~]$
[SESA615438@SocAvailMonitor2 ~]$ php -r " echo date('Y-m-d H:i:s');"
2021-08-30 05:05:06
[SESA615438@SocAvailMonitor2 ~]$
[SESA615438@SocAvailMonitor2 ~]$ php -r " echo gmdate('Y-m-d H:i:s');"
2021-08-30 12:05:19
[SESA615438@SocAvailMonitor2 ~]$
[SESA615438@SocAvailMonitor2 ~]$ date
Mon Aug 30 05:05:38 PDT 2021
[SESA615438@SocAvailMonitor2 ~]$ ls -l /etc/localtime
lrwxrwxrwx 1 root root 39 Dec 12 2016 /etc/localtime -> /usr/share/zoneinfo/America/Los_Angeles


[SESA615438@SocAvailMonitor2 ~]$ tail /usr/local/nagiosxi/tmp/phpmailer.log
[08-30-2021 01:00:05] Message sent! (method=smtp;host=smtp.se.com;port=25;smtpauth=true;security=none), Referer: includes/components/scheduledreporting > Scheduled Report
[08-30-2021 01:00:05] Message sent! (method=smtp;host=smtp.se.com;port=25;smtpauth=true;security=none), Referer: includes/components/scheduledreporting > Scheduled Report
[08-30-2021 01:00:05] Message sent! (method=smtp;host=smtp.se.com;port=25;smtpauth=true;security=none), Referer: includes/components/scheduledreporting > Scheduled Report
[08-30-2021 01:00:05] Message sent! (method=smtp;host=smtp.se.com;port=25;smtpauth=true;security=none), Referer: includes/components/scheduledreporting > Scheduled Report
[08-30-2021 01:00:06] Message sent! (method=smtp;host=smtp.se.com;port=25;smtpauth=true;security=none), Referer: includes/components/scheduledreporting > Scheduled Report
[08-30-2021 01:00:06] Message sent! (method=smtp;host=smtp.se.com;port=25;smtpauth=true;security=none), Referer: includes/components/scheduledreporting > Scheduled Report
[08-30-2021 01:03:06] Message sent! (method=smtp;host=smtp.se.com;port=25;smtpauth=true;security=none), Referer: includes/components/scheduledreporting > Scheduled Report
[08-30-2021 01:42:50] Message sent! (method=smtp;host=smtp.se.com;port=25;smtpauth=true;security=none), Referer: Unknown
[08-30-2021 03:00:03] Message sent! (method=smtp;host=smtp.se.com;port=25;smtpauth=true;security=none), Referer: includes/components/scheduledreporting > Scheduled Report
[08-30-2021 05:06:43] Message sent! (method=smtp;host=smtp.se.com;port=25;smtpauth=true;security=none), Referer: Unknown
You do not have the required permissions to view the files attached to this post.
Thanks, Pavan
User avatar
pbroste
Posts: 1288
Joined: Tue Jun 01, 2021 1:27 pm

Re: Emails not getting generated after 2FA enablement

Post by pbroste »

Hello @pavan509

Thanks for following up with the results. We see from the test email is still getting sent out on port 25 from the screenshot that you provided.

Want to make sure that the Settings for SMTP were updated after you made the updated change on the UI by having you go to the Core Configuration Manager (CCM) > Apply configuration. Or via api:

Code: Select all

curl -XPOST "http://xxx.xxx.xxx.xxx/nagiosxi/api/v1/system/applyconfig?apikey=yourkeyhere"
Also Going out on a limb, want to rule out the browser is caching browser history and would like to have you run through the test email in incognito or private browser mode.

Please let us know the results,
Perry
pavan509
Posts: 72
Joined: Fri Apr 30, 2021 7:07 am

Re: Emails not getting generated after 2FA enablement

Post by pavan509 »

Hello Perry,

If I run it on port 587 with tls option selected, I am not able to receive a 2FA email, and below is the log snippet.

[root@SocAvailMonitor2 ~]# tail /usr/local/nagiosxi/tmp/phpmailer.log
[09-06-2021 01:00:04] Message sent! (method=smtp;host=smtp.se.com;port=25;smtpauth=true;security=none), Referer: includes/components/scheduledreporting > Scheduled Report
[09-06-2021 01:00:05] Message sent! (method=smtp;host=smtp.se.com;port=25;smtpauth=true;security=none), Referer: includes/components/scheduledreporting > Scheduled Report
[09-06-2021 01:00:05] Message sent! (method=smtp;host=smtp.se.com;port=25;smtpauth=true;security=none), Referer: includes/components/scheduledreporting > Scheduled Report
[09-06-2021 01:00:05] Message sent! (method=smtp;host=smtp.se.com;port=25;smtpauth=true;security=none), Referer: includes/components/scheduledreporting > Scheduled Report
[09-06-2021 01:01:26] Message sent! (method=smtp;host=smtp.se.com;port=25;smtpauth=true;security=none), Referer: includes/components/scheduledreporting > Scheduled Report
[09-06-2021 01:03:02] Message sent! (method=smtp;host=smtp.se.com;port=25;smtpauth=true;security=none), Referer: Unknown
[09-06-2021 01:33:53] Message sent! (method=smtp;host=smtp.se.com;port=25;smtpauth=true;security=none), Referer: Unknown
[09-06-2021 03:00:04] Message sent! (method=smtp;host=smtp.se.com;port=25;smtpauth=true;security=none), Referer: includes/components/scheduledreporting > Scheduled Report
[09-06-2021 05:57:41] SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/ ... leshooting (method=smtp;host=smtp.se.com;port=587;smtpauth=true;security=tls), Referer: Unknown
[09-06-2021 05:59:14] SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/ ... leshooting (method=smtp;host=smtp.se.com;port=587;smtpauth=true;security=tls), Referer: admin/testemail.php

If I run it on 587 with none in security settings, below is the log snippet and not receiving any emails.

[09-06-2021 06:09:43] SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/ ... leshooting (method=smtp;host=smtp.se.com;port=587;smtpauth=true;security=none), Referer: admin/testemail.php
[09-06-2021 06:10:16] SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/ ... leshooting (method=smtp;host=smtp.se.com;port=587;smtpauth=true;security=none), Referer: Unknown

Kindly advise.
Thanks, Pavan
User avatar
pbroste
Posts: 1288
Joined: Tue Jun 01, 2021 1:27 pm

Re: Emails not getting generated after 2FA enablement

Post by pbroste »

Hello @pavan509

Thanks for following up, appears that you are not able to receive any response from the PHPmailer. You verified that the smtp server is expecting TLS on port 587.

Want to find out what you get on the results on this command:

Code: Select all

echo QUIT | openssl s_client -starttls smtp -crlf -connect smtp.se.com:587
Please run through a [Send Test Email] while running this command to capture the results:

Code: Select all

tail -Fn0 /var/log/httpd/* /var/log/apache2/* >> /tmp/results.txt
Please send the '/tmp/results.txt' and results on the command output.

Thanks,
Perry

Thanks,
Perry
pavan509
Posts: 72
Joined: Fri Apr 30, 2021 7:07 am

Re: Emails not getting generated after 2FA enablement

Post by pavan509 »

Hello Perry,

I have sent you the SMTP results via PM and attached the results file when Send Test Email is running. Kindly review and advise.
You do not have the required permissions to view the files attached to this post.
Thanks, Pavan
Locked