gpt4 book ai didi

curl - OS X 与 curl SSL 战斗 - 证书错误

转载 作者:太空宇宙 更新时间:2023-11-03 13:27:58 27 4
gpt4 key购买 nike

我正在尝试使用带 SSL 的 curl,但我收到有关证书的永久性错误。我知道 OSX 在 curl 证书方面一团糟,我想我在为开发人员创建自己的自签名证书(本地主机上的 node_ssl_server.local)后忘记了一个重要过程

错误:

curl --verbose --header "Authorization: Bearer b8232aedb20e0a97499b3bffa9d3edeb3c1b25" https://node_ssl_server.local:8000/Categories
* About to connect() to node_ssl_server.local port 8000 (#0)
* Trying 192.168.1.13...
* connected
* Connected to node_ssl_server.local (192.168.1.13) port 8000 (#0)
* successfully set certificate verify locations:
* CAfile: /usr/share/curl/cacert.pem
CApath: none
* 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, verify that the CA cert is OK.
Details:
error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed
* Closing connection #0
curl: (60) SSL certificate problem, verify that the CA cert is OK. Details:
error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed

我之前为创建自签名证书所做的工作:

    cd /etc/ssl/self-signed
sudo openssl genrsa -des3 -out server.pass.key 2048
sudo openssl rsa -in server.pass.key -out server.key
sudo openssl genrsa -des3 -passout pass:x -out server.pass.key 2048
sudo openssl rsa -passin pass:x -in server.pass.key -out server.key
sudo rm server.pass.key
sudo openssl req -new -key server.key -out server.csr
..
>Common Name (e.g. server FQDN or YOUR name) []:node_ssl_server.local
..
sudo openssl x509 -req -days 365 -in server.csr -signkey server.key -out server.crt

所以我将我的自签名证书放入/etc/ssl/self-signed:

    ls /etc/ssl/self-signed
> server.crt server.csr server.key

和我的 curl cacert.pem 到/usr/share/curl :

    ls /usr/share/curl 
> cacert.pem

我备份它:

    sudo cp cacert.pem cacert.pem.old

ls /usr/share/curl
> cacert.pem cacert.pem.old

我删除它,并构建一个新的,并连接我的自签名证书:

    sudo rm cacert.pem
sudo sh -c 'cat cacert.pem.old /etc/ssl/self-signed/server.crt >> cacert.pem'

ls /usr/share/curl
> cacert.pem cacert.pem.old

然后我使用 curl ... 引发错误关于钥匙串(keychain)是否有任何其他过程(Mac OSX 10.9 - Mountain Lion)?在使用 curl w SSL 之前 ????

最佳答案

我将我的自签名证书 (/etc/ssl/self-signed/server.crt) 添加到 Apple keychain 证书(作为根证书),授予了授权......并且我重新启动了我的电脑....这是一个关键点......我不知道为什么我的电脑需要重新启动,但我发现证书不被识别...

关于curl - OS X 与 curl SSL 战斗 - 证书错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19433657/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com