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.
当前回答
我在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,除非你添加额外的自动化。
我添加这个答案是因为在我甚至懒得深入研究插件源代码之前,我已经认为我在我的设置中做了一些错误或不稳定的事情。希望这可以为正在做类似事情的人节省一些时间。
其他回答
特别对于Windows用户,使用curl-7.57.0-win64-mingw或类似版本。
这有点晚了,现有的答案是正确的。但我还是得费点劲才能让它在我的Windows电脑上运行,不过这个过程其实相当简单。所以,分享一步一步的过程。
这个错误基本上意味着,curl无法验证目标URI的证书。如果您信任证书的颁发者(CA),则可以将其添加到受信任证书列表。
为此,浏览URI(例如在Chrome上)并遵循步骤
Right click on the secure padlock icon Click on certificate, it'll open a window with the certificate details Go to 'Certification Path' tab Click the ROOT certificate Click View Certificate, it'll open another certificate window Go to Details tab Click Copy to File, it'll open the export wizard Click Next Select 'Base-64 encoded X.509 (.CER)' Click Next Give a friendly name e.g. 'MyDomainX.cer' (browse to desired directory) Click Next Click Finish, it'll save the certificate file Now open this .cer file and copy the contents (including -----BEGIN CERTIFICATE----- and -----END CERTIFICATE-----) Now go to the directory where curl.exe is saved e.g. C:\SomeFolder\curl-7.57.0-win64-mingw\bin Open the curl-ca-bundle.crt file with a text editor Append the copied certificate text to the end of the file. Save
现在,您的命令应该在curl中正常执行。
它失败了,因为cURL无法验证服务器提供的证书。
有两个选项可以让它工作:
使用带-k选项的cURL,允许cURL建立不安全的连接,即cURL不验证证书。 将根CA(签署服务器证书的CA)添加到/etc/ssl/certs/ca-certificates.crt
您应该使用选项2,因为它是确保您连接到安全FTP服务器的选项。
这是ssh证书存储问题。请先从目标CA网站下载有效的证书pem文件,再构建软链接文件指示ssl信任证书。
openssl x509 -hash -noout -in DigiCert_Global_Root_G3.pem
您将得到dd8e9d41
使用散列号构建solf链接,并以.0(点- 0)作为文件后缀
DD8E9D41.0
然后再试一次。
简单的解决方案: 在~ /。Sdkman /etc/config, change sdkman_insecure_ssl=true
步骤: 纳米~ / .sdkman / etc /配置 将sdkman_insecure_ssl=false修改为sdkman_insecure_ssl=true 保存并退出
我们最近遇到了这个错误。事实证明,这与根证书没有正确安装在CA存储目录有关。我使用了一个curl命令,其中我直接指定了CA目录。Curl——cacert /etc/test/server。—capath /etc/test…此命令每次都失败,curl: (60) SSL证书问题:无法获得本地颁发者证书。
在使用strace curl…根据openssl哈希命名约定,curl正在查找名称为60ff2731.0的根证书文件。所以我发现这个命令可以有效地导入根证书:
Ln -s rootcert。pem的openssl x509散列-noout——rootcert.pem ' 0
哪个会创建软链接
60f2731.0 ->找到脚
卷曲,在被子下读取服务器。pem,确定根证书文件的名称(rootcert.pem),将其转换为其哈希名称,然后进行操作系统文件查找,但无法找到它。
因此,结论是,当curl错误很模糊时,在运行curl时使用strace(这是一个巨大的帮助),然后确保使用openssl命名约定正确安装根证书。
推荐文章
- 我需要做什么才能使ie8接受自签署证书?
- 使用请求包时出现SSL InsecurePlatform错误
- BEGIN RSA PRIVATE KEY与BEGIN PRIVATE KEY的区别
- 从URL执行bash脚本
- 你从哪里包含jQuery库?谷歌JSAPI吗?CDN吗?
- Ruby Bundle Symbol not found: _SSLv2_client_method (LoadError)
- PHP中的cURL是什么?
- 错误:无法验证nodejs中的第一个证书
- 对bash脚本函数中定义的变量使用curl POST
- 没有为Android SSL连接找到信任锚
- 抓取:SSL: CERTIFICATE_VERIFY_FAILED错误http://en.wikipedia.org
- 使用curl POST multipart/form-data的正确方法是什么?
- 使用.htaccess和mod_rewrite强制SSL/https
- PHP -调试Curl
- (1) libcurl不支持或禁用https协议