ruby was-sdk v2 : Seahorse::Client::NetworkingErro

2020-05-06 13:46发布

问题:

I downloaded the ca-bundle.crt from https://raw.githubusercontent.com/bagder/ca-bundle/master/ca-bundle.crt and installed it on my OS X Yosemite (10.10 w Ruby 2.2.1) local computer at /usr/local/etc/openssl/certs/ca-bundle.crt, as the was-sdk v2 is not anymore shipped with an SSL CA bundle

However, executing :

 @s3 = Aws::S3::Client.new(credentials: Aws.config[:credentials] )
 puts @s3.list_buckets()

I get an error

 *** Seahorse::Client::NetworkingError Exception: SSL_connect 
returned=1 errno=0 state=SSLv3 read server certificate 
B: certificate verify failed

I tried wo success to add the ca-bundle.cert path to my Aws.config

 Aws.config[:ssl_ca_bundle] = '/usr/local/etc/openssl/certs/ca-bundle.crt'

I also tried to disable the ssl peer verification (for test purpose only)

 Aws.config[:ssl_verify_peer] = false

But in both tests it's still failing ..

I read some issues posted about this topic, but none related to the final v2 version ... what could be the 'definitive' solution to this issue ? thanks for feedback

回答1:

It's an OS X / Homebrew issue ... install openssl w Homebrew the CA cert is located at : /usr/local/etc/openssl/cert.pem

so I need to configure it :

 Aws.config[:ssl_ca_bundle] = '/usr/local/etc/openssl/cert.pem'