I just wanna know how to set proxy values(Url, user, password) for Berkshelf3 under windows platform when I launch the command >berks intall ?
I already try in cmd command:
http_proxy='http://xx.xx.xx.xx'
http_proxy_user=USERNAME
http_proxy_pass=PASSWORD
The reamining issue:
C:\chef-repo-distant\cookbooks\putty>berks install
Resolving cookbook dependencies...
Fetching 'putty' from source at .
Fetching cookbook index from ttps://supermarket.getchef.com...
C:/opscode/chefdk/embedded/lib/ruby/2.0.0/net/http.rb:918:in connect': SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certific
ate verify failed (Faraday::SSLError)
from C:/opscode/chefdk/embedded/lib/ruby/2.0.0/net/http.rb:918:inblock in connect'
from C:/opscode/chefdk/embedded/lib/ruby/2.0.0/timeout.rb:66:in timeout'
from C:/opscode/chefdk/embedded/lib/ruby/2.0.0/net/http.rb:918:inconnect'
from C:/opscode/chefdk/embedded/lib/ruby/2.0.0/net/http.rb:862:in do_start'
from C:/opscode/chefdk/embedded/lib/ruby/2.0.0/net/http.rb:851:instart'
from C:/opscode/chefdk/embedded/lib/ruby/2.0.0/net/http.rb:1367:in request'
from C:/opscode/chefdk/embedded/lib/ruby/2.0.0/net/http.rb:1126:inget'
from C:/opscode/chefdk/embedded/lib/ruby/gems/2.0.0/gems/faraday-0.9.0/lib/faraday/adapter/net_http.rb:78:in perform_request'
from C:/opscode/chefdk/embedded/lib/ruby/gems/2.0.0/gems/faraday-0.9.0/lib/faraday/adapter/net_http.rb:39:incall'
from C:/opscode/chefdk/embedded/lib/ruby/gems/2.0.0/gems/faraday-0.9.0/lib/faraday/request/retry.rb:87:in call'
from C:/opscode/chefdk/embedded/lib/ruby/gems/2.0.0/gems/faraday-0.9.0/lib/faraday/response.rb:8:incall'
from C:/opscode/chefdk/embedded/lib/ruby/gems/2.0.0/gems/faraday-0.9.0/lib/faraday/response.rb:8:in call'
from C:/opscode/chefdk/embedded/lib/ruby/gems/2.0.0/gems/faraday-0.9.0/lib/faraday/rack_builder.rb:139:inbuild_response'
from C:/opscode/chefdk/embedded/lib/ruby/gems/2.0.0/gems/faraday-0.9.0/lib/faraday/connection.rb:377:in run_request'
from C:/opscode/chefdk/embedded/lib/ruby/gems/2.0.0/gems/faraday-0.9.0/lib/faraday/connection.rb:140:inget'
from C:/opscode/chefdk/embedded/lib/ruby/gems/2.0.0/gems/berkshelf-api-client-1.2.0/lib/berkshelf/api_client/connection.rb:62:in universe'
from c:/opscode/chefdk/embedded/apps/berkshelf/lib/berkshelf/source.rb:22:inbuild_universe'
from c:/opscode/chefdk/embedded/apps/berkshelf/lib/berkshelf/installer.rb:21:in `block (2 levels) in build_universe'
Thanks for the support!
Try to follow all the fix I can find on the web but it didn't make it :(
I use "source 'ttp://api.berkshelf.com" in my Berksfile
And launch the command berks install in a powershell windows
WITHOUT the proxy set, I got:
Error retrieving universe from source: ttp://api.berkshelf.com
* [Berkshelf::APIClient::TimeoutError] Unable to connect to: ttp://api.berkshelf.com
WITH the proxy set, I got:
Installing windows (1.34.2) from ttp://api.berkshelf.com ([opscode] ttp://supermarket.getchef.com/api/v1)
E, [2014-09-01T18:27:50.775682 #13104] ERROR -- : Actor crashed!
Faraday::SSLError: SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed
C:/opscode/chefdk/embedded/lib/ruby/2.0.0/net/http.rb:918:in `connect'
C:/opscode/chefdk/embedded/lib/ruby/2.0.0/net/http.rb:918:in `block in connect'
C:/opscode/chefdk/embedded/lib/ruby/2.0.0/timeout.rb:52:in `timeout'
C:/opscode/chefdk/embedded/lib/ruby/2.0.0/net/http.rb:918:in `connect'
C:/opscode/chefdk/embedded/lib/ruby/2.0.0/net/http.rb:862:in `do_start'
C:/opscode/chefdk/embedded/lib/ruby/2.0.0/net/http.rb:851:in `start'
C:/opscode/chefdk/embedded/lib/ruby/2.0.0/net/http.rb:1367:in `request'
C:/opscode/chefdk/embedded/lib/ruby/2.0.0/net/http.rb:1126:in `get'
C:/opscode/chefdk/embedded/lib/ruby/gems/2.0.0/gems/faraday-0.9.0/lib/faraday/adapter/net_http.rb:78:in `perform
_request'
I'm desperate to solve this issue :(
Yeah, it works I'll have to add 3 certificates retrieve from IE to the cacert.pem !!!
Great ;)
Thanks Tensibai ;)
Your problem is here:
connect': SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certific
ate verify failed (Faraday::SSLError)
Your proxy is doing an interception on SSL traffic and use its own certificate to resign the distant site certificate.
So you have to add your proxy certificate into the cacerts.pem of your ruby install.
With a navigator show the proxy information of a ssl site and use 'copy to file' and chose base64 encoded x509 format.
Next edit this file to copy its content
Edit the cacert file (for chefdk according to you install it would be c:/opscode/chefdk/embedded/ssl/cacerts.pem
Paste your proxy certificate before the last one (to avoid messing with the end of file)
and retry that should do the trick.
For some cases you have to setup the SSL_CERT_FILE env var:
set SSL_CERT_FILE=c:/opscode/chefdk/embedded/ssl/cacerts.pem
Source
Related
I'm trying to utilize a gem to access my accounting site, e-conomic, via Ruby.
Gem (rconomic): https://github.com/substancelab/rconomic
The code I've used is below (where I've replaced the private app ID and the access ID with the relevant IDs):
Dir.chdir 'C:\Ruby22\bin'
require 'rconomic'
economic = Economic::Session.new
economic.connect_with_token 'the_private_app_id', 'the_access_id_you_got_from_the_grant'
However, when I run the code I receive the following error message:
C:/Ruby22/lib/ruby/gems/2.2.0/gems/httpi-2.4.2/lib/httpi/adapter/net_http.rb:51:in 'rescue in request': SSL_connect returned=1 errno=0 state=error: certificate verify failed (HTTPI::SSLError)
from C:/Ruby22/lib/ruby/gems/2.2.0/gems/httpi-2.4.2/lib/httpi/adapter/net_http.rb:33:in 'request'
from C:/Ruby22/lib/ruby/gems/2.2.0/gems/httpi-2.4.2/lib/httpi.rb:161:in `request'
from C:/Ruby22/lib/ruby/gems/2.2.0/gems/httpi-2.4.2/lib/httpi.rb:133:in 'post'
from C:/Ruby22/lib/ruby/gems/2.2.0/gems/savon-2.11.1/lib/savon/operation.rb:94:in 'block in call_with_logging'
from C:/Ruby22/lib/ruby/gems/2.2.0/gems/savon-2.11.1/lib/savon/request_logger.rb:12:in 'call'
from C:/Ruby22/lib/ruby/gems/2.2.0/gems/savon-2.11.1/lib/savon/request_logger.rb:12:in 'log'
from C:/Ruby22/lib/ruby/gems/2.2.0/gems/savon-2.11.1/lib/savon/operation.rb:94:in 'call_with_logging'
from C:/Ruby22/lib/ruby/gems/2.2.0/gems/savon-2.11.1/lib/savon/operation.rb:54:in 'call'
from C:/Ruby22/lib/ruby/gems/2.2.0/gems/savon-2.11.1/lib/savon/client.rb:36:in 'call'
from C:/Ruby22/lib/ruby/gems/2.2.0/gems/rconomic-0.5.2/lib/economic/endpoint.rb:74:in 'request'
from C:/Ruby22/lib/ruby/gems/2.2.0/gems/rconomic-0.5.2/lib/economic/endpoint.rb:20:in 'call'
from C:/Ruby22/lib/ruby/gems/2.2.0/gems/rconomic-0.5.2/lib/economic/session.rb:22:in 'connect_with_token'
from C:/Ruby22/bin/rconomic_test.rb:8:in ''
Any ideas as to what would be causing this?
- I have tried updating my rubygems
- I am running on Windows 7 with Ruby 2.2.6
I'm a bit of a novice in Ruby, but I would really appreciate any help on this!
Best,
Martin
Maybe there are other questions answered around this, but I cannot seem to be able to solve my problem.
I am trying to use the Apple Push Notification Service as a Provider, using ruby 2.2.3.
I have tried a series of gems that I found and they all have the same problem. The gems that I have tried are:
grocer
apns
houston
They all raise the same exception:
OpenSSL::SSL::SSLError: SSL_connect SYSCALL returned=5 errno=0 state=SSLv3 read server session ticket A
These gems are using OpenSSL to create an SSL connection to APNS end point. But they fail to do that.
Please, note that I am working on a Mac OS X Yosemite machine.
Any help?
EDIT More info on how I use grocer:
pusher = Grocer.pusher(
certificate: "/Users/panayotismatsinopoulos/Documents/ProgrammingSwift/certificate.pem",
passphrase: "the passphrase for loading certificate",
gateway: "gateway.sandbox.push.apple.com",
port: 2195,
retries: 3
)
notification = Grocer::Notification.new(
device_token: "....the device token here...",
alert: "Hello There!",
badge: 42)
pusher.push(notification)
And the exception I get is:
OpenSSL::SSL::SSLError: SSL_connect SYSCALL returned=5 errno=0 state=SSLv3 read server session ticket A
from /Users/panayotismatsinopoulos/.rvm/gems/ruby-2.2.3#my_project/gems/grocer-0.6.1/lib/grocer/ssl_connection.rb:43:in `connect'
from /Users/panayotismatsinopoulos/.rvm/gems/ruby-2.2.3#my_project/gems/grocer-0.6.1/lib/grocer/ssl_connection.rb:43:in `connect'
from /Users/panayotismatsinopoulos/.rvm/gems/ruby-2.2.3#my_project/gems/grocer-0.6.1/lib/grocer/connection.rb:29:in `connect'
from /Users/panayotismatsinopoulos/.rvm/gems/ruby-2.2.3#my_project/gems/grocer-0.6.1/lib/grocer/connection.rb:55:in `with_connection'
from /Users/panayotismatsinopoulos/.rvm/gems/ruby-2.2.3#my_project/gems/grocer-0.6.1/lib/grocer/connection.rb:23:in `write'
from /Users/panayotismatsinopoulos/.rvm/gems/ruby-2.2.3#my_project/gems/grocer-0.6.1/lib/grocer/pusher.rb:8:in `push'
from (irb):29
from /Users/panayotismatsinopoulos/.rvm/gems/ruby-2.2.3#my_project/gems/railties-4.2.4/lib/rails/commands/console.rb:110:in `start'
from /Users/panayotismatsinopoulos/.rvm/gems/ruby-2.2.3#my_project/gems/railties-4.2.4/lib/rails/commands/console.rb:9:in `start'
from /Users/panayotismatsinopoulos/.rvm/gems/ruby-2.2.3#my_project/gems/railties-4.2.4/lib/rails/commands/commands_tasks.rb:68:in `console'
from /Users/panayotismatsinopoulos/.rvm/gems/ruby-2.2.3#my_project/gems/railties-4.2.4/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
from /Users/panayotismatsinopoulos/.rvm/gems/ruby-2.2.3#my_project/gems/railties-4.2.4/lib/rails/commands.rb:17:in `<top (required)>'
from bin/rails:4:in `require'
from bin/rails:4:in `<main>'
Finally, I realised that I was using wrong .pem file. It was not the one specific for the Mobile app that I was trying to push notifications to.
It was the .pem file corresponding to signing certificate to sign my code.
As soon as I used the correct .pem file, everything went smoothly.
I'm following the Jumpstart Labs MicroBlogger tutorial and I'm running into an issue where I'm unable to connect to twitter. I am getting the following errors:
C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/net/http.rb:799:in `connect': SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed (Twitter::Error::ClientError)
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/net/http.rb:799:in `block in connect'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/timeout.rb:68:in `timeout'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/timeout.rb:99:in `timeout'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/net/http.rb:799:in `connect'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/net/http.rb:755:in `do_start'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/net/http.rb:744:in `start'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/net/http.rb:1284:in `request'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/faraday-0.8.8/lib/faraday/adapter/net_http.rb:75:in `perform_request'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/faraday-0.8.8/lib/faraday/adapter/net_http.rb:38:in `call'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/faraday-0.8.8/lib/faraday/response.rb:8:in `call'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/faraday-0.8.8/lib/faraday/response.rb:8:in `call'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/faraday-0.8.8/lib/faraday/response.rb:8:in `call'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/faraday-0.8.8/lib/faraday/request/url_encoded.rb:14:in `call'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/faraday-0.8.8/lib/faraday/request/multipart.rb:13:in `call'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/twitter-4.8.1/lib/twitter/request/multipart_with_file.rb:14:in `call'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/faraday-0.8.8/lib/faraday/connection.rb:253:in `run_request'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/faraday-0.8.8/lib/faraday/connection.rb:118:in `post'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/twitter-4.8.1/lib/twitter/client.rb:108:in `request'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/twitter-4.8.1/lib/twitter/client.rb:72:in `post'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/twitter-4.8.1/lib/twitter/api/utils.rb:82:in `object_from_response'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/twitter-4.8.1/lib/twitter/api/tweets.rb:129:in `update'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/jumpstart_auth-0.3.0/lib/jumpstart_auth.rb:32:in `update'
from C:/Users/Steve/RubymineProjects/MicroBlogger/micro_blogger.rb:12:in `tweet'
from C:/Users/Steve/RubymineProjects/MicroBlogger/micro_blogger.rb:18:in `<top (required)>'
from -e:1:in `load'
from -e:1:in `<main>'
This is my code so far:
require 'jumpstart_auth'
class MicroBlogger
attr_reader :client
def initialize
puts "Initializing"
#client = JumpstartAuth.twitter
end
def tweet(message)
#client.update(message)
end
end
blogger = MicroBlogger.new
blogger.tweet("hey")
As indicated in the error message, the SSL library couldn't verify the SSL certificate returned from the Twitter server. In this case, it is most likely because no certificate authorities were installed for you.
The details and solution are available here:
https://gist.github.com/fnichol/867550#file-readme-md
I suggest using the "boring" method, since it does not involve running code copied off the internet (instructions in case the link disappears, but better to read info at link):
Download http://curl.haxx.se/ca/cacert.pem
Save it to somewhere like C:\RailsInstaller\cacert.pem
Run set SSL_CERT_FILE=C:\RailsInstaller\cacert.pem to set the location for the current shell
Run your script in the same shell
If you have installed ruby directly to windows you can copy the cacert.pem file to the Ruby200dir(eg. c:\ruby200) and run the set SSL_CERT_FILE=[path to the cert file] command from the command prompt.
Keep in mind that this will require you to add the SSL cert for every boot of your computer
consumer and token hash is defined in my code
access_token = OAuth::AccessToken.from_hash(consumer, token_hash)
url = URI.encode("https://api.twitter.com/1.1/statuses/update.json?status=awesome!")
response = access_token.request(:post, url)
it gives us
OpenSSL::SSL::SSLError: SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed
from /usr/lib/ruby/1.8/net/http.rb:586:in `connect'
from /usr/lib/ruby/1.8/net/http.rb:586:in `connect'
from /usr/lib/ruby/1.8/net/http.rb:553:in `do_start'
from /usr/lib/ruby/1.8/net/http.rb:542:in `start'
from /usr/lib/ruby/1.8/net/http.rb:1035:in `__request__'
from /usr/lib/ruby/gems/1.8/gems/rest-client-1.6.7/lib/restclient/net_http_ext.rb:51:in `request'
from /usr/lib/ruby/gems/1.8/gems/oauth-0.4.7/lib/oauth/consumer.rb:161:in `request'
from /usr/lib/ruby/gems/1.8/gems/oauth-0.4.7/lib/oauth/tokens/consumer_token.rb:25:in `request'
from /usr/lib/ruby/gems/1.8/gems/oauth-0.4.7/lib/oauth/tokens/access_token.rb:12:in `request'
Please help me
Use Latest RVM (Ruby Version Manager) to fix third party app integration by using Ruby on Rail framework.
For more info use Step by Step guide here - OpenSSL Errors and Rails Certificate Verify Failed
Hope it helps!
I had the same error. I still havn't been able able to resolve the underlying issues but try pasting this into your .rb files.
OpenSSL::SSL::VERIFY_PEER = OpenSSL::SSL::VERIFY_NONE
It basically turns off the verification step.
I have followed the sample code on the Twilio github page and it doesn't work. In my Rails console, it looks like this:
irb(main):039:0> require 'twilio-ruby'
=> nil
irb(main):040:0* account_sid='xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
=> "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
irb(main):041:0> auth_token='yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy'
=> "yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy"
irb(main):042:0> client=Twilio::REST::Client.new account_sid, auth_token
=> <Twilio::REST::Client #account_sid=AC1322312300a752f6e84a8254535ecce5>
irb(main):043:0> client.account.sms.messages.create :from=>'16135551234', :to=>'16135551212', :body=>"Ada is fat"
OpenSSL::SSL::SSLError: SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed
from C:/Ruby192/lib/ruby/1.9.1/net/http.rb:678:in `connect'
from C:/Ruby192/lib/ruby/1.9.1/net/http.rb:678:in `block in connect'
from C:/Ruby192/lib/ruby/1.9.1/timeout.rb:44:in `timeout'
from C:/Ruby192/lib/ruby/1.9.1/timeout.rb:87:in `timeout'
from C:/Ruby192/lib/ruby/1.9.1/net/http.rb:678:in `connect'
from C:/Ruby192/lib/ruby/1.9.1/net/http.rb:637:in `do_start'
from C:/Ruby192/lib/ruby/1.9.1/net/http.rb:626:in `start'
from C:/Ruby192/lib/ruby/1.9.1/net/http.rb:1168:in `request'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/rest-client-1.6.7/lib/restclient/net_http_ext.rb:51:in `request'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/twilio-ruby-3.4.2/lib/twilio-ruby/rest/client.rb:214:in `connect_and_send'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/twilio-ruby-3.4.2/lib/twilio-ruby/rest/client.rb:138:in `block (2 levels) in <class:Client>'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/twilio-ruby-3.4.2/lib/twilio-ruby/rest/list_resource.rb:73:in `create'
from (irb):43
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.0.11/lib/rails/commands/console.rb:44:in `start'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.0.11/lib/rails/commands/console.rb:8:in `start'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.0.11/lib/rails/commands.rb:23:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'irb(main):044:0>
What else do I need to do to get twilio-ruby to successfully send a text message? I have used these numbers and credentials for incoming calls, so they are good.
** EDIT Dec 24, 2011 ***
Instead of running this code on my PC, I deployed it to heroku.com. Then I had no SSL errors and I was able to place outgoing calls. I'm very puzzled.
This shouldn't be a problem in twilio-ruby versions starting with 3.5.0. It "just works" out of the box now.
With twilio-ruby versions before 3.5.0 there wasn't an SSL CA cert bundle packaged with the gem. So the only way to "fix" this was to either point your client at a cert bundle at initialization time:
client = Twilio::REST::Client.new sid, token, :ssl_ca_file => '/path/to/file'
or to disable SSL verification altogether (not recommended in production):
client = Twilio::REST::Client.new sid, token, :ssl_verify_peer => false
You may be missing root certificate files. This typically shouldn't be necessary but you can try disabling certificate verification by adding these lines before making the call:
require 'open-uri'
require 'openssl'
OpenSSL::SSL::VERIFY_PEER = OpenSSL::SSL::VERIFY_NONE