http_access2 and SSL

E

Ed O'Loughlin

Hi,

I'm somewhat new to Ruby. I'm trying to force myself to use Ruby rather
than perl to write a simple script to get a form from a url and post
data using http_access2. It seems simple enough except that the site
uses https and has a self-signed cert.

My code is quite simple:

client = HTTPAccess2::Client.new(proxy)
# etc...
content = client.get_content(login_url)

I get the error in OpenSSL (see below). I had a look at the http_access2
code and it seems to provide for configuring OpenSSL (I want to tell it
not to verify certs) but it's not exposed in the constructor. I'm not
familiar enough with Ruby to decode some of the syntax, so I'm not sure
if there is a way of passing options to ssl.

Any help most appreciated before I fall back on bad habits (i.e., Perl).

Ed O'Loughlin

======
at depth 2 - 19: self signed certificate in certificate chain
d:/ruby-1.8.1/lib/ruby/site_ruby/1.8/http-access2.rb:970:in `connect':
certificate verify failed (OpenSSL::SSL::SSLError)
from d:/ruby-1.8.1/lib/ruby/site_ruby/1.8/http-access2.rb:970:in
`ssl_connect'
from
d:/ruby-1.8.1/lib/ruby/site_ruby/1.8/http-access2.rb:1294:in `connect'
from
d:/ruby-1.8.1/lib/ruby/site_ruby/1.8/http-access2.rb:1282:in `timeout'
from d:/ruby-1.8.1/lib/ruby/1.8/timeout.rb:55:in `timeout'
from
d:/ruby-1.8.1/lib/ruby/site_ruby/1.8/http-access2.rb:1282:in `connect'
from
d:/ruby-1.8.1/lib/ruby/site_ruby/1.8/http-access2.rb:1142:in `query'
from d:/ruby-1.8.1/lib/ruby/site_ruby/1.8/http-access2.rb:864:in
`query'
from d:/ruby-1.8.1/lib/ruby/site_ruby/1.8/http-access2.rb:414:in
`do_get_block'
from d:/ruby-1.8.1/lib/ruby/site_ruby/1.8/http-access2.rb:358:in
`conn_request'
from d:/ruby-1.8.1/lib/ruby/site_ruby/1.8/http-access2.rb:290:in
`request'
from d:/ruby-1.8.1/lib/ruby/site_ruby/1.8/http-access2.rb:265:in
`get'
from d:/ruby-1.8.1/lib/ruby/site_ruby/1.8/http-access2.rb:240:in
`get_content'
from send_stuff.rb:16
 
N

NAKAMURA, Hiroshi

--------------enig000A10C2CB00607313581082
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

Hi,
I'm somewhat new to Ruby. I'm trying to force myself to use Ruby rather
than perl to write a simple script to get a form from a url and post
data using http_access2. It seems simple enough except that the site
uses https and has a self-signed cert.

My code is quite simple:

client = HTTPAccess2::Client.new(proxy)
# etc...
content = client.get_content(login_url)

I get the error in OpenSSL (see below). I had a look at the http_access2
code and it seems to provide for configuring OpenSSL (I want to tell it
not to verify certs) but it's not exposed in the constructor. I'm not
familiar enough with Ruby to decode some of the syntax, so I'm not sure
if there is a way of passing options to ssl.

You can tell a client not to verify the server with;

client.ssl_config.verify_mode = nil

Bear in mind that it's just an insecure and awkwardly slow connection.
:) I recommend to set trusted CA certificate with;

client.cfg.set_trust_ca('ca_cert.pem')

FYI: here is a project site of http-access2:
http://rrr.jin.gr.jp/projects/http-access2

Regards,
// NaHi

--------------enig000A10C2CB00607313581082
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: OpenPGP digital signature
Content-Disposition: attachment; filename="signature.asc"

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (Cygwin)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFB/zHEf6b33ts2dPkRAiGbAJ0RfqY/+CPIgi3GnJCYeWDZ12wQlQCeIY9o
D/uNoV7S1h/KhIqacjipy7o=
=KiFj
-----END PGP SIGNATURE-----

--------------enig000A10C2CB00607313581082--
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,776
Messages
2,569,603
Members
45,189
Latest member
CryptoTaxSoftware

Latest Threads

Top