Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Firefox disconnects websockets connection for a self signed certificate

I am trying to make websocket connection to a backend server that uses a self-signed certificate. In firefox I've added an exception for the self-signed cert.

However my websocket connection wss:// fails to connect. I get a close event with code 1006 which is a catch all code.

Chrome and IE websockets work. Since I am using windows, I've installed the cert using certmgr.exe as a trusted cert.

My guess right now is that firefox websockets do not work with certificate exceptions and need to be trusted.

Has this scenario worked for anyone else?

like image 218
rrevo Avatar asked Dec 31 '14 20:12

rrevo


People also ask

Does Firefox support WebSockets?

WebSocket, as an IETF standard, and with a W3C browser API, is fully supported by all modern browsers: Chrome 16 + (incl. Chrome for Android) Firefox 11 + (incl.

Does WebSocket need SSL?

You should strongly prefer the secure wss:// protocol over the insecure ws:// transport. Like HTTPS, WSS (WebSockets over SSL/TLS) is encrypted, thus protecting against man-in-the-middle attacks. A variety of attacks against WebSockets become impossible if the transport is secured.


2 Answers

Just in case it could help anyone, what is mentioned in OP's answer is not true at this time of writing (v61.0.1).

I navigated to the address of my WS server using https, as any WS server is practically an HTTP server, then the usual invalid certificate screen appeared and allowed me to add an exception. After that any wss connection made to the same host and port is successful.

like image 119
php_nub_qq Avatar answered Nov 15 '22 02:11

php_nub_qq


Firefox works with secure websockets (wss://) only when the certificate of the site is trusted.

With a self-signed certificate I was able to browse the site by adding an exception to the certificate. The exception is not used for websockets and the connection was dropped during the ssl handshake.

Instead I created my own Root CA cert and then another signed cert for the webserver. In Options > View Certificates > Authorities I imported the Root cert. Now firefox is able to connect over secure websockets without any issue.

Firefox does not allow for importing of self-signed certs as Authorities. Windows Certificate manager allows importing of self signed certs into the "Trusted Root Certificate Authorities" list.

like image 32
rrevo Avatar answered Nov 15 '22 04:11

rrevo