0

在我的公司,我正在慢慢地从一个专属的开发人员角色转变为更多的混合 DevOps 角色。这意味着我对很多东西都很陌生,请放轻松... :-p

我的客户的服务器运行的是 Ubuntu 16.04,带有 PHP 5.6.4,并且在他们网站的管理门户中有一个功能,它运行一个curl命令(基本上)返回到自身以进行某种文件同步。它已经失败了一段时间(几周/几个月)。问题(我认为)是证书验证失败,因此该功能正在死亡。

当我 ssh 进入服务器时,我可以轻松地蜷缩到没有问题的任何地方(Google、example.org 等)。但试图只是一个基本的 curl 到网站的主要 url borks

$ curl -v https://www.[my-site-name].com

*   Trying [my-site-IP]...
* Connected to [my-site-name] ([my-site-IP]) port 443 (#0)
* found 258 certificates in /etc/ssl/certs/ca-certificates.crt
* found 908 certificates in /etc/ssl/certs/
* ALPN, offering http/1.1
* SSL connection using TLS1.2 / ECDHE_RSA_AES_128_GCM_SHA256
* server certificate verification failed. CAfile: /etc/ssl/certs/ca-certificates.crt CRLfile: none
* Closing connection 0
curl: (60) server certificate verification failed. CAfile: /etc/ssl/certs/ca-certificates.crt CRLfile: none
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 以-k使其不安全,但我很犹豫。我想第一个问题是,我是否应该担心使用不安全标志运行它,因为它在技术上根本不会离开服务器?我已经在我们的一个运行 Ubuntu 18.x 的较新机器上以及运行 v20 的 DigitalOcean 上测试了这个完全相同的 curl 命令,完全没有问题——外部和内部卷曲都很好。

我什至可以在另一台服务器上,然后回到我遇到问题的服务器上,这也很好。

我已经尝试了我能想到的一切(诚然不多),但似乎没有任何效果。

  • 运行 curl 和 certbot 包的更新
  • 强迫update-ca-certificates
  • /etc/ssl/certs/cacert.pem添加到 php.ini 中的curl.cainfoopenssl.cafilevars

我知道这可能无关紧要,但为了完整起见,我还通过各种在线验证服务运行了该网站:

所有人都带着积极的结果回来了。唯一的负面(我猜)是 SSLLabs 给我们评分为“B”,因为显然 TLS 1.0 仍然处于启用状态。


任何帮助将不胜感激。我觉得阅读失败警告中提到的文档并没有那么有帮助。

建议/提示/技巧??

1000 提前谢谢你!

4

0 回答 0