SUGI製作所

音楽機材やスマホアプリ開発のネタが中心です。

SSLエラー

APIのテストを始めようとしたところ、LWPがhttpsアクセスでエラー

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

curlでもエラー

curl: (60) SSL certificate problem: unable to get local issuer certificate
More details here: http://curl.haxx.se/docs/sslcerts.html

curl performs SSL certificate verification by default, using a "bundle"
of Certificate Authority (CA) public keys (CA certs). If the default
bundle file isn't adequate, you can specify an alternate file
using the --cacert option.
If this HTTPS server uses a certificate signed by a CA represented in
the bundle, the certificate verification probably failed due to a
problem with the certificate (it might be expired, or the name might
not match the domain name in the URL).
If you'd like to turn off curl's verification of the certificate, use
the -k (or --insecure) option.

Macでは起こらなかった。
両方とも、無視出来るオプションはあるがちゃんと対処することにする

一応curlの確認

curl -V
curl 7.26.0 (x86_64-unknown-linux-gnu) libcurl/7.26.0 OpenSSL/0.9.8b zlib/1.2.3 libssh2/1.4.2
Protocols: dict file ftp ftps gopher http https imap imaps pop3 pop3s rtsp scp sftp smtp smtps telnet tftp

OpenSSLは付いている

こちらのサイトを参考にさせてもらった
http://d.hatena.ne.jp/kanonji/20111208/1323323155

証明書をmozillaが更新している最新のものにするとよいらしい
cd /etc/pki/tls/certs/
backup
sudo cp ca-bundle.crt ca-bundle.crt.bak
更新
sudo curl http://curl.haxx.se/ca/cacert.pem -o ca-bundle.crt

これでいいはずだけど今回は駄目だった。
サーバー管理の方に伝えて調査してもらったところ、
接続先のnginxの中間証明書が足りなかったらしい。

SSLについても勉強したいなー。