本文介绍了使用 rbenv 和 ruby​​-build 构建 ruby​​ 失败并显示未定义符号:SSLv2_method的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在具有 ARMv7 处理器的 Synology DS215j 上安装 ruby​​ 2.2.4 或 2.3.0.我使用 optware-ng 来安装 gcc、make、openssl、openssl-dev 和 zlib.我根据 README.

I'm trying to install ruby 2.2.4 or 2.3.0 on my Synology DS215j which has an ARMv7 processor. I used optware-ng to install gcc, make, openssl, openssl-dev and zlib. I installed rbenv (version 1.0.0-19-g29b4da7) and the ruby-build plugin according to the instructions in the README.

这些是使用 optware-ng 安装的软件包及其版本

These are the package and their versions installed with optware-ng

binutils - 2.25.1-1
gcc - 5.3.0-6
gconv-modules - 2.21-3
glibc-opt - 2.21-4
libc-dev - 2.21-1
libgmp - 6.0.0a-1
libmpc - 1.0.2-1
libmpfr - 3.1.3-1
libnsl - 2.21-3
libstdc++ - 6.0.21-6
make - 4.1-1
ncurses - 5.7-4
openssl - 1.0.2f-1
openssl-dev - 1.0.2f-1
readline - 6.1-2
ruby - 2.2.0-1
screen - 4.2.1-2
termcap - 1.3.1-3
zlib - 1.2.8-2

当我在这两种情况下运行 rbenv install 2.2.4rbenv install 2.3.0 时,构建都会失败并显示错误消息未定义符号:SSLv2_method".这是 2.2.4 版本的错误:

When I run rbenv install 2.2.4 or rbenv install 2.3.0 in both cases the build fails with the error message "undefined symbol: SSLv2_method". This is the error for the 2.2.4 build:

installing bundle gems:       /var/services/homes/florian/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0 (build_info, cache, doc, extensions, gems, specifications)
/tmp/ruby-build.20160329115213.2672/ruby-2.2.4/lib/rubygems/core_ext/kernel_require.rb:54:in `require': /tmp/ruby-build.20160329115213.2672/ruby-2.2.4/.ext/armv7l-linux-eabihf/openssl.so: undefined symbol: SSLv2_method - /tmp/ruby-build.20160329115213.2672/ruby-2.2.4/.ext/armv7l-linux-eabihf/openssl.so (LoadError)
    from /tmp/ruby-build.20160329115213.2672/ruby-2.2.4/lib/rubygems/core_ext/kernel_require.rb:54:in `require'
    from /tmp/ruby-build.20160329115213.2672/ruby-2.2.4/.ext/common/openssl.rb:17:in `<top (required)>'
    from /tmp/ruby-build.20160329115213.2672/ruby-2.2.4/lib/rubygems/core_ext/kernel_require.rb:54:in `require'
    from /tmp/ruby-build.20160329115213.2672/ruby-2.2.4/lib/rubygems/core_ext/kernel_require.rb:54:in `require'
    from /tmp/ruby-build.20160329115213.2672/ruby-2.2.4/lib/rubygems/security.rb:11:in `<top (required)>'
    from /tmp/ruby-build.20160329115213.2672/ruby-2.2.4/lib/rubygems/core_ext/kernel_require.rb:54:in `require'
    from /tmp/ruby-build.20160329115213.2672/ruby-2.2.4/lib/rubygems/core_ext/kernel_require.rb:54:in `require'
    from /tmp/ruby-build.20160329115213.2672/ruby-2.2.4/lib/rubygems/package.rb:43:in `<top (required)>'
    from /tmp/ruby-build.20160329115213.2672/ruby-2.2.4/lib/rubygems/core_ext/kernel_require.rb:54:in `require'
    from /tmp/ruby-build.20160329115213.2672/ruby-2.2.4/lib/rubygems/core_ext/kernel_require.rb:54:in `require'
    from /tmp/ruby-build.20160329115213.2672/ruby-2.2.4/lib/rubygems/dependency_installer.rb:3:in `<top (required)>'
    from /tmp/ruby-build.20160329115213.2672/ruby-2.2.4/lib/rubygems/core_ext/kernel_require.rb:54:in `require'
    from /tmp/ruby-build.20160329115213.2672/ruby-2.2.4/lib/rubygems/core_ext/kernel_require.rb:54:in `require'
    from /tmp/ruby-build.20160329115213.2672/ruby-2.2.4/lib/rubygems.rb:556:in `install'
    from ./tool/rbinstall.rb:722:in `block (2 levels) in <main>'
    from ./tool/rbinstall.rb:721:in `each'
    from ./tool/rbinstall.rb:721:in `block in <main>'
    from ./tool/rbinstall.rb:757:in `call'
    from ./tool/rbinstall.rb:757:in `block in <main>'
    from ./tool/rbinstall.rb:754:in `each'
    from ./tool/rbinstall.rb:754:in `<main>'
uncommon.mk:246: recipe for target 'do-install-all' failed
make: *** [do-install-all] Error 1

这似乎与 ruby​​gems 中的某些内容有关.

This seems to be related to something in rubygems.

有趣的是,我尝试自己构建 ruby​​ 的原因是,当我尝试安装 gems 时,Synology 6 附带的 ruby​​ 版本返回了类似的错误:

Interestingly, the reason why I try to build ruby myself is, that the ruby version delivered with Synology 6 returns a similar error when I try to install gems:

florian@synology:~/.rbenv/plugins$ /usr/bin/gem install rails
ERROR:  Loading command: install (LoadError)
        /usr/lib/ruby/2.3.0/armle-linux-gnu/openssl.so: undefined symbol: SSLv2_method - /usr/lib/ruby/2.3.0/armle-linux-gnu/openssl.so
ERROR:  While executing gem ... (NoMethodError)
    undefined method `invoke_with_build_args' for nil:NilClass

什么可能导致这些问题,我该如何解决?

What could cause these issues and how could I resolve them?

推荐答案

什么可能导致这些问题......

What could cause these issues ...

由于 CVE-2016-0800(DROWN 攻击).

我认为完全删除有点苛刻,因为您正在经历这种影响.应该有一个警告和过渡期.它应该发生在 10 年前左右.

I think the complete removal was a bit harsh because of the effects like you are experiencing. There should have been a warning and transition period. And it should have occurred 10 years ago or so.

我认为 SSLv2_methodSSLv2_client_methodSSLv2_server_method 应该设置适当的错误代码,例如 ,而不是由于 DROWN 而完全删除ERR_R_REMOVED_INSECURE 并返回 NULL. 也应该无条件地设置 OPENSSL_NO_SSL2.

Instead of complete removal due to DROWN, I think SSLv2_method, SSLv2_client_method and SSLv2_server_method should have set an appropriate error code like ERR_R_REMOVED_INSECURE and returned NULL. <openssl/opensslconf.h> should have unconditionally set OPENSSL_NO_SSL2 also.

OpenSSL 意识到他们破坏了 ABI 兼容性,并使用 1.0.2 提交了 1.0.2一>.签入再次提供符号SSLv2_methodSSLv2_client_methodSSLv2_server_method,但它们返回NULL 而不设置错误代码.它们也没有定义 OPENSSL_NO_SSL2.另请参阅 [openssl.org #4398] BUG/1.0.2g 中断卷曲扩展.

OpenSSL realized they broke ABI compatibility and added the symbols back to 1.0.2 with Commit 133138569f37d149. The check-in provided the symbols SSLv2_method, SSLv2_client_method and SSLv2_server_method again, but they return NULL without setting an error code. They also do not define OPENSSL_NO_SSL2. Also see [openssl.org #4398] BUG / 1.0.2g breaks CURL extension.

SSLv2 已经不安全了 15 或 20 年.像 Ruby 这样的包不应该引用这些符号.您应该针对 Ruby 提交安全错误报告以引用符号.

SSLv2 has been insecure for 15 or 20 years. Packages like Ruby should not have been referencing the symbols. You should file a security bug report against Ruby for referencing the symbol.

...我该如何解决它们?

要解决此问题,我相信您需要 (1) 等待 OpenSSL 1.0.2h,(2),手动修补 OpenSSL 1.0.2g,或 (3) 删除对 SSLv2_methodSSLv2_client_methodSSLv2_server_method.

To fix the issue, I believe you need either (1) wait for OpenSSL 1.0.2h, (2), manually patch OpenSSL 1.0.2g, or (3) remove all Ruby references to SSLv2_method, SSLv2_client_method and SSLv2_server_method.

这是您需要的补丁(2),手动补丁 OpenSSL 1.0.2g:

Here's the patch you need for (2), manually patch OpenSSL 1.0.2g:

diff --git a/ssl/s2_meth.c b/ssl/s2_meth.c
index b312f17..d46e2f5 100644
--- a/ssl/s2_meth.c
+++ b/ssl/s2_meth.c
@@ -74,8 +74,8 @@ IMPLEMENT_ssl2_meth_func(SSLv2_method,
                          ssl2_accept, ssl2_connect, ssl2_get_method)
 #else                           /* !OPENSSL_NO_SSL2 */

-# if PEDANTIC
-static void *dummy = &dummy;
-# endif
+SSL_METHOD *SSLv2_method(void) { return NULL; }
+SSL_METHOD *SSLv2_client_method(void) { return NULL; }
+SSL_METHOD *SSLv2_server_method(void) { return NULL; }

 #endif

您还应该使用至少 no-ssl2 no-ssl3 no-comp 标志配置和编译 OpenSSL,因为它们是已知的安全问题.配置选项在 中定义了 OPENSSL_NO_SSL2OPENSSL_NO_SSL3OPENSSL_NO_COMP.

You should also configure and compile OpenSSL with at least no-ssl2 no-ssl3 no-comp flags because they are known security problems. The configure options define OPENSSL_NO_SSL2, OPENSSL_NO_SSL3 and OPENSSL_NO_COMP in <openssl/opensslconf.h>.

这篇关于使用 rbenv 和 ruby​​-build 构建 ruby​​ 失败并显示未定义符号:SSLv2_method的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-23 20:30