在GCE自签名的SSL证书 - “SSL证书无法解析”(self-signed SSL certif

2019-11-05 06:13发布

我有一个网站,说mySite.com在谷歌云引擎,一个Debian虚拟机中运行。 我期待在这个网站上安装SSL证书,这样Firefox将不被显示,其中之一就是在登录场的安全性错误(没有很好地熟悉网络安全 - 请原谅天真的措辞)

我知道,SSL应由中央机构(CA)签署,并为此,我既可以我。)支付与得到它的一个已知的CA,或ii。签署)创建一个CA自己并签署自己的认证,无需支付任何东西。 我现在想第二个选项看东西就GCE第一是如何工作的,以及它是否足以满足我的目的 - 那就是,自认证SSL将提供GCE的安全性。

我也跟着上的命令与CA OpenSSL签名https_client证书 ,并成功运行,以便执行以下操作:

// Generate CA key and cert:
openssl genrsa -out msite.CA.key 2048
openssl req -x509 -new -key msite.CA.key -days 3650 -out msite.CA.pem -subj '/C=AA/ST=aa/L=aaa/O=msite/OU=msite/CN=aa/emailAddress=sth'

// Generate client key and csr:
openssl genrsa -out mySite.com.key 2048
openssl req -new -key mySite.com.key -out mySite.com.csr -subj '/C=BB/ST=bb/L=bb/O=msite/OU=msite/CN=bb/emailAddress=bbb'

// Generate client cert signed with CA cert:
openssl x509 -req -days 365 -CA msite.CA.pem -CAkey msite.CA.key -CAcreateserial -CAserial serial -in mySite.com.csr -out mySite.com.pem

// verify:
openssl verify -verbose -CAfile msite.CA.pem mySite.com.pem
// the output to this is “mySite.com.pem: OK”

所有似乎确定迄今为止 - 所有上述命令的运行,没有任何错误。 在这一点上,我跑下(从命令https://cloud.google.com/load-balancing/docs/ssl-certificates )

gcloud compute ssl-certificates create mysertificatee \
--certificate mySite.com.csr \
--private-key mySite.com.key

并得到了错误:

ERROR: (gcloud.compute.ssl-certificates.create) Some requests did not succeed: 
- The SSL certificate could not be parsed. 

什么是错误的原因是什么? 如何解决呢?

Answer 1:

gcloud compute ssl-certificates create mysertificatee \
--certificate mySite.com.csr \
--private-key mySite.com.key

对于参数--certificate应该是证书,即mySite.com.pem 。 相反,CSR mySite.com.csr给出。



文章来源: self-signed SSL certificate on GCE — 'SSL certificate could not be parsed'