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.

当前回答

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

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

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

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

其他回答

这可以帮助你控制暴饮暴食:

$client = new Client(env('API_HOST'));
$client->setSslVerification(false);

测试在guzzle/guzzle 3.*

有这个问题,但新版本没有解决。/etc/certs有根证书,浏览器说一切正常。经过一些测试后,我从ssllabs.com得到警告,我的链是不完整的(实际上这是旧证书链,而不是新证书链)。在纠正了证书链之后,一切都很好,即使是curl。

仅仅更新证书列表可能就足够了

sudo update-ca-certificates -f

update-ca-certificates是一个更新/etc/ssl/certs目录以保存SSL证书并生成ca-certificates的程序。Crt,一个连接的证书单文件列表。

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

根- >中间- >服务器

服务器至少应该发送服务器和中间体。

使用openssl s_client -showcerts -starttls ftp -crlf -connect abc:21进行调试。

如果只返回一个证书(自签名或颁发),那么您必须选择:

修复服务器 信任该证书并将其添加到您的CA证书存储(不是最好的主意) 禁用信任,例如curl -k(非常糟糕的主意)

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

在此链的CA存储中安装CA(根)证书,例如谷歌颁发者。(只有当你信任该CA时) 服务器是否将CA作为链的一部分发送 信任链中的证书 禁用的信任

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

添加(信任)它 禁用的信任

我忽略了过期/撤销的证书,因为没有消息表明它。但是您可以使用openssl x509 -text检查certs

假设您正在连接到家庭版(https://www.cerberusftp.com/support/help/installing-a-certificate/) ftp服务器,我将说它是自签名的。

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

关于“SSL证书问题:无法获得本地颁发者证书”错误。需要注意的是,这适用于发送CURL请求的系统,而不是接收请求的服务器。

Download the latest cacert.pem from https://curl.se/ca/cacert.pem Add the '--cacert /path/to/cacert.pem' option to the curl command to tell curl where the local Certificate Authority file is. (or) Create or add to a '.curlrc' file the line: cacert = /path/to/cacert.pem See 'man curl', the section about the '-K, --config <file>' section for information about where curl looks for this file. (or if using php) Add the following line to php.ini: (if this is shared hosting and you don't have access to php.ini then you could add this to .user.ini in public_html).

卷毛。cainfo = " - path / to / downloaded cacert pem。”

请确保将路径用双引号括起来!!

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