“SSL_connect 返回=1 errno=0 state=SSLv3 读取服务器证书B:证书验证失败" [英] "SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed"
问题描述
我正在设置 Redmine 以通过 IMAP 轮询来自 gmail 的电子邮件.尝试运行适当的 Ruby 任务会导致以下错误:
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 返回=1 errno=0 state=SSLv3 读取服务器证书B:证书验证失败
SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed
当 Ruby 尝试通过 OpenSSL 连接 imap.gmail.com
时发生错误,在以下代码行中:
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)
当我尝试从 OpenSSL 命令行连接上述主机时,它连接成功.
When I try to connect the above host from OpenSSL command line, it gets connected successfully.
我了解 Ruby 没有找到一些证书,并且我看到了各种解决方案建议,但不幸的是我仍然无法弄清楚如何解决这个问题(我不使用 rvm).
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).
我尝试通过设置 OpenSSL::SSL::VERIFY_PEER = OpenSSL::SSL::VERIFY_NONE
来禁用验证,但出现动态常量分配"错误.
I tried to disable the verification by setting OpenSSL::SSL::VERIFY_PEER = OpenSSL::SSL::VERIFY_NONE
, but got "dynamic constant assignment" error.
我的环境:
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
推荐答案
只需安装根证书即可解决问题:
The issue has been solved by simply installing root certificates:
apt-get install openssl ca-certificates
这篇关于“SSL_connect 返回=1 errno=0 state=SSLv3 读取服务器证书B:证书验证失败"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!