Rocket.Chat.Electron icon indicating copy to clipboard operation
Rocket.Chat.Electron copied to clipboard

3.0 Client cannot connect to Internal server with Self-signed certificate

Open TaLoN1x opened this issue 6 years ago • 10 comments

My Setup

  • Operating System: Mac Os X 10.15
  • App Version: 3.0.0
  • Installation type: Brew, Manual install
  • [x] I have tested with the latest version
  • [x] I can simulate the issue easily

Description

When trying to connect to an internal server, that is using certificate issued from Internal PKI (and trusted by endpoint), the login to service cannot succeed.

Current Behavior

Client tells "No valud server found at the URL"

Trying to start application from terminal shows following error: [bugsnag] Loaded! SyntaxError: Unexpected token o in JSON at position 1 at JSON.parse (<anonymous>) at /Applications/Rocket.Chat.app/Contents/Resources/app.asar/app/main.js:1344:42 at Generator.next (<anonymous>) at /Applications/Rocket.Chat.app/Contents/Resources/app.asar/node_modules/tslib/tslib.js:114:75 at new Promise (<anonymous>) at Object.__awaiter (/Applications/Rocket.Chat.app/Contents/Resources/app.asar/node_modules/tslib/tslib.js:110:16) at setupServers (/Applications/Rocket.Chat.app/Contents/Resources/app.asar/app/main.js:1280:46) at /Applications/Rocket.Chat.app/Contents/Resources/app.asar/app/main.js:3225:11 at Generator.next (<anonymous>) at fulfilled (/Applications/Rocket.Chat.app/Contents/Resources/app.asar/node_modules/tslib/tslib.js:111:62) Checking for update Update for version 3.0.0 is not available (latest version: 3.0.0, downgrade is disallowed). [bugsnag] Event failed to send… Error: self signed certificate in certificate chain at TLSSocket.onConnectSecure (_tls_wrap.js:1484:34) at TLSSocket.emit (events.js:310:20) at TLSSocket.EventEmitter.emit (domain.js:482:12) at TLSSocket._finishInit (_tls_wrap.js:927:8) at TLSWrap.ssl.onhandshakedone (_tls_wrap.js:697:12) Error: self signed certificate in certificate chain at TLSSocket.onConnectSecure (_tls_wrap.js:1484:34) at TLSSocket.emit (events.js:310:20) at TLSSocket.EventEmitter.emit (domain.js:482:12) at TLSSocket._finishInit (_tls_wrap.js:927:8) at TLSWrap.ssl.onhandshakedone (_tls_wrap.js:697:12) { code: 'SELF_SIGNED_CERT_IN_CHAIN' } [bugsnag] Failed to send event to Bugsnag [bugsnag] Unhandled rejection… TypeError: Error processing argument at index 0, conversion failure from at BrowserWindow.setBounds (electron/js2c/browser_init.js:29:405) at applyRootWindowState (/Applications/Rocket.Chat.app/Contents/Resources/app.asar/app/main.js:760:20) at /Applications/Rocket.Chat.app/Contents/Resources/app.asar/app/main.js:3241:5 at Generator.next (<anonymous>) at fulfilled (/Applications/Rocket.Chat.app/Contents/Resources/app.asar/node_modules/tslib/tslib.js:111:62) at processTicksAndRejections (internal/process/task_queues.js:97:5)

Expected Behavior

Would be greate to get logged in :)

TaLoN1x avatar Oct 01 '20 08:10 TaLoN1x

P.S. if I offload certificate locally via the proxy and connect with HTTP, it works. Seems like issue with ignoring endpoint trust certificate setting and not having an option to feed custom certificate chain.

TaLoN1x avatar Oct 01 '20 08:10 TaLoN1x

Can confirm simmilar behaivor on Windows

TaLoN1x avatar Oct 01 '20 08:10 TaLoN1x

same for me

berndlackinger avatar Oct 01 '20 09:10 berndlackinger

I can confirm same for Ubuntu (snap)

trickvi avatar Oct 01 '20 11:10 trickvi

Can confirm this. Had to downgrade to login

Vkat14 avatar Oct 02 '20 06:10 Vkat14

Can confirm this, too. Manually entering the server using 3.0.0 & 3.0.1 does not work. Preconfiguring with servers.json works fine.

TheWrongGuy avatar Oct 02 '20 10:10 TheWrongGuy

Figured out a temp work around here https://github.com/RocketChat/Rocket.Chat.Electron/issues/1764#issuecomment-702993532

TheDigitalEagle avatar Oct 02 '20 23:10 TheDigitalEagle

I've found the cause: node-fetch was used to connect to the server instead of Electron's net API, therefore certificate-error and select-client-certificate events are not emitted. I'm working on it now, please wait.

tassoevan avatar Oct 03 '20 20:10 tassoevan

~Electron is a joke.~ net.request does not raise any certificate-error event at all. To perform a request, I have to run it in a renderer process, so the fix is taking a little longer.

tassoevan avatar Oct 06 '20 15:10 tassoevan

When I've worked with CEF, it took good effort to wrap and implement SSL event handling. It's possible Electron hasn't gone far into handle that part of Chromium.

TheDigitalEagle avatar Oct 06 '20 15:10 TheDigitalEagle