cURL と Iceweasel は同じ CA を持っているにもかかわらず、TLS 証明書の妥当性に同意しません。

cURL と Iceweasel は同じ CA を持っているにもかかわらず、TLS 証明書の妥当性に同意しません。

Debian Jessie 8.4 GNU/Linux で証明書検証が一貫しない問題があります。氷のイタチ(DebianのFirefox派生)とカールURL関連https://profile.mensa.org.uk/contact.aspx

氷のイタチ

訪問するhttps://profile.mensa.org.uk/contact.aspxIceweaselを使用すると、エラーや警告は発生しません。アドレスバーの左側にある南京錠のアイコンをクリックし、[追加情報...]ボタンをクリックすると、次の内容を含むウィンドウが表示されます。

ウェブサイトのロゴ
ウェブサイト:profile.mensa.org.uk
所有者:このウェブサイトは独占情報を提供しません。
確認済み:地質信託工事

「証明書の表示」ボタンをクリックすると、「一般」と「詳細」という2つのタブがあるウィンドウが表示されます。 「全般」タブには、以下が表示されます。

この証明書は検証されており、次の目的で使用できます。
SSL クライアント証明書
SSL サーバー証明書
発行者
一般名(CN)profile.mensa.org.uk
組織(O)<証明書の一部ではありません>
組織単位(OU)GT91227394
シリアル番号06:26:4F
発行者
一般名(CN)RapidSSL SHA256 CA - G3
組織(O)GeoTrust Inc。
組織単位(OU)<証明書の一部ではない>
有効期間
2015年5月8日
開始 16年6月9日終了
指紋
SHA-256 指紋 9C:F3:D7:B8:96:D6:A5:BC:98:9E:F0:DE:26:63:BD:17:
C5:29:24:C9:02:A9:90: D3:A5:49:AB:10:5D:E8:C0:3C
SHA1 指紋

[詳細] タブをクリックすると、[証明書階層] フィールドに 3 つのレベルの階層が表示されます。

GeoTrust Global CA
  RapidSSL SHA256 CA - G3
    profile.mensa.org.uk

GeoTrust Global CAフィールドで項目を選択し、[エクスポート...]ボタンをクリックしてファイルに保存すると、期待~/Documents/organisations/mensa/geotrust_global_ca.pemどおりに機能します。指紋は次のとおりです。

$ openssl x509 -noout -in ~/Documents/organisations/mensa/geotrust_global_ca.pem -fingerprint
SHA1 Fingerprint=DE:28:F4:A4:FF:E5:B9:2F:A3:C5:03:D1:A3:49:A7:F9:96:2A:82:12

これをcURLと比較してみましょう。

カール

訪問するhttps://profile.mensa.org.uk/contact.aspxcURL を使用すると、証明書エラーが発生する可能性があります。以下は、ヘッダー情報のみを取得する詳細な出力です。

$ curl -v --head https://profile.mensa.org.uk/contact.aspx
* Hostname was NOT found in DNS cache
*   Trying 93.159.201.114...
* Connected to profile.mensa.org.uk (93.159.201.114) port 443 (#0)
* successfully set certificate verify locations:
*   CAfile: none
  CApath: /etc/ssl/certs
* SSLv3, TLS handshake, Client hello (1):
* SSLv3, TLS handshake, Server hello (2):
* SSLv3, TLS handshake, CERT (11):
* SSLv3, TLS alert, Server hello (2):
* SSL certificate problem: unable to get local issuer certificate
* Closing connection 0
curl: (60) SSL certificate problem: unable to get local issuer certificate
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). If the default
 bundle file isn't adequate, 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.

cURLは、HTTP経由のこのURLとHTTPS経由の他のドメインに対してうまく機能します。

$ curl --head http://profile.mensa.org.uk/contact.aspx
HTTP/1.1 302 Found
Date: Sat, 28 May 2016 14:30:56 GMT
Server: Microsoft-IIS/6.0
X-Powered-By: ASP.NET
X-AspNet-Version: 4.0.30319
Location: /login.aspx?target=%2fcontact.aspx
Set-Cookie: ASP.NET_SessionId=axylcyf2cep2lq4e3brkggln; path=/; HttpOnly
Set-Cookie: WebToolsParam= ; path=/; HttpOnly
Cache-Control: no-cache, no-store
Pragma: no-cache
Expires: -1
Content-Type: text/html; charset=utf-8
Content-Length: 151

$ curl --head https://www.mensa.org.uk
HTTP/1.1 200 OK
Date: Sat, 28 May 2016 12:39:56 GMT
Server: Apache
Pragma: no-cache
Expires: Sun, 19 Nov 1978 05:00:00 GMT
Cache-Control: store, no-cache, must-revalidate, post-check=0, pre-check=0
Set-Cookie: SESS4b296932593725667cea89bf7eb4e462=d10lbmrpju03rccsaftdemiai6; path=/; domain=.mensa.org.uk
Last-Modified: Sat, 28 May 2016 12:39:56 GMT
Content-Type: text/html; charset=utf-8

cURLの現在のバージョンに関する情報は次のとおりです。

$ curl -V
curl 7.38.0 (i586-pc-linux-gnu) libcurl/7.38.0 OpenSSL/1.0.1k zlib/1.2.8 libidn/1.29 libssh2/1.4.3 librtmp/2.3
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtmp rtsp scp sftp smtp smtps telnet tftp 
Features: AsynchDNS IDN IPv6 Largefile GSS-API SPNEGO NTLM NTLM_WB SSL libz TLS-SRP

/etc/ssl/certsIceweaselには独自のCAリポジトリがありますが、上記の詳細な出力に示すように、cURLはここで証明機関の証明書を見つけると思います。だから私の最初の考えは、cURLにアクセス中にエラーが発生したことです。https://profile.mensa.org.uk/contact.aspx/etc/ssl/certsIceweaselが認識するCA証明書が不足しているためですGeoTrust Global CA。しかし、私は発見した/etc/ssl/certs する適切な証明書が含まれています。

$ openssl x509 -noout -in /etc/ssl/certs/GeoTrust_Global_CA.pem -fingerprint
SHA1 Fingerprint=DE:28:F4:A4:FF:E5:B9:2F:A3:C5:03:D1:A3:49:A7:F9:96:2A:82:12

ご覧の~/Documents/organisations/mensa/geotrust_global_ca.pemとおり、上記のような指紋です。

だから何か他のことが起こっている必要があります。オプションで、cURL が両方の証明書の使用を強制しようとしましたが、--cacert失敗しました。

$ curl --cacert ~/Documents/organisations/mensa/geotrust_global_ca.pem --head https://profile.mensa.org.uk/contact.aspx
curl: (60) SSL certificate problem: unable to get local issuer certificate
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). If the default
 bundle file isn't adequate, 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.

$ curl --cacert /etc/ssl/certs/GeoTrust_Global_CA.pem --head https://profile.mensa.org.uk/contact.aspx
curl: (60) SSL certificate problem: unable to get local issuer certificate
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). If the default
 bundle file isn't adequate, 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.

私の主な質問は次のとおりです。cURLとIceweaselの間にこの不一致が発生するのはなぜですか?

2番目の質問は次のとおりです。これらの不一致は、Iceweaselおよび/またはcURLにバグがあることを意味しますか?

ベストアンサー1

profile.mensa.org.ukの証明書チェーンが正しく構成されていないようです。 Firefox プロファイルには不足している中間コンテンツがキャッシュされているため、機能します。カールはそれをキャッシュしません。

~に帰属マット・ノルドフ

おすすめ記事