Forums | Mahara Community

Support /
Error retrieving public key - Mahara in sub-domain, sub-directory


Reggie  Euser's profile picture
Posts: 14

11 March 2010, 12:30

Am trying to connect Moodle & Mahara on the same server.

Have Moodle installed at http://moodle.mysite.com, in directory /opt/httpd/htdocs/moodle.

Have Mahara installed in directory /opt/httpd/htdocs/mahara.

I put a symbolic link in /opt/httpd/htdocs/moodle to the mahara directory, then accessed Mahara via http://moodle.mysite.com/mahara.  Was able to install, set up mahara this way, no problem.

However, when trying to set up my http://moodle.mysite.com as an Institution on Mahara, when I try to set up the XMLRPC authentication, I get:

"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."

The application & WWW Root fields are correct & networking is enabled. I have been able to connect that Moodle instance to another remote server with a different instance of Mahara normally, using the same credentials, via defaults (port 80, etc).

The PHP Error log shows:

[11-Mar-2010 11:10:24] [WAR] bc (lib/peer.php:183) file_get_contents(http://moodle.mysite.com): failed to open stream: Connection refused
[11-Mar-2010 11:10:24] Call stack (most recent first):
[11-Mar-2010 11:10:24]   * log_message("file_get_contents(http://moodle.mysite.com):...", 8, true, true, "/opt/httpd/htdocs/mahara/lib/peer.php", 183) at /opt/httpd/htdocs/mahara/lib/errors.php:446
[11-Mar-2010 11:10:24]   * error(2, "file_get_contents(http://moodle.mysite.com):...", "/opt/httpd/htdocs/mahara/lib/peer.php", 183, array(size 6)) at Unknown:0
[11-Mar-2010 11:10:24]   * file_get_contents("http://moodle.mysite.com") at /opt/httpd/htdocs/mahara/lib/peer.php:183
[11-Mar-2010 11:10:24]   * Peer->bootstrap("http://moodle.mysite.com", null, "moodle", "ngcsusched") at /opt/httpd/htdocs/mahara/auth/xmlrpc/lib.php:842
[11-Mar-2010 11:10:24]   * PluginAuthXmlrpc::validate_config_options(array(size 20), object(Pieform)) at Unknown:0
[11-Mar-2010 11:10:24]   * call_user_func_array(array(size 2), array(size 2)) at /opt/httpd/htdocs/mahara/lib/mahara.php:1030
[11-Mar-2010 11:10:24]   * call_static_method("PluginAuthXmlrpc", "validate_config_options", array(size 20), object(Pieform)) at /opt/httpd/htdocs/mahara/admin/users/addauthority.php:112
[11-Mar-2010 11:10:24]   * auth_config_validate(object(Pieform), array(size 20)) at Unknown:0
[11-Mar-2010 11:10:24]   * call_user_func_array("auth_config_validate", array(size 2)) at /opt/httpd/htdocs/mahara/lib/pieforms/pieform.php:1210
[11-Mar-2010 11:10:24]   * Pieform->validate(array(size 20)) at /opt/httpd/htdocs/mahara/lib/pieforms/pieform.php:410
[11-Mar-2010 11:10:24]   * Pieform->__construct(array(size 5)) at /opt/httpd/htdocs/mahara/lib/pieforms/pieform.php:170
[11-Mar-2010 11:10:24]   * Pieform::process(array(size 5)) at /opt/httpd/htdocs/mahara/lib/pieforms/pieform.php:71
[11-Mar-2010 11:10:24]   * pieform(array(size 5)) at /opt/httpd/htdocs/mahara/admin/users/addauthority.php:92
[11-Mar-2010 11:10:24]
[11-Mar-2010 11:10:24] [WAR] bc (lib/web.php:2849) Curl error: 7: couldn't connect to host
[11-Mar-2010 11:10:24] Call stack (most recent first):
[11-Mar-2010 11:10:24]   * log_message("Curl error: 7: couldn't connect to host", 8, true, true) at /opt/httpd/htdocs/mahara/lib/errors.php:111
[11-Mar-2010 11:10:24]   * log_warn("Curl error: 7: couldn't connect to host") at /opt/httpd/htdocs/mahara/lib/web.php:2849
[11-Mar-2010 11:10:24]   * mahara_http_request(array(size 5)) at /opt/httpd/htdocs/mahara/api/xmlrpc/lib.php:626
[11-Mar-2010 11:10:24]   * get_public_key("http://moodle.mysite.com", "moodle") at /opt/httpd/htdocs/mahara/lib/peer.php:234
[11-Mar-2010 11:10:24]   * Peer->bootstrap("http://moodle.mysite.com", null, "moodle", "ngcsusched") at /opt/httpd/htdocs/mahara/auth/xmlrpc/lib.php:842
[11-Mar-2010 11:10:24]   * PluginAuthXmlrpc::validate_config_options(array(size 20), object(Pieform)) at Unknown:0
[11-Mar-2010 11:10:24]   * call_user_func_array(array(size 2), array(size 2)) at /opt/httpd/htdocs/mahara/lib/mahara.php:1030
[11-Mar-2010 11:10:24]   * call_static_method("PluginAuthXmlrpc", "validate_config_options", array(size 20), object(Pieform)) at /opt/httpd/htdocs/mahara/admin/users/addauthority.php:112
[11-Mar-2010 11:10:24]   * auth_config_validate(object(Pieform), array(size 20)) at Unknown:0
[11-Mar-2010 11:10:24]   * call_user_func_array("auth_config_validate", array(size 2)) at /opt/httpd/htdocs/mahara/lib/pieforms/pieform.php:1210
[11-Mar-2010 11:10:24]   * Pieform->validate(array(size 20)) at /opt/httpd/htdocs/mahara/lib/pieforms/pieform.php:410
[11-Mar-2010 11:10:24]   * Pieform->__construct(array(size 5)) at /opt/httpd/htdocs/mahara/lib/pieforms/pieform.php:170
[11-Mar-2010 11:10:24]   * Pieform::process(array(size 5)) at /opt/httpd/htdocs/mahara/lib/pieforms/pieform.php:71
[11-Mar-2010 11:10:24]   * pieform(array(size 5)) at /opt/httpd/htdocs/mahara/admin/users/addauthority.php:92
[11-Mar-2010 11:10:24]
[11-Mar-2010 11:10:24] [DBG] bc (auth/xmlrpc/lib.php:844) Error retrieving public key, failed with error code 0: Curl error: 7: couldn't connect to host


Additional information: 

 -  This server really listens on port 8080, but port 80 is forwarded there.  Further, the http://moodle.mysite.com instance is set up to require https secure login, (via port 8443 with 443 forwarded there) but serves all other pages via http.  Have tried all 4 ports.

-  Have attempted to connect to this Mahara instance from another instance of Moodle on a remote server, with the same results.

-  Have double checked Apache virtual host settings for Mahara instance, and find all correct. 

Is there a problem accessing Mahara via the subdomain sub-directory?  Any other thoughts or suggestions?

Many thanks in advance!

 

Reggie  Euser's profile picture
Posts: 14

11 March 2010, 12:42

Update:

Moved Mahara to be directly under http://mdltest.mysite.com - same results, so placing it in a subdirectory is apparently not the issue.

Could there be some kind of permissions issue?  The main Mahara data directory is set to 0777, but the generated sub-directories are all 0700 - is this as it should be?

 Thanks! 

anonymous profile picture
Account deleted
Posts: 228

15 March 2010, 16:43

That's a weird error.  Is it possible that you have a firewall blocking ports?
Reggie  Euser's profile picture
Posts: 14

16 March 2010, 15:26

Hi Penny, thanks for the reply.

 We certainly have ports blocked. Do we need ports other than 80 (which in our case is forwarded to 8080 where Apache is listening) and/or 443 (forwarded to 8443 for secure login) open?

 Just for exercise, I went back and cleaned up the database as instructed in the ReadMeFirst post, then tried again.  Same thing.

Thanks again for helping!

anonymous profile picture
Account deleted
Posts: 228

16 March 2010, 16:28

Hrmm.  What if you run this command from a login shell on the server:

wget http://yourmoodlesite.com/index.php

Do you get a result?

anonymous profile picture
Account deleted
Posts: 228

16 March 2010, 16:32

And did you set up Mahara as a peer in Moodle? Did that work?
Reggie  Euser's profile picture
Posts: 14

16 March 2010, 17:12

Running:

 wget http://yourmoodlesite.com/index.php 

give me connection refused.

Running:

wget http://yourmoodlesite.com:8080/index.php

Retrieves index.php

Setting Mahara up as a peer did not work as the public key was not retrieved. I tried adding it manually, but this didn't help.

Gotta be the port, I'm guessing, but specifying 8080 when trying to add the authentication method didn't make any difference. Is there something else I can do?

 

Reggie  Euser's profile picture
Posts: 14

16 March 2010, 17:19

PS -  Just FWIW, I deleted the original database and re-installed Mahara. All went fine, but results are the same.
anonymous profile picture
Account deleted
Posts: 228

16 March 2010, 17:21

At which layer is port 80 forwarded to 8080? Is this done with a reverse proxy, or iptables or what?
Reggie  Euser's profile picture
Posts: 14

16 March 2010, 17:34

iptables, I believe.

 (This is a virtual server, I don't have root access and didn't set up the forwarding...any easy, accessible way to confirm?)

15 results