Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SMTP configuration incorrect in installer - with fix #23180

Open
chrisale opened this issue Jan 21, 2023 · 2 comments
Open

SMTP configuration incorrect in installer - with fix #23180

chrisale opened this issue Jan 21, 2023 · 2 comments

Comments

@chrisale
Copy link

Steps to reproduce the problem

Case 1) In the script:

  1. Follow steps on joinmastodon.org to install mastodon and prerequisites from source
  2. run RAILS_ENV=production bundle exec rake mastodon:setup
  3. attempt to configure with any SSL related authentication setting

Case 2) In a running mastodon instance have in the .env.production file the standard settings using port 465 / SSL:

SMTP_SERVER=mymailserver
SMTP_PORT=465
SMTP_LOGIN=myloginemail
SMTP_PASSWORD=mypassword
SMTP_AUTH_METHOD=plain
SMTP_OPENSSL_VERIFY_MODE=client_once
SMTP_ENABLE_STARTTLS=always
SMTP_FROM_ADDRESS=notifications@emailaddress

Expected behaviour

An email should be generated and successfully sent

Actual behaviour

The commands timeout and produces: "Net::ReadTimeout: "Net::ReadTimeout with #TCPSocket:(closed)" in script output and syslog

Detailed description

To resolve this problem we consulted this discourse link:
https://discourse.joinmastodon.org/t/new-mailserver-no-mails/3420

The problem appears to be in the SSL settings. SMTP_AUTH_METHOD, SMTP_OPENSSL_VERIFY_MODE and SMTP_ENABLE_STARTTLS are commented out and SMTP_TLS=true must be added.

My successful settings were:

SMTP_SERVER=mymailserver
SMTP_PORT=465
SMTP_LOGIN=myloginemail
SMTP_PASSWORD=mypassword
#SMTP_AUTH_METHOD=plain
#SMTP_OPENSSL_VERIFY_MODE=client_once
#SMTP_ENABLE_STARTTLS=always
SMTP_TLS=true
SMTP_FROM_ADDRESS=notifications@emailaddress

Related Mastodon Thread:
https://mstdn.ca/@chrisale/109725219048851990

Specifications

Debian 11
Mastodon | 4.0.2
Ruby | 3.0.4p208
PostgreSQL | 15.1
Redis | 6.0.16
OpenSSL 1.1.1

@chrisale chrisale added the bug Something isn't working label Jan 21, 2023
@smiba
Copy link
Contributor

smiba commented Jan 23, 2023

Could be a misconfiguration from your side, TLS and STARTTLS are not the same. Could you try this with SMTP_ENABLE_STARTTLS set to auto or never?

I do agree that it would make sense to also include the option for TLS (and not just STARTTLS settings) in the setup configuration if this is not fixed by using the following settings (could you test them out for us and let me know?)

SMTP_SERVER=mymailserver
SMTP_PORT=465
SMTP_LOGIN=myloginemail
SMTP_PASSWORD=mypassword
SMTP_AUTH_METHOD=plain
SMTP_OPENSSL_VERIFY_MODE=client_once
SMTP_ENABLE_STARTTLS=auto
SMTP_FROM_ADDRESS=notifications@emailaddress

(If it doesn't work, please try "SMTP_ENABLE_STARTTLS=never")

@chrisale
Copy link
Author

chrisale commented Jan 23, 2023

I can confirm I have tried both those configurations in both the setup test script and the working server file and neither send successfully. Judging by inspecting the tcpdump, they do seem to negotiate a connection but they time out while trying to send an email.

In case it is helpful I have attached some of the output from openssl when connecting to and sending email through my smtp server manually. It works without any issue.

6D3709A8-F663-44D9-8AA2-5D169143BA1F
0F633F05-D298-4118-84AF-EA590ADF4230

@renchap renchap removed the bug Something isn't working label Oct 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants