Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CURL error: Connection timed out Issue when Using MNet #181

Open
andisugandi opened this issue Oct 25, 2023 · 4 comments
Open

CURL error: Connection timed out Issue when Using MNet #181

andisugandi opened this issue Oct 25, 2023 · 4 comments

Comments

@andisugandi
Copy link

andisugandi commented Oct 25, 2023

In order to MNet to be working properly in Moodle site (using this moodlehq/moodle-php-apache Docker image) the PHP must be compiled with XMLRPC Support: --with-xmlrpc in Configure Command. Please see It doesn't work. What do I do now?.

  • make sure xmlrpc is installed. Please go to your phpinfo page and search for --with-xmlrpc. If your php has not been compiled with xmlrpc then you need to address that! At present it appears that PEAR xmlrpc will not work.

I got the output of the php command bellow: --with-xmlrpc is not enabled (by default) in the moodlehq/moodle-php-apache image. Is it (please CMIIW)?

$ php -i | grep 'Configure \Command'

Configure Command =>  './configure'  '--build=x86_64-linux-gnu' '--with-config-file-path=/usr/local/etc/php' '--with-config-file-scan-dir=/usr/local/etc/php/conf.d' '--enable-option-checking=fatal' '--with-mhash' '--with-pic' '--enable-ftp' '--enable-mbstring' '--enable-mysqlnd' '--with-password-argon2' '--with-sodium=shared' '--with-pdo-sqlite=/usr' '--with-sqlite3=/usr' '--with-curl' '--with-iconv' '--with-openssl' '--with-readline' '--with-zlib' '--disable-phpdbg' '--with-pear' '--with-libdir=lib/x86_64-linux-gnu' '--disable-cgi' '--with-apxs2' 'build_alias=x86_64-linux-gnu'

If it is not enabled by default (in Configure Command), how to rebuild the image with this: --with-xmlrpc ?

Thank you in advance.

MoodleSite-admin-phpinfo php--2023-10-25
@stronk7
Copy link
Member

stronk7 commented Oct 25, 2023

Hola @andisugandi ,

and which image (tag) of the moodle-php-apache images are you using exactly? I think that current images (up to php 8.2) come with the xmlrpc extension installed.

And, more important... which Moodle version are you using? Note that, since Moodle 4.1, the xmlrpc extension is NOT needed for MNet. We changed MNet to use a (pure-php) library instead of the extension (see MDL-70889).

Ciao :-)

@andisugandi
Copy link
Author

andisugandi commented Oct 26, 2023

Hello, @stronk7 ,

Thank you for the response. =)

and which image (tag) of the moodle-php-apache images are you using exactly? I think that current images (up to php 8.2) come with the xmlrpc extension installed.

Forgot to mention those details, sorry.

It is using moodlehq/moodle-php-apache:8.1 and the MNet is between Moodle site version 4.1.5+ (Build: 20230826) and 4.3+ (Build: 20231013).

And, more important... which Moodle version are you using? Note that, since Moodle 4.1, the xmlrpc extension is NOT needed for MNet. We changed MNet to use a (pure-php) library instead of the extension (see MDL-70889).

Is that pure-php library already included & enabled in moodle-php-apache:8.1 ?

Related Issues

The issue is happening in two activities:

  1. When the user (for example, from Moodle 4.1) wants to access the "Network Servers" (Moodle 4.3 site), then the error message appears:
Ooops! Your MNET communication has failed! Here's that error message to pass on to your administrator: CURL error: Connection timed out after 59001 millisecondsERROR 8:<br />8:CURL error: Connection timed out after 59001 milliseconds<br />
 
Debug info:
Error code: rpcerror
 
Stack trace:
line 261 of /auth/mnet/auth.php: moodle_exception thrown
line 51 of /auth/mnet/land.php: call to auth_plugin_mnet->confirm_mnet_session()
Network-Servers-Login-MNet--2023-10-26
  1. When user wants to "Edit Enrollment" on "Remote Enrollments Client" page, the error message is:
mnetservice_enrol/fetchingcourses
 
Debug info: mnet_xmlrpc_client request returned errors:
8:CURL error: Connection timed out after 59001 milliseconds
 
Error code: fetchingcourses
$a contents:
 
Stack trace:
line 62 of /mnet/service/enrol/host.php: moodle_exception thrown
Edit-Enrollments-MNet--2023-10-26

What do you suggest?

Thank you.

@andisugandi andisugandi changed the title How To Rebuild The Image with XMLRPC Support on PHP CURL error: Connection timed out Issue when Using MNet Nov 2, 2023
@andisugandi
Copy link
Author

andisugandi commented Nov 13, 2023

Hi all,

This MNet cURL Connection timed out issue has been resolved by appending the extra_hosts on its corresponding moodle service:

extra_hosts:
  - "host.docker.internal:host-gateway"

But it then leads to different issue: CURL error: SSL certificate problem: unable to get local issuer certificate.

The current conditions are:

  1. Accessing "Network Servers":

    • Moodle 4.3 to Moodle 4.1 is working successfully (no issue).
    • Moodle 4.1 to Moodle 4.3 has an error:
      Ooops! Your MNET communication has failed! Here's that error message to pass on to your administrator: CURL error: SSL certificate problem: unable to get local issuer certificateERROR 8:<br />8:CURL error: SSL certificate problem: unable to get local issuer certificate<br />
    
      Debug info:
      Error code: rpcerror
    
      Stack trace:
      line 261 of /auth/mnet/auth.php: moodle_exception thrown
      line 51 of /auth/mnet/land.php: call to auth_plugin_mnet->confirm_mnet_session()
    

    More information about this error

    01-Accessing-NetworkServers-Moodle41-to-Moodle43-cropped
  2. Clicking "Edit Enrollment" on "Remote Enrollments Client" page:

    • Moodle 4.3 to Moodle 4.1 has an error:

      mnetservice_enrol/fetchingcourses
      
      Debug info: mnet_xmlrpc_client request returned errors:
      8:CURL error: SSL certificate problem: unable to get local issuer certificate
      
      Error code: fetchingcourses
      $a contents:
      
      Stack trace:
      line 62 of /mnet/service/enrol/host.php: moodle_exception thrown
      

      More information about this error

    02-EditEnrollments-on-RemoteEnrollmentsClientpage-Moodle43-cropped
    • Moodle 4.1 to Moodle 4.3 is working successfully (no issue).

Any helps and suggestions are very much appreciated.

Thank you.

@stronk7
Copy link
Member

stronk7 commented Nov 18, 2023

Hola @andisugandi,

I may be wrong but I think your problem may be that you're trying to make a SSL connection between the 2 Moodle servers and one (or both) them are lacking any certificate, so SSL cannot do its work.

Maybe your configuration is missing some curl.cainfo or openssl.cafile configuration or something else, but it seems to be related to SSL in the system in general.

Maybe, for testing purposes, you can go to your MNet configuration and try to switch the peers "SSL verification" to none in both servers and see if, that way, it works.

Then, go enabling it and verify which exact combination is the one not working for you.

Finally, note that these images are intended for development purposes, not production, so some settings may be not the best for production.

Ciao :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants