Node.js - 在运行时动态更改 HTTPS 服务器的 SSL 证书
我正在 node
中构建 HTTPS 代理。基本上,我允许人们为我的代理计算机(设置了通配符 DNS)设置 DNS CNAME 别名,并将他们的 SSL 证书导入到我的应用程序中(就像 AWS Elastic Load Balancer 所做的那样),以便他们的 CNAME 主机名在每次请求时都受到客户端的适当保护和识别。
现在我正在代理端工作,我正在尝试找到一种在与客户端进行 SSL 握手之前动态加载正确证书的方法。工作流程为:
- 服务器收到新请求
- 获取客户端请求的主机名(即用户设置的 DNS CNAME 别名)
- 加载属于该主机名的正确证书
- 在当前请求中使用加载的证书 (这里需要帮助)
- 握手(使用加载的证书 - 根据请求的不同而不同)
有办法做到这一点吗?
I'm building an HTTPS proxy in node
. Basically I'm allowing people to set a DNS CNAME alias to my proxy machine (which has a wildcard DNS setupped), and import their SSL certificate into my application (like AWS Elastic Load Balancer does) so that their CNAME hostname is properly protected and recognized by the client on every request.
Now I'm working on the proxy side, and I'm trying to find a way to load the right certificate dynamically before the SSL handshake with the client. The workflow is:
- A new request is received by the server
- Get the hostname requested by the client (that is the DNS CNAME alias set by the user)
- Load the right certificate belonging to that hostname
- Use the loaded certificate in the current request (need help here)
- Handshake (with the loaded certificate - which varies from request to request)
Is there a way to do that?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我们开始吧:在节点中使用 SNI 应该可以正常工作。
问题是并非所有客户端(浏览器或库)都支持它。
Here we go: using SNI in node should make it work.
The problem is that not all the clients (browsers or libraries) support it yet.