TLS 1.0 when sending mails through PHPMailer?
Posted: Wed Aug 14, 2019 8:04 am
Hi,
We are currently using smtp.office365.com for sending mails from Nagios XI. As Microsoft is soon removing support for older versions of TLS we have received a notification that the mails sent from Nagios are transported over a connection secured by TLS 1.0.
Is this correct?
If so, how do we remedy this?
I have done some digging myself, based on a hunch that this could be linked to the old version of PHP shipped with CentOS.
I found that PHPMailer uses stream_socket_enable_crypto (docs) for securing the connection, but as we are using PHP 5.4 the most secure flag available is STREAM_CRYPTO_METHOD_TLS_CLIENT. This appears to lead to a call to TLSv1_client_method() (PHP 5.4.16 source), which I believe is for negotiating a TLS 1.0 connection.
If this is correct (and I may very well have taken a wrong turn) the most obvious solution would be moving to a newer PHP release.
Is upgrading the installed version of PHP officially supported, or are we better off looking to sendmail for future delivery of mail?
E:
On further inspection, changing the flag in /usr/local/nagiosxi/html/includes/phpmailer/class.smtp.php from STREAM_CRYPTO_METHOD_TLS_CLIENT to STREAM_CRYPTO_METHOD_SSLv23_CLIENT may lead to calling SSLv23_client_method(), which is the "version-flexible" according to the manpages. I will report back when I can see whether this fixes our problem.
We are currently using smtp.office365.com for sending mails from Nagios XI. As Microsoft is soon removing support for older versions of TLS we have received a notification that the mails sent from Nagios are transported over a connection secured by TLS 1.0.
Is this correct?
If so, how do we remedy this?
I have done some digging myself, based on a hunch that this could be linked to the old version of PHP shipped with CentOS.
I found that PHPMailer uses stream_socket_enable_crypto (docs) for securing the connection, but as we are using PHP 5.4 the most secure flag available is STREAM_CRYPTO_METHOD_TLS_CLIENT. This appears to lead to a call to TLSv1_client_method() (PHP 5.4.16 source), which I believe is for negotiating a TLS 1.0 connection.
If this is correct (and I may very well have taken a wrong turn) the most obvious solution would be moving to a newer PHP release.
Is upgrading the installed version of PHP officially supported, or are we better off looking to sendmail for future delivery of mail?
Code: Select all
Nagios XI version: 5.6.5
XI installed from: source
CentOS Linux release 7.6.1810 (Core)
PHP Version: 5.4.16
On further inspection, changing the flag in /usr/local/nagiosxi/html/includes/phpmailer/class.smtp.php from STREAM_CRYPTO_METHOD_TLS_CLIENT to STREAM_CRYPTO_METHOD_SSLv23_CLIENT may lead to calling SSLv23_client_method(), which is the "version-flexible" according to the manpages. I will report back when I can see whether this fixes our problem.