gpt4 book ai didi

javascript - 具有动态服务器 IP 的 TLS

转载 作者:行者123 更新时间:2023-12-03 06:52:00 24 4
gpt4 key购买 nike

就像从浏览器 javascript 对 websocket 客户端使用 TLS。

问题是服务器是通过与 REST 服务对话动态启动的,启动时会返回端点 ip。即服务器是一个 ec2 实例,启动时有一个新的唯一 IP。该端点没有 dns 名称,因此在执行 tls 时,证书将不会与 IP 匹配。

我有办法绕过 dns 名称检查,但仍然完成连接并享受加密 session 的好处吗?

最佳答案

检查这个 Why does my wss:// (WebSockets over SSL/TLS) connection immediately disconnect without giving any errors?

The key to the problem is this: If your SSL certificate causes a warning of any sort, wss:// WebSocket connections will immediately fail, and there is no canonical way to detect this.

您似乎正在使用颁发给 IP 的自行生成的证书。证书通常颁发给服务器名称,但也可以绑定(bind)到IP地址 Are SSL certificates bound to the servers ip address?

但在这种情况下,如果 IP 更改,您的 TLS 连接将向客户端发出警告,因此浏览器将断开连接

您可以使用带有通配符证书的动态 IP 的动态 DNS。例如

证书颁发给*.domain.com

DNS

conn1.domain.com -> IP1
conn2.domain.com -> IP2
conn3.domain.com -> IP3

如果您无法使用完全动态的 DNS,我建议使用固定范围的 IP 名称和颁发给该 IP 的证书。当您在启动时知道 IP 时,选择适当的证书

关于javascript - 具有动态服务器 IP 的 TLS,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37452604/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com