Skip to content

Instantly share code, notes, and snippets.

@ashikawa
Last active August 29, 2015 13:55
Show Gist options
  • Save ashikawa/8728058 to your computer and use it in GitHub Desktop.
Save ashikawa/8728058 to your computer and use it in GitHub Desktop.
古い OpenSSL の GlobalSign ルート証明書期限切れ

古い OpenSSL の GlobalSign ルート証明書期限切れ

概要

影響する環境 : Cent 4,5 (古い OpenSSL モジュール、バージョンは未確認)

詳細 : 上記環境から GlobalSign を契約している SSL 環境へリクエストを投げた場合にエラーが帰る事がある
OS に入っている SSL 証明書とは関係ない事に注意

検証

$ cat /etc/redhat-release 
CentOS release 4.6 (Final)
$ openssl version
OpenSSL 0.9.7a Feb 19 2003
$ php -v
PHP 5.3.10 (cli) (built: Feb  4 2012 07:55:15) 
Copyright (c) 1997-2012 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2012 Zend Technologies

※ アクセス先のドメインはダミーです

wget

$ wget https://secure.example.com/
[1] 4215
secure.example.com をDNSに問いあわせています... 192.168.1.1
secure.example.com|192.168.1.1|:443 に接続しています... 接続しました。
エラー: secure.example.com の証明書の検証エラーです: certificate has expired
secure.example.com に安全の確認をしないで接続するには、`--no-check-certificate' を使ってください。
SSL による接続が確立できません。

curl

$ curl https://secure.example.com/
[1] 4140
$ curl: (60) SSL certificate problem, verify that the CA cert is OK. Details:
error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed
More details here: http://curl.haxx.se/docs/sslcerts.html

curl performs SSL certificate verification by default, using a "bundle"
 of Certificate Authority (CA) public keys (CA certs). The default
 bundle is named curl-ca-bundle.crt; you can specify an alternate file
 using the --cacert option.
If this HTTPS server uses a certificate signed by a CA represented in
 the bundle, the certificate verification probably failed due to a
 problem with the certificate (it might be expired, or the name might
 not match the domain name in the URL).
If you'd like to turn off curl's verification of the certificate, use
 the -k (or --insecure) option.

PHP file_get_contents

$ cat fgc.php 
<?php
ini_set( 'display_errors', 1 );
$ret = file_get_contents('https://secure.example.com/');
var_dump($ret);
$ php fgc.php
# サイトのレスポンスが普通に表示される

PHP curl

$ cat curl.php 
<?php
ini_set( 'display_errors', 1 );
$ch = curl_init('https://secure.example.com/');
$ret = curl_exec($ch);
if (curl_errno($ch)) {
    echo 'Curl error: ' . curl_error($ch) . PHP_EOL;
}
curl_close($ch);
var_dump($ret);
$ php curl.php 
Curl error: SSL certificate problem, verify that the CA cert is OK. Details:
error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed
bool(false)

まとめ

  • OS のバージョンを確認
  • ソースコードを curl で検索
  • PHP のエラーログを見よ
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment