$ heroku certs:update server.crt server.key
但是,没有迹象表明在部署之前进行了任何验证。由于这是生产,我想确保我提供给他们的两个文件不会造成任何安全问题。
我有 foo_com.crt(由 DigiCert 签名)、server.key 和 DigitCertCA.crt。
我发现我可以 security verify-cert -c certificate.pem
用来验证我的证书(在 OS X 上)。我的证书没有验证:
$ security verify-cert -c foo_com.crt
Cert Verify Result: CSSMERR_TP_NOT_TRUSTED
这让我相信我的中介可能不受信任,但是:
$ security verify-cert -c DigiCertCA.crt
...certificate verification successful.
指定 SSL 的目的也成功
$ security verify-cert -p ssl -c foo_com.crt
...certificate verification successful.
我也在 Linux 机器上尝试过,结果也相似。
$ openssl verify foo_com.crt
C = __, ST = ___, L = ___, O = "Foo Inc", CN = foo.com
error 20 at 0 depth lookup: unable to get local issuer certificate
error foo_com.crt: verification failed
$ openssl verify -CAfile DigiCertCA.crt foo_com.crt
foo_com.crt: OK
$ openssl verify -purpose sslserver -CApath /etc/ssl/certs foo_com.crt
C = __, ST = ___, L = ___, O = "Foo Inc", CN = foo.com
error 20 at 0 depth lookup: unable to get local issuer certificate
error foo_com.crt: verification failed
我如何确定当我在 Heroku 中更新我的证书时,一切都会顺利进行?
一位同事提出的运行 nginx 的建议让我有信心知道一切都会顺利部署。
我配置了nginx
server {
listen 443 http2 ssl;
listen [::]:443 http2 ssl;
server_name server_IP_address;
ssl_certificate /Users/traff/cert/gd.crt;
ssl_certificate_key /Users/traff/cert/server.key;
server_name localhost;
...
}
一旦我设置了我的 nginx 服务器,我就运行了openssl s_client -connect localhost:443 -CApath /etc/ssl/certs
. 然后,foo.com
在我的主机中设置指向我的 nginx 服务器之后。我用过curl https://foo.com
。
使用foo_com.crt
和DigiCertCA.crt
(按该顺序)和的连接server.key
,上传成功。
此外,虽然 Heroku 的文档没有说明,但更新步骤确实验证了 SSL 将正常工作
$ heroku certs:update foo_com_DigiCertCA_cat.crt server.key -a my-app
Resolving trust chain... done
_ Potentially Destructive Action
_ This command will change the certificate of endpoint ____
_ (_______.herokussl.com) from _ my-app.
_ To proceed, type my-app or re-run this command with
_ --confirm my-app
> my-app
Updating SSL certificate _____ (____.herokussl.com) for _ my-app... done
Updated certificate details:
Common Name(s): foo.com
Expires At: DateTime
Issuer: /C=US/O=DigiCert Inc/OU=www.digicert.com/CN=DigiCert SHA2 High Assurance Server CA
Starts At: DigiCert
Subject: blah blah blah
SSL certificate is verified by a root authority.
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句