SSL:: SSL_connect返回=1 errno=0状态=SSLv3读取服务器证书B:证书验证失败。

时间:2021-10-16 00:31:19

I get this error:

我得到这个错误:

OpenSSL::SSL::SSLError

SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed

Rails.application.config.middleware.use OmniAuth::Builder do  
  provider :facebook, 'MY_APPID', 'SECRET', {:scope => 'publish_stream,email', :client_options => {:ssl => {:ca_path => "#{Rails.root}/config/cacert.pem"}}}
end

The action:

行动:

def callback
  session['fb_auth'] = request.env['omniauth.auth']
  session['fb_token'] = session['fb_auth']['credentials']['token']
  session['fb_error'] = nil
render :text => request.env['omniauth.auth'].to_yaml  
end

I have been trying some solutions to this problem like:

我一直在试图解决这个问题,比如:

Rails.application.config.middleware.use OmniAuth::Builder do  
  provider :facebook, 'MY_APPID', 'SECRET', {:scope => 'publish_stream,email', :client_options => {:ssl => {:verify => false}}}
end

and

Rails.application.config.middleware.use OmniAuth::Builder do  
  provider :facebook, 'MY_APPID', 'SECRET', {:scope => 'publish_stream,email', :client_options => {:ssl => {:ca_path => "#{Rails.root}/config/ca-bundle.crt"}}}
end

Where ca-bundle is: http://certifie.com/ca-bundle/ca-bundle.crt.txt

ca-bundle在哪里:http://certifie.com/ca-bundle/ca-bundle.crt.txt

Rails.application.config.middleware.use OmniAuth::Builder do  
  provider :facebook, 'MY_APPID', 'SECRET', {:scope => 'publish_stream,email', :client_options => {:ssl => {:ca_path => "#{Rails.root}/config/cacert.pem"}}}
end

Where cacert.pem is: http://curl.haxx.se/ca/cacert.pem

cacert的地方。pem是:http://curl.haxx.se/ca/cacert.pem。

I am using Windows 7. Does anybody have a solution on this or I am doing something wrong. What is the differens between .pem and .crt?

我正在使用Windows 7。有人能解决这个问题吗?或者我做错了什么。pem和。crt有什么区别?

1 个解决方案

#1


0  

Ruby cannot find any root certificates.

Ruby找不到任何根证书。

Here is another option for debugging purposes:

下面是另一个用于调试的选项:

require 'openssl'
OpenSSL::SSL::VERIFY_PEER = OpenSSL::SSL::VERIFY_NONE

Source: https://*.com/a/12032944/1047207 (My answer to similar question)

来源:https://*.com/a/12032944/1047207(我对类似问题的回答)

You may want to take a look at this Blog also.

你也可以看看这个博客。

#1


0  

Ruby cannot find any root certificates.

Ruby找不到任何根证书。

Here is another option for debugging purposes:

下面是另一个用于调试的选项:

require 'openssl'
OpenSSL::SSL::VERIFY_PEER = OpenSSL::SSL::VERIFY_NONE

Source: https://*.com/a/12032944/1047207 (My answer to similar question)

来源:https://*.com/a/12032944/1047207(我对类似问题的回答)

You may want to take a look at this Blog also.

你也可以看看这个博客。