Skip to content

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Download a cacert.pem for RailsInstaller

Why?

There is a long standing issue in Ruby where the net/http library by default does not check the validity of an SSL certificate during a TLS handshake. Rather than deal with the underlying problem (a missing certificate authority, a self-signed certificate, etc.) one tends to see bad hacks everywhere. This can lead to problems down the road.

From what I can see the OpenSSL library that Rails Installer delivers has no certificate authorities defined. So, let's go fetch some from the curl website. And since this is for ruby, why don't we download and install the file with a ruby script?

Installation

The Ruby Way! (Fun)

This assumes your have already installed the Rails Installer for Windows.

Download the ruby script to your Desktop folder from https://gist.github.com/raw/867550/win_fetch_cacerts.rb. Then in your command prompt, execute the ruby script:

ruby "%USERPROFILE%\Desktop\win_fetch_cacerts.rb"

Now make ruby aware of your certificate authority bundle by setting SSL_CERT_FILE. To set this in your current command prompt session, type:

set SSL_CERT_FILE=C:\RailsInstaller\cacert.pem

To make this a permanent setting, add this in your control panel.

The Manual Way (Boring)

Download the cacert.pem file from http://curl.haxx.se/ca/cacert.pem. Save this file to C:\RailsInstaller\cacert.pem.

Now make ruby aware of your certificate authority bundle by setting SSL_CERT_FILE. To set this in your current command prompt session, type:

set SSL_CERT_FILE=C:\RailsInstaller\cacert.pem

To make this a permanent setting, add this in your control panel.

require 'net/http'
# create a path to the file "C:\RailsInstaller\cacert.pem"
cacert_file = File.join(%w{c: RailsInstaller cacert.pem})
Net::HTTP.start("curl.haxx.se") do |http|
resp = http.get("/ca/cacert.pem")
if resp.code == "200"
open(cacert_file, "wb") { |file| file.write(resp.body) }
puts "\n\nA bundle of certificate authorities has been installed to"
puts "C:\\RailsInstaller\\cacert.pem\n"
puts "* Please set SSL_CERT_FILE in your current command prompt session with:"
puts " set SSL_CERT_FILE=C:\\RailsInstaller\\cacert.pem"
puts "* To make this a permanent setting, add it to Environment Variables"
puts " under Control Panel -> Advanced -> Environment Variables"
else
abort "\n\n>>>> A cacert.pem bundle could not be downloaded."
end
end
@jpillora

Thank you :D

@maflores

Excellent!!!! Thanks a lot! :)

@Odelya

Excellent!
If you are using JRuby - just locate the file in lib\ruby\somedirectory under the jruby folder and assign the system environment variable

@Easter1021

awesome !!

@mxrguspxrt

Using is more convient, imho:

config/initializers/ssl_configuration.rb

ENV["SSL_CERT_FILE"] = "/usr/local/rvm/usr/ssl/certs/cacerts"

@zdavatz

How do I specify a path with a space on Windows? I would like to do

cacert_file = File.join(%w{c: Users "User Name" cacert.pem})

Where "User Name" is something like Zeno Davatz.

How would that work?

Best
Zeno

@ByScripts

cacert_file = File.join(%w{c: Users Zeno\ Davatz cacert.pem})

@bryanwongbh

thank you so much!

@mandlaanilbabu

I am getting this error like this using Ruby On Rails
Error:SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed,

I am following manual step
Stil i am getting same error,I am using win7 OS
pls help me

@mandlaanilbabu

I am following first step also getting error

C:\Users\RUBY\Desktop>ruby win_fetch_cacerts.rb
win_fetch_cacerts.rb:2: syntax error, unexpected '<'
<!-- saved from url=(0063)http...
^
win_fetch_cacerts.rb:2: syntax error, unexpected tIDENTIFIER, expecting keyword_
do or '{' or '('
<!-- saved from url=(0063)https://gist.githu...
^
win_fetch_cacerts.rb:2: syntax error, unexpected tIDENTIFIER, expecting $end
...<!-- saved from url=(0063)https://gist.github.com/fnichol/86...
... ^

@allybee

Thank you! It worked after I added it in control panel.

@L2G

This is really useful info. If it wasn't for your gist, I wouldn't have ever known about the SSL_CERT_FILE variable. I've been tearing my hair out trying to get Bundler to talk to https://rubygems.org/; now, finally, it works!

@jesalg

This is great, thank you!

@sschwartzman

Thank you so much for posting this! This error was driving me nuts. If anyone's interested, in order to make the fix self-contained to the Ruby script, I did this:

  1. Download cacerts.pem to same directory as ruby script (or the /config" sub-dir in my case)
  2. Add the following to your script:
    # Fixes SSL Connection Error in Windows execution of Ruby
    # Based on fix described at: https://gist.github.com/fnichol/867550
    ENV['SSL_CERT_FILE'] = File.expand_path(File.dirname(__FILE__)) + "/config/cacert.pem"

This may be worthwhile if you're distributing the script and don't want to make users have to set the environment variable.

@sjaykr

I tried the above fix but I still get this error

C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/bundler-1.3.5/lib/bundler/v
endor/net/http/persistent/ssl_reuse.rb:70:in `connect': An established connectio
n was aborted by the software in your host machine. - SSL_connect (Errno::ECONNA
BORTED)

@harshadsabne

Thanks a lot, works like a charm ! :D

For the uninitiated : It works without Rails Installer also. Just copy cacert.pem to any folder of your choice and set the environment variable path accordingly.

@annalifatou

I still get this error...
WARNING: Error fetching data: SSL_connect returned=1 errno=0 state=SSLv3 read s
erver certificate B: certificate verify failed (https://rubygems.org/latest_spec
s.4.8.gz)
Updating rubygems-update
ERROR: While executing gem ... (TypeError)
can't modify frozen object

@DudeKumar

Thanks...This was really useful !!

@OldGrantonian

I'm new to anything related to Ruby. I'm using WinXP Pro.

I notice that all google posts on any site seem to relate to rails. Therefore all the suggested solutions relate to rails.

I don't use rails. I want to use Watir and Watir-WebDriver for testing web applications.

So, my question is: how do I solve the SSL problem for the command:

gem install mini_magick -v 3.5 --no-document
ERROR: Could not find a valid gem 'mini_magick' (= 3.5), here is why:
Unable to download data from https://rubygems.org/ - SSL_connect retur
ned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed (
https://s3.amazonaws.com/production.s3.rubygems.org/specs.4.8.gz)

BTW: mini_magick is part of DevKit, which is needed before installing Watir.

@AugustoPedraza

Thanks!!! This work for me to install the net-sftp gem on my Windows!!!

@kirkytullins

Thank you ! that saved me a lot of trouble !

@Gabri3l

Wow, thanks! That was really easy to solve!

@trn-malyy

Thank you for this post ! Fixed my ssl cert. error.

@jishaq

@sschwartzman - I like your idea of adding the cacerts.pem to the config, and then using it to set ENV['SSL_CERT_FILE']. I tried this in my Ruby command-line application, but it wasn't working - I was still getting the same error.

The problem is that when I build my gem, the "executable" that RubyGems generates has bootstrap code where it attempts to load my gem (which causes the OpenSSL error) before I ever have a chance to affect the ENV[] statement. Here is the generated bootstrap code:

C:\RailsInstaller\Ruby1.9.3\bin>type my_gem
#!C:/RailsInstaller/Ruby1.9.3/bin/ruby.exe
#
# This file was generated by RubyGems.
#
# The application 'my_gem' is installed as part of a gem, and
# this file is here to facilitate running it.
#

require 'rubygems'

version = ">= 0"

if ARGV.first
  str = ARGV.first
  str = str.dup.force_encoding("BINARY") if str.respond_to? :force_encoding
  if str =~ /\A_(.*)_\z/
    version = $1
    ARGV.shift
  end
end

gem 'my_gem', version
load Gem.bin_path('my_gem', 'my_gem', version)

C:\RailsInstaller\Ruby1.9.3\bin>

And here is the error; you can see ruby running through the bootstrap code above, getting to the "load" line, and processing a 'require' statement in one of my dependencies (mixpanel_client), which eventually barfs.

C:\Sites>my_gem
C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/net/http.rb:799:in `connect': SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verif
y failed (OpenSSL::SSL::SSLError)
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/net/http.rb:799:in `block in connect'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/timeout.rb:54:in `timeout'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/timeout.rb:99:in `timeout'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/net/http.rb:799:in `connect'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/net/http.rb:755:in `do_start'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/net/http.rb:744:in `start'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/open-uri.rb:306:in `open_http'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/open-uri.rb:775:in `buffer_open'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/open-uri.rb:203:in `block in open_loop'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/open-uri.rb:201:in `catch'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/open-uri.rb:201:in `open_loop'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/open-uri.rb:146:in `open_uri'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/open-uri.rb:677:in `open'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/open-uri.rb:685:in `read'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/mixpanel_client-3.1.2/lib/mixpanel/uri.rb:22:in `get'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/mixpanel_client-3.1.2/lib/mixpanel/client.rb:55:in `request'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/my_gem-0.0.6/lib/my_gem/mixpanel_services.rb:233:in `getVersions'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/my_gem-0.0.6/lib/my_gem/mixpanel_services.rb:287:in `<module:MixpanelSer
vices>'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/my_gem-0.0.6/lib/my_gem/mixpanel_services.rb:12:in `<top (required)>'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/my_gem-0.0.6/lib/my_gem/runner.rb:13:in `require_relative'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/my_gem-0.0.6/lib/my_gem/runner.rb:13:in `<top (required)>'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/my_gem-0.0.6/bin/my_gem:11:in `<top (required)>'
        from C:/RailsInstaller/Ruby1.9.3/bin/my_gem:23:in `load'
        from C:/RailsInstaller/Ruby1.9.3/bin/my_gem:23:in `<main>'

C:\Sites>

I wonder, is there any way to tell RubyGems to put the ENV[] in its generated output. Probably not easily (I suppose I could hand-edit the file it generates, but this is not scalable).

Thanks for the suggestion!

@StevenShi

THANK YOU!

@chrislachance

Thanks, this worked well!

@prakmishra

Thank you. It worked pretty well.

@nedrosat

Thank you for this amazing Work.

Cheers

@franz-josef-kaiser

Same error as @mandlaanilbabu here.

@anmolonruby

The Ruby way works for me. But how do I make it permanent? What should I paste in the environment variables?

@earnestaddae

I followed your instruction, but it didn't work. Any alternative?

@punithasai

I tried the first command that gave me an error.
Why am i not able to run win_fetch_cacerts.rb ruby file thats there in my desktop?

C:\Users\punitha\aggregator>ruby "%USERPROFILE%\Desktop\win_fetch_cacerts.rb"
ruby: No such file or directory -- C:/Users/punitha/Desktop/win_fetch_cacerts.rb
(LoadError)

@loki4u

thanks it works happily :-)

@palytoxin

Thanks a lot, it's work for me :)

@Arduinology

Awesome, worked like a charm!

@jules345

just don't use "net/http" (if possible), use the "httpi" gem because this does the right thing by default !

@seanpoulter

Thanks!

It may be worth noting that this does more than just "grab some certificates" from the Curl project, when they are actually sourced from Mozilla and converted to the required format with Curl's lib\mk-ca-bundle.pl script.

@thomthom

We are seeing this in SketchUp 2014 which uses embedded Ruby 2.0. I found that by setting ENV["SSL_CERT_FILE"] to point to the cert file here will make HTTP with SSL work. But since a SketchUp user has many extensions installed there is no guaranty that one extension has not required the net/http lib without doing this - then it break for everyone else.

Can you shed some more light to where this cert file comes from? And is there a way Ruby can be rebuilt to use it? We're trying to figure out if we can fix this out of the box for SketchUp.

@cocolote

Nice bro! everything working here!

@salqadri

Did not work for me. First of all, it gave an error due to the directory RailsInstaller not existing. So I manually created it, but after doing it I still got the SSL error. I even added the env var to the control panel. Didn't help.

@d1castrob

First of all thank you! this has worked wonders for me. However, yesterday the auth on my app stopped working (I get 401:Unauthorized). I also noticed that if I don't run the script, I used to get the Faraday Error but I now get the 401. The oauth settings on my app (key, secret, url, etc.) remain unchanged from the last time I used them. Any idea why this might be happening?

@philiplorenzo

Thank you!

@ryanafleming

D:\My Documents\Ruby>ruby "%USERPROFILE%\Desktop\win_fetch_cacerts.rb"
C:/Users/Owner/Desktop/win_fetch_cacerts.rb:9:in initialize': No such file or d
irectory @ rb_sysopen - c:/RailsInstaller/cacert.pem (Errno::ENOENT)
from C:/Users/Owner/Desktop/win_fetch_cacerts.rb:9:in
open'
from C:/Users/Owner/Desktop/win_fetch_cacerts.rb:9:in block in <main>'
from C:/Ruby21-x64/lib/ruby/2.1.0/net/http.rb:853:in
start'
from C:/Ruby21-x64/lib/ruby/2.1.0/net/http.rb:583:in start'
from C:/Users/Owner/Desktop/win_fetch_cacerts.rb:6:in

'

This was fixed by changing the rubyinstaller drectory in the the win_fetch_cacerts.rb file:
From:
cacert_file = File.join(%w{c: RubyInstaller cacert.pem})
to:
cacert_file = File.join(%w{c: Ruby21-x64 cacert.pem})
...or whatever your ruby install dir was...

@Victorgf87

Sadly this didn't work for me =(
Still getting the same error

@DavidJFelix

FYI, you don't have to open the control panel to make the change permanent, just use setx instead of set

@jspearlman

Thanks, very helpful.

@vchervanev

works fine since I fixed my "installation" folder, thank you!

@FlatspinZA

Did I say thanks, thanks!

@vchervanev

btw, I think the up-to-date explanation for another but similar problem is https://gist.github.com/luislavena/f064211759ee0f806c88

@tasos-ch

Works great!

Thanks a lot.

Just for reference, my installation details:

  • Windows 7 Pro x64
  • Ruby 2.1.5p273
@heartonbit

Works like a charm. Thx!

@germanmunoz

Still working. Thanks!

@chrisgray79

Thank you! After so many options of solutions, this was my "last ditch effort" before moving on to a non-ruby solution.

@ssebastianj

Nice solution!! Thanks!! :smile:

@mehulcrest

Thank you :blush:

@romdarom

worked like a charm for me thank you

@stenit

Amazing! Cheers! May be you can edit your documentation "The Ruby fun way", because I needed to create manually a folder named "C:\RailsInstaller\". Otherwise I got:

/win_fetch_cacerts.rb:9:in `initialize': No such file or directory @ rb_sysopen - c:/RailsInstaller/cacert.pem (Errno::ENOENT)

@ermaneng

works great

@vbsql7

Thank you very much for this. The Ruby (fun) way gave me trouble, but I got through it with the Manual (boring) way. Thanks for being so thorough!

@thany
C:\Users\Me>ruby "%USERPROFILE%\Desktop\win_fetch_cacerts.rb"
C:/Users/Me/Desktop/win_fetch_cacerts.rb:9:in `initialize': No such file or directory @ rb_sysopen - c:/RailsInstaller/cacert.pem
(Errno::ENOENT)
        from C:/Users/Me/Desktop/win_fetch_cacerts.rb:9:in `open'
        from C:/Users/Me/Desktop/win_fetch_cacerts.rb:9:in `block in <main>'
        from C:/Ruby21-x64/lib/ruby/2.1.0/net/http.rb:853:in `start'
        from C:/Ruby21-x64/lib/ruby/2.1.0/net/http.rb:583:in `start'
        from C:/Users/Me/Desktop/win_fetch_cacerts.rb:6:in `<main>'

I don't have a C:\Railsinstaller folder. I don't have or need or use or want Rails. I think. Just ruby really.

@saninb

Great !

@viratcrest

Thanks...Works for me

@rahulmr

Great!! Thanks a lot! I just downloaded the cacert.pem file in user directory C:\Users\username\cacert.pem and set the variable SSL_CERT_FILE using set SSL_CERT_FILE=C:\Users\username\cacert.pem and everything started working as expected.

@alonzothompson

Man you are the greatest ....coming from an inspired noob developer

@manters2000

Thank you for this instruction mate, worked like a charm! :smile:

@jameskraus

Much appreciated!

@OysteinAmundsen

Thank you. Couldn't get the "Ruby way" to work, but the "Manual way" works like a charm.

@anicething

thanks man, you saved my ass.

@nithinkumar

not able to download cacert.pem

@danieldogeanu

Oh bloody hell! I can't get it to work at all. I fixed the SSL error and now I get this:

DL is deprecated, please use Fiddle
C:/Programs/Ruby/lib/ruby/gems/2.1.0/gems/shopify_theme-0.0.21/lib/shopify_theme.rb:57:in `asset_list': undefined method `collect' for nil:NilClass (NoMethodError)
        from C:/Programs/Ruby/lib/ruby/gems/2.1.0/gems/shopify_theme-0.0.21/lib/shopify_theme/cli.rb:78:in `download'
        from C:/Programs/Ruby/lib/ruby/gems/2.1.0/gems/thor-0.19.1/lib/thor/command.rb:27:in `run'
        from C:/Programs/Ruby/lib/ruby/gems/2.1.0/gems/thor-0.19.1/lib/thor/invocation.rb:126:in `invoke_command'
        from C:/Programs/Ruby/lib/ruby/gems/2.1.0/gems/thor-0.19.1/lib/thor.rb:359:in `dispatch'
        from C:/Programs/Ruby/lib/ruby/gems/2.1.0/gems/thor-0.19.1/lib/thor/base.rb:440:in `start'
        from C:/Programs/Ruby/lib/ruby/gems/2.1.0/gems/shopify_theme-0.0.21/bin/theme:24:in `<top (required)>'
        from C:/Programs/Ruby/bin/theme:23:in `load'
        from C:/Programs/Ruby/bin/theme:23:in `<main>'

How do I fix this? Please help!

@danielpsf

Thank you! I did the manually steps and it is working perfectly now.

@theassyrian

Thank you so much Fletcher
I used your cert file and modified my env on windows and it works with the newest ruby !

C:\software\ruby\bin>cat setrbvars.bat
@ECHO OFF
REM Determine where is RUBY_BIN (where this script is)
PUSHD %~dp0.
SET RUBY_BIN=%CD%
POPD
REM Add RUBY_BIN to the PATH
REM RUBY_BIN takes higher priority to avoid other tools
REM conflict with our own (mainly the DevKit)
SET PATH=%RUBY_BIN%;%PATH%
SET RUBY_BIN=
set SSL_CERT_FILE=C:\users\root\cacert.pem
REM Display Ruby version

ruby.exe -v
C:\software\ruby\bin>ruby -v
ruby 2.1.5p273 (2014-11-13 revision 48405) [x64-mingw32]

@kyusufm

this really help. thanks you so much Fletcher..

@s4sanjoy

Excellent!!!! Thanks a lot ! :)

@kmne68

And there was much rejoicing!

@sunil-sarjug

Awesome ! Thank you for explaining the problem, and methodically resolving the issue.

@zerubb

Thank you. It is very helpful!!! :smiley:

@sagar1099

that's what i was looking for 2 days. Awesome . Worked like charm. Thank you very much. :smile: :relaxed:

@Chuchoo

I am getting the following error message even after installing and setting
set SSL_CERT_FILE=C:\RailsInstaller\cacert.pem

Error message:

C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/net-http-persistent-2.9.4/lib/net/http/persistent/ssl_reuse.rb:70:in
SSLv3 read server certificate B: certificate verify failed (OpenSSL::SSL::SSLError)
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/net-http-persistent-2.9.4/lib/net/http/persistent/ssl_reu
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/timeout.rb:55:in
timeout'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/timeout.rb:100:in timeout'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/net-http-persistent-2.9.4/lib/net/http/persistent/ssl_reu
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/net/http.rb:756:in
do_start'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/net/http.rb:751:in start'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/net-http-persistent-2.9.4/lib/net/http/persistent.rb:700:
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/net-http-persistent-2.9.4/lib/net/http/persistent.rb:631:
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/net-http-persistent-2.9.4/lib/net/http/persistent.rb:994:
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/mechanize-2.7.3/lib/mechanize/http/agent.rb:259:in
fetch
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/mechanize-2.7.3/lib/mechanize.rb:440:in get'
from first.rb:19:in

'

I am trying to login to flicker.com using mechanize gem in ruby.

@DougBlumeyer

OMG lifesaver. thank you so much.

@dmitryvmin

Worked perfectly, thanks!

@isarmstrong

Dear Gist,

Thank you... again. This never gets old.

@Stoffo

very cool, thank you!

@odytrice

None of this is fun. Is having the list of CA Certs embeded in the ssl gem or source too much to ask? I know it is not your fault and thank you so much for your solution.. But I have been pulling my hair out for an issue that should never have existed in the first place. sigh

@nandox

Thanks a lot! It fixed the problem perfectly. I'm concerned about RailsInstaller not fixing this problem since 2012!

@mizutaki

thank you so much!!

@angeldar

Thank you, it works.

@pitrik

So, this works for me, but I have to do it every session. I've tried adding it to my control panel environment variables, to no avail. Does anyone have any tips for doing this? Maybe I'm doing something wrong.

It's not the end of the world to type it in each time, but it's a small quality of life thing!

@ravuthz

This is great, thank you.

@chapgaga

@allybee why i failed even after i set the environmental variable?

@ramugogurla

Thanks it is working

@ramugogurla

Done in the same way but getting below error....any idea?????

C:/Ruby193/lib/ruby/gems/1.9.1/gems/httpclient-2.6.0.1/lib/httpclient/ssl_config.rb:199:in add_file': PEM lib (OpenSSL::X509::StoreError)
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/httpclient-2.6.0.1/lib/httpclient/ssl_config.rb:199:in
add_trust_ca_to_store'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/httpclient-2.6.0.1/lib/httpclient/ssl_config.rb:190:in add_trust_ca'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/httpi-2.4.1/lib/httpi/adapter/httpclient.rb:62:in
setup_ssl_auth'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/httpi-2.4.1/lib/httpi/adapter/httpclient.rb:44:in setup_client'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/httpi-2.4.1/lib/httpi/adapter/httpclient.rb:25:in
request'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/httpi-2.4.1/lib/httpi.rb:161:in request'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/httpi-2.4.1/lib/httpi.rb:127:in
get'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/wasabi-3.5.0/lib/wasabi/resolver.rb:43:in load_from_remote'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/wasabi-3.5.0/lib/wasabi/resolver.rb:33:in
resolve'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/wasabi-3.5.0/lib/wasabi/document.rb:142:in xml'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/wasabi-3.5.0/lib/wasabi/document.rb:160:in
parse'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/wasabi-3.5.0/lib/wasabi/document.rb:147:in parser'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/wasabi-3.5.0/lib/wasabi/document.rb:64:in
soap_actions'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/savon-2.11.1/lib/savon/operation.rb:22:in ensure_exists!'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/savon-2.11.1/lib/savon/operation.rb:15:in
create'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/savon-2.11.1/lib/savon/client.rb:32:in operation'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/savon-2.11.1/lib/savon/client.rb:36:in
call'
from C:/Users/lrtm432/My Documents/Aptana Studio 3 Workspace/EDRS REQUEST WSDL/SSLFIX.rb:66:in `

'

@Befzz

for Windows with PowerShell installed

Installing Windows PowerShell

Paste this 1line code in command console: (WIN + R, cmd)

powershell -Command "& {$fname='cacert.pem'; $outpath=\"$($(Get-ChildItem Env:USERPROFILE).Value)/$fname\"; Invoke-WebRequest http://curl.haxx.se/ca/$fname -OutFile \"$outpath\"; [Environment]::SetEnvironmentVariable('SSL_CERT_FILE', \"$outpath\", 'User')}"

Script will do:
1. Download http://curl.haxx.se/ca/cacert.pem
2. Save it as %USERPROFILE%/cacert.pem ( C:\Users\__you__\cacert.pem)
3. Set persistent environment variable for current user SSL_CERT_FILE as %USERPROFILE%/cacert.pem

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.