Socket.io + SSL + 自签名 CA 证书在连接时出错 [英] Socket.io + SSL + self-signed CA certificate gives error when connecting

查看:66
本文介绍了Socket.io + SSL + 自签名 CA 证书在连接时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用使用自签名 CA 证书创建的证书运行 https 服务器.

I am running an https server using a certificate which was created using a self-signed CA certificate.

现在我想将 Socket.io 客户端连接到连接到 https 服务器的 Socket.io 服务器.不幸的是,我收到一个错误,告诉我:

Now I want to connect Socket.io client to the Socket.io server that is attached to the https server. Unfortunately, I get an error, telling me:

Error: UNABLE_TO_VERIFY_LEAF_SIGNATURE
    at SecurePair.<anonymous> (tls.js:1271:32)
    at SecurePair.EventEmitter.emit (events.js:92:17)
    at SecurePair.maybeInitFinished (tls.js:883:10)
    at CleartextStream.read [as _read] (tls.js:421:15)
    at CleartextStream.Readable.read (_stream_readable.js:293:10)
    at EncryptedStream.write [as _write] (tls.js:330:25)
    at doWrite (_stream_writable.js:211:10)
    at writeOrBuffer (_stream_writable.js:201:5)
    at EncryptedStream.Writable.write (_stream_writable.js:172:11)
    at write (_stream_readable.js:547:24)
    at flow (_stream_readable.js:556:7)

基本上,此错误告诉我无法成功验证证书.这是因为相应的 CA 证书是自签名的.使用 https 请求时,我可以指定我信任的 CA.

Basically, this error tells me that the certificate could not be verified successfully. This is due to the fact the the according CA certificate is self-signed. When using a https request, I can specify CAs whom I trust.

在这种情况下如何连接 Socket.io?

How can I make Socket.io connect in this case?

PS:我正在运行 Node.js 0.10.0 和 Socket.io 0.9.13.

PS: I am running Node.js 0.10.0 and Socket.io 0.9.13.

推荐答案

不要使用自签名证书.只是不要,某些浏览器在使用 WebSockets 时无法让您接受它们.而且你看起来像一个没有购买适当证书的廉价d * ck.

Don’t use self signed certificates. Just don’t, some browsers give you no way of accepting them when using WebSockets. And you look like a cheap d*ck for not buying a proper cert.

来自 他们看到我花粉,他们讨厌(第 23 页).Socket.IO 核心团队成员 Arnout Kazemier (3rdEden) 的演讲.

From They see me pollin, they hatin (p. 23). A presentation by Arnout Kazemier (3rdEden), core team member of Socket.IO.

这篇关于Socket.io + SSL + 自签名 CA 证书在连接时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆