簡體   English   中英

Ruby RestClient Openssl錯誤OS X

[英]Ruby RestClient Openssl Error OS X

我需要解決openssl問題的幫助。 OS X 10.11.1

which openssl
/usr/local/bin/openssl

openssl version
OpenSSL 1.0.2f  28 Jan 2016

rvm version
rvm 1.26.11 (latest) by Wayne E. Seguin <wayneeseguin@gmail.com>, Michal Papis <mpapis@gmail.com> [https://rvm.io/]

gem -v
2.5.2

bundle show | grep rest
  * rest-client (1.8.0)

因此,如您所見,所有內容都是最新的。 但是我仍然得到錯誤:

RestClient.get('https://www.googleapis.com')
RestClient::SSLCertificateNotVerified: SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed

但是github上的https效果很好:

RestClient.get('https://github.com').code
 => 200 

我已經閱讀了此http://railsapps.github.io/openssl-certificate-verify-failed.html

沒有任何幫助。 它出什么問題了?

正如所指出的,Eric platon google不再支持SSL v3.0,但是對於mac和ruby,rvm和openssl,問題在於,即使您鏈接openssl並且使用的是最后的openssl,ruby也會針對系統openssl進行編譯,因此請嘗試以下操作:

rvm reinstall ruby-X.Y.Z --with-openssl-dir=`brew --prefix openssl`

那么它應該工作,

irb(main):001:0> RestClient.get('https://www.googleapis.com')
RestClient::NotFound: 404 Not Found

並請使用brew將openssl更新到最新版本,這對我來說適用於以下版本:

╭─ ~  2.4.0@learn  SBCL 1.3.16 
╰─ brew --prefix openssl                                                                                                255 ↵  06:57 Dur  3371  16:34:01
/usr/local/opt/openssl
╭─ ~  2.4.0@learn  SBCL 1.3.16 
╰─ /usr/local/opt/openssl/bin/openssl version                                                                                           ✓  3373  17:05:45
OpenSSL 1.0.2k  26 Jan 2017

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM