kabachaa has asked for the wisdom of the Perl Monks concerning the following question:
I am new to perl, and trying to figure out how to connect to remote host using perl. I have Client certificate that I need to pass in the http request to authenticate, I wrote this simple script to test it out but I get an error from it.
The file cert.crt has certificate and private key Thanks!
response ---500 Can't connect to something.com:443 (certificate verify failed) Content-Type: text/plain Client-Date: Mon, 13 May 2013 18:38:20 GMT Client-Warning: Internal response Can't connect to something.com: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/lib/perl5/site_perl/5.8.8/LWP/Protocol/http.pm line 51.
#!/usr/bin/perl -l use strict; use warnings; use HTTP::Headers; use HTTP::Request; use LWP::UserAgent; my $UPDATE_SERVER = "https://something.com"; my $ua = LWP::UserAgent->new( verify_hostname => 0, SSL_ca_file => 'cert.crt', ); $ua->timeout(10); $ua->agent(""); my $req = HTTP::Request->new( GET => $UPDATE_SERVER ); my $res = $ua->request($req); print "header ----" . $res->headers_as_string; print "response ---" . $res->as_string;
|
|---|