Forums | Mahara Community

Support /
Networking not working


anonymous profile picture
Account deleted
Posts: 15

30 August 2012, 10:43

I have recently upgraded from 1.4x to 1.5.2 and everything seemed fine until it tried to logon via our moodle site. I had networking set up before which worked fine. Now i get the following message.

 

error

 

I have installed another separate mahara install on the same web server and the network page works fine but on my old one I get this error message saying Mahara cannot generate a SSL key. I have checked that the openssl is installed and the php module is enabled but not sure how to fix the problem.

 

Iñaki Arenaza's profile picture
Posts: 253

02 September 2012, 9:33

Hi,

there are two places where Mahara triggers that error. We need to add a bit of code to debug why the error is triggering.

Edit file api/xmlrpc/lib.php and around line 1428 you'll see these lines of code:

        if (!$new_key = openssl_pkey_new($config)) {
            throw new ConfigException(get_string('errorcouldnotgeneratenewsslkey', 'auth'));
        }

        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(get_string('errorcouldnotgeneratenewsslkey', 'auth'));
        }

Change them to:

        while ($err = openssl_error_string()) {
            /* just consume previous error messags and do nothing */
        }
        if (!$new_key = openssl_pkey_new($config)) {
            log_debug('openssl_pkey_new() failed');
            while ($err = openssl_error_string()) {
                log_debug($err);
            }
            throw new ConfigException(get_string('errorcouldnotgeneratenewsslkey', 'auth'));
        }

        while ($err = openssl_error_string()) {
            /* just consume previous error messags and do nothing */
        }
        if (!$csr_rsc = openssl_csr_new($dn, $new_key, $config)) {
            log_debug('openssl_csr_new() failed');
            while ($err = openssl_error_string()) {
                log_debug($err);
            }
            // 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(get_string('errorcouldnotgeneratenewsslkey', 'auth'));
        }

Then make sure you have $cfg->log_dbg_targets set to LOG_TARGET_ERRORLOG (it is by default, unless you've changed it. This will send the output of log_debug() calls to your PHP error logs.

You should see which of the two functions is actually failing and openssl error messages telling why that function is failing.

Saludos.
Iñaki.

anonymous profile picture
Account deleted
Posts: 15

02 September 2012, 11:34

Cheers for the reply. I did what you said and got the following error messages.

 

[WAR] 79 (D:\EPORTFOLIO\api\xmlrpc\lib.php:1452) openssl_csr_new(): dn: add_entry_by_NID 48 ->  (failed)
Call stack (most recent first):
  • log_message("openssl_csr_new(): dn: add_entry_by_NID 48 -> (fa...", 8, true, true, "D:\EPORTFOLIO\api\xmlrpc\lib.php", 1452) at D:\EPORTFOLIO\lib\errors.php:446
  • error(2, "openssl_csr_new(): dn: add_entry_by_NID 48 -> (fa...", "D:\EPORTFOLIO\api\xmlrpc\lib.php", 1452, array(size 12)) at Unknown:0
  • openssl_csr_new(array(size 7), resource(#45), null) at D:\EPORTFOLIO\api\xmlrpc\lib.php:1452
  • OpenSslRepo->generate_keypair() at D:\EPORTFOLIO\api\xmlrpc\lib.php:1345
  • OpenSslRepo->get_keypair() at D:\EPORTFOLIO\api\xmlrpc\lib.php:1252
  • OpenSslRepo->__construct() at D:\EPORTFOLIO\api\xmlrpc\lib.php:1238
  • OpenSslRepo::singleton() at D:\EPORTFOLIO\admin\site\networking.php:56
[DBG] 79 (D:\EPORTFOLIO\api\xmlrpc\lib.php:1453) openssl_csr_new() failed
[DBG] 79 (D:\EPORTFOLIO\api\xmlrpc\lib.php:1455) error:0E06D06C:configuration file routines:NCONF_get_string:no value
[DBG] 79 (D:\EPORTFOLIO\api\xmlrpc\lib.php:1455) error:0E06D06C:configuration file routines:NCONF_get_string:no value
[DBG] 79 (D:\EPORTFOLIO\api\xmlrpc\lib.php:1455) error:0E06D06C:configuration file routines:NCONF_get_string:no value
[DBG] 79 (D:\EPORTFOLIO\api\xmlrpc\lib.php:1455) error:0E06D06C:configuration file routines:NCONF_get_string:no value
[DBG] 79 (D:\EPORTFOLIO\api\xmlrpc\lib.php:1455) error:0E06D06C:configuration file routines:NCONF_get_string:no value
[DBG] 79 (D:\EPORTFOLIO\api\xmlrpc\lib.php:1455) error:0E06D06C:configuration file routines:NCONF_get_string:no value
[DBG] 79 (D:\EPORTFOLIO\api\xmlrpc\lib.php:1455) error:0D07A098:asn1 encoding routines:ASN1_mbstring_ncopy:string too short
[WAR] 79 (D:\EPORTFOLIO\api\xmlrpc\lib.php:1460) Could not generate a new SSL key. Are you sure that both openssl and the PHP module for openssl are installed on this machine?
Call stack (most recent first):
  • OpenSslRepo->generate_keypair() at D:\EPORTFOLIO\api\xmlrpc\lib.php:1345
  • OpenSslRepo->get_keypair() at D:\EPORTFOLIO\api\xmlrpc\lib.php:1252
  • OpenSslRepo->__construct() at D:\EPORTFOLIO\api\xmlrpc\lib.php:1238
  • OpenSslRepo::singleton() at D:\EPORTFOLIO\admin\site\networking.php:56

 

 

 

It looks like the second if statement failed. Not sure why or how to fix it though. Any ideas?

anonymous profile picture
Account deleted
Posts: 197

17 September 2012, 23:45

Hi Steve,

It looks a bit like the configuration of the auth instance might not be right.

configuration file routines:NCONF_get_string:no value

and

asn1 encoding routines:ASN1_mbstring_ncopy:string too short

suggest as much.

Did you upgrade moodle at the same time, or anything like that?

Thanks,
Melissa.

4 results