2 moodle installs on same ip, one has Public key other doesn't?

2 moodle installs on same ip, one has Public key other doesn't?

by Heather Barton -
Number of replies: 5

Hi All,

I've looked through the discussions and haven't seen a solution to a similar problem yet.  I have been following the steps from Moodle Network with Moodle1.8 and haven't made it past Peer to Peer 1- 4. add new host

virtual Server: Suse LInux 10 (curl and openSSL installed), Moodle v1.82, Apache2, php5

both moodles have the same IP but different directories eg. http://10.0.0.0/moodleA , http://10.0.0.0/moodleB

under the Network settings for moodle A there isn't a Public Key (date is 1969 also), only a Public Key is available for moodleB.   Shouldn't they both be using the same key from the same machine or is that the problem?

Thank you for listening and any assistance possible,

Heather =)

Average of ratings: -
In reply to Heather Barton

Re: 2 moodle installs on same ip, one has Public key other doesn't?

by Heather Barton -
It is fixed now but I'm not sure what resolved it as it is 1 day later and I:
-rebooted the server
-turned networking off on both sites

and the public key certificates are there now.

not sure why but am happy it appears okay now,

Heather
In reply to Heather Barton

Re: 2 moodle installs on same ip, one has Public key other doesn't?

by mandy honeyman -
Hi Heather,

is this still working? I ask because I thought that you couldn't network if you were using a virtual server at one end?

Please confirm and then I'll ahve another go.

cheers
Mandy
In reply to mandy honeyman

Re: 2 moodle installs on same ip, one has Public key other doesn't?

by Heather Barton -

Hi Mandy,

I did resolve the key issue and both of the moodles are on the same doman and virtual server, and I'm sad to say that I currently don't have it working.  But to be honest I'm not sure why it wouldn't work?  Is it documented somewhere?

I am going to keep trying but have been pulled off of that task for the last couple of days.

Please let me know if you are successful.. I can't get past an mnet error.

Heather

In reply to mandy honeyman

Re: 2 moodle installs on same ip, one has Public key other doesn't?

by Donal McMullan -
Problems can occur when trying to set up MNet with some IP address configurations.

As an example, let's imagine that http://testmoodle.fake is trying to network with http://moodle.org.

If the server at moodle.org resolves the IP address of testmoodle.fake to be 213.16.16.7, but testmoodle.fake is trying to connect to moodle.org from the IP address 20.20.20.20, the attempt will fail. The server at moodle.org will note that the server that claims to be testmoodle.fake is connecting from a different IP address, and will reject the incoming call with a 7017 error.

Usually, this is ok, and it worked fine in testing, but it's causing problems for lots of users in the field. In particular, it can be a problem for some clustered Moodle setups, and may cause problems for Moodles running in virtual servers, etc.

A fix is planned, which will probably be a configuration option allowing admins to disable strict IP checks in Moodle. In the meantime, you can comment out two lines of code which should (untested) disable the IP check for you. The lines are in:

/mnet/xmlrpc/server.php

and they're in the function mnet_server_strip_wrappers. In my checkout, lines 135 and 136 need to be commented out.

} elseif (isset($_SERVER['REMOTE_ADDR']) && $_SERVER['REMOTE_ADDR'] != $MNET_REMOTE_CLIENT->ip_address) {
exit(mnet_server_fault(7017, 'wrong-ip'));

I'd be interested to learn if this resolves networking problems for any users.

In reply to Heather Barton

Re: 2 moodle installs on same ip, one has Public key other doesn't?

by Donal McMullan -
Hi Heather - the first thing I noticed is that you're using the network identifier (10.0.0.0) as a host address. This isn't impossible (I think) but it's pretty unusual. If you have the option, you might want to try 10.0.0.1 or higher as the address for the host.

Having said that...

Each Moodle instance will have its own keypair. The public keys for your Moodles can be viewed on these pages:
http://10.0.0.0/moodleA/admin/mnet/index.php
http://10.0.0.0/moodleB/admin/mnet/index.php

You'll note that they're different. Each of these Moodles must fetch and store the public key of the other one. If you visit this page:
http://10.0.0.0/moodleA/admin/mnet/peers.php?step=update&hostid=3
You should be able to view the public key for some remote host. If you only have one remote host configured (MoodleB) you'll probably see the details for that host. If you don't, please go to this page:
http://10.0.0.0/moodleA/admin/mnet/peers.php
..and click on the link for MoodleB.

If MoodleA has been able to retrieve and store a public key for MoodleB, it will appear here in the text panel. The expiry date of the key will appear below it. If it has failed even to retrieve this key, you're really in trouble. The text panel will be blank and the expiry date will be noted as sometime in 1969/1970.

Keys expire every month or so, and normally when they expire (if you connect to the remote host within a few months after the expiry date) the servers should re-exchange their current up-to-date keys.

However, you may see the following message:
The public key you are holding for this host is different from the public key it is currently publishing.
Underneath, the current up-to-date key that MoodleB is currently publishing will appear. You can copy this text (including the -----BEGIN CERTIFICATE----- and -----END CERTIFICATE----- parts) and paste it into the text panel. Then click on 'save changes'.

If your keys get out of sync for some reason - perhaps you've torn down and re-installed one of your Moodles - this is a good way to re-establish communication between the Moodle instances.