2017-07-05 36 views
0

請求單個特定https端點在我的一臺服務器上出現故障,PHP CURL出現「NSS:客戶端證書未找到(暱稱未指定)」錯誤。PHP CURL「NSS:未找到客戶端證書(未指定暱稱)」問題

當我從命令行使用verbose選項運行相同的查詢時,我得到了同樣的錯誤,但在此之後,我也得到了有效的響應(在相同CURL請求中的錯誤之後)。

然後我啓用verbose選項我的PHP CURL請求,並顯示它的測試是這樣的:

$error = curl_error($curl); 

if ($error) { 
     echo "cURL Error #:" . $error; 

     rewind($verbose); 
     $verboseLog = htmlspecialchars(stream_get_contents($verbose)); 

     echo "<pre>"; 
     print_r($verboseLog); 
} else { 
    echo $response; 
} 

,並得到此作爲輸出:

cURL Error #:NSS: client certificate not found (nickname not specified) 
* About to connect() to <address> port 8001 (#0) 
* Trying <ip>... * connected 
* Connected to <address> (<ip>) port 8001 (#0) 
* skipping SSL peer certificate verification 
* NSS: client certificate not found (nickname not specified) 
* SSL connection using TLS_RSA_WITH_AES_128_GCM_SHA256 
* Server certificate: 
* subject: CN=*.<address>m,O=XXX A.S.,OU=IT,L=Umraniye,ST=Istanbul,C=TR 
* start date: Jun 11 12:52:03 2015 GMT 
* expire date: Jun 09 14:16:13 2018 GMT 
* common name: *.<address> 
* issuer: CN=GlobalSign Organization Validation CA - SHA256 - G2,O=GlobalSign nv-sa,C=BE 
> POST /<url_part> HTTP/1.1 
Host: <address>:8001 
Accept: */* 
Accept-Encoding: deflate, gzip 
authorization: Basic UlBlahBlahnJrcjEyMzQ1Ng== 
cache-control: no-cache 
content-type: application/json 
postman-token: eeefe018-7cac-1706-7b6d-847800a7ad0f 
Content-Length: 333 

< HTTP/1.1 200 OK 
< set-cookie: sap-usercontext=sap-client=100; path=/ 
< set-cookie: SAP_SESSIONID_CFP_100=ohZvfO5ZOwq_LTE76Zgz9L-C0NdhlRHngM0AF6R3IFY%3d; path=/ 
< content-type: application/json; charset=utf-8 
< content-length: 1150 
< cache-control: max-age=0 
< sap-cache-control: +180 
< sap-isc-uagent: 0 
< 
* Connection #0 to host <address> left intact 
* Closing connection #0 

所以,嫋嫋的要求與完成該錯誤,但在詳細日誌中,我們看到在錯誤有效響應也被提取之後。

這裏是我的問題:

  1. 有什麼辦法,只要其他不同https端點的工作完全沒解決這個問題NSS?它是否與端點的服務器配置連接並可以在那裏解決?
  2. 如果第一項失敗,是否可以不拋出CURL NSS錯誤,而是得到響應呢? CURLOPT_FAILONERROR選項沒有幫助。

捲曲經建有NSS:

curl 7.19.7 (x86_64-redhat-linux-gnu) libcurl/7.19.7 NSS/3.27.1 zlib/1.2.3 libidn/1.18 libssh2/1.4.2 
Protocols: tftp ftp telnet dict ldap ldaps http file https ftps scp sftp 
Features: GSS-Negotiate IDN IPv6 Largefile NTLM SSL libz 

更新:

第二項可以被關閉,因爲這個錯誤真的很奇怪:curl_error返回錯誤,但curl_exec同時返回有效響應。

+0

也許看起來** [這裏](https://stackoverflow.com/questions/15773806/nss-client-certificate-not-found-nickname-not-指定)**,看看它是否適用於你的情況。 – YvesLeBorg

+0

@YvesLeBorg不,它不適用,問題是我沒有使用任何明確的證書。 –

回答

0

嘗試給出證書的絕對路徑並添加「./」前綴。例如「./path-to-your-cert」

+0

問題是我沒有使用任何明確的證書。 –

相關問題