I went through the documentation for Net::SSLeay and after searching for some good examples which I couldnt find i wrote something like this.
I think I am not passing the certificate correctly that why i am getting the Forbidden 403.
Using curl i can make the request and get a response from the host machine with the same cert.
I would really appreciate if someone could give me any pointers to what I am doing wrong. Thanks!
curl '-i' '-k' '-H' 'tag: 6-0-2-1' '-H' 'tag2' '-E' 'ops-cert.crt' '-
+-data-binary' '@request_e' '--url' 'https://host.com:443/'
use strict;
use warnings;
use IO::Socket::SSL qw(debug3);
use Net::SSLeay qw(get_https get_https post_https sslcat make_headers
+make_form);
$Net::SSLeay::ssl_version = 3;
$|=1;
my $host = 'host.com';
my $port = 443;
my $pathCert = '/home/cert/ops-cert-O.crt';
my $pathkey = '/home/cert/keys.key';
my $result ='';
my %headers = '' ;
($page, $result, %headers) = get_https($host, 443, '', '', '', '', $p
+athCert, $pathkey);
print $result ;
output i get
do_httpx3(GET,1,host.com:443) at blib/lib/Net/SSLeay.pm (autosplit int
+o blib/lib/auto/Net/SSLeay/do_httpx3.al) line 1268.
httpx_cat: usessl=1 (host.com:443) at blib/lib/Net/SSLeay.pm (autospli
+t into blib/lib/auto/Net/SSLeay/httpx_cat.al) line 1177.
Opening connection to host.com:443 (208.90.58.23) at blib/lib/Net/SSLe
+ay.pm (autosplit into blib/lib/auto/Net/SSLeay/open_tcp_connection.al
+) line 449.
Creating SSL 3 context...
Creating SSL connection (context was '425677232')...
Setting fd (ctx 425677232, con 425782688)...
Entering SSL negotiation phase...
Cipher list: DHE-RSA-AES256-SHA, DHE-RSA-AES256-SHA, DHE-DSS-AES256-SH
+A, AES256-SHA, KRB5-DES-CBC3-MD5, KRB5-DES-CBC3-SHA, EDH-RSA-DES-CBC3
+-SHA, EDH-DSS-DES-CBC3-SHA, DES-CBC3-SHA, DHE-RSA-AES128-SHA, DHE-DSS
+-AES128-SHA, AES128-SHA, KRB5-RC4-MD5, KRB5-RC4-SHA, RC4-SHA, RC4-MD5
+, KRB5-DES-CBC-MD5, KRB5-DES-CBC-SHA, EDH-RSA-DES-CBC-SHA, EDH-DSS-DE
+S-CBC-SHA, DES-CBC-SHA, EXP-KRB5-RC2-CBC-MD5, EXP-KRB5-DES-CBC-MD5, E
+XP-KRB5-RC2-CBC-SHA, EXP-KRB5-DES-CBC-SHA, EXP-EDH-RSA-DES-CBC-SHA, E
+XP-EDH-DSS-DES-CBC-SHA, EXP-DES-CBC-SHA, EXP-RC2-CBC-MD5, EXP-KRB5-RC
+4-MD5, EXP-KRB5-RC4-SHA, EXP-RC4-MD5\n at blib/lib/Net/SSLeay.pm (aut
+osplit into blib/lib/auto/Net/SSLeay/https_cat.al) line 1110.
Cipher `DHE-RSA-AES256-SHA'
Subject Name: /C=US/ST=California/L=San Bruno/O=Inc Systems/CN=host.co
+m
Issuer Name: /C=US/ST=California/O=Inc Systems/CN=dev-sds-host.com
https_cat 32382: sending 76 bytes...
write_all VM at entry=vm_unknown
written so far 76:76 bytes (VM=vm_unknown)
waiting for reply...
got 169:0 bytes (VM=vm_unknown).
got 0:169 bytes (VM=vm_unknown).
Got 169 bytes.
headers ><html>
<head><title>403 Forbidden</title></head>
<body bgcolor="white">
<center><h1>403 Forbidden</h1></center>
<hr><center>nginx/0.8.54</center>
</body>
</html>
< page >><< http >>><html>
<head><title>403 Forbidden</title></head>
<body bgcolor="white">
<center><h1>403 Forbidden</h1></center>
<hr><center>nginx/0.8.54</center>
</body>
</html>
<<< at blib/lib/Net/SSLeay.pm (autosplit into blib/lib/auto/Net/SSLeay
+/do_httpx3.al) line 1275.