Forums | Mahara Community

Mahara/Moodle integration /
unable to add the moodle institution.


anonymous profile picture
Account deleted
Posts: 4

02 December 2009, 18:03

when I try, I get this error message:

-----------------------------------------------------

An error occurred while retrieving the public key from the remote server.
Please ensure that the Application and WWW Root fields are correct, and that networking is enabled on the remote host.

----------------------------------------------------------------

I have checked and double checked that the moodle installation has networking turned on and that the WWW root for both moodle and mahara are correct and everything looks correct.

One additional piece of information: my system administrator has some trouble with HIS public keys.  The site we have mahara and moodle installed on is: https://cs.mtmercy.edu (with /moodle and /mahara for the moodle and mahara installations respectively).  When people visit http://cs.mtmercy.edu they get an error message that complains about a bad certificate.  Could this be causing mahara to fail getting the pubic key from Moodle?

 Any help would be greatly appreciated,

steve

anonymous profile picture
Account deleted
Posts: 228

03 December 2009, 2:10

Hi Steve,

Have you checked in the webserver error log? Normally when you see that message there is more information in the error log.

The error you're getting in the browser is because the certificate you're using is self signed, rather than signed by an authority.  That's usually because it costs money to get real ones.

MNET uses self signed certificates anyway, so no, the problem is not related :)

anonymous profile picture
Account deleted
Posts: 4

03 December 2009, 11:26

thanks for the great help, but i need more help :-)

i can't tell what's going on from the error messages:

[Thu Dec 03 09:17:38 2009] [error] [client 10.9.2.239] [DBG] 2c (auth/xmlrpc/lib.php:844) Error retrieving public key, failed with error code 0: Curl error: 60: SSL certificate problem, verify that the CA cert is OK. Details:, referer: https://cs.mtmercy.edu/mahara/admin/users/addauthority.php?add=1&i=mahara&p=xmlrpc
[Thu Dec 03 09:17:38 2009] [error] [client 10.9.2.239] [DBG] 2c (auth/xmlrpc/lib.php:844) error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed, referer: https://cs.mtmercy.edu/mahara/admin/users/addauthority.php?add=1&i=mahara&p=xmlrpc

this seems to be saying that the certificate itself is flawed, yes?  if so, how do i fix the problem?

 thanks again,

steve

anonymous profile picture
Account deleted
Posts: 228

03 December 2009, 12:37

Hrmm.  I'm not sure what could cause that.

One thing to check is that you're sure that Moodle thinks it has the same url that you're telling Mahara - eg, if you have www.mysite.com and mysite.com it won't work.

anonymous profile picture
Account deleted
Posts: 1

18 March 2010, 0:24

I have the exact same problem. :( Did you find a solution?

 From what I can gather, Moodle generates it's own self-signed certificate for networking, however Mahara keeps thinking that this certificate is invalid - since it's self-signed and not trusted from a known CA. I've tried various hacks on lib.php/web.php to tell PHP/CURL to ignore the error, but it doesn't seem to make any difference.

Moodle & Maraha are on the same XAMPP windows server, but with seperate HTTPS virtual hosts / DNS names for each. Using Moodle 1.9.7 and Maraha 1.2.3

anonymous profile picture
Account deleted
Posts: 1

07 March 2011, 17:53

Incase anyone runs into this.

If you are running Moodle on a server with a self-signed ssl certificate here is are two diffs you can apply to allow it to work.

------------------------------------------------------------------------------------------------

--- a/htdocs/api/xmlrpc/client.php
+++ b/htdocs/api/xmlrpc/client.php
@@ -68,9 +68,11 @@ class Client {
 
         if (strpos($URL, 'https://') === 0) {
             if ($cainfo = get_config('cacertinfo')) {
-                curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true);
+                //curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true);
+                curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
                 curl_setopt($ch, CURLOPT_CAINFO, $cainfo);
             }
+               curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
         }
 
         $timestamp_send    = time();

---------------------------------------------------------------------------------------------------

--- a/htdocs/lib/web.php
+++ b/htdocs/lib/web.php
@@ -2973,9 +2973,11 @@ function mahara_http_request($config) {
 
     if (strpos($config[CURLOPT_URL], 'https://') === 0) {
         if ($cainfo = get_config('cacertinfo')) {
-            curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true);
+            //curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true);
+            curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
             curl_setopt($ch, CURLOPT_CAINFO, $cainfo);
         }
+curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
     }
 
     $result = new StdClass();

---------------------------------------------------------------------------------------------------

anonymous profile picture
Account deleted
Posts: 1

16 August 2011, 9:54

Thank you Trevor!

Your really saved my day!

BR,

Tobias

anonymous profile picture
Account deleted
Posts: 4

25 February 2013, 22:46

Hi, I'm new to Mahara and am having the same issue as above.

I am unsure how to implement the codes you contributed:

1

I can find api/xmlrpc/client.php in my mahara folder, bit can't see the code in the file you talk about here.

2

I have implemented the second code /lib/web.php but still get the same error message.


Sorry for the noob questions. Any advice welcome


Jon :)

Kristina Hoeppner's profile picture
Posts: 4867

03 March 2013, 11:01

Hi Jon,

The code examples given earlier was from 2011. Since then both Mahara and Moodle have evolved and the code might not work 1 to 1 anymore but might have to be tweaked.

Cheers

Kristina

Aaron Wells's profile picture
Posts: 896

07 March 2013, 11:28

Hi Jon,

It appears that api/xmlrpc/client.php has been changed since 2011 so that it now always sets CURLOPT_SSL_VERIFYPEER to false, which is why you couldn't find that code in there.

Can you paste in here the error message that you get? (and/or a screenshot)

Cheers,

Aaron

10 results