我在同一个域中有两个网站示例 app1.test.local
和 app2.test.lcaol
.以下是我生成 self-signed
的过程证书。
openssl genrsa -out tls.key 2048
openssl.conf
文件和更新req_distinguished_name
和 alt_names
内容。 [req]
distinguished_name = req_distinguished_name
req_extensions = v3_req
[req_distinguished_name]
countryName = IN
countryName_default = IN
stateOrProvinceName = KA
stateOrProvinceName_default = KA
localityName = Test
localityName_default = Test
organizationalUnitName = test
organizationalUnitName_default = test
commonName = *.test.local
commonName_max = 64
[ v3_req ]
# Extensions to add to a certificate request
basicConstraints = CA:FALSE
keyUsage = nonRepudiation, digitalSignature, keyEncipherment
subjectAltName = @alt_names
[alt_names]
DNS.1 = *.test.local
openssl req -new -out tls.csr -key tls.key -config openssl.cnf
openssl x509 -req -days 3650 -in tls.csr -signkey tls.key -out tls.crt -extensions v3_req -extfile openssl.cnf
来自 view certificate
浏览器选项我可以看到SAN
和 CN
有 *.test.local
作为值(value)。但是,当我启动应用程序 app2
来自 app1
浏览器再次提示信任证书 [ The certificate is not trusted because it is self-signed.
]。问题:如何防止浏览器提示
Accept the risk and Continue
多次使用同一个证书,但来自不同网站的自签名证书。
最佳答案
How to prevent browser from prompting to Accept the risk and Continue multiple times for the same certificate but from different websites for self-signed certificates.
覆盖证书的警告只会影响当前使用的域,而不是证书中的每个域。否则,有人可以为一些无辜的站点创建证书,但其中还包括像 paypal.com 这样的重要站点的 SAN,然后再使用该证书来冒充重要站点。
要使证书中给定的所有域都信任证书,需要将证书作为受信任显式导入浏览器信任存储区,而不是简单地忽略证书警告。
关于ssl - 如何在网站之间共享自签名 TLS 证书,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/71733406/