我正在尝试弄清楚如何使用 heroku 上的 Rails 应用程序进行加密。
我已经尝试了几个 gem,它们似乎是为帮助完成此过程而设计的(letsencrypt-plugin),但删除了这些 gem 推荐的所有安装步骤,因为我无法正常工作。
现在,我再次尝试理解此处列出的教程:
http://collectiveidea.com/blog/archives/2016/01/12/lets-encrypt-with-a-rails-app-on-heroku/
https://medium.com/should-designers-code/how-to-set-up-ssl-with-lets-encrypt-on-heroku-for-free-266c185630db#.h9vjoxboq
我还没有走远。
我再次尝试这个:https://medium.com/should-designers-code/how-to-set-up-ssl-with-lets-encrypt-on-heroku-for-free-266c185630db#.h9vjoxboq
目前,错误消息显示:
Type: unauthorized
Detail: The key authorization file from the server did not match
this challenge
[first random string.second random string]
!= [#{params[:id]}.ENV["LETS_ENCRYPT_SECOND"]]
To fix these errors, please make sure that your domain name was
entered correctly and the DNS A record(s) for that domain
contain(s) the right IP address.
我已将 LETS_ENCRYPT_SECOND 与“第二个随机字符串”保存在我的 application.yml 中。
我的 DNS 中没有任何 A 记录。我在 Heroku 上托管 - 它不提供任何 A 记录或 IP 地址。我的域名已在 123-reg 上注册。
我不明白这部分说明:
mkdir -p /tmp/certbot/public_html/.well-known/acme-challenge
cd /tmp/certbot/public_html
printf "%s" 第一个随机字符串.第二个随机字符串 > .well-known/acme-challenge/第一个随机字符串
每个服务器仅运行一次:
$(命令-v python2 || 命令-v python2.7 || 命令-v python2.6) -c \
“导入BaseHTTPServer,SimpleHTTPServer;\
s = BaseHTTPServer.HTTPServer(('', 80), SimpleHTTPServer.SimpleHTTPRequestHandler); \
s.serve_forever()"
我认为它们意味着我需要将上述 4 个命令中的每一个命令放入终端中,然后就完成了。我已经这样做过好几次了,但我没有取得任何进展。
任何人都可以帮忙提供如何设置的建议。我被困住了。
UPDATE
我已经删除了尝试遵循上述指南创建的所有设置,并使用 LetsEncrypt_Plugin gem 再次尝试
目前,这些设置均已配置,但是当我尝试运行 rake Letsencrypt_plugin 时,我收到一条错误消息:
挑战验证失败!错误:urn:acme:error:unknownHost: 找不到 www.example.com 的有效 IP 地址
我现在不确定是否应该将自定义域名放入letsencrypt_plugin.yml 文件中,或者是否应该在那里为自定义域名写入heroku 应用别名。
此外,由于该应用程序托管在 heroku 上,因此没有 IP 地址。我的 DNS 配置根本没有任何 A 记录(没有 IP 地址)。
进一步更新
我制作了一个全新的 Rails 5 应用程序。我把它放在heroku上。我再次尝试了let encrypt_plugin。这次,我收到一条错误消息:
heroku run rake letsencrypt_plugin
Running rake letsencrypt_plugin on ⬢ ancient-octopus-78709... up, run.6780 (Hobby)
I, [2016-10-17T07:59:13.985385 #3] INFO -- : Trying to register at Let's Encrypt service...
I, [2016-10-17T07:59:13.985480 #3] INFO -- : Loading private key...
I, [2016-10-17T07:59:14.255357 #3] INFO -- : Acme::Client::Error::Malformed - Registration key is already in use
I, [2016-10-17T07:59:14.256579 #3] INFO -- : Already registered.
I, [2016-10-17T07:59:14.256646 #3] INFO -- : Sending authorization request for: www..com...
I, [2016-10-17T07:59:14.504527 #3] INFO -- : Storing challenge information...
I, [2016-10-17T07:59:16.688404 #3] INFO -- : Waiting for challenge status...
E, [2016-10-17T07:59:18.456415 #3] ERROR -- : Challenge verification failed! Error: urn:acme:error:unauthorized: Invalid response from http://www..com/.well-known/acme-challenge/eAniFLfG_3t5HrD6zbtppzWWYz1Ay76r0GaFHQ62GLI: "<!DOCTYPE html>
We're sorry, but something went wrong (500)