jdudleyh has asked for the wisdom of the Perl Monks concerning the following question:
I had a nice script working with a web service via XML::Compile until recently when the web service went to SSL. I'm not really sure how to go about SSL via XML::Compile. Taking a first leap I decided I'll probably need to create an SSL socket:
use strict; use warnings; use IO::Socket::SSL qw(debug3); my $socket = IO::Socket::SSL->new ( PeerAddr => 'some.server.com', PeerPort => 443, Proto => 'tcp', SSL_use_cert => 1, SSL_verify_mode => SSL_VERIFY_NONE, SSL_cert_file => 'server.pem' ) or die "failed connect or ssl handshake: $!,",&IO::Socket::SSL::errs +tr,"\n";
But when I run this, I get a bad return value from Net::SSLeay
DEBUG: .../IO/Socket/SSL.pm:251: set domain to 2 DEBUG: .../IO/Socket/SSL.pm:1784: new ctx 41181280 DEBUG: .../IO/Socket/SSL.pm:446: socket not yet connected DEBUG: .../IO/Socket/SSL.pm:448: socket connected DEBUG: .../IO/Socket/SSL.pm:466: ssl handshake not started DEBUG: .../IO/Socket/SSL.pm:501: using SNI with hostname some.server.c +om DEBUG: .../IO/Socket/SSL.pm:537: Net::SSLeay::connect -> -1 DEBUG: .../IO/Socket/SSL.pm:543: fatal SSL error: SSL connect attempt +failed with unknown error DEBUG: .../IO/Socket/SSL.pm:1821: free ctx 41181280 open=41181280 DEBUG: .../IO/Socket/SSL.pm:1829: OK free ctx 41181280 failed connect or ssl handshake: Bad file descriptor,IO::Socket::INET6 + configuration failed SSL connect attempt failed with unknown error
perl -MNet::SSLeay -e " print Net::SSLeay::SSLeay_version();
reveals "OpenSSL 1.0.1e 11 Feb 2013"
I'm not certain I'm pursuing the right direction, or how I'm actually going to pass the socket into the XML::Compile transport, so I thought I'd stop here for a sanity check.
Other info... I'm having to do this via Windows with Strawberry Perl 5.16.3. I updated a whole slew of libraries (from Net::HTTP* to IO::Socket* to Net:SSL*) I do have the ability to run openssl to get the cert info. I can connect via telnet to the server at port 443. I don't really care about the server verification/certificate as the client is just used for test automation.
Thanks Monks
Update: I found a handy script somewhere (lost the link now) that helped me determine that the SSL was version 3. So adding "SSL_version => 'SSLv3'" to the LWP::UserAgent's ssl_opts got the SSL handshake to complete.
Now I'm stuck on a read timeout. I will be increasing the client timeout on the transport layer underneath the SSL layer.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Creating SSL socket
by Khen1950fx (Canon) on Oct 23, 2013 at 06:17 UTC | |
by jdudleyh (Acolyte) on Oct 23, 2013 at 16:03 UTC | |
by Anonymous Monk on Nov 25, 2013 at 20:38 UTC | |
by Anonymous Monk on Aug 29, 2014 at 12:34 UTC | |
by Anonymous Monk on Nov 26, 2013 at 18:28 UTC | |
|
Re: Creating SSL socket (XML::Compile ssl)
by Anonymous Monk on Oct 23, 2013 at 06:52 UTC | |
by jdudleyh (Acolyte) on Oct 23, 2013 at 16:11 UTC |