curl_exec threw error SSL read
Hi.
After days working with code for connect to remote WHM, with hash, get this error
[PHP]curl_exec threw error "SSL read: error:00000000:lib(0):func(0):reason(0), errno 104" for https://myhost.com:2087/json-api/listaccts?api.version=1[/PHP]
[PHP]$whmuser = 'root';
$hash = $this->hash; // correct has one line
$host = $this->host; // myhost.com
$query = "https://".$host.":2087/json-api/listaccts?api.version=1";
$curl = curl_init();
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST,0);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER,0);
curl_setopt($curl, CURLOPT_RETURNTRANSFER,1);
$header[0] = "Authorization: WHM $whmuser:" . preg_replace("'(\r|\n)'","",$hash);
curl_setopt($curl,CURLOPT_HTTPHEADER,$header);
curl_setopt($curl, CURLOPT_URL, $query);
$result = curl_exec($curl);
if ($result == false) {
$msg = "curl_exec threw error \"" . curl_error($curl) . "\" for $query";
Log::critical($msg);
exit($msg);
}
curl_close($curl);[/PHP]
If try debug connection
Some ideas?
openssl s_client -connect "myhost.com:2087"
CONNECTED(00000003)
depth=3 C = SE, O = AddTrust AB, OU = AddTrust External TTP Network, CN = AddTrust External CA Root
verify return:1
depth=2 C = GB, ST = Greater Manchester, L = Salford, O = COMODO CA Limited, CN = COMODO RSA Certification Authority
verify return:1
depth=1 C = US, ST = TX, L = Houston, O = "cPanel, Inc.", CN = "cPanel, Inc. Certification Authority"
verify return:1
depth=0 OU = Domain Control Validated, OU = PositiveSSL, CN = myhost.com
verify return:1
---
Certificate chain
0 s:/OU=Domain Control Validated/OU=PositiveSSL/CN=myhost.com
i:/C=US/ST=TX/L=Houston/O=cPanel, Inc./CN=cPanel, Inc. Certification Authority
1 s:/C=US/ST=TX/L=Houston/O=cPanel, Inc./CN=cPanel, Inc. Certification Authority
i:/C=GB/ST=Greater Manchester/L=Salford/O=COMODO CA Limited/CN=COMODO RSA Certification Authority
2 s:/C=GB/ST=Greater Manchester/L=Salford/O=COMODO CA Limited/CN=COMODO RSA Certification Authority
i:/C=SE/O=AddTrust AB/OU=AddTrust External TTP Network/CN=AddTrust External CA Root
---
Server certificate
-----BEGIN CERTIFICATE-----
MIIFIjCCBAqgAwIBAgIRAJOGf5WM8tcI8ZCGtRJrgKkwDQYJKoZIhvcNAQELBQAw
cjELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAlRYMRAwDgYDVQQHEwdIb3VzdG9uMRUw
...
VKzpPon19yK1P1cMTn2Ngq7fu6CjTFpuXrisqfC6lEiEikWSVWdsIKTpoyIgCRKp
mGXvtyD98u1tX9kIsl2Xmz0/KTvAwA==
-----END CERTIFICATE-----
subject=/OU=Domain Control Validated/OU=PositiveSSL/CN=myhost.com
issuer=/C=US/ST=TX/L=Houston/O=cPanel, Inc./CN=cPanel, Inc. Certification Authority
---
No client certificate CA names sent
Peer signing digest: SHA512
Server Temp Key: ECDH, P-256, 256 bits
---
SSL handshake has read 4908 bytes and written 431 bytes
---
New, TLSv1/SSLv3, Cipher is ECDHE-RSA-AES128-GCM-SHA256
Server public key is 2048 bit
Secure Renegotiation IS supported
Compression: NONE
Expansion: NONE
No ALPN negotiated
SSL-Session:
Protocol : TLSv1.2
Cipher : ECDHE-RSA-AES128-GCM-SHA256
Session-ID: 9A955F47CE2WWWWWDSASSS275FAF70AD1DECE3FB282AFB995560C6E8D114
Session-ID-ctx:
Master-Key: 4D1AB53CEA341EKSAKSKSK8B71826B01C9B2D9106A3AD353D92637727D0326A5476AEEAAD8E0932CE40879D9199DE51BB
Key-Arg : None
PSK identity: None
PSK identity hint: None
SRP username: None
TLS session ticket lifetime hint: 300 (seconds)
TLS session ticket:
0000 - 45 22 00 80 dd 85 95 88-8e 7c ae d3 27 a5 f2 ba E".......|..'...
0010 - 3f a8 85 50 e2 8b da 20-21 2a 62 87 10 ef 75 11 ?..P... !*b...u.
0020 - e1 0d e9 34 15 1b 0c 8a-12 f6 cf 49 6b c4 a2 f7 ... .......Ik...
0030 - 77 26 e8 b0 4f a4 12 e8-f7 c1 e7 68 65 9f dc 7d w&..O......he..}
0040 - b0 6b 70 a6 f3 43 13 38-75 f7 73 ae 2a 50 80 29 .kp....8u.s.*P.)
0050 - f7 8d 4c 9a d6 0e 00 4b-8a 49 8d e2 c8 d3 b2 8a ..L....K.I......
0060 - 28 78 a1 1c 4f b7 3c a5-b7 c5 84 19 a0 c1 03 f4 (x..O.<.........
0070 - 76 1b 05 e5 2a 4e cd 73-09 f1 99 69 06 c6 a8 bb v...*N.s...i....
0080 - 64 92 78 76 61 3f 7d c0-13 95 d4 78 1a d0 32 bc d.xva?}....x..2.
0090 - 99 7d 5a f2 b0 06 66 57-6c 00 d2 ef 32 82 cb f6 .}Z...fWl...2...
Start Time: 1477417001
Timeout : 300 (sec)
Verify return code: 0 (ok)
Some ideas?
-
Hello, Could you let us know if the example from the [/PHP] Also, how are you calling the PHP script? Thank you. 0
Please sign in to leave a comment.
Comments
1 comment