【curl】「unable to get local issuer certificate」って出た
こんばんは葛の葉です。
いつものアホ面でcurl
を叩いたら見慣れないErrorが出てきました。
$ curl -vI https://***********.htm * Trying ***.***.***.***... * TCP_NODELAY set * Connected to ********** (***.***.***.***) port 443 (#0) * ALPN, offering h2 * ALPN, offering http/1.1 * successfully set certificate verify locations: * CAfile: /etc/ssl/certs/ca-certificates.crt CApath: /etc/ssl/certs * TLSv1.3 (OUT), TLS handshake, Client hello (1): * TLSv1.3 (IN), TLS handshake, Server hello (2): * TLSv1.2 (IN), TLS handshake, Certificate (11): * TLSv1.2 (OUT), TLS alert, Server hello (2): * SSL certificate problem: unable to get local issuer certificate * stopped the pause stream! * Closing connection 0 curl: (60) SSL certificate problem: unable to get local issuer certificate More details here: https://curl.haxx.se/docs/sslcerts.html curl failed to verify the legitimacy of the server and therefore could not establish a secure connection to it. To learn more about this situation and how to fix it, please visit the web page mentioned above.
unable to get local issuer certificate
とはローカル発行者証明書を取得できません
と書かれているみたいです。すなわち、https
の証明書の証明するルート証明書が取得できないみたいです。
そもそも、https通信における安全性の担保は暗号化通信とサーバーが安全であることを証明するSSLサーバー証明書が必要です。そのSSLサーバー証明書が安全かどうかを証明する認証局があります。その認証局をリスト化したルート証明書があるのですが、ブラウザやソフトウェアにはデフォルトでいくつかの認証局が記載されてはいるものの、全部の認証局を網羅しているわけではないみたいです。
今回はそのデフォルトのルート証明書内にそのurlの認証局が見当たらない?ようで、curlは通信を拒否したみたいです。
証明書を気にせず通信するという方法もあり、curl -k (該当url)
とするみたいです。
ちょっと気になったのは今回のその認証局そのものが本当に信用できるのかというところで、私にはなんとも判断できませんでした。某有名なレンタルサーバー屋さんにも使われているみたいですが、それが必ずしも信用に値するとは限らないですし。
証明書の追加方法は以下のURLを見てみてください。