Hello Wise Monks. I'm getting an error that I can't connect to my ip using https. Here's my code. I replaced my real ip address with "myipaddress"

$useragent=new LWP::UserAgent; $request=new HTTP::Request('GET', "https://myipaddress/somea +pps/someapp.cgi"); $result=$useragent->request($request); $placibo2[0]=$result->{_content}; if ($placibo2[0]) { print header; print $placibo2[0]; }

Should I set a value for $ENV{ HTTPS_CA_FILE }? If so, what value? I'm using a windows 2012 server to run the perl program. When I try to access https://www.google.com it works. If I try to access https://myipaddress from the browser on the server it works. When I try to access my ipaddress using https using the above code i get:

LWP::Protocol::https::Socket: SSL connect attempt failed with unknown error error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed

I also tried the following: $ENV{'PERL_LWP_SSL_VERIFY_HOSTNAME'} = 0 which worked. I was able to access my ip address using the above code but this is not secure and open to man in the middle attack. What should I now do? Thank you in advance for your wisdom.


In reply to https using lwp by Gorby

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.