Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

LWP with SSL support

Status
Not open for further replies.

rpanella

Programmer
Aug 31, 2006
3
US
I am trying to get LWP to work with SSL support.

First, I tried installing the IO::Socket::SSL which it supposedly works with out of the box according to the README.SSL. After install it when I run my script I get the following error:

500 Can't connect to (Illegal seek)
Aborting at test.pl line 5.


I then tried using the Crypt::SSLeay module but it had some errors when installing. When I would try to run my test script after this module was installed I would just get a seg fault. I have looked this up and I guess it is a common problem, but I could not find any solutions for it other than people saying they sumbitted a bugfix.

If anyone knows how to get either of these modules to work with LWP I would greatly appreciate any help.

Thanks,
Russell
 
What operating system? What Perl? What was the Crypt::SSLeay error when you inistalled?
 
OS: Fedora Core 5
Perl 5.8.8

This is the output when I try to install Crypt::SSLeay


cpan> install Crypt::SSLeay
CPAN: Storable loaded ok
Going to read /root/.cpan/Metadata
Database was generated on Wed, 30 Aug 2006 05:31:43 GMT
Running install for module Crypt::SSLeay
Running make for C/CH/CHAMAS/Crypt-SSLeay-0.51.tar.gz
CPAN: Digest::SHA loaded ok

CPAN: Module::Signature security checks disabled because Module::Signature
not installed. Please consider installing the Module::Signature module.
You may also need to be able to connect over the Internet to the public
keyservers like pgp.mit.edu (port 11371).

CPAN: Compress::Zlib loaded ok
Checksum for /root/.cpan/sources/authors/id/C/CH/CHAMAS/Crypt-SSLeay-0.51.tar.gz ok
Scanning cache /root/.cpan/build for sizes
Crypt-SSLeay-0.51/
Crypt-SSLeay-0.51/t/
Crypt-SSLeay-0.51/t/net_ssl.t
Crypt-SSLeay-0.51/t/ssl_context.t
Crypt-SSLeay-0.51/lib/
Crypt-SSLeay-0.51/lib/Crypt/
Crypt-SSLeay-0.51/lib/Crypt/SSLeay/
Crypt-SSLeay-0.51/lib/Crypt/SSLeay/MainContext.pm
Crypt-SSLeay-0.51/lib/Crypt/SSLeay/Conn.pm
Crypt-SSLeay-0.51/lib/Crypt/SSLeay/X509.pm
Crypt-SSLeay-0.51/lib/Crypt/SSLeay/Err.pm
Crypt-SSLeay-0.51/lib/Crypt/SSLeay/CTX.pm
Crypt-SSLeay-0.51/lib/Net/
Crypt-SSLeay-0.51/lib/Net/SSL.pm
Crypt-SSLeay-0.51/certs/
Crypt-SSLeay-0.51/certs/ca-bundle.crt
Crypt-SSLeay-0.51/certs/notacakeynopass.pem
Crypt-SSLeay-0.51/certs/notacacert.pem
Crypt-SSLeay-0.51/MANIFEST
Crypt-SSLeay-0.51/typemap
Crypt-SSLeay-0.51/MANIFEST.SKIP
Crypt-SSLeay-0.51/SSLeay.pm
Crypt-SSLeay-0.51/CHANGES
Crypt-SSLeay-0.51/lwp-ssl-test
Crypt-SSLeay-0.51/net_ssl_test
Crypt-SSLeay-0.51/SSLeay.xs
Crypt-SSLeay-0.51/README
Crypt-SSLeay-0.51/Makefile.PL
Removing previously used /root/.cpan/build/Crypt-SSLeay-0.51

CPAN.pm: Going to build C/CH/CHAMAS/Crypt-SSLeay-0.51.tar.gz

Found OpenSSL (version OpenSSL 0.9.8) installed at /usr
Which OpenSSL build path do you want to link against? [/usr]

================================================
BUILD INFORMATION
================================================

ssl dir: /usr
libraries: -lssl -lcrypto -lgcc -lRSAglue -lrsaref
include dir: /usr/include
ssl header: openssl/ssl.h
ssl candidate: /usr; /usr/include/openssl; OpenSSL 0.9.8

================================================

Checking if your kit is complete...
Looks good
Note (probably harmless): No library found for -lgcc
Note (probably harmless): No library found for -lRSAglue
Note (probably harmless): No library found for -lrsaref
Writing Makefile for Crypt::SSLeay
cp lib/Crypt/SSLeay/X509.pm blib/lib/Crypt/SSLeay/X509.pm
cp lib/Net/SSL.pm blib/lib/Net/SSL.pm
cp SSLeay.pm blib/lib/Crypt/SSLeay.pm
cp lib/Crypt/SSLeay/MainContext.pm blib/lib/Crypt/SSLeay/MainContext.pm
cp lib/Crypt/SSLeay/CTX.pm blib/lib/Crypt/SSLeay/CTX.pm
cp lib/Crypt/SSLeay/Conn.pm blib/lib/Crypt/SSLeay/Conn.pm
cp lib/Crypt/SSLeay/Err.pm blib/lib/Crypt/SSLeay/Err.pm
/usr/bin/perl /usr/lib/perl5/5.8.8/ExtUtils/xsubpp -typemap /usr/lib/perl5/5.8.8/ExtUtils/typemap -typemap typemap SSLeay.xs > SSLeay.xsc && mv SSLeay.xsc SSLeay.c
gcc -c -I/usr/include -D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing -pipe -Wdeclaration-after-statement -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/include/gdbm -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m32 -march=i386 -mtune=generic -fasynchronous-unwind-tables -DVERSION=\"0.51\" -DXS_VERSION=\"0.51\" -fPIC "-I/usr/lib/perl5/5.8.8/i386-linux-thread-multi/CORE" SSLeay.c
SSLeay.c: In function âXS_Crypt__SSLeay__CTX_newâ:
SSLeay.c:120: warning: unused variable âpacknameâ
SSLeay.xs: In function âXS_Crypt__SSLeay__CTX_use_pkcs12_fileâ:
SSLeay.xs:177: warning: suggest parentheses around assignment used as truth value
SSLeay.xs: In function âXS_Crypt__SSLeay__Conn_newâ:
SSLeay.xs:252: warning: passing argument 2 of âSSL_set_info_callbackâ from incompatible pointer type
SSLeay.c:398: warning: unused variable âpacknameâ
SSLeay.c: In function âXS_Crypt__SSLeay__CTX_use_pkcs12_fileâ:
SSLeay.c:288: warning: âRETVALâ may be used uninitialized in this function
Running Mkbootstrap for Crypt::SSLeay ()
chmod 644 SSLeay.bs
rm -f blib/arch/auto/Crypt/SSLeay/SSLeay.so
gcc -shared -L/usr/local/lib SSLeay.o -o blib/arch/auto/Crypt/SSLeay/SSLeay.so \
-L/usr/lib -lssl -lcrypto \

chmod 755 blib/arch/auto/Crypt/SSLeay/SSLeay.so
cp SSLeay.bs blib/arch/auto/Crypt/SSLeay/SSLeay.bs
chmod 644 blib/arch/auto/Crypt/SSLeay/SSLeay.bs
Manifying blib/man3/Crypt::SSLeay.3pm
/usr/bin/make -- OK
Running make test
PERL_DL_NONLAZY=1 /usr/bin/perl "-MExtUtils::Command::MM" "-e" "test_harness(0, 'blib/lib', 'blib/arch')" t/*.t
t/net_ssl........dubious
Test returned status 0 (wstat 11, 0xb)
t/ssl_context....dubious
Test returned status 0 (wstat 11, 0xb)
FAILED--2 test scripts could be run, alas--no output ever seen
make: *** [test_dynamic] Error 255
/usr/bin/make test -- NOT OK
Running make install
make test had returned bad status, won't install without force
Failed during this command:
CHAMAS/Crypt-SSLeay-0.51.tar.gz : make_test NO
 
The first test it failed is this:

#!/usr/bin/perl

use lib qw(../lib ./lib);

use Net::SSL;

my $sock;
eval {
$sock = Net::SSL->new(
PeerAddr => '127.0.0.1',
PeerPort => 40000,
Timeout => 3,
);
};

print "1..1\n";
print $@;
if($@ && ($@ !~ /Connect failed/i)) {
print "not ok\n";
} else {
print "ok\n";
}

The tst is trying to contact your own machine and cannot. Assuming you are running this on a server it would asume you need to have something listening to receive the connection? Maybe look at the docs on Net::SSL as well.
 
Running that test manually gives the error that Net/SSL.pm cannot be found, which makes sense since that is what I'm trying to install in the first place.

Net::SSL is the same as Crypt::SSLeay as far as I can tell since running a cpan install Net::SSL tries to install the same Cyrpt::SSLeay module.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top