【问题标题】:SSL Handshake error using Curl to POST a file to a web service使用 Curl 将文件 POST 到 Web 服务的 SSL 握手错误
【发布时间】:2018-03-24 12:21:43
【问题描述】:

我一直在玩 Curl,尝试将文件简单 POST 到 Web 服务几天,但没有成功。

目标 POST 服务是未经身份验证的 HTTPS。尝试通过 Curl 或 Informatica 运行我的 POST 请求时,两种方法都出现 SSL 握手失败。

例如:

curl -X POST -F 'file=@filename.dat' https://url

我已经能够使用 Postman 让它工作,所以我知道该服务有效。根据网络安全,在此环境中禁用 SSL。我运气不好,还是有办法在没有 SSL 的情况下让它工作?

遇到的具体错误: curl:(35)错误:14077410:SSL例程:SSL23_GET_SERVER_HELLO:sslv3警报握手失败

【问题讨论】:

  • 并且还提供任何错误信息、错误文本或代码等。

标签: ssl curl


【解决方案1】:

默认情况下,建立 HTTPS URL 连接的客户端会检查 SSL 证书的有效性 - 否则,使用 SSL 有什么意义?

在您的情况下,您是在说“假装使用 HTTPS 但实际上,忽略证书”,因为它无效,或者您仍在获得证书,或者您处于开发阶段(我希望后者是正确的,并且在需要时获取或创建有效的服务器证书)。

curl 不知道这一点。假设您要求它与 HTTPS 端点建立连接 - 因此它将尝试验证证书 - 在您的情况下,这可能是失败的根源。

试试curl -k -X POST -F 'file=@filename.dat' https://url 从手册页:

-k, --insecure
          (TLS) By default, every SSL connection curl makes is verified to be secure. This option allows curl to proceed and operate even for server connections otherwise considered insecure.

          The server connection is verified by making sure the server's certificate contains the right name and verifies successfully using the cert store.

          See this online resource for further details:
           https://curl.haxx.se/docs/sslcerts.html

          See also --proxy-insecure and --cacert.

【讨论】:

  • 我尝试了不安全的选项但没有成功,但我确实看到当前没有安装证书。我在 7.27 版本上运行,因此我会尝试让服务器团队将版本提升到 7.40 以上,以确保这不是唯一的问题。
猜你喜欢
  • 2016-08-31
  • 1970-01-01
  • 2019-01-09
  • 2016-06-10
  • 1970-01-01
  • 2017-02-11
  • 2016-11-19
  • 1970-01-01
  • 2016-05-02
相关资源
最近更新 更多