Note that there are some explanatory texts on larger screens.

plurals
  1. POWhy is Ruby unable to verify an SSL certificate?
    primarykey
    data
    text
    <p>This is my first time trying to use the XMLRPC::Client library to interact with a remote API and I keep receiving this error:</p> <pre><code>warning: peer certificate won't be verified in this SSL session </code></pre> <p>Searching around I've found loads of people that have gotten that error. Usually it's with self-signed certificates and they just want it to go away, so they do something dirty like monkey patch the way XMLRPC::Client is opening it's http session.</p> <p>I first assumed this was simply the client not caring whether the certificate was valid or not, so I continued my search and came across <a href="https://github.com/jamesgolick/always_verify_ssl_certificates" rel="noreferrer">this gem</a>. It simply forces verification of all SSL certificates and throws a hard error if it's not able too. This was exactly what I wanted. I included it, ran the code again and now I'm getting this:</p> <pre><code>OpenSSL:SSL::SSLError: SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed </code></pre> <p>Of course! The certificate is bad! But I double check just to make sure with openssl's builtin s_client like so:</p> <pre><code>openssl s_client -connect sub.example.com:443 </code></pre> <p>and what do I get:</p> <pre><code>CONNECTED(00000003) --- Certificate chain &lt;snip&gt; Verify return code: 0 (ok) </code></pre> <p>So now we get to my question. OpenSSL (the command line version) says the certificate is good. OpenSSL (the Ruby library) disagrees. All of my web browsers say the certificate is good.</p> <p>A few additional details that might be of use. The certificate is a wildcard but is valid for the domain. The openssl s_client was run on the same machine seconds apart from the Ruby code. This is Ruby 1.8.7 p357 which is installed with RVM.</p> <p>Does Ruby use something other than the CA bundle provided by the host OS? Is there a way to tell Ruby to use a specific CA bundle or the system one?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload