Open KrzaQ opened 6 years ago
Hi @KrzaQ
I found this: https://mislav.net/2013/07/ruby-openssl/
The author discusses several ways to fix your Problem.
You can either switch SSL certificate verification off (which I would not recommend) or add your Certificate (or CA) Manually:
require 'https'
http = Net::HTTP.new('example.com', 443)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_PEER
http.cert_store = OpenSSL::X509::Store.new
http.cert_store.set_default_paths
http.cert_store.add_file('/path/to/cacert.pem')
# ...or:
cert = OpenSSL::X509::Certificate.new(File.read('mycert.pem'))
http.cert_store.add_cert(cert)
I hope this is still of some help
This seems pretty odd to me. I noticed that my ruby program runs perfectly fine with openssl doing its thing, no certificate problem at all. It also works just fine when ocra runs the program to check for dependencies before actually packaging stuff together. But afterwards, when I start the exe, I get this error about missing certificates:
#<OpenSSL::SSL::SSLError: SSL_connect returned=1 errno=0 state=error: certificate verify failed (unable to get local issuer certificate)>
Is it possible that ocra misses out on packing the certificates into the exe?
For additional info in my case: I am using the tk gem for gui and therefore have to use the following command for the packaging:
C:\ruby26-portable\bin\ruby.exe C:\ruby26-portable\bin\ocra C:\ruby26-portable\MyApp\MyApp.rb --windows --chdir-first --gemfile C:\ruby26-portable\MyApp\Gemfile C:\ruby26-portable\lib\ruby\gems\2.6.0\gems\tk-0.2.0\ --no-autoload --add-all-core
Do I have to add the certificates folder as additional ressource just like with the tk stuff?
Any hint would be greatly appreciated!
Hi guys, having the same problem than you. I've found an easy way to workaround this problem by now.
Gotta use the gem net_http_ssl_fix. Require it in your code before using Net::HTTP. And make sure to update cacert.pem to its last version, specific steps to do that are here.
The method of net_http_ssl_fix has become invalid. The approach I have figured out now is Disabling Certificate Verification. Wishing everyone good luck.
This script, when executed with ruby 2.4.1 and 2.4.2 (from rubyinstaller, on Windows 7 and 10) finishes displaying a
404
(as expected) to the standard output.When compiled with ocra, it also does output
404
:But when executing the generated executable file: