Ubuntu 通过cURL-cURL发送Pushkit通知:(60)SSL证书问题:无法获取本地颁发者证书
我使用Ubuntu 通过cURL-cURL发送Pushkit通知:(60)SSL证书问题:无法获取本地颁发者证书,ubuntu,ssl,curl,apple-push-notifications,pushkit,Ubuntu,Ssl,Curl,Apple Push Notifications,Pushkit,我使用cURL向Apple发送pushkit通知。我的Rails代码如下所示: curl--http2-v-d'{payload.to_json}'--cert{pem}{pushkit_base_uri}/{registration_id} 自20201年1月19日起,在Ubuntu上运行此命令将返回以下信息: ... ... ... * SSL certificate problem: unable to get local issuer certificate * stopped the
cURL
向Apple发送pushkit通知。我的Rails代码如下所示:
curl--http2-v-d'{payload.to_json}'--cert{pem}{pushkit_base_uri}/{registration_id}
自20201年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.
到目前为止,我已经尝试了以下解决方案:
更新ca证书
(文档)我还没能让它工作。非常感谢您的帮助,如果我找到解决方案,我将更新此帖子。滚动至TLDR的结尾 通过运行
awk-vcmd='opensslx509-noout-subject'/BEGIN/{close(cmd)};{print | cmd}
我们可以查看操作系统信任的所有权限的列表
...
...
...
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
...
...
...
通过在Firefox中打开api.push.apple.com
,我们可以检查他们的证书
根据浏览器上次更新其CA存储的时间,该站点可能会显示为安全站点,也可能不会显示为安全站点。我们看到,Apple IST CA 2-G1
证书是由GeoTrust Global CA
颁发的。在我们的操作系统中搜索受信任CA列表时,这两个术语都不会返回结果
为了解决这个问题,我们可以下载Firefox提供的api push apple com chain.pem
maid,然后在发出cURL
请求时使用它,如下所示:
curl--cacert'{ca#u cert}'--http2-v-d…
虽然这解决了我们的问题,我们的请求也成功了,但我们可以继续尝试并理解为什么会出现这个问题。查看/etc/ca certificates.conf
,我们发现有几个GeoTrust ca被标记为不可信。(注意行开始处的砰砰声)
在谷歌上,我们找到了这个和这个
根据2017年通过的共识提案,Mozilla开始不信任2016年6月1日至6月1日之前在Firefox 60上发布的赛门铁克(包括GeoTrust、RapidSSL和Thawte)证书,并计划不信任从Firefox 64上发布的赛门铁克证书,除非它们是由具有以下SHA-256主题公钥散列(subjectPublicKeyInfo)的白名单下级CA发布的:
它还包括白名单上的苹果证书列表:
c0554bde87a075ec13a61f275983ae023957294b454caf0a9724e3b21b7935bc
56e98deac006a729afa2ed79f9e419df69f451242596d2aaf284c74a855e352e
7289c06dedd16b71a7dcca66578572e2e109b11d70ad04c2601b6743bc66d07b
fae46000d8f7042558541e98acf351279589f83b6d3001c18442e4403d111849
b5cf82d47ef9823f9aa78f123186c52e8879ea84b0f822c91d83e04279b78fd5
e24f8e8c2185da2f5e88d4579e817c47bf6eafbc8505f0f960fd5a0df4473ad3
3174d9092f9531c06026ba489891016b436d5ec02623f9aafe2009ecc3e4d557
这使得我们能够在firefox上安全地打开URL。(由于某些原因,Firefox开发人员版本上没有)
TLDR:在cURL
命令中使用as--cacert
c0554bde87a075ec13a61f275983ae023957294b454caf0a9724e3b21b7935bc
56e98deac006a729afa2ed79f9e419df69f451242596d2aaf284c74a855e352e
7289c06dedd16b71a7dcca66578572e2e109b11d70ad04c2601b6743bc66d07b
fae46000d8f7042558541e98acf351279589f83b6d3001c18442e4403d111849
b5cf82d47ef9823f9aa78f123186c52e8879ea84b0f822c91d83e04279b78fd5
e24f8e8c2185da2f5e88d4579e817c47bf6eafbc8505f0f960fd5a0df4473ad3
3174d9092f9531c06026ba489891016b436d5ec02623f9aafe2009ecc3e4d557