Ruby using the wrong version of openssl

$ brew install openssl Warning: openssl-1.0.2a-1 already installed $ openssl version OpenSSL 0.9.8zd 8 Jan 2015 $ ruby -ropenssl -e 'puts OpenSSL::OPENSSL_VERSION' OpenSSL 1.0.1j 15 Oct 2014 $ rvm -v rvm 1.26.11 (latest) by Wayne E. Seguin < wayneeseguin@gmail.com >, Michal Papis < mpapis@gmail.com > [https://rvm.io/] 

I see a lot of inconsistencies between openssl versions. Homebrew thinks this is at 1.0.2a-1 , openssl himself thinks about it at 0.9.8zd , and Ruby thinks about it at 1.0.1j . I don’t even know if any of them are really updated!

How can I resolve this inconsistency and force Ruby to use the correct version of OpenSSL? The fact that it uses the wrong version prevents me from using secure APIs.

+6
source share
1 answer

Installing OpenSSL with HomeBrew will not immediately bind it as OpenSSL by default.

First, let's see which version you are using (July 10, 15 latest version 1.0.2d ):

 openssl version -a which openssl ruby -r openssl -e 'puts OpenSSL::OPENSSL_VERSION' 

Now, be sure to update OpenSSL to the latest version:

 brew update brew install openssl brew unlink openssl brew link --force openssl 

If you run the initial checks again, you should see the first 2 pointing to the recently installed OpenSSL. Ruby will most likely point to the old one anyway, since it was compiled with it.

If it points to the old version, let me recompile Ruby and point it to the new one. And just to be sure that it will use the correct version, let it pass the OpenSSL prefix - although this is not necessary, since we linked the homebrrew OpenSSL.

 rvm get stable rvm install ruby-2.1.6 --with-openssl-dir=`brew --prefix openssl` 

(or rvm reinstall if you are already using 2.1.6)

That should do it.

+8
source

Source: https://habr.com/ru/post/988805/


All Articles