overleaf / toolkit

GNU Affero General Public License v3.0
506 stars 122 forks source link

SSL out of date #91

Open pizzapanther opened 2 years ago

pizzapanther commented 2 years ago

Steps to Reproduce

  1. Setup mailgun.com SMTP
  2. Send a test mail

Expected Behavior

mail sends successfully

Observed Behavior

Error below:

[2022-03-15 00:04:17] INFO: Sending mail using SMTP/2.0.1[client:2.0.1]
[2022-03-15 00:04:17] ERROR: [dTrCV8rSo8s] 140296029108096:error:1408F10B:SSL routines:ssl3_get_record:wrong version number:../deps/openssl/openssl/ssl/record/ssl3_record.c:332:

[2022-03-15 00:04:17] DEBUG: [dTrCV8rSo8s] Closing connection to the server using "destroy"
[2022-03-15 00:04:17] ERROR: Send Error: 140296029108096:error:1408F10B:SSL routines:ssl3_get_record:wrong version number:../deps/openssl/openssl/ssl/record/ssl3_record.c:332:

Context

Makes it difficult to setup the mail service

Analysis

It looks like the SSL is out of date and I'm assuming mailgun enforces a higher version of SSL than what overleaf supports.

Work Around

I setup a local postfix server that correctly connects and relays the SMTP and used SMTP unauthed in the container without SSL.

I then add to the docker compose:

extra_hosts:
            - "host.docker.internal:host-gateway"

And variables look like:

SHARELATEX_EMAIL_FROM_ADDRESS=overleaf@example.com
SHARELATEX_EMAIL_SMTP_HOST=host.docker.internal
SHARELATEX_EMAIL_SMTP_PORT=25
SHARELATEX_EMAIL_SMTP_SECURE=false
SHARELATEX_EMAIL_SMTP_NAME=ubuntu
SHARELATEX_EMAIL_SMTP_LOGGER=true
SHARELATEX_EMAIL_SMTP_TLS_REJECT_UNAUTH=false
SHARELATEX_EMAIL_SMTP_IGNORE_TLS=true
LittleYe233 commented 1 year ago

From this answer on Stack Overflow, port for SSL is 465, not 587 which is for STARTTLS. Replacing SHARELATEX_EMAIL_SMTP_PORT=587 to SHARELATEX_EMAIL_SMTP_PORT=465 solves the problem.

pizzapanther commented 1 year ago

I believe I tried both but it's been so long now I can't remember all the configuration details I tried. But mailgun supports 25, 587, and 465 and I believe I tried them all. Also the linked stacked overflow looks like a different error than ssl3_record.c:332