Secure Socket Client Connection Error "self signed certificate in certificate chain"
See original GitHub issueI suppose if you take the given example but at the end of the client code you put wss instead of ws the error is reported when trying to connect from another nodejs server as a client.
Connect Error: self signed certificate in certificate chain
I have indeed for now properly working self signed certificates and a Certificate Authority CA that is self signed. I’ve also tried adding to npm the cafile key and filename, (in “config” and out). https://docs.npmjs.com/misc/config#cafile [note: it’s just for the registry, and unrelated]
so secure connections are rejected if self signed, and there doesn’t seem to be anything I can do about it?! What am I missing or is this a feature request other then the bug it’s feeling like. It’s hard to believe no one noticed and fixed this before, so I figure I need a help sorting out the issue, thanks. I guess the question is is there somewhere I put my CA.cert for accepting self signed certificates?
I’m seeing https://github.com/theturtle32/WebSocket-Node/blob/master/lib/WebSocketClient.js#L115
WebSocketClient.prototype.connect = function(requestUrl, protocols, origin, headers, extraRequestOptions) {
for the first time digging into the code (so maybe I missed some docs too?). something in the tlsOptions maybe?
I’ve also looked further into nodejs createServer options, but it’s really the client that you’d think needs to know about my CertAuth. https://nodejs.org/api/tls.html#tls_tls_createserver_options_secureconnectionlistener
Issue Analytics
- State:
- Created 7 years ago
- Comments:10
Top GitHub Comments
Maybe that is what you looking for ?
let client = new WebSocketClient({tlsOptions: {rejectUnauthorized: false}});
For testing purposes (Node.js), I was able to use the following in the client script while using self-signed certificate approach:
process.env.NODE_TLS_REJECT_UNAUTHORIZED = "0";