LoginSignup
3
1

More than 3 years have passed since last update.

openssl最新版を参照しないcurlのconfigureオプションを改良(原因判明+根本解決に至らず)

Last updated at Posted at 2018-03-29

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

1.問題点

以下を参考にcurlをHomeBrewから入れた。
homebrewでinstlalしたOpenSSLが反映されず、OSX標準のOpenSSLが使用されてしまう場合の対処方法 - production.log
homebrewでinstallしたcurlがbrew cask install時のTLS1.2ではOSX標準のcurlが邪魔をしてうまく反映されなかった時の対処法 - production.log

ところが、2018年03月の時点で上記URLの内容を実行しても解決しない。
openssl 1.0.2oをインストールした後、curlをHomeBrewから入れても
curlがMacOSX標準のopenssl 0.9.8を参照してしまう。

前提条件1 .bash_profieの確認

export PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
(中略)
export PATH="/usr/local/sbin:$PATH"
export PATH="/usr/local/opt/openssl/bin:$PATH"
(中略)

前提条件2(2019年01月の今回はOpenSSL 1.0.2qに更新した)

~ $ which openssl
/usr/local/opt/openssl/bin/openssl
~ $ openssl version
OpenSSL 1.0.2q  20 Nov 2018

結論だけを書く。

2. 別マシンでHomeBrewが稼働したcurlのconfigure文を参考。

HomeBrewが実行するconfigureオプション

./configure --disable-silent-rules --prefix=/usr/local/Cellar/curl/7.59.0 --with-darwinssl --without-ca-bundle --without-ca-path --without-libssh2 --without-libmetalink --without-gssapi --without-librtmp --disable-ares

opensslをHomeBrewでインストールした為、
/usr/local/opt/openssl
であってほしいが、--with-darwinssl となっている。
MacOSX標準のopensslと推測。

3. configureオプションを改変してopensslが新しくなった。

tar xvfz curl-7.xx.0.tar.gz
cd curl-7.xx.0
HomeBrewが実行するcurlのconfigureを参考にして
今回、作成したconfigureオプション

$ ./configure --with-ssl=/usr/local/opt/openssl --disable-silent-rules --without-ca-bundle --without-ca-path --without-libssh2 --without-libmetalink --without-gssapi --without-librtmp --disable-ares

--with-ssl=/usr/local/opt/opensslを追加
--with-darwinssl を外した。後はmakeとmakeinstall。

$ curl --version
curl 7.59.0 (x86_64-apple-darwin13.4.0) libcurl/7.59.0 OpenSSL/1.0.2o zlib/1.2.11 libidn2/2.0.4
Release-Date: 2018-03-14
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtsp smb smbs smtp smtps telnet tftp
Features: AsynchDNS IDN IPv6 Largefile NTLM NTLM_WB SSL libz TLS-SRP UnixSockets HTTPS-proxy

2018年03月の時点でOpenSSL/1.0.2o を利用できている。

4.2019年1月 OpenSSL 1.0.2qに更新

homebrew、formulaを一部インストールし直した。

curlのダウンロードリンク - Download

tar xvfz curl-7.63.0.tar.gz
cd curl-7.63.0
(configureオプションで今回も、上述の対処をした。)
make
sudo make install
を行っただけである。
2019年01月の実行でも、OpenSSL/1.0.2q を利用できている。

$ curl --version
curl 7.63.0 (x86_64-apple-darwin13.4.0) libcurl/7.63.0 OpenSSL/1.0.2q zlib/1.2.5 libidn2/2.0.5
Release-Date: 2018-12-12
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtsp smb smbs smtp smtps telnet tftp
Features: AsynchDNS IDN IPv6 Largefile NTLM NTLM_WB SSL libz TLS-SRP UnixSockets HTTPS-proxy

5.補足

今回のcurlとopensslの更新において次のことが言える。
前回と同じくcurl 7.63.0をbrew install curlでインストール後、古いopensslを参照している。同じ問題が起き再現性がある。
homebrewが提供するconfigureオプションに問題があると思われる。

誰かhomebrew作者に報告して改善してほしい。

「brew link openssl --force とbrew install curl」は行っても駄目だった。
google検索してでてくる、「brew link openssl --force」は解決策として本当なのだろうか?未だによくわからない。
HomeBrewが10.9.5をサポートしてない事が原因かもしれない。
「brew install --with-openssl curl」などもNG。

2019年01月の時点で
openssl curl homebrew
openssl curl mac
でgoogle検索すると、curlが最新opensslを使わない問題が未だに多数見つかる。

以上

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