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

风流意气都作罢 提交于 2019-12-01 07:21:10

问题


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

回答1:


The issue has been solved by simply installing root certificates:

apt-get install openssl ca-certificates


来源:https://stackoverflow.com/questions/16913828/ssl-connect-returned-1-errno-0-state-sslv3-read-server-certificate-b-certifica

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!