Rails, Windows and HTTPS

My goal is to move from a standard HTTP server to more secure HTTPS.

My setup: Ruby 2.0.0p598, Rails 4.2.0, Thin 1.6.3, Windows 7-Pro-x64-SP1

What I did: Using a self-signed certificate, I try to start the server using

thin start --ssl --ssl-key-file ssl/server.key --ssl-cert-file ssl/server.crt 

What is the problem: I get the following error:

 terminate called after throwing an instance of 'std::runtime_error' what(): Encryption not available on this event-machine This application has requested the Runtime to terminate it in an unusual way. Please contact the application support team for more information. 

My question is for you: Do you know that this is a common problem in Windows (so I can’t even think about how to succeed), or is there a way to give subtle work with ssl on Windows?

+6
source share
1 answer

This is a duplicate: Install OpenSSL with Ruby for eventmachine on Windows 7 x86

I will answer there too:

using rubyinstaller-2.1.6.exe, DevKit-mingw64-32-4.7.2-20130224-1151-sfx.exe and OpenSSL ( http://slproweb.com/download/Win32OpenSSL-1_0_2c.exe or later) in C : \ OpenSSL

 gem install eventmachine -- --with-ssl-dir=C:\OpenSSL 

succeeds, but then doing thin with ssl is not done in the usual way:

 Encryption not available on this event-machine 

You see above how to pass the parameter to the original gem setting, which should help you. We still need to find a set of parameters that will allow us to build the thing correctly.

how to do

 checking for main() in -lssl... no 

a yes ...?

digging afternoon I fixed eventmachine to correctly search for ssl libs on windows, so use the line below in the gemfile until the changes are merged:

 gem 'eventmachine', :github => 'krzcho/eventmachine', :branch => 'master' 

Before installing the package, specify the location of ssl (this should be the full version of ssl with the headers / libraries of the developers)

 bundle config build.eventmachine --with-ssl-dir=c:/OpenSSL 

I also needed to make my own tone, which does not fire another eventmachine, so I need a different line in the gemfile:

 gem 'thin', :github => 'krzcho/thin', :branch => 'master' 

Unfortunately, I still have a problem when using a non-self- signed certificate: the thin server / eventmachine rail on windows does not work with a custom certificate (case closed - wrong cert)

+3
source

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


All Articles