我需要将一个.pem证书文件添加到我的默认CA证书包,但我不知道默认的CA证书包保存在哪里。
我需要将我的新的.pem文件追加到这个默认的包。 我宁愿这样做,而不是使用–capath指定我自己的位置
cURL清楚地知道在哪里看,但是我没有看到任何显示位置的cURL命令。 有没有一个命令可以显示这个位置? 我怎么find它?
根据cURL:
将您的服务器的CA证书添加到现有的默认CA证书包。 所使用的CA软件包的默认path可以通过使用–with-ca-bundle选项运行configure指定所选path来更改。
谢谢
用strace运行curl可能会给你一个线索。
strace curl https://www.google.com |&grep open
很多的输出,但接近尾声我看到:
打开(“/ etc / ssl / certs / 578d5c04.0”,O_RDONLY)= 4
这是我的证书存储的地方。
curl的“bin /”应该有一个“curl-config”程序,也就是“curl”二进制文件所在的位置。
./curl-config –ca
给出了ca bundle的安装path。
我只是做了一个whatis curl-config:“获取有关libcurl安装的信息”,所以我想只有在安装了libcurl的情况下才能使用它,我认为这是标准的。
我发现一个简单的方法:使用错误的文件名--cacert ,输出将显示path。
例:
~$ curl --cacert non_existing_file https://www.google.com curl: (77) error setting certificate verify locations: CAfile: non_existing_file CApath: /etc/ssl/certs
您可以从haxx.se下载作为curl创build者的CA根证书包。 那么只需在.pem中附加你的证书,并在使用curc和–cacert选项时引用它
默认的CA软件包位置取决于操作系统。 在RHEL5上,它位于/etc/pki/tls/certs/ca-bundle.pem。 在其他风格的Linux或非Linux操作系统上,它可能位于不同的位置。
-v duh。 有人分享一些有用的东西像命令添加到此crt。
$ curl -v https://google.com * Rebuilt URL to: https://google.com/ * timeout on name lookup is not supported * Trying 172.217.9.174... % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0* Connected to google.com (172.217.9.174) port 443 (#0) * ALPN, offering http/1.1 * Cipher selection: ALL:!EXPORT:!EXPORT40:!EXPORT56:!aNULL:!LOW:!RC4:@STRENGTH * successfully set certificate verify locations: * *CAfile: C:/Program Files/Git/mingw64/ssl/certs/ca-bundle.crt*