SMTP connect() failed on new setup

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
jpdl
Posts: 23
Joined: Thu Jan 13, 2022 2:51 am

SMTP connect() failed on new setup

Post by jpdl »

Hello Team,
Here is the brief of notification issue we are facing.

Hosted Nagios XI on WAS cloud with public IP assigned and trying to send email notification but could not do so. We have configured O365 email settings as per Microsoft documents.
Also tested the SMTP relay on PowerShell and it works without an issue, so it is not the email account.

Below is the error we received when try to generate test notification.

A test email was sent to [email protected]
----
Mailer said: [02-06-2022 18:04:40] SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/ ... leshooting (method=smtp;host=smtp.office365.com;port=587;smtpauth=true;security=ssl), Referer: admin/testemail.php
An error occurred sending a test email!

I have attached our system profile.


Regards
JP
You do not have the required permissions to view the files attached to this post.
gsmith
Posts: 1253
Joined: Tue Mar 02, 2021 11:15 am

Re: SMTP connect() failed on new setup

Post by gsmith »

Hi

Please go to Admin, Email Settings:
Image001.png
If the Send From: is showing Nagios XI <root@localhost> then please change it to a legitimate
email address as most mail servers will reject emails from root@localhost.

Thanks!
You do not have the required permissions to view the files attached to this post.
jpdl
Posts: 23
Joined: Thu Jan 13, 2022 2:51 am

Re: SMTP connect() failed on new setup

Post by jpdl »

I can confirm that my email settings are correct as per my attached screenshot.

I have tested with multiple O365 accounts and still failing

A test email was sent to [email protected]
----
Mailer said: [02-07-2022 16:05:04] SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/ ... leshooting (method=smtp;host=smtp.office365.com;port=587;smtpauth=true;security=ssl), Referer: admin/testemail.php
An error occurred sending a test email!
You do not have the required permissions to view the files attached to this post.
gsmith
Posts: 1253
Joined: Tue Mar 02, 2021 11:15 am

Re: SMTP connect() failed on new setup

Post by gsmith »

Hi

What version of php are you running?

Thanks
jpdl
Posts: 23
Joined: Thu Jan 13, 2022 2:51 am

Re: SMTP connect() failed on new setup

Post by jpdl »

How am I able to check that? as I am new with Nagios XI, please provide steps on how to check?
I have also attached our current profile downloaded
I have downloaded the latest version and not sure but maybe the php is the problem
You do not have the required permissions to view the files attached to this post.
gsmith
Posts: 1253
Joined: Tue Mar 02, 2021 11:15 am

Re: SMTP connect() failed on new setup

Post by gsmith »

Hi

Please go to a shell (command line) on your Nagios XI server and run:

php -v

That will tell you the php version.

If it is 5.xx.xx then we will need to get you to php7

Let me know what version you get.

Thanks!
jpdl
Posts: 23
Joined: Thu Jan 13, 2022 2:51 am

Re: SMTP connect() failed on new setup

Post by jpdl »

Hi

Thank you for your message, sorry I am very bad with Linux and with your help managed to check the version.
My version is PHP 5.4.16
So it will need to be updated, would you be able to provide the steps to update the PHP to the correct version?

I take it has to do with Microsoft getting rid of TLS 1.0 and 1.1
ssax
Dreams In Code
Posts: 7682
Joined: Wed Feb 11, 2015 12:54 pm

Re: SMTP connect() failed on new setup

Post by ssax »

You should be able to follow the guide below:

https://support.nagios.com/kb/article/n ... 7-860.html

But before you do, send the output of this command:

Code: Select all

rpm -qa | grep nagiosxi
If your XI install was installed via RPM or via the offline package, DO NOT follow that guide.

EDIT: You likely need to do this after upgrading PHP as well because of Microsoft getting rid of TLS 1.0 and 1.1.

Edit this file:

Code: Select all

/usr/local/nagiosxi/html/includes/phpmailer/class.smtp.php
Change line 360 from:

Code: Select all

$crypto_method = STREAM_CRYPTO_METHOD_TLS_CLIENT;
To:

Code: Select all

$crypto_method = STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT;
jpdl
Posts: 23
Joined: Thu Jan 13, 2022 2:51 am

Re: SMTP connect() failed on new setup

Post by jpdl »

Hi,

thank you for your message, please see below response for command: rpm -qa | grep nagiosxi that was run on our server.
Our Nagios was installed via a custom template on AWS, so I am not sure which steps should be followed.
I will attach the screenshot of the setup that was used on AWS.

[centos@ip-172-31-16-10 ~]$ rpm -qa | grep nagiosxi
nagiosxi-deps-el7-5.8.7-1.noarch
You do not have the required permissions to view the files attached to this post.
ssax
Dreams In Code
Posts: 7682
Joined: Wed Feb 11, 2015 12:54 pm

Re: SMTP connect() failed on new setup

Post by ssax »

You would follow that guide:
- Take a VM snapshot before doing it though in case you run into issues

https://support.nagios.com/kb/article/n ... 7-860.html
Locked