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证书供应商那里得到的信息:

- abc.crt
- abc.pem
- abc-bunde.crt

在abc。CRT文件,只有一个证书:

-----BEGIN CERTIFICATE-----
/*certificate content here*/
-----END CERTIFICATE-----

如果我以这种格式提供它,浏览器将不会显示任何错误(Firefox),但我会得到curl:(60) SSL证书:无法获得本地颁发者证书错误时,我做curl请求。

要修复此错误,请检查abc-bunde。crt文件。你很可能会看到这样的东西:

-----BEGIN CERTIFICATE-----
/*additional certificate content here*/
-----END CERTIFICATE-----
-----BEGIN CERTIFICATE-----
/*other certificate content here*/
-----END CERTIFICATE-----
-----BEGIN CERTIFICATE-----
/*different certificate content here*/
-----END CERTIFICATE-----

这些是您的中级证书和根证书。发生错误是因为您提供给应用程序的SSL证书中缺少它们。

要修复此错误,请以以下格式合并这两个文件的内容:

-----BEGIN CERTIFICATE-----
/*certificate content here*/
-----END CERTIFICATE-----
-----BEGIN CERTIFICATE-----
/*additional certificate content here*/
-----END CERTIFICATE-----
-----BEGIN CERTIFICATE-----
/*other certificate content here*/
-----END CERTIFICATE-----
-----BEGIN CERTIFICATE-----
/*different certificate content here*/
-----END CERTIFICATE-----

请注意,证书之间、文件的末尾或开头没有空格。一旦您向应用程序提供了这个组合证书,您的问题就会得到解决。

其他回答

我们最近遇到了这个错误。事实证明,这与根证书没有正确安装在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命名约定正确安装根证书。

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

否则,这些是关于如何更新您的CA证书的不错的说明,您可以尝试。

在所有的ca中,我对Digicert有这个问题。我创建了一个数字文件。Pem文件,只是中间和根粘贴到一个文件。

curl https://cacerts.digicert.com/DigiCertGlobalRootCA.crt.pem
curl https://cacerts.digicert.com/DigiCertSHA2SecureServerCA.crt.pem

curl -v https://mydigisite.com/sign_on --cacert DigiCertCA.pem
...
*  subjectAltName: host "mydigisite.com" matched cert's "mydigisite.com"
*  issuer: C=US; O=DigiCert Inc; CN=DigiCert SHA2 Secure Server CA
*  SSL certificate verify ok.
> GET /users/sign_in HTTP/1.1
> Host: mydigisite.com
> User-Agent: curl/7.65.1
> Accept: */*
...

Eorekan有答案,但只有我和另一个人对他的答案进行了投票。

简单的解决方案: 在~ /。Sdkman /etc/config, change sdkman_insecure_ssl=true

步骤: 纳米~ / .sdkman / etc /配置 将sdkman_insecure_ssl=false修改为sdkman_insecure_ssl=true 保存并退出

我本想评论Yuvik的回答,但我缺乏足够的声誉点。

当您将.crt文件导入到/usr/share/local/ca-certificates时,需要使用正确的格式。其中一些已经在前面提到过,但是还没有人提到只需要一个新的行字符,也没有人收集过清单,所以我想在这里提供一个清单。

The certificate needs to end in .crt. From Ubuntu's man page: Certificates must have a .crt extension in order to be included by update-ca-certificates Certificate files in /usr/local/share/ca-certificates can only contain one certificate Certificate files must end in a newline. update-ca-certificates will appear to work if each row contains, for example, a carriage return + a newline (as is standard in Windows), but once the certificate is appended to /etc/ssl/ca-certificates.crt, it still will not work. This specific requirement bit me as we're loading certificates from an external source.