“SSL_connect返回=1 errno=0状态=SSLv3读取服务器证书B:证书验证失败”[复制]

时间:2021-11-24 00:29:05

This question already has an answer here:

这个问题已经有了答案:

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:

我准备通过IMAP从gmail开始调查电子邮件。尝试运行适当的Ruby任务会导致以下错误:

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

SSL_connect返回=1 errno=0状态=SSLv3读取服务器证书B:证书验证失败。

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

当Ruby试图通过OpenSSL连接imap.gmail.com时,出现了错误。

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

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

当我尝试从OpenSSL命令行连接上述主机时,它会成功连接。

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).

我知道Ruby没有找到一些证书,我看到了各种各样的解决方案建议,但不幸的是,我仍然不能解决如何解决这个问题(我不使用rvm)。

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

我试图通过设置OpenSSL来禁用验证::VERIFY_PEER = OpenSSL:: VERIFY_NONE,但是得到了“动态常数赋值”错误。

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 个解决方案

#1


3  

The issue has been solved by simply installing root certificates:

通过简单地安装根证书来解决这个问题:

apt-get install openssl ca-certificates

#1


3  

The issue has been solved by simply installing root certificates:

通过简单地安装根证书来解决这个问题:

apt-get install openssl ca-certificates