I’m asked to implement OIDC using php 5.2.6, but encounter “Unknown SSL protocol error in connection” during fetchURL:
curl_setopt($ch, CURLOPT_URL $url);
if (isset($this->certPath)){
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
curl_setopt($ch, CURLOPT_CAINFO, $this->certPath);
}
else{
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
}
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$output = curl_exec($ch);
if (curl_exec($ch) === false{
throw new OpenIDConnectioClientException('Curl error: ' . curl_error($ch));
}
Have searched and tried following actions, but didn’t help”
- set CA file (cacert.pem) provided by our IT
- set VERIFYPEER / VERIFYHOST to False
- Using different SSLVERSION (DEFAULT / TLSv1 / SSLv2, SSLv3, TLSv1_0, TLSv1_1, TLSv1_2)
- set VERBOSE but no more detailed message
Currently, only these actions can get response from target service:
- using php curl, set the beginning of url with http instead of https
- using windows curl, with argument -k or –ssl_no_revoke
- using linux curl with cacert.pem provided by IT
I expect that php using curl with CA file should be ok (as what I do in linux curl), is there anyone know the reason why different result in different system and how to solve the problem? Thanks a lot!
Version:
- php 5.2.6 with curl 7.16.0
- Windows curl 8.0.1 (Windows) libcurl/8.0.1 Schannel WinIDN
- Linux curl 7.68.0 (x86_64-pc-linux-gnu) libcurl/7.68.0 OpenSSL/1.1.1f zlib/1.2.11 brotli/1.0.7 libidn2/2.2.0 libpsl/0.21.0 (+libidn2/2.2.0) libssh/0.9.3/openssl/zlib nghttp2/1.40.0 librtmp/2.3
TL;DR: you probably need to upgrade your ages old software stack to solve the issue.
- php 5.2.6 with curl 7.16.0
This is a version of PHP released 16 years ago (2008) and unsupported for ages. The included curl 7.16.0 is even older – released 2006. Likely the openssl version linked to this PHP is similar old.
OpenSSL 1.0.1 was the first version with support for TLS1.2 and was released in 2012 (but long end of live now too), i.e. many years after your PHP version and thus unlikely included. But any SSL/TLS version lower than TLS 1.2 is considered obsolete today, so likely the server you access will not accept it – leading to the error you experience. curl under Linux uses OpenSSL 1.1.1, which support for TLS 1.2 and also TLS 1.3. But even OpenSSL 1.1.1 is EOL now.
Apart from not being able to use modern TLS with such an old software stack it is grossly negligent to use such an old versions for security reasons. This version contains several critical issues, including unauthenticated code execution.
4