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.

当前回答

尝试在Ubuntu中重新安装curl,并使用sudo update-ca-certificates—fresh更新我的CA证书

其他回答

它失败了,因为cURL无法验证服务器提供的证书。

有两个选项可以让它工作:

使用带-k选项的cURL,允许cURL建立不安全的连接,即cURL不验证证书。 将根CA(签署服务器证书的CA)添加到/etc/ssl/certs/ca-certificates.crt

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

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

sudo apt-get install ca-certificates

特别对于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中正常执行。

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

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

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

在所有的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有答案,但只有我和另一个人对他的答案进行了投票。