title: Installing a new ca certificate for Perl 5.14.2 LWP on Ubuntu 12.04
body: <p>I am getting the following error trying to connect to a specific https website using LWP:</p>
  
  <pre><code>LWP::Protocol::https::Socket: SSL connect attempt failed with unknown errorerror:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed at /usr/local/share/perl/5.14.2/LWP/Protocol/http.pm line 51.
  </code></pre>
  
  <p>I tried with wget and got: </p>
  
  <pre><code>ERROR: cannot verify [domain]'s certificate, issued by `/C=US/ST=Arizona/L=Scottsdale/O=GoDaddy.com, Inc./OU=http://certificates.godaddy.com/repository/CN=Go Daddy Secure Certification Authority/serialNumber=********':
    Unable to locally verify the issuer's authority.
  </code></pre>
  
  <p>I googled around and discovered that I probably had to install the godaddy root ca cert. I figured out how to do that (download certificates, put in /usr/share/ca-certificates and run update-ca-certificates). I also learnt how to use openssl s_client in the process.</p>
  
  <p>Now that the certificate is installed, wget works, but LWP still fails with the same error and so does openssl s_client:</p>
  
  <pre><code># openssl s_client -connect [domain]:443
  CONNECTED(00000003)
  depth=0 O = [domain], OU = Domain Control Validated, CN = [domain]
  verify error:num=20:unable to get local issuer certificate
  verify return:1
  depth=0 O = [domain], OU = Domain Control Validated, CN = [domain]
  verify error:num=27:certificate not trusted
  verify return:1
  depth=0 O = [domain], OU = Domain Control Validated, CN = [domain]
  verify error:num=21:unable to verify the first certificate
  verify return:1
  </code></pre>
  
  <p>I have no idea where to go next to get this working. Any suggestions?</p>
  
  <hr>
  
  <p><strong>EDIT:</strong>  <strong>SOLVED</strong> Here is a simple script that describes what worked after mikew's suggestion:</p>
  
  <pre><code>#!/usr/bin/perl
  use LWP::UserAgent;
  $URL="[domain]";
  my $ua = LWP::UserAgent-&gt;new(ssl_opts =&gt; { SSL_ca_path=&gt;'/etc/ssl/certs'});
  my $response = $ua-&gt;get($URL);
  </code></pre>