带有curl的centOS7的证书问题

yhived7q  于 2022-11-13  发布在  其他
关注(0)|答案(2)|浏览(239)

我在使用curl时遇到了一个问题。我运行的是centOS7。我们设法在其他地方运行curl,但在我们的开发机器上不行:
我们正在努力做的事情:

sudo curl -X 'GET' 'https://webpage/document' --cert '/localization.crt.pem' --key '/localization.key.pem' -H 'accept: */*' -k

我得到这个错误:

curl: (58) SSL peer cannot verify your certificate.

我尝试做什么?(来自centOS文档)https://access.redhat.com/documentation/en-us/red_hat_certificate_system/9/html/administration_guide_common_criteria_edition/importing_certificate_into_nssdb

# PKICertImport -d . -n "client name" -t ",," -a -i certificate.crt.pem -u C

在echo $之后?我们得到一个0,所以我认为它安装正确?
任何关于哪里出了问题的想法都是很好的。

xdyibdwo

xdyibdwo1#

我最近在我们的linux环境中遇到了这个问题。我发现如果你有一个SSL证书,也包括一个链证书,这往往会发生。如果你的服务器上没有配置链,OpenSSL会认为证书无效。
我将使用以下命令对此进行测试:

openssl s_client -showcerts -verify 5 -connect website.com:443

如果您看到类似这样的区块,表示您的服务器组态中遗漏了凭证链接:

---
SSL handshake has read 2162 bytes and written 401 bytes
Verification error: unable to verify the first certificate
---

Windows填补了这一空白,并不介意这种类型的配置,但openssl非常特别。

wi3ka0sx

wi3ka0sx2#

我设法解决了这个问题。重新编译curl与openSSL与以下教程:Install curl with openssl
工作起来就像一个魅力:)

相关问题