LoginSignup
70
56

More than 5 years have passed since last update.

CentOS6.xのlibcurlが古くてcurl: (35) SSL connect errorが発生する件

Posted at

決済サービス等のモジュールにアクセスする際、curlでリクエストを送る場合、CentOS6.xのyumでインストール出来るlibcurlは古く、'curl: (35) SSL connect error'が発生してしまいます。
(調べると7.36.0でsslv3のdefault設定は無効になっていました。)

[vagrant@localhost ~]$ cat /etc/redhat-release
CentOS release 6.7 (Final)

[vagrant@localhost ~]$ yum info libcurl
読み込んだプラグイン:fastestmirror
Loading mirror speeds from cached hostfile
 * base: www.ftp.ne.jp
 * epel: ftp.riken.jp
 * extras: www.ftp.ne.jp
 * updates: www.ftp.ne.jp
インストール済みパッケージ
名前                : libcurl
アーキテクチャ      : x86_64
バージョン          : 7.19.7
リリース            : 46.el6
容量                : 339 k
リポジトリー        : installed
提供元リポジトリー  : base
要約                : A library for getting files from web servers
URL                 : http://curl.haxx.se/
ライセンス          : MIT
説明                : This package provides a way for applications to use FTP, HTTP, Gopher and
                    : other servers for getting files.

利用可能なパッケージ
名前                : libcurl
アーキテクチャ      : i686
バージョン          : 7.19.7
リリース            : 46.el6
容量                : 175 k
リポジトリー        : base
要約                : A library for getting files from web servers
URL                 : http://curl.haxx.se/
ライセンス          : MIT
説明                : This package provides a way for applications to use FTP, HTTP, Gopher and
                    : other servers for getting files.

コマンドラインで --tlsv1.2 オプションを付ければsslv3を使用せずにtlsvを使用できる訳ですが配布されている決済サービスから提供されているライブラリ等を変更するのも良いことだとは思っていません。

対応方法

結論としてlibcurlをアップデートするんですが、ソースから入れるのは嫌だったので、別のリポジトリを使用します。

City-Fan.org

CentOS6.x
sudo rpm -Uvh http://www.city-fan.org/ftp/contrib/yum-repo/city-fan.org-release-1-13.rhel6.noarch.rpm

デフォルトでenabled=1になっているので0にしておきましょう。

[vagrant@localhost ~]$ sudo vim /etc/yum.repos.d/city-fan.org.repo

[city-fan.org]
name=city-fan.org repository for Red Hat Enterprise Linux (and clones) $releasever ($basearch)
#baseurl=http://mirror.city-fan.org/ftp/contrib/yum-repo/rhel$releasever/$basearch
mirrorlist=http://mirror.city-fan.org/ftp/contrib/yum-repo/mirrorlist-rhel$releasever
#enabled=1
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-city-fan.org

--enablerepo=city-fan.org をつけてlibcurlをアップデートします。

[vagrant@localhost ~]$ sudo yum update --enablerepo=city-fan.org libcurl

libcurlが最新版にアップデートされ問題が解決されるはずです。

[vagrant@localhost ~]$ yum info libcurl
読み込んだプラグイン:fastestmirror
Loading mirror speeds from cached hostfile
 * base: www.ftp.ne.jp
 * epel: ftp.riken.jp
 * extras: www.ftp.ne.jp
 * updates: www.ftp.ne.jp
インストール済みパッケージ
名前                : libcurl
アーキテクチャ      : x86_64
バージョン          : 7.46.0
リリース            : 2.0.cf.rhel6
容量                : 457 k
リポジトリー        : installed
提供元リポジトリー  : city-fan.org
要約                : A library for getting files from web servers
URL                 : http://curl.haxx.se/
ライセンス          : MIT
説明                : libcurl is a free and easy-to-use client-side URL transfer library, supporting
                    : FTP, FTPS, HTTP, HTTPS, SCP, SFTP, TFTP, TELNET, DICT, LDAP, LDAPS, FILE, IMAP,
                    : SMTP, POP3 and RTSP. libcurl supports SSL certificates, HTTP POST, HTTP PUT,
                    : FTP uploading, HTTP form based upload, proxies, cookies, user+password
                    : authentication (Basic, Digest, NTLM, Negotiate, Kerberos4), file transfer
                    : resume, HTTP proxy tunneling and more.

利用可能なパッケージ
名前                : libcurl
アーキテクチャ      : i686
バージョン          : 7.19.7
リリース            : 46.el6
容量                : 175 k
リポジトリー        : base
要約                : A library for getting files from web servers
URL                 : http://curl.haxx.se/
ライセンス          : MIT
説明                : This package provides a way for applications to use FTP, HTTP, Gopher and
                    : other servers for getting files.

すでにPHP等で使用している場合にはhttpdのリスタートもやっておいた方がいいかもしれません。

70
56
1

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
70
56