slayedbylucifer slayedbylucifer - 1 year ago 274
Perl Question

REST::Client: how to ignore SSL certificates

I am working with

and my code fails with SSL error.

Here is the code:

#!usr/bin/perl -w
use strict;
use REST::Client;

my $client = REST::Client->new();

print $client->responseContent();

and here is the output:

WP::Protocol::https::Socket: SSL connect attempt failed with unknown error error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed at /usr/local/share/perl/5.10.1/LWP/Protocol/ line 51.

I know the problem.
is not able to ignore the SSL certificate.

I get the exact same error with
when I do not use "-k" option:

here is curl command:

curl -i -H "Accept:application/*+xml;version=1.5" -u "username@system:password" -X post https://something/api/sessions

and here is curl output(Error):

curl: (60) SSL certificate problem, verify that the CA cert is OK. Details:
error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed

However, if I add "-k" to the curl command, then it works just fine.

From curl's man page, here is the explanation of "-k":

(SSL) This option explicitly allows curl to perform "insecure" SSL connections and transfers.


So, How do I make
ignore the SSL certificate? OR is there any other elegant way to work with? I gone through the
documentation on CPAN but it does not talk anything about this.


Answer Source

I got it working by adding below line:



Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download