LoginSignup
1
2

More than 3 years have passed since last update.

MacでSSL CA(認証局)証明書インストールする方法が解らない。(2020年に解決)

Last updated at Posted at 2018-04-08

2018年4月頃 作成
2020-08-12 更新

MacOSX 10.8.5
HomeBrewをインストール不可能なMacOSX 10.8.5マシンがある。

OpenSSL 1.0.2o 27 Mar 2018
ruby 2.4.4p296 (2018-03-28 revision 63013) [x86_64-darwin12.6.0]
curl 7.59.0 (x86_64-apple-darwin12.6.0) libcurl/7.59.0 OpenSSL/1.0.2o zlib/1.2.11
Release-Date: 2018-03-14

1. HomeBrewインストールコマンドを実行しても、エラーになる。

$ /usr/local/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
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.

2. opensslの証明書を更新。

ruby -ropenssl -e "p OpenSSL::X509::DEFAULT_CERT_FILE"
に出力されるディレクトリを
/usr/local/xxxxxxxxxx/xxxxxx/cert.pem
だとすると、
sudo wget -O /usr/local/xxxxxxxxxx/xxxxxx/cert.pem http://curl.haxx.se/ca/cacert.pem
としても1のエラーは変わらない。

3. (追記)エラーが変わった。

時間を変えてやってみたところエラーが変わった。
sudo wget -O /usr/local/xxxxxxxxxx/xxxxxx/cert.pem http://curl.haxx.se/ca/cacert.pem
今まではなんだったのか?更新されていなかったのか?

--2018-04-09 xx:xx:16--  http://curl.haxx.se/ca/cacert.pem
Resolving curl.haxx.se... 151.101.74.49, 2a04:4e42:11::561
Connecting to curl.haxx.se|151.101.74.49|:80... connected.
HTTP request sent, awaiting response... 301 Moved Permanently
Location: https://curl.haxx.se/ca/cacert.pem [following]
--2018-04-09 xx:xx:17--  https://curl.haxx.se/ca/cacert.pem
Connecting to curl.haxx.se|151.101.74.49|:443... connected.
ERROR: cannot verify curl.haxx.se's certificate, issued by 'CN=GlobalSign CloudSSL CA - SHA256 - G3,O=GlobalSign nv-sa,C=BE':
  Unable to locally verify the issuer's authority.
To connect to curl.haxx.se insecurely, use `--no-check-certificate'.

wget に --no-check-certificateを付けろとでている。

$ sudo wget --no-check-certificate /usr/local/xxxxxxxxxx/xxxxxx/cert.pem http://curl.haxx.se/ca/cacert.pem
/usr/local/xxxxxxxxxx/xxxxxx/cert.pem: Scheme missing.
--2018-04-09 xx:xx:55--  http://curl.haxx.se/ca/cacert.pem
Resolving curl.haxx.se... 151.101.74.49, 2a04:4e42:11::561
Connecting to curl.haxx.se|151.101.74.49|:80... connected.
HTTP request sent, awaiting response... 301 Moved Permanently
Location: https://curl.haxx.se/ca/cacert.pem [following]
--2018-04-09 xx:xx:55--  https://curl.haxx.se/ca/cacert.pem
Connecting to curl.haxx.se|151.101.74.49|:443... connected.
WARNING: cannot verify curl.haxx.se's certificate, issued by 'CN=GlobalSign CloudSSL CA - SHA256 - G3,O=GlobalSign nv-sa,C=BE':
  Unable to locally verify the issuer's authority.
HTTP request sent, awaiting response... 200 OK
Length: 215556 (211K) [application/x-pem-file]
Saving to: 'cacert.pem'

cacert.pem                   100%[=============================================>] 210.50K  --.-KB/s    in 0.02s   

2018-04-09 16:00:55 (8.60 MB/s) - 'cacert.pem' saved [215556/215556]

FINISHED --2018-04-09 16:00:55--
Total wall clock time: 0.8s
Downloaded: 1 files, 211K in 0.02s (8.60 MB/s)

これで更新されたようだ。#4以降は未だに不明。

4. 【質問】Macで、SSL CA(認証局)証明書インストールする方法が解らない。

SSL CA(認証局)証明書が古くてcurl がエラーになる件
サーバのSSL CA(認証局)証明書が古くてcurl がエラーになる件 - うまいぼうぶろぐ

上記URLの内容をMacで行うにはどうすれば良いのかが解らない。

参考URL

プライベート認証局のCA証明書を追加する(Windows・Mac OS X・CentOS 7・Ubuntu Server16.04) | 俺的備忘録 〜なんかいろいろ〜

プライベート認証局を構築してLAN内で利用する証明書を発行する | 俺的備忘録 〜なんかいろいろ〜

Mac OS X にインストールされているルート証明書の確認方法 | Webセキュリティの小部屋

[Ruby] open-uri の HTTPS リクエストで certificate verify failed | mofu犬blog

1
2
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
1
2