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

Hi Guys, our admin team recently did Linux patch upgrade 'RHEL 6.8'on Informatica server after that I am facing below error whenever my pearl script trying to connect to the server.

500 Can't connect to login.salesforce.com:443 (Connection timed out)

Was going through the release notes and find below- make sure the IO::Socket::SSL Perl module is installed and the PERL_LWP_SSL_VERIFY_HOSTNAME environment variable set to 1 or that the application is modified to set the ssl_opts option correctly.

anyone who faced the same issue, please help me.
  • Comment on 500 Can't connect to login.salesforce.com:443

Replies are listed 'Best First'.
Re: 500 Can't connect to login.salesforce.com:443
by hippo (Archbishop) on Sep 13, 2016 at 12:52 UTC
    (Connection timed out)

    That's more likely to be a firewall or routing issue than anything connected directly with perl. Check you can connect to the URL from the box without using perl - if you can't then it's a job for your IT Dept.

      Yes, I am able to connect the URL with the same user credentials...

        So try this:

        #!/usr/bin/env perl use strict; use warnings; #use IO::Socket::SSL 'debug4'; use LWP; use Test::More tests => 1; my $ua = LWP::UserAgent->new; my $res = $ua->get ('https://login.salesforce.com/'); ok ($res->is_success);

        which works for me with

        • Perl v5.20.3
        • LWP 6.15
        • IO::Socket::SSL 2.012
        • Mozilla::CA 20141217

        If it fails for you, uncomment the IO::Socket::SSL line to obtain a better idea of where the problem might lie.

Re: 500 Can't connect to login.salesforce.com:443
by genio (Beadle) on Sep 13, 2016 at 13:48 UTC
    Hi! edit: also, yum install perl-Crypt-SSLeay

    WWW::Salesforce uses LWP::UserAgent as its method of transport.

    In order to ensure your machine can communicate over SSL, you'll need to install the LWP::Protocol::https module.

    sudo yum install perl perl-core perl-local-lib gcc make openssl-devel +perl-Crypt-SSLeay eval $(perl -I$HOME/perl5/lib/perl5 -Mlocal::lib) echo '[ $SHLVL -eq 1 ] && eval "$(perl -I$HOME/perl5/lib/perl5 -Mlocal +::lib)"' >>~/.bashrc cpan App::cpanminus cpanm LWP::UserAgent LWP::Protocol::https WWW::Salesforce

    The above should put you in a better position.

    The usual convention is to install modules in some place designated by local::lib. This way, you aren't going to have to worry about your yum updates breaking your Perl modules.

    You also won't have to worry about overwriting one of the system modules that may cause some system Perl application to break.

    Discussing such matters in IRC will result in the fastest communication with the community to understand this concept. System-Perl == bad (generic, broad-sweeping statement).

      Using Crypt::SSLeay is not recommended because it fails to verify certificates properly. The default since LWP 6.0 is to use IO::Socket::SSL (which uses Net::SSLeay not Crypt::SSLeay) but proxy support works only since LWP 6.06.
Re: 500 Can't connect to login.salesforce.com:443
by noxxi (Pilgrim) on Sep 13, 2016 at 16:33 UTC
    Please make sure that you are using at least LWP version 6.06. Proxy support with IO::Socket::SSL is broken in earlier versions.

      Thanks all...was able to find a fix finally in my script moved below code out of SOAP LITE and it works $ENV{PERL_NET_HTTPS_SSL_SOCKET_CLASS} = "Net::SSL"; $ENV{PERL_LWP_SSL_VERIFY_HOSTNAME} = 0; $ENV{HTTPS_PROXY} = 'https://xx.xxx......'; This was the one we were missing: $ENV{PERL_NET_HTTPS_SSL_SOCKET_CLASS} = "Net::SSL"; Thanks for everyone's guidance!

        This is heavily insecure because you for one enforce the use of a class which does no proper certificate validation and second additionally disable any remaining validation. This way you will not notice if some man in the middle will grab your login credentials.