Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed" [duplicate]

I'm setting-up Redmine to poll e-mails from gmail via IMAP. An attempt to run the appropriate Ruby task causes the following error:

SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed

The error occurs when Ruby attempts to connect imap.gmail.com via OpenSSL, in the following code line:

imap = Net::IMAP.new(host, port, ssl)

When I try to connect the above host from OpenSSL command line, it gets connected successfully.

I understand that Ruby doesn't find some certificates and I saw various solution proposals, but unfortunately I still can't figure out how to sort out this issue (I do not use rvm).

I tried to disable the verification by setting OpenSSL::SSL::VERIFY_PEER = OpenSSL::SSL::VERIFY_NONE, but got "dynamic constant assignment" error.

My environment:

Linux debianvm 3.2.0-4-amd64 #1 SMP Debian 3.2.41-2+deb7u2 x86_64 GNU/Linux
root@debianvm:~# ruby --version
ruby 1.9.3p429 (2013-05-15 revision 40747) [x86_64-linux]
root@debianvm:~# rails --version
Rails 3.2.13
like image 463
Igor R. Avatar asked Nov 21 '25 04:11

Igor R.


1 Answers

The issue has been solved by simply installing root certificates:

apt-get install openssl ca-certificates
like image 150
Igor R. Avatar answered Nov 22 '25 21:11

Igor R.



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!