Ruby on rails sslv3 警报握手失败



我正在尝试向Salesforce实例发出HTTPS API请求。我正在尝试从本地主机和窗口计算机连接。

SALESFORCE_URL = "https://my.salesforce.com"
TOKEN_URL = "services/oauth2/token"
request_params =  {
"grant_type" => "password",
"client_id" => "3MVG9gOZsF7exF8Pn79zdsxuntzX_0TlVPRKL0R8iPxBQ8dHqh14yzg",
"client_secret" => "272142298328091392325",
"redirect_url" => "https://localhost:3000/RestTest/oauth/_callback",
"username" => "user@xyz.com",
"password" => "xyz@2018",
}   
url = SALESFORCE_URL + "/" + TOKEN_URL
uri = URI.parse(url)
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Post.new(uri.path, initheader = {'Content-Type' =>'application/json'})
request.body = request_params.to_json
response = http.request(request)
Rails.logger.info response.inspect

我得到以下错误。

OpenSSL::SSL::SSLError: SSL_connect returned=1 errno=0 state=SSLv2/v3 read server hello A: sslv3 alert handshake failure
C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/net/http.rb:800:in `connect'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/net/http.rb:800:in `block in connect'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/timeout.rb:55:in `timeout'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/timeout.rb:100:in `timeout'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/net/http.rb:800:in `connect'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/net/http.rb:756:in `do_start'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/net/http.rb:745:in `start'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/right_http_connection-1.3.0/lib/net_fix.rb:129:in `request'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/rest-client-1.6.7/lib/restclient/net_http_ext.rb:51:in `request'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/newrelic_rpm-3.7.1.188/lib/new_relic/agent/instrumentation/net.rb:27:in `block (2 levels) in request_with_newrelic_trace'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/newrelic_rpm-3.7.1.188/lib/new_relic/agent.rb:400:in `disable_all_tracing'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/newrelic_rpm-3.7.1.188/lib/new_relic/agent/instrumentation/net.rb:26:in `block in request_with_newrelic_trace'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/newrelic_rpm-3.7.1.188/lib/new_relic/agent/cross_app_tracing.rb:41:in `trace_http_request'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/newrelic_rpm-3.7.1.188/lib/new_relic/agent/instrumentation/net.rb:23:in `request_with_newrelic_trace'
C:/Users/user/Home/projects/portcullis/mainNew/lib/tasks/salesforce.rake:41:in `block (2 levels) in <top (required)>'

为什么我会收到此错误?

Salesforce 不支持 SSLv3(POODLE 漏洞(。

使用Comodo的SSL Analyzer或Qualys SSL Labs等在线工具检查支持的密码,并配置您的HTTP客户端

connection.ssl_version = :TLSv1 or :TLSv1_2 

相关内容

最新更新