Loomio
Mon 7 Oct 2019 2:45PM

Maling Issue: SSL wrong version number

CB Charles B. Public Seen by 85

I'm new to a lots of tools here (docker, loomio, etc.) and while I nearly manage to run my loomio on my server I failed to correctly send mail with loomio.

I have installed loomio following the official documentation available here : https://github.com/loomio/loomio-deploy/
I have it set up on a server which was not running anything (yet).
I set it up to be run on a subdomain that I own (loomio.mydomain.org)
* I had a first headeack because the .env file is never read when I run the docker-compose up -d command (I manually had them to my environment).

But the issue is the following : I setup a sparkpost account and am able to send mail (tested through swaks) from the server.

But the loomio mailer always failed with this error:

loomio-worker | Sent mail to [email protected] (367.2ms)
loomio-worker | [Worker(host:ed4ede424a84 pid:7)] Job UserMailer.login (id=73) FAILED (0 prior attempts) with OpenSSL::SSL::SSLError: SSL_connect returned=1 errno=0 state=error: wrong version number
loomio-worker | 2019-10-07T15:00:12+0000: [Worker(host:ed4ede424a84 pid:7)] Job UserMailer.login (id=73) FAILED (0 prior attempts) with OpenSSL::SSL::SSLError: SSL_connect returned=1 errno=0 state=error: wrong version number

I read some mail And tryed some openssl commandes:
From my server:
openssl s_client -connect smtp.sparkpostmail.com:587

CONNECTED(00000003)

140665815314496:error:1408F10B:SSL routines:ssl3_get_record:wrong version number:../ssl/record/ssl3_record.c:252:

no peer certificate available

No client certificate CA names sent

SSL handshake has read 5 bytes and written 176 bytes

Verification: OK

New, (NONE), Cipher is (NONE)
Secure Renegotiation IS NOT supported
Compression: NONE
Expansion: NONE
No ALPN negotiated
SSL-Session:
Protocol : TLSv1.2
Cipher : 0000
Session-ID:
Session-ID-ctx:
Master-Key:
PSK identity: None
PSK identity hint: None
SRP username: None
Start Time: 1570460833
Timeout : 7200 (sec)
Verify return code: 0 (ok)

Extended master secret: no

From the container:
docker exec -ti loomio-worker openssl s_client -connect smtp.sparkpostmail.com:587

CONNECTED(00000003)

139668762641536:error:1408F10B:SSL routines:ssl3_get_record:wrong version number:../ssl/record/ssl3_record.c:332:

no peer certificate available

No client certificate CA names sent

SSL handshake has read 5 bytes and written 314 bytes

Verification: OK

New, (NONE), Cipher is (NONE)
Secure Renegotiation IS NOT supported
Compression: NONE
Expansion: NONE
No ALPN negotiated
Early data was not sent
Verify return code: 0 (ok)

My server have both IPV4 and IPV6 addresses but I don't know if that helps.

I'm sorry I'm kinda lost here.

RG

Robert Guthrie Thu 21 Jul 2022 10:37AM

Hi John, it's not easy to do that - however, if there are any config settings you'd like to be able to change but cannot, let me know, I'll add env support for them.

Here's the documentation for configuring SMTP in rails: https://guides.rubyonrails.org/v6.1/action_mailer_basics.html

JB

John Benedetto Wed 20 Jul 2022 10:31PM

I am having the same problem as described in this post. I am able to SMTP authenticate by entering the container and connecting via openssl. Below are my SMTP settings and the error message received:

.env SMTP Settings:

SMTP_AUTH=LOGIN 
SMTP_DOMAIN=benedetto.io 
SMTP_SERVER=smtp.office365.com 
SMTP_PORT=587 
SMTP_USERNAME={USERNAME UTF8 ENCODED} 
SMTP_PASSWORD={PASSWORD UTF8 ENCODED} 
SMTP_USE_SSL=1

loomio-worker error message:

"SSL_connect returned=1 errno=0 state=error: wrong version number","error_class":"OpenSSL::SSL::SSLError"

Any advice would be appreciated.

RG

Robert Guthrie Thu 21 Jul 2022 10:33AM

Hi John. I've had a little search around, and I wonder if this is helpful:

https://stackoverflow.com/questions/26151495/rails-actionmailer-gmail-works-office-365-does-not

If the problem is that office365 requires SMTP_USERNAME needs to be the same as the "from", then set NOTIFICATIONS_EMAIL_ADDRESS to the same value as SMTP_USERNAME in your env.

You could also try setting SMTP_SSL_VERIFY_MODE to one of: none, peer, client_once, fail_if_no_peer_cert

RG

Robert Guthrie Thu 21 Jul 2022 10:39AM

Oh, this is interesting too: https://gist.github.com/Godoy/4648243