cURLを介したプッシュキット通知の送信-curl:(60)SSL証明書の問題:ローカル発行者証明書を取得できません

ネイブドカーン

私はcURLAppleにプッシュキット通知を送信するために使用します。私のRailsコードは次のようになります:

curl --http2 -v -d '#{payload.to_json}' --cert #{pem} #{pushkit_base_uri}/#{registration_id}

2 0201年1月19日以降、Ubuntuでこのコマンドを実行すると次のようになります。

...
...
...

* SSL certificate problem: unable to get local issuer certificate
* stopped the pause stream!
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
* Closing connection 0
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.

私はこれまでに次の解決策を試しました。

  1. update-ca-certificates(ドキュメントはこちら
  2. ここにリストされているソリューション

私はまだこれを機能させることができていません。どんな助けでもありがたいです、そして私が解決策を見つけたら私はこの投稿を更新します。

ネイブドカーン

TLDRの最後までスクロールします。

実行awk -v cmd='openssl x509 -noout -subject' '/BEGIN/{close(cmd)};{print | cmd}' < /etc/ssl/certs/ca-certificates.crt | lessすることで、OSによって信頼されているすべての機関のリストを表示できます。

...
...
...
subject=C = PL, O = Unizeto Technologies S.A., OU = Certum Certification Authority, CN = Certum Trusted Network CA
subject=C = PL, O = Unizeto Technologies S.A., OU = Certum Certification Authority, CN = Certum Trusted Network CA 2
subject=C = EU, L = Madrid (see current address at www.camerfirma.com/address), serialNumber = A82743287, O = AC Camerfirma S.A., CN = Chambers of Commerce Root - 2008
subject=C = GB, ST = Greater Manchester, L = Salford, O = Comodo CA Limited, CN = AAA Certificate Services
subject=O = "Cybertrust, Inc", CN = Cybertrust Global Root
subject=C = DE, O = D-Trust GmbH, CN = D-TRUST Root Class 3 CA 2 2009
subject=C = DE, O = D-Trust GmbH, CN = D-TRUST Root Class 3 CA 2 EV 2009
subject=O = Digital Signature Trust Co., CN = DST Root CA X3
...
...
...

そしてapi.push.apple.comFirefoxで開くことで、彼らの証明書を調べることができます。

FirefoxでのApple証明書の詳細

ブラウザが最後に更新された日時に応じて、CAストアは、サイトが安全であると表示される場合と表示されない場合があります。Apple IST CA 2 - G1証明書がによって発行されたことがわかりGeoTrust Global CAます。OSで信頼できるCAのリストを検索しても、これらの用語はどちらも結果を返しません。

この問題を解決するために、api-push-apple-com-chain.pemFirefoxで利用可能なメイドをダウンロードして、次のようにcURLリクエストするときに使用できます

curl --cacert '#{ca_cert}' --http2 -v -d ...

これで問題が解決し、リクエストが成功しましたが、先に進んで、この問題が発生し始めた理由を理解することができます。見てみると/etc/ca-certificates.conf、いくつかのGeoTrustCAが信頼できないとマークされていることがわかります。(行頭の強打に注意してください)

...
...
 !mozilla/GeoTrust_Global_CA.crt
 !mozilla/GeoTrust_Primary_Certification_Authority.crt
 mozilla/GeoTrust_Primary_Certification_Authority_-_G2.crt
 !mozilla/GeoTrust_Primary_Certification_Authority_-_G3.crt
 !mozilla/GeoTrust_Universal_CA.crt
 !mozilla/GeoTrust_Universal_CA_2.crt
...
...

On some googling, we find this ticket and this wiki.

In accordance with the consensus proposal that was adopted in 2017, Mozilla began to distrust Symantec (including GeoTrust, RapidSSL, and Thawte) certificates issued before 1-June 2016 starting in Firefox 60, and plans to distrust Symantec certificates regardless of the date of issuance starting in Firefox 64, unless they are issued by whitelisted subordinate CAs that have the following SHA-256 Subject Public Key hashes (subjectPublicKeyInfo):

It also includes a list of Apple certificates whitelisted:

c0554bde87a075ec13a61f275983ae023957294b454caf0a9724e3b21b7935bc
56e98deac006a729afa2ed79f9e419df69f451242596d2aaf284c74a855e352e
7289c06dedd16b71a7dcca66578572e2e109b11d70ad04c2601b6743bc66d07b
fae46000d8f7042558541e98acf351279589f83b6d3001c18442e4403d111849
b5cf82d47ef9823f9aa78f123186c52e8879ea84b0f822c91d83e04279b78fd5
e24f8e8c2185da2f5e88d4579e817c47bf6eafbc8505f0f960fd5a0df4473ad3
3174d9092f9531c06026ba489891016b436d5ec02623f9aafe2009ecc3e4d557

which makes it possible for us to open the URLs securely on firefox. ( Not on Firefox Developer Version for some reason )

TLDR: Use the attached file as --cacert with your cURL command.

この記事はインターネットから収集されたものであり、転載の際にはソースを示してください。

侵害の場合は、連絡してください[email protected]

編集
0

コメントを追加

0

関連記事

Related 関連記事

ホットタグ

アーカイブ