【问题标题】:Rails and SSL_CERT_FILE OS XRails 和 SSL_CERT_FILE OS X
【发布时间】:2011-09-14 12:25:20
【问题描述】:

在需要 ssl 认证检查的远程位置(如 github)使用模板创建新的 Rails 应用程序时,我遇到了一些问题。我正在使用带有 ruby​​1.9.2 和 openssl 的雪豹,两者都安装了 macports。

rails new rails_mongo -m https://raw.github.com/RailsApps/rails3-application-templates/master/rails3-mongoid-devise-template.rb

将导致:

SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed (OpenSSL::SSL::SSLError)

为了避免这个问题,我使用 SSL_CERT_FILE 变量运行 rails:

SSL_CERT_FILE=/opt/local/share/curl/curl-ca-bundle.crt rails new rails_mongo -m https://raw.github.com/RailsApps/rails3-application-templates/master/rails3-mongoid-devise-template.rb

为了保持这个设置,我在我的 .bash_profile 中设置了 SSL_CERT_FILE 变量,并且 echo 确认该变量具有正确的值:

echo $SSL_CERT_FILE
/opt/local/share/curl/curl-ca-bundle.crt

但是,如果我再次运行 rails,证书检查将失败,我不明白为什么? 有没有其他方法可以在不到处设置 OpenSSL::SSL::VERIFY_NONE 的情况下避免这个问题?

(像 git 这样的其他应用程序一直运行良好)

谢谢

【问题讨论】:

    标签: ruby-on-rails macos github openssl


    【解决方案1】:

    您可能已经解决了这个问题,但您是否记得:

    export SSL_CERT_FILE=/opt/local/etc/openssl/cert.pem
    

    因为 rails 将与 bash shell 分开运行,因此需要导出 env vars(简单的东西,但如果它是深夜并且你不想解决另一个 rails 环境问题,那么它可能会被忽略!)

    【讨论】:

      猜你喜欢
      • 2012-12-07
      • 2011-08-02
      • 2013-07-12
      • 1970-01-01
      • 2012-06-04
      • 2011-04-04
      • 2012-07-02
      • 1970-01-01
      • 2012-10-17
      相关资源
      最近更新 更多