title: Rails 2.3.x & Koala & Facebook: certificate verify failed
body: <p>I'm trying to get Facebook Graph API to work in Rails 2.3.5 using Koala. All works fine in my dev environment (Mac) but fails in production (Ubuntu 8.04.1).</p>
  
  <p>Test code:</p>
  
  <pre><code>cookies = {"__utma"=&gt;"158657023.1470934917.1315425280.1317394623.1317406089.55", "28aac256bbbe09dcae1eb7086ae1c326"=&gt;"c14d42fcd1a6700aa6198a2ecd7587fa", "fbsetting_28aac256bbbe09dcae1eb7086ae1c326"=&gt;"{\"connectState\":1,\"oneLineStorySetting\":3,\"shortStorySetting\":3,\"inFacebook\":false}", "__utmb"=&gt;"158657023.23.10.1317406089", "28aac256bbbe09dcae1eb7086ae1c326_session_key"=&gt;"c76e09e8124a194e26a9c1e9.1-635077092", "28aac256bbbe09dcae1eb7086ae1c326_user"=&gt;"635077092", "__utmc"=&gt;"158657023", "28aac256bbbe09dcae1eb7086ae1c326_expires"=&gt;"0", "__utmz"=&gt;"158657023.1317406089.55.52.utmcsr=angel.co|utmccn=(referral)|utmcmd=referral|utmcct=/thingspotter", "fbs_265881436784759"=&gt;"\"access_token=AAADx0ViXiHcBAFMuyXsGRdZB4GmmHyZBQl9h7Ymqi6z0kk3ko5jRJGmdWZCdJQm7dWg2nCyraaZCJuJ6iurPxDHL6bZCMzosZD&amp;expires=0&amp;secret=815a69d93434d26034ada92bb2e80ae9&amp;session_key=858594415a361e318af23dd1.1-635077092&amp;sig=55f7e932f8e68a7dad6ae35af1877b45&amp;uid=635077092\"", "_DefaultAppFacebook_session"=&gt;"BAh7CToPc2Vzc2lvbl9pZCIlYzZjZGU5ZmJlNGU0NTM2ZjExNmQ1ZGQ5ZTc3ZjhiZDUiCmZsYXNoSUM6J0FjdGlvbkNvbnRyb2xsZXI6OkZsYXNoOjpGbGFzaEhhc2h7AAY6CkB1c2VkewA6EF9jc3JmX3Rva2VuIjFnZllGbGFVK0hMdVdZcDZaZjhJY3VJWVlZY2dEakc4VCtpM0dWTktSbFFRPSILbGF5b3V0IgxkZXNrdG9w--195b2d14ce7593502ec6d161906ceb0c38ed4219", "28aac256bbbe09dcae1eb7086ae1c326_ss"=&gt;"0854c086618a5e075e2d9a866ce03f82"}
  @facebook_cookies = Koala::Facebook::OAuth.new.get_user_info_from_cookie(cookies)
  oauth_access_token = @facebook_cookies["access_token"]
  graph = Koala::Facebook::GraphAPI.new(oauth_access_token)
  fb_user = graph.get_object('me')
  </code></pre>
  
  <p>Produces the error message:</p>
  
  <pre><code>OpenSSL::SSL::SSLError: 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/1.8/net/http.rb:772:in `get'
      from /usr/lib/ruby/gems/1.8/gems/faraday-0.7.4/lib/faraday/adapter/net_http.rb:49:in `call'
      from /usr/lib/ruby/gems/1.8/gems/faraday-0.7.4/lib/faraday/request/url_encoded.rb:14:in `call'
      from /usr/lib/ruby/gems/1.8/gems/faraday-0.7.4/lib/faraday/request/multipart.rb:13:in `call'
      from /usr/lib/ruby/gems/1.8/gems/faraday-0.7.4/lib/faraday/connection.rb:203:in `run_request'
      from /usr/lib/ruby/gems/1.8/gems/faraday-0.7.4/lib/faraday/connection.rb:85:in `get'
      from /usr/lib/ruby/gems/1.8/gems/koala-1.2.0/lib/koala/http_service.rb:49:in `send'
      from /usr/lib/ruby/gems/1.8/gems/koala-1.2.0/lib/koala/http_service.rb:49:in `make_request'
      from /usr/lib/ruby/gems/1.8/gems/koala-1.2.0/lib/koala.rb:131:in `make_request'
      from /usr/lib/ruby/gems/1.8/gems/koala-1.2.0/lib/koala.rb:57:in `api'
      from /usr/lib/ruby/gems/1.8/gems/koala-1.2.0/lib/koala/graph_api.rb:215:in `graph_call'
      from /usr/lib/ruby/gems/1.8/gems/koala-1.2.0/lib/koala/graph_api.rb:36:in `get_object'
  </code></pre>
  
  <p>It's obviously something related to SSL certificates, so I've tried to configure Koala:</p>
  
  <pre><code>Koala.http_service.http_options = {
    :ssl =&gt; {
      :ca_file =&gt; '/etc/ssl/certs',
      :verify_mode =&gt; OpenSSL::SSL::VERIFY_PEER,
      :verify =&gt; true
    }
  }
  </code></pre>
  
  <p>...and also download <a href="http://curl.haxx.se/ca/cacert.pem" rel="nofollow noreferrer">http://curl.haxx.se/ca/cacert.pem</a> to the <strong>/etc/ssl/certs</strong> folder.
  Does not make any visible difference though.</p>
  
  <p>Relevant gems are:</p>
  
  <pre><code>faraday (0.7.4)
  koala (1.2.0)
  rails (2.3.5)
  ruby 1.8.6 (2007-09-24 patchlevel 111) [i486-linux]
  </code></pre>
  
  <p>I've found <a href="https://stackoverflow.com/questions/3977303/omniauth-facebook-certificate-verify-failed">related SO posts</a> but no perfect match.</p>