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.

当前回答

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

其他回答

没有一个答案提到,可能是连接到内部vpn的角色,我以前遇到过这个问题,并要求在专用网络上

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

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

关于“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/)。

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

我的情况不同。我在防火墙后面托管一个网站。错误是由pfSense引起的。

Network layout: |Web Server 10.x.x.x| <-> |pfSense 49.x.x.x| <-> |Open Internet|

多亏了这个答案,我意外地找到了原因。


当我从广域网访问我的网站时,一切都很好。

然而,当从局域网内访问站点时(例如,当Wordpress向其自己的服务器发出curl请求时,尽管使用WAN IP 49.x.x.x),它被提供pfSense登录页面。

我将证书标识为pfSense webConfigurator自签名证书。难怪curl抛出一个错误。

原因:发生的事情是curl正在使用站点的WAN IP地址49.x.x.x。但是,在web服务器的上下文中,广域网IP是防火墙。

调试:我发现我正在获得pfSense证书。

解决方案:在托管该站点的服务器上,将其自己的域名指向127.0.0.1

通过应用该解决方案,web服务器正确地处理了curl的请求,并且没有转发到防火墙,防火墙通过发送登录页面进行响应。