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

[Bug]: SMTP relay fails to connect to Prontonmail bridge #2765

Closed
mpclepto opened this issue Mar 18, 2024 · 10 comments
Closed

[Bug]: SMTP relay fails to connect to Prontonmail bridge #2765

mpclepto opened this issue Mar 18, 2024 · 10 comments
Labels
bug Something isn't working

Comments

@mpclepto
Copy link

Describe the issue

While using the Proton mail bridge, ABS is unable to send emails via SMTP.

Steps to reproduce the issue

  1. Install / configure protonmail bridge app on unraid
    (configuration is known good as other apps (Ombi / overseer) function with the bridge)
  2. install / configure ABS to point to the mail bridge (whether "secure" or "insecure" is selected, neither function)
    (mail bridge config is known good as other services can send mail through it such as Ombi or Overseerr)
  3. receive the following log error while "secure" is selected in ABS:

[2024-03-18 15:19:39.116] INFO: [EmailManager] Sending test email
[2024-03-18 15:19:39.160] ERROR: [EmailManager] Failed to verify SMTP connection config [Error: B8ECF7BE60140000:error:0A00010B:SSL routines:ssl3_get_record:wrong version number:../deps/openssl/openssl/ssl/record/ssl3_record.c:354:
] {
library: 'SSL routines',
reason: 'wrong version number',
code: 'ESOCKET',
command: 'CONN'
} (EmailManager.js:17)

  1. receive the following log error while "insecure" is selected in ABS:

[2024-03-18 15:24:01.008] INFO: [EmailManager] Sending test email
[2024-03-18 15:24:01.059] ERROR: [EmailManager] Failed to verify SMTP connection config Error: self-signed certificate
at TLSSocket.onConnectSecure (node:_tls_wrap:1674:34)
at TLSSocket.emit (node:events:518:28)
at TLSSocket._finishInit (node:_tls_wrap:1085:8)
at ssl.onhandshakedone (node:_tls_wrap:871:12) {
code: 'ESOCKET',
command: 'CONN'
} (EmailManager.js:17)

With ABS, I am able to send emails to the Gmail SMTP gateway with no issues. I'm not entirely certain what the correct fix is here, but seeing as how this is entirely internal to my own network, I would be happy with a "allow self-signed cert" if that fixes the issue. Thanks in advance!

Audiobookshelf version

v2.8.1

How are you running audiobookshelf?

Docker

@mpclepto mpclepto added the bug Something isn't working label Mar 18, 2024
@advplyr
Copy link
Owner

advplyr commented Apr 25, 2024

Are you still having this issue? What port are you using?

@advplyr advplyr added the awaiting release Issue is resolved and will be in the next release label Apr 25, 2024
@mpclepto
Copy link
Author

mpclepto commented Apr 29, 2024

Yes this is still an issue and it is using port 25 for the protonmail bridge.

@advplyr
Copy link
Owner

advplyr commented Apr 29, 2024

Have you tested with leaving secure toggled off? I read that the package we are using doesn't want that set for other ports which I updated for the next release but you can test now.

@mpclepto
Copy link
Author

I have tested with secure off and it still has the same failure.

@0xGingi
Copy link
Sponsor

0xGingi commented May 7, 2024

I'm using ProtonMail SMTP Tokens rather than the bridge, but with secure on it doesn't work for me neither.

Turning secure off fixed it for me

With Secure On:
[EmailManager] Failed to verify SMTP connection config Error: C8912DC2777F0000:error:0A00010B:SSL routines:ssl3_get_record:wrong version number:../deps/openssl/openssl/ssl/record/ssl3_record.c:354:

@advplyr
Copy link
Owner

advplyr commented May 7, 2024

Thanks for confirming. I have this fixed for the next release

@advplyr
Copy link
Owner

advplyr commented May 27, 2024

Fixed in v2.10.0

@advplyr advplyr closed this as completed May 27, 2024
@advplyr advplyr removed the awaiting release Issue is resolved and will be in the next release label May 27, 2024
@jecpr
Copy link

jecpr commented May 29, 2024

I am still having this issue after the fix.
Current version 10.0.1. Running proton mail bridge and have verified i can connect and authenticate. Proton serves smtp on port 1025. I have tried with both secure selected and not.
Log output when secure not selected:

[2024-05-29 20:27:05.018] INFO: [EmailManager] Sending test email
[2024-05-29 20:27:05.024] ERROR: [EmailManager] Failed to verify SMTP connection config Error: self-signed certificate
    at TLSSocket.onConnectSecure (node:_tls_wrap:1674:34)
    at TLSSocket.emit (node:events:519:28)
    at TLSSocket._finishInit (node:_tls_wrap:1085:8)
    at ssl.onhandshakedone (node:_tls_wrap:871:12) {
  code: 'ESOCKET',
  command: 'CONN'
} (EmailManager.js:17)

and with secure:

[2024-05-29 20:27:51.521] INFO: [EmailManager] Sending test email
[2024-05-29 20:27:51.527] ERROR: [EmailManager] Failed to verify SMTP connection config Error: self-signed certificate
    at TLSSocket.onConnectSecure (node:_tls_wrap:1674:34)
    at TLSSocket.emit (node:events:519:28)
    at TLSSocket._finishInit (node:_tls_wrap:1085:8)
    at ssl.onhandshakedone (node:_tls_wrap:871:12) {
  code: 'ESOCKET',
  command: 'CONN'
} (EmailManager.js:17)

Is there a way to tell it to not validate the ssl cert for the email?

Many thanks in advance!

@0xGingi
Copy link
Sponsor

0xGingi commented May 29, 2024

@advplyr I may be wrong, but since audiobookshelf uses nodemailer, there could easily be either a existing check on the SMTP cert or an additional toggle to add "rejectUnauthorized: false" in the createTransport to allow self-signed certs

@jecpr
Copy link

jecpr commented May 29, 2024

Yep, so I think a reasonable fix might be to include the following in the getTransportObject within /server/objects/settings/EmailSettings.js:

payload.tls = {
    rejectUnauthorized: false
  }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants