root@sclrdev:/home/sclr/certs/FreshCerts# curl --ftp-ssl --verbose ftp://{abc}/ -u trup:trup --cacert /etc/ssl/certs/ca-certificates.crt
* About to connect() to {abc} port 21 (#0)
*   Trying {abc}...
* Connected to {abc} ({abc}) port 21 (#0)
< 220-Cerberus FTP Server - Home Edition
< 220-This is the UNLICENSED Home Edition and may be used for home, personal use only
< 220-Welcome to Cerberus FTP Server
< 220 Created by Cerberus, LLC
> AUTH SSL
< 234 Authentication method accepted
* successfully set certificate verify locations:
*   CAfile: /etc/ssl/certs/ca-certificates.crt
  CApath: /etc/ssl/certs
* SSLv3, TLS handshake, Client hello (1):
* SSLv3, TLS handshake, Server hello (2):
* SSLv3, TLS handshake, CERT (11):
* SSLv3, TLS alert, Server hello (2):
* SSL certificate problem: unable to get local issuer certificate
* Closing connection 0
curl: (60) SSL certificate problem: unable to get local issuer certificate
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.

当前回答

由于conda环境,一些系统可能存在此问题。如果你安装了conda,那么禁用它可以解决你的问题。在我的情况下,当我停用conda时,这个curl-SSL错误得到了解决。在ubuntu或MacOS上试试这个命令

conda deactivate

其他回答

没有一个答案提到,可能是连接到内部vpn的角色,我以前遇到过这个问题,并要求在专用网络上

是的,您还需要添加一个CA证书。在Node.js中添加一个代码片段以获得更清晰的视图。

var fs = require(fs)
var path = require('path')
var https = require('https')
var port = process.env.PORT || 8080;
var app = express();

https.createServer({
key: fs.readFileSync(path.join(__dirname, './path to your private key/privkey.pem')),
cert: fs.readFileSync(path.join(__dirname, './path to your certificate/cert.pem')),
ca: fs.readFileSync(path.join(__dirname, './path to your CA file/chain.pem'))}, app).listen(port)

对我来说,简单地安装证书有帮助:

sudo apt-get install ca-certificates

我在Wordpress安装上试图通过ElasticPress和AWS ACM PCA管理的自签名根CA与内部ElasticSearch服务通信,已经为这个问题困扰了几天。

在我的特殊情况下,我从默认的cURL传输以及预期的正文中收到了200 OK响应,但Wordpress返回了一个WP_Error对象,ElasticPress由于这个证书问题而获得,但从未记录。

说到Wordpress,有两件事值得注意:

The default cURL Transport for all wp_remote_* calls will look to a CA Bundle located in wp-includes/certificates/ca-bundle.crt. This bundle serves largely the same purpose as what's found under https://curl.haxx.se/docs/caextract.html, and will cover most use-cases that don't typically involve more exotic setups. Action/Filter order matters in Wordpress, and in ElasticPress' case, many of its own internal functions leverage these remote calls. The problem is, these remote calls were being executed during the plugins_loaded lifecycle, which is too early for Theme logic to be able to override. If you're using any plugins that make external calls out to other services and you need to be able to modify the requests, you should take careful note as to WHEN these plugins are performing these requests.

这意味着,即使在主题中定义了正确的服务器设置、钩子、回调和逻辑,你仍然可能以一个坏的设置结束,因为底层插件调用在主题加载之前执行得很好,并且永远无法告诉Wordpress关于新证书的信息。

在Wordpress应用程序中,我知道只有两种方法可以在不更新核心或第三方代码逻辑的情况下规避这个问题:

(推荐)添加一个“必须使用”插件到您的安装,调整您需要的设置。MU插件是Wordpress生命周期中最早加载的,可以让你在不直接改变它们的情况下覆盖你的插件和核心。在我的例子中,我用下面的逻辑建立了一个简单的MU插件:

// ep_pre_request_args is an ElasticPress-specific call that we need to adjust for all outbound HTTP requests
add_filter('ep_pre_request_args', function($args){
    if($_ENV['ELASTICSEARCH_SSL_PATH'] ?? false) {
        $args['sslcertificates'] = $_ENV['ELASTICSEARCH_SSL_PATH'];
    }
    return $args;
});

(不推荐)如果你实在没有其他选择,你也可以将根CA附加到wp-includes/certificates/ CA -bundle.crt。这似乎会“纠正”潜在的问题,你将得到正确的SSL证书验证,但这种方法将失败每次更新Wordpress,除非你添加额外的自动化。

我添加这个答案是因为在我甚至懒得深入研究插件源代码之前,我已经认为我在我的设置中做了一些错误或不稳定的事情。希望这可以为正在做类似事情的人节省一些时间。

到目前为止,我看到这个问题在公司网络中发生,有两个原因,其中一个或两个都可能发生在你的情况中:

由于网络代理的工作方式,它们有自己的SSL证书,从而改变了curl看到的证书。许多或大多数企业网络强制您使用这些代理。 在客户端电脑上运行的一些防病毒程序也类似于HTTPS代理,这样它们就可以扫描你的网络流量。您的防病毒程序可能有禁用此功能的选项(假设您的管理员允许)。

作为旁注,上面的第2条可能会让您对被扫描的本应安全的TLS通信感到不安。这就是你的公司世界。