“SSL_connect returned = 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任务会导致以下错误:
SSL_connect返回= 1 errno = 0状态= SSLv3读取服务器证书B:证书验证失败
当Ruby尝试连接 imap.gmail.com
通过OpenSSL,在以下代码行:
imap = Net :: IMAP.new(host,port,ssl)
当我尝试从OpenSSL命令行连接上述主机时, >
我知道Ruby没有找到一些证书,我看到了各种解决方案建议,但不幸的是我仍然无法弄清楚如何解决这个问题(我不使用rvm )。
我试图通过设置 OpenSSL :: SSL :: VERIFY_PEER = OpenSSL :: SSL :: VERIFY_NONE
,但得到动态常量赋值错误。
我的环境:
code> 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修订40747)[x86_64-linux]
root @ debianvm:〜#rails --version
Rails 3.2.13
pre>
解决方案这个问题已经通过安装根证书解决了:
apt-get install openssl ca-certificates
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
解决方案The issue has been solved by simply installing root certificates:
apt-get install openssl ca-certificates
这篇关于“SSL_connect returned = 1 errno = 0 state = SSLv3读取服务器证书B:证书验证失败”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!