In Some cases, when you are integrating MAHARA with Moodle , the OpenSSL certificate Key is not displayed.
We came across this problem many times in a windows installation.The reason was the OpenSSL within the Apache folder is not configured in the MAHARA and Moodle.
They are more of configured to work on Linux than Windows.
The solution for the same is , using the OPENSSL methods we can override the existing methods by directly pointing to the openssl certificate file (openssl.cnf)
In Mahara,
Edit the File
$config is a array which holds the path of the Openssl.cnf in the your exisiting setup
$config = array("config" => "C:\Apache\openssl.cnf");
// ensure we remove trailing slashes
$dn["commonName"] = preg_replace(':/$:', '', $dn["commonName"]);
//if (!$new_key = openssl_pkey_new()) {
if (!$new_key = openssl_pkey_new($config)) {
throw new ConfigException('Could not generate a new SSL key. Are '
. 'you sure that both openssl and the PHP module for openssl are '
. 'installed on this machine?');
}
//if (!$csr_rsc = openssl_csr_new($dn, $new_key, array('private_key_bits',2048))) {
if (!$csr_rsc = openssl_csr_new($dn, $new_key, $config)) {
// This behaviour has been observed once before, on an ubuntu hardy box.
// The php5-openssl package was installed but somehow openssl
// wasn't.
throw new ConfigException('Could not generate a new SSL key. Are '
. 'you sure that both openssl and the PHP module for openssl are '
. 'installed on this machine?');
}
//$selfSignedCert = openssl_csr_sign($csr_rsc, null, $new_key, 365 /*days*/);
$selfSignedCert = openssl_csr_sign($csr_rsc, null, $new_key, 365 /*days*/,$config);
unset($csr_rsc); // Free up the resource
The Same applies to Moodle.
Edit the File :
$config = array("config" => "c:/apache/conf/openssl.cnf");
//$new_key = openssl_pkey_new();
$new_key = openssl_pkey_new($config);
//$csr_rsc = openssl_csr_new($dn, $new_key, array('private_key_bits',2048));
//$selfSignedCert = openssl_csr_sign($csr_rsc, null, $new_key, $days);
$csr_rsc = openssl_csr_new($dn, $new_key, $config);
$selfSignedCert = openssl_csr_sign($csr_rsc, null, $new_key, $days,$config);
unset($csr_rsc); // Free up the resource
Thanks for posting this - your solution has allowed us to move a step forward in our attempts to integrate Mahara and Moodle on a Windows platform. Both installations run OK separately and the networking configuration, including the generation of the key seems to have been successful. But we’re still having problems linking from Moodle to Mahara with the following error generated:
ReplyDelete"Sorry, could not log you in :(
Sorry, we could not log you into Mahara at this time. Please try again shortly, and if the problem persists, contact your administrator"
Do you know if there are further settings that need to be specifically configured for a Windows installation?
Thanks in advance
Kenny
Continue same problem........
ReplyDeleteThe environment where Mahara is running is misconfigured and this is causing problems. You probably need to contact a server administrator to get this fixed. Details, if any, follow:
Could not generate a new SSL key. Are you sure that both openssl and the PHP module for openssl are installed on this machine?