如何设置一个自签名的ssl证书,以便本地网络上的两台机器可以互相通信。(我们正在测试API,需要ssl来读取cookie)
openssl.cnf:
[req]
req_extensions = v3_req
distinguished_name = req_distinguished_name
[req_distinguished_name]
organizationName = text
organizationalUnitName = text
localityName = text
stateOrProvinceName = text
countryName = Ru
commonName = localhost
emailAddress = [email protected]
[v3_req]
keyUsage = keyEncipherment, dataEncipherment
extendedKeyUsage = serverAuth
subjectAltName = @alt_names
[alt_names]
DNS.1 = *
IP.1 = 192.168.1.63
IP.2 = 192.168.1.69
我创建一个证书和密钥:
openssl req -x509 -newkey rsa:2048 -keyout private-key.pem -out certificate.pem -days 365 -config openssl.cnf
在第二台计算机上安装此证书并使其受信任后,出现错误“net::ERR_CERT_COMMON_NAME_INVALID”。
但请求显然不是本地主机。
使用easy-rsa颁发证书。在其中创建一个自签名根。