InstantSSL 的证书与 Nginx 下通过 IP 访问地址的自签名证书没什么区别

InstantSSL 的证书与 Nginx 下通过 IP 访问地址的自签名证书没什么区别

我从 InstantSSL 订购了 SSL 证书并获得了以下两个文件:

my_ip.ca-bundle,my_ip.crt

我之前也使用 openssl 生成了我自己的密钥和 crt 文件。

我把所有的 crt 文件连接起来:

cat my_previously_generted.crt my_ip.ca_bundle my_ip.crt > chained.crt

并配置nginx如下:

server { 
    ...

    listen 443;
    ssl on;
    ssl_certificate /home/dmsf/csr/chained.crt;
    ssl_certificate_key /home/dmsf/csr/csr.nopass.key;

    ...
 }

我没有客户要求的域名。当我打开浏览器时https://my_ip

chrome 给了我这个错误:

The site's security certificate is not trusted!
You attempted to reach my_ip, but the server presented a certificate issued by an entity that is not trusted by your computer's operating system. This may mean that the server has generated its own security credentials, which Google Chrome cannot rely on for identity information, or an attacker may be trying to intercept your communications.
You should not proceed, especially if you have never seen this warning before for this site.

有什么方法可以让 SSL 证书仅使用 IP 地址工作吗?还是我必须获取域名才能与我的网站建立正确的 https 连接?

答案1

首先,当您在 Chrome 中打开网站并查看证书属性时,它是否是正确的证书?如果不是,请修复您的 nginx,以便它提供正确的证书。我真的帮不上忙。

假设它是正确的,则需要在证书中定义 IP 地址,以便浏览器信任它。具体来说,它需要设置为主题备用名称中的通用名称 (CN) 或 DNS 值。请注意,主题备用名称中有一个 IP 地址值可供使用,但 Chrome 不会使用它。它只信任 DNS 条目中的 IP 值。

答案2

我把所有的 crt 文件连接起来

这听起来不对。您只需连接签名的证书和必要的中间证书,这两者都由 CA 提供给您。

您自己生成的证书(无论它是什么)在那里显得格格不入。

相关内容