LoginSignup
9
11

More than 1 year has passed since last update.

curl: (60) Peer's Certificate issuer is not recognized への対処方法

Last updated at Posted at 2019-10-06

CentOSを利用していて、yumやcurl、dockerを利用するときに
curl: (60) Peer's Certificate issuer is not recognized というエラーが表示された。

最終的には解決したが、意外と時間かかったのでメモ。

【一時的な回避策】

  1. curlの場合
  2. yumの場合

1. curl の場合

-k オプションをつけて、強制的に接続する
ただし、一時的なエラー回避策に過ぎない。

$ curl -k https://www.yahoo.co.jp

2. yumの場合

/etc/yum.conf に sslverify=false を追記。
こちらも、一時的なエラー回避策に過ぎない。

/etc/yum.conf
[main]
cachedir=/var/cache/yum/$basearch/$releasever
### 省略 ###
distroverpkg=centos-release
sslverify=false #<------- ここに記述

#  This is the default, if you make this bigger yum won't see if the metadata
# is newer on the remote and so you'll "gain" the bandwidth of not having to
# download the new metadata and "pay" for it by yum not having correct
# information.

【解決策】CA証明書のインストール

探し方が悪かったか、結局はこの方法で解決した。
原因は、社内に導入しているセキュリティソフトの設定。
ネットワークにアクセスするときに、指定のCA証明書がないとダメだったようです。

【手順】

  1. CA証明書をもらう
  2. CA証明書を配置
  3. コマンド実行、確認

1. CA証明書をもらう

社内のセキュリティ担当者やネットワーク担当者に相談し、
curl:(60) Peer's...が発生して通信できないことを伝え、CA証明書をもらいます。
(CA証明書のファイル名は mycacert.crt とします)

2. CA証明書を配置

もらったCA証明書は、/usr/share/pki/ca-trust-source/anchors/ に配置します。

$ sudo cp mycacert.crt /usr/share/pki/ca-trust-source/anchors/

3. コマンド実行、確認

update-ca-trustコマンドを実行し、念のため通信が正常かを確認します。
問題なければ、curl:(60) Peer's...のエラーが消え
同様のエラーが出ていたアプリケーションも問題解消するはずです。

$ sudo update-ca-trust extract
$ curl https://google.co.jp

Ubuntu20.04の場合(2021-09-30追記)

Ubuntuの場合、CA証明書のインストールは下記のようにする
update-ca-certificatesコマンドを実行した時に、1 added のように表示されたら成功

$ sudo mkdir /usr/local/share/ca-certificates/extra
$ sudo cp mycacert.crt /usr/local/share/ca-certificates/extra
$ sudo update-ca-certificates 

Updating certificates in /etc/ssl/certs...
1 added, 0 removed; done.
Running hooks in /etc/ca-certificates/update.d...
done.

その他

  • CA証明書とは
    • Certificate Authority certificate
    • 日本語訳は、「(公開鍵証明書)認証局の証明書」
    • 所有者はパブリックキーに対応したプライベートキーの持ち主と証明できる
    • 認証局は、セキュリティベンダーや公的機関など多岐にわたる
    • 適用例:CA証明書の所有者に限定したサービスを提供したい

参考

9
11
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
9
11