在 Debian 8 上安裝中間憑證以進行 curl/openssl 連線。

在 Debian 8 上安裝中間憑證以進行 curl/openssl 連線。

我試圖透過 php 的 stream_socket_client() 命令聯繫 url,該命令失敗,沒有錯誤代碼或訊息。這是使用 openssl、curl 還是其他東西?網站使用 https,並且可以在網頁瀏覽器中正常運作。

在此輸入影像描述

當我直接呼叫 openssl 時,它會連接,但對我的憑證鏈似乎不滿意。

root@drupal7 drupal7/includes# openssl s_client -connect test.cgps.org:443
CONNECTED(00000003)
Verify return code: 21 (unable to verify the first certificate)

與捲曲相同

curl https://test.cgps.org/?q=/admin/config/search/clean-urls/check
curl: (60) SSL certificate problem: unable to get local issuer certificate

所以我想我需要將中間憑證安裝到 Linux 中,我透過將 Apache 使用的相同中間憑證放入 /usr/local/share/ca-certificates 並執行 update-ca-certificates 來完成。

root@drupal7 drupal7/includes# update-ca-certificates
Updating certificates in /etc/ssl/certs... 1 added, 0 removed; done.
Running hooks in /etc/ca-certificates/update.d....done.

還是沒有運氣...

相關內容