Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PERL_LWP_SSL_VERIFY_HOSTNAME setting to 0 is not working

Am running into an issue connecting on a Ubuntu machine while my other machine works fine. The difference between both is the Ubuntu version and the SSLeay version but i can't narrow down what the issue is.

I already did the following: a) add the environment variable: PERL_LWP_SSL_VERIFY_HOSTNAME with a value of 0 b) add the $ENV{PERL_LWP_SSL_VERIFY_HOSTNAME} = 0; to the VICommon.pm file

Both the above ones didn't work. I can't figure out why it doesn't work on my second machine.

Ubuntu 12.10 (Works)

$perl /usr/lib/vmware-vcli/apps/general/connect.pl --url https:///sdk/webService --username --password

Connection Successful

Server Time : 2013-07-19T22:11:31.681181Z

$ perl -v

This is perl 5, version 14, subversion 2 (v5.14.2) built for x86_64-linux-gnu-thread-multi

$ perl -MLWP -e 'print "LWP Version: $LWP::VERSION\n"'

LWP Version: 6.04

$ perl -MCrypt::SSLeay -e 'print "Crypt::SSLeay Version: $Crypt::SSLeay::VERSION\n"'

Crypt::SSLeay Version: 0.58

Ubuntu 13.04 (Doesn't work)

$perl /usr/lib/vmware-vcli/apps/general/connect.pl --url https:///sdk/webService --username --password

Server version unavailable at 'https:///sdk/vimService.wsdl' at /usr/share/perl/5.14/VMware/VICommon.pm line 548.

$ perl -v

This is perl 5, version 14, subversion 2 (v5.14.2) built for x86_64-linux-gnu-thread-multi

$ perl -MLWP -e 'print "LWP Version: $LWP::VERSION\n"'

LWP Version: 6.04

$ perl -MCrypt::SSLeay -e 'print "Crypt::SSLeay Version: $Crypt::SSLeay::VERSION\n"'

Crypt::SSLeay Version: 0.64

Certificate error (same in both machines)

lwp-request https:///sdk/webService Can't connect to :443 (certificate verify failed)

LWP::Protocol::https::Socket: SSL connect attempt failed with unknown error error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed at /usr/share/perl5/LWP/Protocol/http.pm line 51.

UPDATE 1

Looks like the issue has nothing to do with the Ubuntu version but the new packages i get when i do 'apt-get upgrade', on the 12.10 box i didn't do that and it was working. However on 13.04 i ended up doing all the updates. Now since i get more than 80 updates when i did i still haven't narrowed down to the library which is messing it up. When i installed a new 13.04 image it works fine.

** Update 2 **

Looks like the base Ubuntu 12.10 or 13.04 work fine. If you get the latest updates then it stops working. So not sure yet which library is causing the problem.

like image 653
user2601110 Avatar asked Jul 19 '13 22:07

user2601110


1 Answers

I have had the very same problem - I solved it by typing "use Net::SSL;" before the requests.

Also tried to find out what library is causing the problem because it's definately an upgraded module that is causing it. Most sites were okay though, but one site's certificate wouldn't validate.

like image 97
Gauntlet Avatar answered Sep 21 '22 06:09

Gauntlet