我使用OpenSSL创建自己的证书颁发机构。
我将创建的根证书放在Windows 10和Ubuntu18.04上。
我创建了一个签名证书,该证书用于.NET核心服务器(运行在Ubuntu上)。
当使用Chrome访问Windows 10上的服务器时,证书是有效/安全的。
访问Ubuntu时,证书无效。
以下是我所采取的步骤:
创建CA
openssl genrsa -des3 -out self-ca.key -passout pass:password 2048
openssl req -x509 -new -nodes -key self-ca.key -sha256 -days 1825 -out self-ca.pem -passin pass:password在Ubuntu上安装CA
openssl x509 -outform der -in self-ca.pem -out self-ca.crt
cp self-ca.crt /usr/local/share/ca-certificates/.
update-ca-certificates在Windows上安装CA
Place certificate under Trusted Root Authorities创建证书
req.conf文件:
[req]
distinguished_name = req_distinguished_name
req_extensions = v3_req
prompt = no
[req_distinguished_name]
C = CA
ST = ON
O = Self Certificate
CN = www.<mysite>.com
[v3_req]
keyUsage = keyEncipherment, dataEncipherment
extendedKeyUsage = serverAuth
subjectAltName = @alt_names
[alt_names]
DNS.1 = *.<mysite>.com证书命令
openssl genrsa -out self.key 2048
openssl req -new -sha256 -key self.key -config req.conf -out self.csr
openssl x509 -req -in self.csr -CA self-ca.pem -CAkey self-ca.key -CAcreateserial -out self.crt -days 1095 -sha256 -extensions v3_req -extfile req.conf -passin pass:password创建用于.NET核心服务器的pfx文件:
openssl pkcs12 -export -inkey self.key -in self.crt -out self.pfx发布于 2020-07-03 13:59:40
Ubuntu中的Chrome使用NSS数据库而不是全局/etc/ssl存储。
可以使用命令certutil将证书导入到用户级NSS。
安装certutil:sudo apt install libnss3-tools
添加CA证书:certutil -d sql:$HOME/.pki/nssdb/ -A -n "My private CA" -i CA_cert.pem -t "C,C,C"
此命令将从文件CA_Cert.pem安装证书,名称为My private CA,作为SSL证书、S/MIME证书和代码签名服务器的受信任根。
要检查证书是否已安装:certutil -L -d sql:$HOME/.pki/nssdb/
https://stackoverflow.com/questions/62707097
复制相似问题