Heroku ssl证书:密钥无法读取,因为它受密码保护

Tyl*_*ler 4 ssl openssl heroku ssl-certificate dnsimple

我无法生成Heroku将接受secure.mydomain.com的ssl证书.我正在使用DNSimple,Cedar Stack,并按照此处的说明操作:https://devcenter.heroku.com/articles/ssl-certificate

  1. 从DNSimple复制server.key和server.orig.crt
  2. 获取根CA证书 $ curl https://knowledge.rapidssl.com/library/VERISIGN/ALL_OTHER/RapidSSL%20Intermediate/RapidSSL_CA_bundle.pem > rapidssl_bundle.pem
  3. 用一个连接成一个文件 cat server.orig.crt rapidssl_bundle.pem > server.crt

所以现在我有了server.key和server.orig.crt文件,我尝试将其上传到Heroku $ heroku certs:add server.crt server.key.这给出了错误

Key could not be read since it's protected by a passphrase.
Run Code Online (Sandbox Code Playgroud)

上面的文档没有提到有关从server.key文件中删除密码的任何内容.所以我在这里挖掘并找到了文档:https://devcenter.heroku.com/articles/ssl#customdomain-ssl.我在上面的#1和#2之间运行这些命令:

1B. $ mv server.key server.orig.key

1C. $ openssl rsa -in server.orig.key -out server.key

然而,这给出了错误

unable to load Private Key
47930:error:0906D06C:PEM routines:PEM_read_bio:no start line:/SourceCache/OpenSSL098/OpenSSL098-47/src/crypto/pem/pem_lib.c:648:Expecting: ANY PRIVATE KEY
Run Code Online (Sandbox Code Playgroud)

我怀疑这意味着没有找到私钥.

谁知道这里有什么问题?这是Heroku问题还是openssl问题(或DNSimple问题)?

Sam*_* M. 8

我只是在使用DNSimple和RapidSSL在Heroku应用程序上安装SSL Certs几乎完全相同的问题,并希望在此处发布我的解决方案以防有人遇到类似问题.

我按照SO和Heroku开发中心的所有地方的指示通过DNSimple和RapidSSL安装证书,但每次我尝试使用命令添加证书时:

$ heroku certs:add server.crt bundle.pem server.key

无论我做了什么,我都有这个错误:

$ Adding SSL Endpoint to mysite... failed
 !    Key could not be read since it's protected by a passphrase.
 !    Read instructions on how to remove the passphrase on:
 !    http://www.madboa.com/geek/openssl/#key-removepass`
Run Code Online (Sandbox Code Playgroud)

我知道密钥没有密码(因为我经历了多次这个过程),但它仍然不想添加密码.虽然我不确定哪一个是硬道理,但我做了两件最终使它工作的事情.

首先,我确保从RapidSSL电子邮件链接下的Apache,Plesk和CPA框下载适当的PEM文件到中级证书.

第二件事是通过执行以下步骤验证我的Heroku工具带安装:https://devcenter.heroku.com/articles/heroku-command#installing-the-heroku-cli

原来我还在使用宝石,不得不卸载,直到我到了heroku-toolbelt,之后我再次尝试添加证书并瞧.

  • 并确保您使用*latest*heroku toolbelt.从2.30.2升级到2.39.3为我解决了这个问题. (7认同)

Tyl*_*ler 1

这确实很愚蠢,但据我所知,在 Mac OS 中使用 TextEdit 保存初始 server.key 和 server.orig.crt 文件存在问题。

我改用 TextMate,一切正常。