"uninitialized constant OpenSSL::PKey::EC" from Ruby on CentOS 6.6 -


i have rails server application uses openid_connect gem. when attempt run on centos 6.6, get:

uninitialized constant openssl::pkey::ec 

here full stacktrace:

$ rails server /home/foo/.rvm/gems/ruby-2.1.3/gems/json-jwt-1.5.1/lib/json/jwk/jwkizable.rb:69:in `<top (required)>': uninitialized constant openssl::pkey::ec (nameerror)     /home/foo/.rvm/gems/ruby-2.1.3/gems/json-jwt-1.5.1/lib/json/jwt.rb:102:in `<top (required)>'     /home/foo/.rvm/gems/ruby-2.1.3/gems/openid_connect-0.9.2/lib/openid_connect/response_object/id_token.rb:1:in `<top (required)>'     /home/foo/.rvm/gems/ruby-2.1.3/gems/openid_connect-0.9.2/lib/openid_connect/response_object.rb:7:in `block in <top (required)>'     /home/foo/.rvm/gems/ruby-2.1.3/gems/openid_connect-0.9.2/lib/openid_connect/response_object.rb:6:in `each'     /home/foo/.rvm/gems/ruby-2.1.3/gems/openid_connect-0.9.2/lib/openid_connect/response_object.rb:6:in `<top (required)>'     /home/foo/.rvm/gems/ruby-2.1.3/gems/openid_connect-0.9.2/lib/openid_connect/connect_object.rb:52:in `<top (required)>'     /home/foo/.rvm/gems/ruby-2.1.3/gems/openid_connect-0.9.2/lib/openid_connect.rb:85:in `<top (required)>'     /home/foo/.rvm/gems/ruby-2.1.3/gems/bundler-1.10.6/lib/bundler/runtime.rb:76:in `require'     /home/foo/.rvm/gems/ruby-2.1.3/gems/bundler-1.10.6/lib/bundler/runtime.rb:76:in `block (2 levels) in require'     /home/foo/.rvm/gems/ruby-2.1.3/gems/bundler-1.10.6/lib/bundler/runtime.rb:72:in `each'     /home/foo/.rvm/gems/ruby-2.1.3/gems/bundler-1.10.6/lib/bundler/runtime.rb:72:in `block in require'     /home/foo/.rvm/gems/ruby-2.1.3/gems/bundler-1.10.6/lib/bundler/runtime.rb:61:in `each'     /home/foo/.rvm/gems/ruby-2.1.3/gems/bundler-1.10.6/lib/bundler/runtime.rb:61:in `require'     /home/foo/.rvm/gems/ruby-2.1.3/gems/bundler-1.10.6/lib/bundler.rb:134:in `require'     /home/foo/tmp/openid_connect_sample/config/application.rb:7:in `<top (required)>'     /home/foo/.rvm/gems/ruby-2.1.3/gems/railties-3.2.22/lib/rails/commands.rb:53:in `require'     /home/foo/.rvm/gems/ruby-2.1.3/gems/railties-3.2.22/lib/rails/commands.rb:53:in `block in <top (required)>'     /home/foo/.rvm/gems/ruby-2.1.3/gems/railties-3.2.22/lib/rails/commands.rb:50:in `tap'     /home/foo/.rvm/gems/ruby-2.1.3/gems/railties-3.2.22/lib/rails/commands.rb:50:in `<top (required)>'     script/rails:6:in `require'     script/rails:6:in `<main>' 

what mean , how can past it?

this problem stems red hat's refusal include (for fear-of-patent-litigation reasons) elliptic curve (ec) algorithms in centos' default build of openssl.

note: according @cal's answer, centos 6.7 not have issue.

the openid_connect gem dependent on json-jwt gem, uses 1 of not-included algorithms.

therefore, need rebuild new version of openssl includes needed algorithms.

these steps followed (adapted here) build new openssl on machine:

  1. cd /usr/src
  2. wget https://www.openssl.org/source/openssl-1.0.1l.tar.gz
  3. yum install autoconf automake (you have these installed)
  4. tar zxvf openssl-1.0.1l.tar.gz
  5. cd openssl-1.0.1l
  6. export cflags="-fpic"
  7. ./config --prefix=/opt/openssl shared enable-ec enable-ecdh enable-ecdsa
  8. make all
  9. make install

now, ruby still linked against old openssl library, you'll need rebuild link new one.

are using rvm? great! new rubies install build against new openssl. rvm remove ruby , re-install (or install different ruby version).

not using rvm? guess you'll need rebuild ruby traditional way. know how that, right? if not, you'll need in different tutorial, because can't cover here.

now reinstall bunder , bundle install, , rails server should run successfully.

(if has corrections or clarifications offer, please leave comment , i'll make edits necessary.)


Comments