【问题标题】:The certificate for this site does not contain a Subject Alternative Name extension containing a domain name or IP address?此站点的证书不包含包含域名或 IP 地址的主题备用名称扩展名?
【发布时间】:2018-03-22 02:40:01
【问题描述】:

我已使用 openSSL 以下命令生成自签名证书 在我基于 ubuntu 的电脑中。

openssl req -x509 -newkey rsa:2048 -nodes -keyout key.pem -out cert.pem -pubkey -days 365  -subj "/C=NZ/ST=LH/O=SoN, Inc./CN=10.16.1.96" -reqexts Canada -config <(cat /etc/ssl/openssl.cnf <(printf "[Wellington]\nsubjectAltName=DNS:10.16.1.96,DNS:10.16.1.96"))

接下来,我在运行网络服务器并使用这些密钥的 raspberrypi(10.16.1.96) 中复制了私钥和 cert.pem。

另外,我已经在我的 chrome 浏览器中添加了 cert.pem - 管理证书/权限,我已经导入了这个证书。

但是,我的浏览器抱怨这个 -

Subject Alternative Name missing
The certificate for this site does not contain a Subject Alternative Name extension containing a domain name or IP address.

Certificate error
There are issues with the site's certificate chain (net::ERR_CERT_COMMON_NAME_INVALID).

我怎样才能摆脱这个错误?

【问题讨论】:

    标签: ssl https


    【解决方案1】:

    在您的命令结束时,您将提供如下主题替代名称:subjectAltName=DNS:10.16.1.96,DNS:10.16.1.96"

    问题在于您使用的是dNSName 类型的SAN(OpenSSL 配置中的DNS:),但您使用的是IP 地址,因此在这种情况下您需要iPAddress 类型的SAN(请参阅this answer 更多规格详情)。

    将您的命令更改为使用 subjectAltName=IP:10.16.1.96,IP:10.16.1.96" 应该可以解决它。

    【讨论】:

      猜你喜欢
      • 2018-06-11
      • 1970-01-01
      • 2019-02-07
      • 1970-01-01
      • 2023-03-23
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多