Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-74394

Make mnet public key validation php8 compatible

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • 3.11.7, 4.0.1
    • 3.11.6, 4.0
    • MNet
    • MOODLE_311_STABLE, MOODLE_400_STABLE
    • MOODLE_311_STABLE, MOODLE_400_STABLE
    • Hide

      You will need to create ssl certificate https://www.digitalocean.com/community/tutorials/how-to-create-a-self-signed-ssl-certificate-for-apache-in-ubuntu-20-04 and use ngrok for you moodles

      Using php8:

      1. Setup a couple of Moodle sites (site1 and site2), one with MOODLE_311_STABLE and another with MOODLE_400_STABLE or master.
      2. Ensure that they have different $CFG->sessioncookie setting (can modify it from Administration).
      3. In both sites, enable and configure MNet as explained @ https://docs.moodle.org/311/en/MNet#Peer_to_Peer_Network. You don't need to configure the "remote enrolments" steps, only the "get users roaming" ones.
      4. Create user1 in site1 and user2 in site2.
      5. Log as user1 in site1
      6. Go to the home/front page of the site.
      7. In the "network servers" block (that has been added as per the configuration instructions, click on site2.
      8. Verify that now you are welcome to site2 as user1.
      9. Log as user2in site2
      10. Go to the home/front page of the site.
      11. In the "network servers" block (that has been added as per the configuration instructions, click on site1.
      12. Verify that now you are welcome to site1 as user2.
      13. Done, now user1 and user2 do exist in both sites and SSO/roaming between them works ok.

      Note: during the setup, depending of the debugging levels, it's possible that you see some notices, ignore them as far as the configuration happens ok.

      Show
      You will need to create ssl certificate https://www.digitalocean.com/community/tutorials/how-to-create-a-self-signed-ssl-certificate-for-apache-in-ubuntu-20-04 and use ngrok for you moodles Using php8: Setup a couple of Moodle sites (site1 and site2), one with MOODLE_311_STABLE and another with MOODLE_400_STABLE or master. Ensure that they have different $CFG->sessioncookie setting (can modify it from Administration). In both sites, enable and configure MNet as explained @ https://docs.moodle.org/311/en/MNet#Peer_to_Peer_Network . You don't need to configure the "remote enrolments" steps, only the "get users roaming" ones. Create user1 in site1 and user2 in site2. Log as user1 in site1 Go to the home/front page of the site. In the "network servers" block (that has been added as per the configuration instructions, click on site2. Verify that now you are welcome to site2 as user1. Log as user2in site2 Go to the home/front page of the site. In the "network servers" block (that has been added as per the configuration instructions, click on site1. Verify that now you are welcome to site1 as user2. Done, now user1 and user2 do exist in both sites and SSO/roaming between them works ok. Note: during the setup, depending of the debugging levels, it's possible that you see some notices, ignore them as far as the configuration happens ok.

      As part of processing mnet requests - Moodle verifies that the public key associated with the mnet host is a valid key.

      It does this by checking that the type returned by `openssl_get_publickey` for the key is a "resource". However, as of php 8.0, that function now returns an object of type "OpenSSLAsymmetricKey" on success.

      By checking for either, we can support both php7 and 8 (the function still returns `false` on failure).

      Reference:

      https://www.php.net/manual/en/function.openssl-pkey-get-public.php (openssl_get_publickey is an alias to this func).

            aolley Adam Olley
            aolley Adam Olley
            Eloy Lafuente (stronk7) Eloy Lafuente (stronk7)
            Ilya Tregubov Ilya Tregubov
            Carlos Escobedo Carlos Escobedo
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - 0 minutes
                0m
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 3 hours, 55 minutes
                3h 55m

                  Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.