meathouse has asked for the wisdom of the Perl Monks concerning the following question:

Project & Env - I'm migrating a legacy server from A->B. It is CentOS4 i686. The code base seems to be a very organically grown mix of libs and modules all over the place. Oh, and it uses Apache 1. Giving the code and deps a much needed update is not in the scope of the project. All I am tasked with is moving from A->B which happens to be a physical server at data center A, to a virtual server at data center B. The server's primary function is a user login page (cookies) that redirect you to another server where actual user accounts live. Let's call that server C.

I have Server B up and running and most of the software is working except for one big gotcha. If I attempt to use the log in code on http (port 80) I am happily redirected to my account on server C. If I attempt to use the log in code on https (port 443) I can load server B's web page fine, but submitting the page gives me this error (from CARP).

The Error
501 (Not Implemented) Protocol scheme 'https' is not supported (Crypt: +:SSLeay not installed) Location: https://server_c.company.com/users/ Content-Type: text/plain Client-Date: Tue, 08 Jul 2014 00:21:09 GMT Client-Warning: Internal response LWP will support https URLs if the Crypt::SSLeay module is installed. More information at <http://www.linpro.no/lwp/libwww-perl/README.SSL>.

I've spent the last few hours.. OK days.. trying to figure this out. First off let me clarify that Crypt::SSLeay is installed. Twice. Here are the two dirs

The first dir install was done via CPAN. And the second was copied from server A. Note that 99% of the server install base lives in under the /usr/local/ray root directory. Also note that Server A does not have a CPAN install of Crypt::SSLeay, it only has the one under /usr/local/ray.

I've attempted to force the login code to use Crypt/SSLeay with "use lib". I looked into recompiling from source. So far no joy. Here are the relevant sections of code on the login page.

Abbreviated code
#!/usr/bin/perl use strict; use lib '/usr/local/ray/www/site_perl'; use Apache::Constants qw(:common); use CGI qw(:standard); use CGI::Carp; use LWP::UserAgent; my $cgi = new CGI; my %p = $cgi->Vars; $p{credential_0} =~ s/^\s+|\s+$//g; my $server= 'server_c'; my $domain= 'company.com'; ## Set protocol based on what the user wants ## some might use http my $protocol = 'http'; ## And for https... if ( $ENV{HTTP_REFERER} =~ /^https:/ ) { $protocol = 'https'; } ## This is the server that the user will be redirected to my $url = "$protocol://$server.$domain"; my $dest = '/users/'; my $creds = "credential_0=$p{credential_0}&credential_1=$p{credential_ +1}&destination=$dest"; my $ua = LWP::UserAgent->new(ssl_opts => { verify_hostname => 0 }); ## Post the credentials my $req = HTTP::Request->new(POST => "$url/LOGIN"); $req->content_type('application/x-www-form-urlencoded'); $req->content($creds); ## Get the response my $res = $ua->request($req); ## Change location to their server $res->header( 'Location' => "$url/users/" ); ## Print to browser print $res->as_string;
Any advise is appreciated.

Replies are listed 'Best First'.
Re: Crypt::SSLeay not installed
by syphilis (Archbishop) on Jul 08, 2014 at 01:13 UTC
    use lib '/usr/local/ray/www/site_perl';

    Does that specify the right location ?
    It's the '/usr/local/ray/lib/perl5/site_perl/5.8.5/i686-linux/' directory (not '/usr/local/ray/lib/perl5/site_perl') that needs to be searched when looking for Crypt/SSLeay.pm.
    Similarly, for the other location of Crypt::SLLeay (which is the one I'd be trying first) you'd want
    use lib '/usr/lib/perl5/site_perl/5.8.8/i386-linux-thread-multi/';
    Cheers,
    Rob
      Rob, I took your suggestion and added
      use lib '/usr/lib/perl5/site_perl/5.8.8/i386-linux-thread-multi/';
      I now get "no data received in the browser" and the following in Apache error logs
      /usr/local/ray/apache/bin/httpd: symbol lookup error: /usr/lib/perl5/s +ite_perl/5.8.8/i386-linux-thread-multi//auto/Compress/Raw/Zlib/Zlib.s +o: undefined symbol: Perl_Tstack_sp_ptr
      Some kind of mismatch?
        Looks like you're mixing two different perls with that use lib line

        fix your shebang or compile the modules with a different perl