curl:(60)SSL证书:无法获得本地发行者证书

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. 

有关'SSL证书问题:无法获得本地发行者证书'的错误。 显然这适用于发送CURL请求的系统(并且没有服务器接收请求)

1)从https://curl.haxx.se/ca/cacert.pem下载最新的cacert.pem

2)将下面一行添加到php.ini中(如果这是共享主机,并且您无权访问php.ini,则可以将其添加到public_html中的.user.ini中)

curl.cainfo=/path/to/downloaded/cacert.pem

3)默认情况下,FastCGI进程将每隔300秒parsing一次新文件(如果需要的话,可以通过添加一些文件来改变频率,如https://ss88.uk/blog/fast-cgi-and-user-ini -files-the-new-htaccess / )

由于curl无法validation服务器提供的证书,因此失败。

有两个选项可以使这个工作:

  1. 使用curl和-k选项允许curl进行不安全连接,即curl不validation证书。

  2. 将根CA(签署服务器证书的CA)添加到etc/ssl/certs/ca-certificates.crt

您应该使用选项2作为确保您连接到安全FTP服务器的选项。

我通过在cURL脚本中添加一行代码解决了这个问题:

 curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); 

警告 :这使得请求绝对不安全(请参阅@YSU的答案)!

安装Git Extensions v3.48后有这个问题。 试图再次安装mysysgit,但同样的问题。 最后,必须禁用(请考虑安全隐患!)Git SSLvalidation:

 git config --global http.sslVerify false 

但如果你有一个域名证书更好地添加到(Win7的)

 C:\Program Files (x86)\Git\bin\curl-ca-bundle.crt 

在我的情况下,事实certificate,我正在试图用cURL消费的服务上安装我的证书的问题。 我未能将中间证书和根证书捆绑/连接到我的域证书 。 一开始并不明显,这是因为Chrome解决了问题,并且接受了证书,尽pipe没有中间和根证书。

捆绑证书后,一切按预期工作。 我是这样捆绑的

 $ cat intermediate.crt >> domain.crt 

并重复所有中间和根证书。

我们最近遇到了这个错误。 事实certificate,这与root证书没有正确安装在CA存储目录中有关。 我正在使用一个curl命令,我直接指定了CA dir。 curl --cacert /etc/test/server.pem --capath /etc/test ...这个命令每次都会失败curl:(60)SSL证书问题:无法获取本地颁发者证书。

在使用strace curl ...之后,确定curl正在寻找名称为60ff2731.0的根证书文件,该文件基于openssl hash命名传递。 所以我发现这个命令有效地导入根证书:

ln -s rootcert.pem`openssl x509 -hash -noout -in rootcert.pem`.0

这创build了一个软链接

60ff2731.0 – > rootcert.pem

curl下,读取server.pem证书,确定根证书文件(rootcert.pem)的名称,将其转换为哈希名称,然后执行操作系统文件查找,但找不到它。

因此,在curl错误模糊的情况下运行curl时使用strace(是一个巨大的帮助),然后一定要使用openssl命名约定来正确安装root cert。

这很可能是从服务器丢失的证书。

根 – >中程>服务器

服务器应至less发送服务器和中间件。

使用openssl s_client -showcerts -starttls ftp -crlf -connect abc:21来debugging问题。

如果只返回一个证书(自签名或签发),则必须select:

  1. 有固定的服务器
  2. 信任该证书并将其添加到您的CA证书商店(不是最好的主意)
  3. 禁用信任,例如curl -k (非常糟糕的想法)

如果服务器返回了多个,但不包括自签名(root)证书:

  1. 在您的CA商店中为此链安装CA(根)证书,例如发行者谷歌。 ( 只有当你信任CA时)
  2. 将服务器固定为发送CA作为链的一部分
  3. 信任链中的证书
  4. 禁用信任

如果服务器返回根CA证书,那么它不在您的CA商店中,您的选项是:

  1. 加(信任)它
  2. 禁用信任

我已经忽略了过期/撤销证书,因为没有消息指出它。 但是您可以使用openssl x509 -text来检查证书

鉴于你连接到家庭版( https://www.cerberusftp.com/support/help/installing-a-certificate/)ftp服务器,我将要说它是自签名的。;

请发布更多的细节,比如openssl的输出。

在Windows上,我遇到了这个问题。 curl是由mysysgit安装的,所以下载并安装最新的版本解决了我的问题。

否则,这些是如何更新您可以尝试的CA证书的体面指示 。

-k

(SSL)此选项明确允许curl执行“不安全的”SSL连接和传输。 从curl 7.10开始,所有的SSL连接都将通过使用默认安装的CA证书包来保证安全。 这使得所有认为“不安全”的连接都会失败,除非使用-k / – insecure。

man.cx/curl

是的,您还需要添加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) 

简单的解决scheme:在~/.sdkman/etc/config ,更改sdkman_insecure_ssl=true

脚步:
~/.sdkman/etc/config
sdkman_insecure_ssl=false更改为sdkman_insecure_ssl=true
保存并退出