RocketChat / RocketChat/Rocket.Chat
Email direct reply doesn't seem to work with GSuite
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 46.1k
- Forks
- 13.9k
- Avg merge
- 3d 3h
- Merged PRs (30d)
- 130
Description
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:
- 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 - Save changes
- 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:
- Version of Rocket.Chat Server: 3.5.1
- Operating System: Linux
- Deployment Method: Official Docker Image via Rocket.Chat Helm Chart
- Number of Running Instances: 2
- DB Replicaset Oplog: Enabled
- NodeJS Version: v12.16.1
- MongoDB Version: 4.0.12
Client Setup Information
Shouldn't be relevant, but:
- Desktop App or Browser Version: Firefox 79.0 (64-bit)
- Operating System: macOS 10.15.6
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
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in app/lib/server/lib/interceptDirectReplyEmails.js at the IMAP configuration referenced by the issue, then read the linked node-imap workaround for setting serverName in tlsOptions. Done means Rocket.Chat can connect to imap.gmail.com for Direct Reply, or can pass the required custom TLS options, without the self-signed certificate error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- node.js
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 35/100