Post by Jasperz » Wed May 10, 2023 1:53 am

Hi folks,

I know that this has been asked a couple times on this forum, but none of the solutions provided worked for me.

The issue:
We have an OpenCart v3.0.2.0 running. Today, our hoster has disabled the TLS 1.0 and 1.1 versions. Since then, every time we do something on our OpenCart that triggers and email (registering a new account, finishing an order) fails and results in this message:

Code: Select all

Fatal error: Uncaught exception 'Exception' with message 'Error: EHLO not accepted from server!' in /var/www/vhosts/join-together.de/shop.join-together.de/system/library/mail/smtp.php:157 
As far as I understand, this has to do with the email settings in open cart (see the screenshot attached for more details).
I've tried removing the tls://, changing it to ssl:// (and changing the port to 465 of course), nothing works. Also tried forcing .php with the "curl_setopt($curl, CURLOPT_SSLVERSION, 6);".

What does work is changing the SMTP to php.Mail (the first dropdown). However, Google rejects emails that have been send this way (because they're lacking DKIM or SPF authentication).

Had anyone this issue before and knows how to fix it? What do I need to change in order to make email work again (preferrably the smtp version)?
In case it helps, I wrote this short .php script that reads the current TLS version - it's 1.2 it seems: https://shop.join-together.de/test_tsl.php

Attachments

email-settings-opencart.jpg

email-settings-opencart.jpg (458.13 KiB) Viewed 7956 times


Newbie

Posts

Joined
Sun Mar 03, 2019 8:34 pm

Post by Cue4cheap » Wed May 10, 2023 2:02 am

How about asking your host for all the details... #1 What port you should be using

cue4cheap not cheap quality


Expert Member

Posts

Joined
Fri Sep 20, 2013 4:45 am

Post by straightlight » Wed May 10, 2023 3:29 am

Jasperz wrote:
Wed May 10, 2023 1:53 am
Hi folks,

I know that this has been asked a couple times on this forum, but none of the solutions provided worked for me.

The issue:
We have an OpenCart v3.0.2.0 running. Today, our hoster has disabled the TLS 1.0 and 1.1 versions. Since then, every time we do something on our OpenCart that triggers and email (registering a new account, finishing an order) fails and results in this message:

Code: Select all

Fatal error: Uncaught exception 'Exception' with message 'Error: EHLO not accepted from server!' in /var/www/vhosts/join-together.de/shop.join-together.de/system/library/mail/smtp.php:157 
As far as I understand, this has to do with the email settings in open cart (see the screenshot attached for more details).
I've tried removing the tls://, changing it to ssl:// (and changing the port to 465 of course), nothing works. Also tried forcing .php with the "curl_setopt($curl, CURLOPT_SSLVERSION, 6);".

What does work is changing the SMTP to php.Mail (the first dropdown). However, Google rejects emails that have been send this way (because they're lacking DKIM or SPF authentication).

Had anyone this issue before and knows how to fix it? What do I need to change in order to make email work again (preferrably the smtp version)?
In case it helps, I wrote this short .php script that reads the current TLS version - it's 1.2 it seems: https://shop.join-together.de/test_tsl.php
OC v3.0.2.0 is quite old as the email library has been upgrade, since. Aside from your email password, what are your email settings from your OC admin? As for the cURL code, it should work just fine without it from the upgraded library.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by Jasperz » Wed May 10, 2023 3:57 am

Cue4cheap wrote:
Wed May 10, 2023 2:02 am
How about asking your host for all the details... #1 What port you should be using
That was the first thing I tried - without any success.


@straightlight What admin settings do you mean? Where can I find them?

Newbie

Posts

Joined
Sun Mar 03, 2019 8:34 pm

Post by straightlight » Wed May 10, 2023 6:00 am

Jasperz wrote:
Wed May 10, 2023 3:57 am
Cue4cheap wrote:
Wed May 10, 2023 2:02 am
How about asking your host for all the details... #1 What port you should be using
That was the first thing I tried - without any success.


@straightlight What admin settings do you mean? Where can I find them?
OC Admin > System Settings > Edit Settings > Mail tab.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by Jasperz » Wed May 10, 2023 7:06 am

These are what I shared above (see the screenshot). Or am I completely wrong? :)

Newbie

Posts

Joined
Sun Mar 03, 2019 8:34 pm

Post by ADD Creative » Wed May 10, 2023 7:17 am

What version of PHP are you using? You will need by on 7.2 or greater for TLS 1.2 without making changes to the stream_socket_enable_crypto settings in the SMTP class.

www.add-creative.co.uk


Guru Member

Posts

Joined
Sat Jan 14, 2012 1:02 am
Location - United Kingdom

Post by Jasperz » Wed May 10, 2023 3:17 pm

ADD Creative wrote:
Wed May 10, 2023 7:17 am
What version of PHP are you using? You will need by on 7.2 or greater for TLS 1.2 without making changes to the stream_socket_enable_crypto settings in the SMTP class.
Okay, I was thinking that something like this would be the problem. But why can I see that the website is using TLS 1.2 using the script I wrote? That doesn't make sense for me yet...

Does anyone has experience with setting up either of DKIM or SPF?

Newbie

Posts

Joined
Sun Mar 03, 2019 8:34 pm

Post by ADD Creative » Wed May 10, 2023 4:51 pm

So what PHP version are you using? What is the test script you are you are using to test the TLS version? It may be testing the wrong thing.

DKIM or SPF should be set up on your hosting. Ask your host if they will do it.

www.add-creative.co.uk


Guru Member

Posts

Joined
Sat Jan 14, 2012 1:02 am
Location - United Kingdom

Post by Jasperz » Wed May 10, 2023 5:10 pm

Sorry, forgot to add that it's 5.6.40 for PHP. Is there a chance of just adding in an updated mail module in my old OP v3?

Thanks, that helps!

Newbie

Posts

Joined
Sun Mar 03, 2019 8:34 pm

Post by ADD Creative » Wed May 10, 2023 6:01 pm

Find STREAM_CRYPTO_METHOD_TLS_CLIENT in system/library/mail/smtp.php and replace with STREAM_CRYPTO_METHOD_TLS_ANY_CLIENT.

www.add-creative.co.uk


Guru Member

Posts

Joined
Sat Jan 14, 2012 1:02 am
Location - United Kingdom

Post by by mona » Wed May 10, 2023 6:10 pm

In version 3.0.2.0, "Error: EHLO not accepted from server" has nothing to do with tls or ssl as the EHLO command is send after the connection has been established but before tls is even started.
Most likely, your mail server does not respond fast enough to the EHLO (Extended Hello) command afterwhich the class triggers an exception.
First try setting the timeout higher or use the class from later versions where it does several retries when response is slow.

PS. the email parameter is only used when using php mail, not by smtp.

DISCLAIMER:
You should not modify core files .. if you would like to donate a cup of coffee I will write it in a modification for you.


https://www.youtube.com/watch?v=zXIxDoCRc84


User avatar
Expert Member

Posts

Joined
Mon Jun 10, 2019 9:31 am

Post by ADD Creative » Wed May 10, 2023 7:37 pm

by mona wrote:
Wed May 10, 2023 6:10 pm
In version 3.0.2.0, "Error: EHLO not accepted from server" has nothing to do with tls or ssl as the EHLO command is send after the connection has been established but before tls is even started.
Most likely, your mail server does not respond fast enough to the EHLO (Extended Hello) command afterwhich the class triggers an exception.
First try setting the timeout higher or use the class from later versions where it does several retries when response is slow.

PS. the email parameter is only used when using php mail, not by smtp.
That is not correct. When using TLS, if the stream_socket_enable_crypto fails to established the encryption, then the next EHLO is still sent and an 'Error: EHLO not accepted from server!' will be generated.

There should really be a check in the code for stream_socket_enable_crypto failing and not continue sending EHLO and the credentials. Yes the EHLO will likely fail, but it does make it easier for the then plain text credentials be intercepted.

www.add-creative.co.uk


Guru Member

Posts

Joined
Sat Jan 14, 2012 1:02 am
Location - United Kingdom

Post by by mona » Thu May 11, 2023 2:32 am

you may be right, simply change the first occurence to:

Code: Select all

throw new \Exception('Error: EHLO 1 not accepted from server!');
and the second to:

Code: Select all

throw new \Exception('Error: EHLO 2 not accepted from server!');
and you will know which is which.

DISCLAIMER:
You should not modify core files .. if you would like to donate a cup of coffee I will write it in a modification for you.


https://www.youtube.com/watch?v=zXIxDoCRc84


User avatar
Expert Member

Posts

Joined
Mon Jun 10, 2019 9:31 am

Post by ADD Creative » Thu May 11, 2023 4:35 pm

I've done a pull request for the security issue.
https://github.com/opencart/opencart/pull/12321

www.add-creative.co.uk


Guru Member

Posts

Joined
Sat Jan 14, 2012 1:02 am
Location - United Kingdom

Post by paulfeakins » Thu May 11, 2023 6:51 pm

Jasperz wrote:
Wed May 10, 2023 1:53 am
Today, our hoster has disabled the TLS 1.0 and 1.1 versions.
Surely they should have given you some warning to give you time to do some testing and get a fix in place *before* they changed it?

UK OpenCart Hosting | OpenCart Audits | OpenCart Support - please email info@antropy.co.uk


User avatar
Legendary Member
Online

Posts

Joined
Mon Aug 22, 2011 11:01 pm
Location - London Gatwick, United Kingdom

Post by straightlight » Thu May 11, 2023 8:05 pm

paulfeakins wrote:
Thu May 11, 2023 6:51 pm
Jasperz wrote:
Wed May 10, 2023 1:53 am
Today, our hoster has disabled the TLS 1.0 and 1.1 versions.
Surely they should have given you some warning to give you time to do some testing and get a fix in place *before* they changed it?
Most of them don't. They just make changes on-the-fly.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by JNeuhoff » Fri May 12, 2023 6:54 pm

ADD Creative wrote:
Thu May 11, 2023 4:35 pm
I've done a pull request for the security issue.
https://github.com/opencart/opencart/pull/12321
Now merged into the 3.0.x.x_Maintenance branch. Thanks for that.

Export/Import Tool * SpamBot Buster * Unused Images Manager * Instant Option Price Calculator * Number Option * Google Tag Manager * Survey Plus * OpenTwig


User avatar
Guru Member
Online

Posts

Joined
Wed Dec 05, 2007 3:38 am

Who is online

Users browsing this forum: No registered users and 46 guests