2011-12-21

lwp-request or GET and POST and self signed SSL certificates (HTTPS)

I was using the command line last night when I needed to hit one of my pages real quick. I didn't need the output all browser fancy, and I just needed a blurb of text, so I typed GET and the page address plus my credentials. I received an error from down in the bowels of Perl and the LWP::UserAgent library about my certificate not being verified.

I looked around the Internet, and I saw different posts, but nothing told me exactly what to do. Different peoples solutions were vastly different. So, I looked for the documentation for the LWP libraries, and I found them. There I found the exact solution. The library can be affected by environment variables. The specific one is PERL_LWP_SSL_VERIFY_HOSTNAME. It is a boolean value or 0/1 in Perl. So on the command line I simply ran:

export PERL_LWP_SSL_VERIFY_HOSTNAME=0

I then reran GET, and everything was good. So, if you run into this problem, then here is your fix. Simple and sweet.

No comments: