Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using a custom CA in SSL for Nodejs applications #594

Closed
Ferk opened this issue Dec 9, 2013 · 5 comments
Closed

Using a custom CA in SSL for Nodejs applications #594

Ferk opened this issue Dec 9, 2013 · 5 comments

Comments

@Ferk
Copy link

Ferk commented Dec 9, 2013

There's not much documentation about socket.io with SSL. And I couldn't find any option concerning trusted Certificate Authorities.

How can I specify the list of certificate authorities that are trusted when I create a socket from nodejs?

I need to use a custom CA for my nodejs application and I want that only authorized certificates are allowed, the ones coming from my root certificate.

I even acked through the code trying to find anything that might help me, but there's nothing, the only option that can be provided when connecting from the client is the "secure" flag, which mostly just takes care to set the right protocol string in the url in a bunch of places and to set the default port to either 443 or 80.

I assume that this feature is not implemented? where does socket.io-client obtain the list of trusted Certificate Authorities? or if it doesn't, then at which point does it delegate this job to a different layer?

@rauchg
Copy link
Contributor

rauchg commented Dec 9, 2013

Like I said on the socket.io issue, the best way to approach this would be to allow passing any request related option to the client (for usage from node.js), including the CA options of course.

@Ferk
Copy link
Author

Ferk commented Dec 10, 2013

Oh, I see. Thanks.

Is there perhaps a way for the socket.io-client to connect using an already existing "tls" object, in a similar way to how the socket.io server can do?

var app = require('tls').createServer(options);
io = require("socket.io").listen(app);

Would it make sense to do something like this for the client too, or am I talking nonsense?

Is there a hack for me to do it currently or would I be better off switching to bare tls?

@rauchg
Copy link
Contributor

rauchg commented Dec 10, 2013

I think there's a trick you can do by changing the settings of the globalAgent

@FruitieX
Copy link

FruitieX commented Jun 6, 2014

Hey, any updates on this issue now that Socket.IO 1.0 is out?

In my Node.js application I also need Socket.IO-client to accept a custom CA. I tried changing settings of the globalAgent but it seems Socket.IO-client does not use these!

As a side note, my application works when running node with the NODE_TLS_REJECT_UNAUTHORIZED=0 environment variable set, but to my understanding this leaves the application vulnerable to man-in-the middle attacks.

@rauchg rauchg closed this as completed Nov 25, 2014
@zxc23
Copy link

zxc23 commented Aug 28, 2017

Is this still not possible?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants