Mac*_*zyk 45 linux google-chrome certificate ssl
我想在 https localhost 上测试我的网络应用程序。不幸的是,似乎不可能从 chrome 中删除证书警告。首先,我生成了这样的证书:
openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/ssl/private/localhost-selfsigned.key -out /etc/ssl/certs/localhost-selfsigned.crt
Run Code Online (Sandbox Code Playgroud)
然后我想将它添加到 Chrome,设置 > 高级 > 管理证书 - > 导入。我尝试导入之前生成的 .crt 文件,我得到的只是:
证书导入错误:此客户端证书的私钥丢失或无效。
我用谷歌搜索它,但我发现没有任何帮助。
我还尝试启用 allow-insecure-localhost 标志并打开 chrome with--ignore-certificate-errors
但它仍然显示警告和损坏的 https
还有其他方法还是我在证书上做错了什么?
Eri*_*rik 63
我认为您可能想要做的是将其添加到错误的证书存储中。如果您尝试将其添加到“您的证书”下,那您会过得很不愉快。该选项卡用于添加身份证书;您的浏览器向服务器提供的内容以建立浏览器的身份。
根据您的描述,我认为您想要做的是您希望您的浏览器信任将在您的服务器端的自签名证书。如果是这种情况,您需要将其添加到“权限”选项卡中。
对我有用的是
我从这个答案中得到了程序。
由于我的具体问题是为了满足多级子域的需求,因此我将从这个角度来看待它。
子域:
export CA=myca
# you probably want to have this in its own directory
mdkir /etc/ssl/$CA && cd /etc/ssl/$CA
# generate private key
openssl genrsa -des3 -out $CA.key 2048
# generate root certificate
openssl req -x509 -new -nodes -key $CA.key -sha256 -days 825 -out $CA.pem
Run Code Online (Sandbox Code Playgroud)
export NAME=fooz.mydomain.com
# if CA files were in a separate directory
cd .. && mkdir /etc/ssl/$NAME && cd /etc/ssl/$NAME
# generate private key
openssl genrsa -out $NAME.key 2048
# Create a certificate-signing request
# Once prompted, set FQDN to the value of $NAME
openssl req -new -key $NAME.key -out $NAME.csr
# Create a config file for the extensions
>$NAME.ext cat <<-EOF
authorityKeyIdentifier=keyid,issuer
basicConstraints=CA:FALSE
keyUsage = digitalSignature, nonRepudiation, keyEncipherment, dataEncipherment
subjectAltName = @alt_names
[alt_names]
DNS.1 = $NAME # Be sure to include the domain name here because Common Name is not so commonly honoured by itself
# Optionally, add additional domains (I've added a subdomain here)
DNS.2 = foo.$NAME
DNS.3 = bar.$NAME
IP.1 = 192.168.0.13 # (Optional, but probably important), add an IP address (if the connection which you have planned requires it)
EOF
# Create the signed certificate
openssl x509 -req -in $NAME.csr -CA $CA.pem -CAkey $CA.key -CAcreateserial -out $NAME.crt -days 825 -sha256 -extfile $NAME.ext
Run Code Online (Sandbox Code Playgroud)
$CA.pem
文件并在浏览器中以权威身份导入: 1. Chrome settings (Settings > Privacy and Security > Security > Manage certificates > Authorities > Import). Check Trust this certificate for identifying websites
2. Firefox: Preferences > Privacy and Security > Certificates > View Certificates > Authorities > import. Check Trust this CA to identify websites
Run Code Online (Sandbox Code Playgroud)