LWP を使用して特定の https Web サイトに接続しようとすると、次のエラーが発生します。
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.
私はwgetで試してみました:
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.
私はグーグルで検索し、おそらくgodaddyルートCA証明書をインストールする必要があることを発見しました. その方法を見つけました(証明書をダウンロードし、/usr/share/ca-certificates に入れ、update-ca-certificates を実行します)。また、プロセスで openssl s_client を使用する方法も学びました。
証明書がインストールされたので、wget は機能しますが、LWP は引き続き同じエラーで失敗し、openssl s_client も失敗します。
# 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
これを機能させるために次にどこに行くべきかわかりません。助言がありますか?
編集:解決済み mikewの提案の後に何が機能したかを説明する簡単なスクリプトを次に示します。
#!/usr/bin/perl
use LWP::UserAgent;
$URL="[domain]";
my $ua = LWP::UserAgent->new(ssl_opts => { SSL_ca_path=>'/etc/ssl/certs'});
my $response = $ua->get($URL);