从 Chrome 58 开始,它不再接受依赖于Common Name以下内容的自签名证书:https : //productforums.google.com/forum/#! topic/chrome/zVo3M8CgKzQ;context-place = topicsearchin/chrome/category $3ACanary%7Csort:相关性%7Cspell:false
相反,它需要使用Subject Alt Name. 我之前一直在关注有关如何生成自签名证书的指南:https : //devcenter.heroku.com/articles/ssl-certificate-self,它工作得很好,因为我需要server.crt和server.key文件来完成我正在做的事情。我现在需要生成新的证书,其中包括SAN我所有的尝试都没有在 Chrome 58 上工作。
这是我所做的:
我按照上面提到的 Heroku 文章中的步骤来生成密钥。然后我写了一个新的 OpenSSL 配置文件:
[ req ]
default_bits = 2048
distinguished_name = req_distinguished_name
req_extensions = san
extensions = san
[ req_distinguished_name ]
countryName = US
stateOrProvinceName = Massachusetts
localityName = Boston
organizationName = MyCompany
[ san ]
subjectAltName = DNS:dev.mycompany.com
Run Code Online (Sandbox Code Playgroud)
然后server.crt使用以下命令生成:
openssl req …Run Code Online (Sandbox Code Playgroud) 我使用 OpenSSL 1.1.1b(2019 年 2 月 26 日)使用以下命令创建了一个自签名证书:
openssl req -nodes -new --days 900 -subj /CN=192.168.0.104:8080 -x509 -keyout server.key -out server.crt
然后我使用 windows mmc将生成的 server.crt 导入到 Console Root -> Certificates - Current User -> Trusted Root Certification Authorities -> Certificates
当我转到 chrome 页面 192.168.0.104:8080 时,它告诉我该页面“不安全”(如果我查看证书信息,证书路径下的证书状态显示“此证书没问题”。
我在我的 android 手机上做了一个类似的过程,将它上传到我的手机,在加密和凭据设置部分添加证书。
但是,当我转到该页面时,它告诉我“服务器的证书与 URL 不匹配”。
我在这里做错了什么?
更新:
我现在正在使用 req.conf
[req]
distinguished_name = req_distinguished_name
x509_extensions = v3_req
prompt = no
[req_distinguished_name]
C = US
ST = CA
L = Belmont
O = N/A
OU …Run Code Online (Sandbox Code Playgroud)