-
-
Notifications
You must be signed in to change notification settings - Fork 925
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SSL Certificates Don't Work From Jar #531
Comments
I can confirm this problem. I get the same error with JRuby 1.7.2 and httpclient 1.3.2 (which tries to load |
I can also confirm this as a problem under JRuby 1.7.2 and Torquebox 2.3.0.
The call to http.request_post generates "OpenSSL::SSL::SSLError":
|
@sgonyea I'm curious what your workaround for the jarfile looks like in code terms, I'm also hitting this issue when using the New Relic gem from within a warbled jar file. :/ |
Read the SSL cert in from a file and then write it out somewhere. So, a tempfile or into a folder, relative to the warbled jar (which is what I am doing). If it's a private SSL key/cert then you can touch the file, set permissions, and then write to it (or something). |
It looks like all-around-nice-guy @jordansissel has created a work around for this, as was documented for JRUBY-6970 which can be found here I'm going to give it a try and see what happens. |
this has been fixed by Kristian's commits (it's in jruby-openssl 0.9.6) ... starting at jruby/jruby-openssl@aa51d9b#diff-67972a6a9364f41a90295ceabf0e9180R298 sponsored by @lookout :) ! |
I'm here to keep the JRuby team mired in SSL blerghs. It appears that something broke when the jruby-openssl gem moved into JRuby. This assertion may be untrue, and I'll verify against 1.7.0.
If you warble a Jar with an SSL certificate, and set the ca_file (also, verify peer) to a file that was bundled along with the Jar... You'll get an error that's something like:
#<OpenSSL::SSL::SSLError: jar:file:/Users/sgonyea/tmp/dp/PP.jar!/my_project/lib/ca-certificates.crt> - ["org/jruby/ext/openssl/SSLContext.java:229:in
setup'", "org/jruby/ext/openssl/SSLSocket.java:145:ininitialize'", "jar:file:/var/folders/bd/qxsdqy3d7_gg31pdjm_00lsr0000gn/T/jruby260755300623026042extract/jruby-stdlib-1.7.2.jar!/META-INF/jruby.home/lib/ruby/1.9/net/http.rb:776 [SNIP]
The code I'm using to make HTTP calls looks like:
Obviously, the above code works if you are not working from a Jar. Warble that code into a jar (or however) and it should fail. Doing a
File.read
on that will return the contents of the file.My interim solution is to simply read in the CA cert and write it out to a tmp directory. It seems that there is no obvious way to turn a Cert file (containing multiple certs) into a Cert Store from a String.
If I do a
http.cert = OpenSSL::X509::Certificate.new(File.read '...')
then the HTTP request times out and fails to connect, it seems. Digging around in the code, it looks like the cert is not used unless a private key is also supplied?The text was updated successfully, but these errors were encountered: