RocketChat / Rocket.Chat

The communications platform that puts data protection first.
https://rocket.chat/
Other
40.08k stars 10.35k forks source link

Email direct reply doesn't seem to work with GSuite #18480

Open inyono opened 4 years ago

inyono commented 4 years ago

Description:

When enabling directly reply for imap.gmail.com & GSuite email address, Rocket.Chat can't get a connection to the IMAP server working:

I20200804-16:15:09.779(0) [connection] Error: Error: self signed certificate I20200804-16:15:09.782(0) Error occurred ... I20200804-16:15:09.783(0) Exception in callback of async function: Error: self signed certificate     at TLSSocket.onConnectSecure (_tls_wrap.js:1473:34)     at TLSSocket.emit (events.js:311:20)     at TLSSocket.EventEmitter.emit (domain.js:482:12)     at TLSSocket._finishInit (_tls_wrap.js:916:8)     at TLSWrap.ssl.onhandshakedone (_tls_wrap.js:686:12)     at Socket.ondata (internal/js_stream_socket.js:72:22)     at Socket.emit (events.js:311:20)     at Socket.EventEmitter.emit (domain.js:482:12)     at addChunk (_stream_readable.js:294:12)     at readableAddChunk (_stream_readable.js:275:11)     at Socket.Readable.push (_stream_readable.js:209:10)     at TCP.onStreamRead (internal/stream_base_commons.js:186:23) {   code: 'DEPTH_ZERO_SELF_SIGNED_CERT',   source: 'socket' } I20200804-16:15:09.784(0) [connection] Closed 

Seems like an upstream bug in node-imap that also suggest a workaround (namely setting serverName in tlsOptions). This can't be set via Rocket.Chat, though: https://github.com/RocketChat/Rocket.Chat/blob/f71f0d14b4d3ed5ce180adf52a0adbf02988e65e/app/lib/server/lib/interceptDirectReplyEmails.js#L18.

Steps to reproduce:

  1. In Administration panel, enable Email > Direct Reply with the following config: Host: imap.gmail.com Port: 993 Separator: + Username: Your GSuite Email address Password: Your GSuite Password
  2. Save changes
  3. See the logs mentioned above in Administration > Logs, "Error: self signed certificate"

Expected behavior:

Expected Rocket.Chat to be able to connect to imap.gmail.com. Alternatively: be able to pass custom tlsOptions to the IMAP config to workaround the issue as mentioned above.

Actual behavior:

Rocket.Chat fails to connect to imap.gmail.com.

Server Setup Information:

Client Setup Information

Shouldn't be relevant, but:

Additional context

Relevant logs:

As mentioned above:

I20200804-16:15:09.779(0) [connection] Error: Error: self signed certificate I20200804-16:15:09.782(0) Error occurred ... I20200804-16:15:09.783(0) Exception in callback of async function: Error: self signed certificate     at TLSSocket.onConnectSecure (_tls_wrap.js:1473:34)     at TLSSocket.emit (events.js:311:20)     at TLSSocket.EventEmitter.emit (domain.js:482:12)     at TLSSocket._finishInit (_tls_wrap.js:916:8)     at TLSWrap.ssl.onhandshakedone (_tls_wrap.js:686:12)     at Socket.ondata (internal/js_stream_socket.js:72:22)     at Socket.emit (events.js:311:20)     at Socket.EventEmitter.emit (domain.js:482:12)     at addChunk (_stream_readable.js:294:12)     at readableAddChunk (_stream_readable.js:275:11)     at Socket.Readable.push (_stream_readable.js:209:10)     at TCP.onStreamRead (internal/stream_base_commons.js:186:23) {   code: 'DEPTH_ZERO_SELF_SIGNED_CERT',   source: 'socket' } I20200804-16:15:09.784(0) [connection] Closed 
buliverd53 commented 4 years ago

I'm having the same problem here even with a simple GMAIL account.

HiveMindNet commented 3 years ago

I tried the workaround and that does not work for me unfortunately.