开发者

Rails and SSL_CERT_FILE OS X

I have some problems when creating new rails apps using templates from remote location like github where ssl certification check is needed. I'm using snow leopard with ruby1.9.2 and openssl, both installed with macports.

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

will result in:

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

so to avoid the problem i run rails with SSL_CERT_FILE variable:

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

To keep this setting i set SSL_CERT_FILE variable in my .bash_profile and echo confirms that the variable has the correct value:

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

however if i run rails again the certificate check will fail and i don't understand why? Is there any other way to avoid the problem without setting OpenSSL::SSL::VERIFY_NONE everywhere?

(other applications like git has always worked fine)

Thanks


You may have already solved this but did you remember to:

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

since rails will be run separate from the bash shell and hence need the env vars exported (simple stuff but if it's late at night and your mind sooo doesn't want to be solving yet another rails environment issue then it could be overlooked!)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜