我收到以下錯誤嘗試使用LWP連接到特定網站的https:安裝對Perl 5.14.2新的CA證書LWP在Ubuntu 12.04
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 root ca cert。我想出瞭如何做到這一點(下載證書,放入/ usr/share/ca-certificates並運行update-ca-certificates)。我也學會了如何在這個過程中使用openssl s_client。
現在安裝證書,wget的作品,但仍LWP失敗,相同的錯誤也是如此的OpenSSL的s_client.First:
# 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);
這工作時,我只添加了SSL_ca_path。謝謝! –
好聽!編輯答案以澄清只需要SSL_ca_file或SSL_ca_path中的一個。 – mikew