Joomdle 1.0 Installation

SSL Operation Failed

More
9 years 8 months ago #1 by James
SSL Operation Failed was created by James
Following a recent upgrade of PHP and Joomdle, integration between Joomla and Moodle is no longer working. The error in Joomdle system check shows:

Joomla to Moodle HTTP connectivity: Joomla cannot connect to Moodle
Moodle to Joomla HTTP connectivity: Moodle cannot connect to Joomla
Joomdle Web Services: Received empty response from Moodle

The errors in the server log files are:
1. PHP Warning: file_get_contents(): SSL operation failed with code 1. OpenSSL Error messages:\nerror:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed in /var/www/html/joomla/administrator/components/com_joomdle/helpers/content.php on line 106

and

2. PHP Warning: file_get_contents(): Failed to enable crypto in /var/www/html/joomla/administrator/components/com_joomdle/helpers/content.php on line 106

The environment is as follows:
PHP Built On: Linux 2.6.32-042stab113.21 #1 SMP Wed Mar 23 11:05:25 MSK 2016 x86_64
Database Version: 5.5.47-MariaDB
PHP Version: 7.0.9
Web Server: Apache/2.4.6 (CentOS) OpenSSL/1.0.1e-fips PHP/7.0.9
WebServer to PHP Interface: apache2handler
Joomla! Version: Joomla! 3.6.0 Stable
Moodle Version: Moodle 3.1+ (Build: 20160609)
Joomdle Version: Joomdle 1.0.6 for Joomla 3+

Any help will be greatly appreciated.

Thanks.

Please Log in or Create an account to join the conversation.

More
9 years 8 months ago #2 by Antonio Durán
Replied by Antonio Durán on topic SSL Operation Failed
Hi.

I don't have access to an SSL enabled site to test now, but I found this:
stackoverflow.com/questions/26148701/fil...with-code-1-and-more

Maybe you can try to modify the code so that it uses your certificate, or just disable verifying in the file_get_contents call. File to modify is administrator/components/com_joomdle/helpers/content.php, call_method_fgc function.

Please Log in or Create an account to join the conversation.

More
9 years 8 months ago #3 by James
Replied by James on topic SSL Operation Failed
Hi Antonio,

Thanks for the suggestion.

We've tried this, without success:

static function call_method_fgc ($method, $params = CJ_EMPTY_VALUE, $params2 = CJ_EMPTY_VALUE, $params3 = CJ_EMPTY_VALUE, $params4 = CJ_EMPTY_VALUE, $params5 = CJ_EMPTY_VALUE)
{
$comp_params = JComponentHelper::getParams( 'com_joomdle' );
$moodle_xmlrpc_server_url = JoomdleHelperContent::_get_xmlrpc_url ();

$request = JoomdleHelperContent::get_request ($method, $params, $params2, $params3, $params4, $params5);

$context = stream_context_create(array('http' => array(
'verify_peer' => false,
'verify_peer_name' => false,
'method' => "POST",
'header' => "Content-Type: text/xml",
'content' => $request
)));
$file = file_get_contents($moodle_xmlrpc_server_url , false, $context);

$response = xmlrpc_decode($file, 'utf8');

if (is_array ($response))
if (xmlrpc_is_fault ($response))
{
echo "XML-RPC Error (".$response."): ".$response;
die; // XXX Something softer?
}

return $response;
}

We did however notice when using curl, that we don't get the error. How can I debug this issue when using curl?

Log extract:
[Tue Aug 02 03:18:29.970507 2016] [:error] [pid 824] [client 94.200.146.140:25980] PHP Warning: file_get_contents(): SSL operation failed with code 1. OpenSSL Error messages:\nerror:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed in /var/www/html/joomla/administrator/components/com_joomdle/helpers/content.php on line 108

Thanks,

James

Please Log in or Create an account to join the conversation.

More
9 years 8 months ago #4 by Antonio Durán
Replied by Antonio Durán on topic SSL Operation Failed
But with cURL, it does not work either? I was going to suggest you to try it. What happens with curl?

You can try editing call_method_curl function, and adding some options to disable certificate verify:
stackoverflow.com/questions/15135834/php...l-verifypeer-ignored

Please Log in or Create an account to join the conversation.

More
9 years 8 months ago #5 by James
Replied by James on topic SSL Operation Failed
Hi Antonio,

With those settings we get this on the website (will change the option back to file_get):
XML-RPC Error (29039061): Invalid parameter value detected | ERRORCODE: invalidparameter

$ch = curl_init();
curl_setopt( $ch, CURLOPT_URL, $moodle_xmlrpc_server_url); # URL to post to
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 ); # return into a variable
curl_setopt( $ch, CURLOPT_HTTPHEADER, $headers ); # custom headers, see above
curl_setopt( $ch, CURLOPT_POSTFIELDS, $request );
curl_setopt( $ch, CURLOPT_SSL_VERIFYHOST, false); # Ignore Cert
curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, false); # Ignore Cert
curl_setopt( $ch, CURLOPT_CUSTOMREQUEST, 'POST' ); # This POST is special, and uses its specified Content-type
$file = curl_exec( $ch ); # run!
curl_close($ch);

Thanks,

James

Please Log in or Create an account to join the conversation.

More
9 years 8 months ago #6 by Antonio Durán
Replied by Antonio Durán on topic SSL Operation Failed
If you get that, you've made progress with CURL, no need to go back to fgc. As you get a XMLRPC error, it has passed certificate validation, as conneciton has been made.

Now you need to know why this is happening, but it's a different problem.

Please Log in or Create an account to join the conversation.

More
9 years 8 months ago #7 by James
Replied by James on topic SSL Operation Failed
That's good to know Antonio. If you have any other pointers I'd really appreciate it. I've hit a brick wall.

Please Log in or Create an account to join the conversation.