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

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

by Donal McMullan -
Number of replies: 0
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.