Owe*_*Nel 9 curl ssl-certificate mutual-authentication
我正在尝试对第三方服务器执行 cUrl。他们为我提供了一个 p12 文件,我将其安装在浏览器中。使用浏览器时,我收到服务器的响应。从 Linux 终端执行 cUrl 时,出现握手错误。
我将 .p12 提取到密钥和证书,然后运行以下命令:
curl --key client.key --cert client.crt -X GET -v https://x.x.x.x:xxxx/folder/endpoint
并得到如下回复:
Note: Unnecessary use of -X or --request, GET is already inferred.
* Trying x.x.x.x...
* TCP_NODELAY set
* Connected to x.x.x.x (x.x.x.x) port xxxx (#0)
* ALPN, offering h2
* ALPN, offering http/1.1
* successfully set certificate verify locations:
* CAfile: /etc/ssl/certs/ca-certificates.crt
CApath: /etc/ssl/certs
* TLSv1.2 (OUT), TLS handshake, Client hello (1):
* TLSv1.2 (IN), TLS handshake, Server hello (2):
* TLSv1.2 (IN), TLS handshake, Certificate (11):
* TLSv1.2 (OUT), TLS alert, Server hello (2):
* SSL certificate problem: unable to get local issuer certificate
* stopped the pause stream!
* 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.
Run Code Online (Sandbox Code Playgroud)
我需要在某处添加自签名证书吗?我觉得我失去了一些东西。如前所述,它可以在导入证书的浏览器中运行,因此我确信他们的证书没有问题。我知道我错过了一些东西。
谢谢,
San*_*512 13
--cacert是的,如果您下载了它或自签名证书(在我的情况下),您需要向curl命令添加选项
curl --key client.key --cert client.crt --cacert bundle.pem -X GET -v https://x.x.x.x:xxxx/folder/endpoint。
具有bundle.pemserver.crt 和 rootCA.crt。
cat server.crt rootCA.crt >> bundle.pem
| 归档时间: |
|
| 查看次数: |
23134 次 |
| 最近记录: |