Could not upgrade or installing plugins from Moodle plugin directory

Could not upgrade or installing plugins from Moodle plugin directory

Tony Zhang -
回帖数:11

Hi,

It just happened about a week ago that my site couldn't get plugins updated or installed. Below is the error I got when I tried to install morefontcolor:


Installing available updates

Debugging output enabled
cURL request for "https://moodle.org/plugins/download.php/24237/mod_bigbluebuttonbn_moodle311_2019101008.zip" failed, HTTP response code: HTTP/1.1 403 Forbidden
  • line 1623 of /lib/filelib.php: call to debugging()
  • line 447 of /lib/classes/update/code_manager.php: call to download_file_content()
  • line 416 of /lib/classes/update/code_manager.php: call to core\update\code_manager->download_file_content()
  • line 121 of /lib/classes/update/code_manager.php: call to core\update\code_manager->download_plugin_zip_file()
  • line 1146 of /lib/classes/plugin_manager.php: call to core\update\code_manager->get_remote_plugin_zip()
  • line 1327 of /lib/classes/plugin_manager.php: call to core_plugin_manager->get_remote_plugin_zip()
  • line 2505 of /lib/upgradelib.php: call to core_plugin_manager->install_plugins()
  • line 196 of /admin/plugins.php: call to upgrade_install_plugins()
Downloading mod_bigbluebuttonbn ... Error

I've tried CURL command on server and it downloaded the zip file no problem.

Please help,
Tony

回复Tony Zhang

Re: Could not upgrade or installing plugins from Moodle plugin directory

Tony Zhang -
Anyone can help?
回复Tony Zhang

Re: Could not upgrade or installing plugins from Moodle plugin directory

Ken Task -
Particularly helpful Moodlers的头像

If you were root user and acquired the BBB plugin via curl and it succeeded there is no wonder in that.   Same if logged on as user via ssh that owns the directory to which you were downloading the .zip.

Via Moodle GUI ... different story.   This sounds like a permissions issue.

So what is:

1. locadtion of moodledata in relation to code.

2. ownership and permissions on directories/files in your moodledata.

3. the zip of the plugin you attempt to install has to be able to be downloaded, unzipped, checked to see if it's a proper archive for installing, then that routine has to arvhive the current plugin folder, and copy the new code/plugin into a proper location for installing ... like a mod plugin to the code/mod/ directory.

Also, your site could be running some sort of web application firewall (WAF) [like mod_security] that is preventing ... same is true of seLinux.

So check your servers web service error logs as well as any WAF log to see what's the problem.

Note: you can manually install plugins.

Please see:

https://docs.moodle.org/311/en/Installing_plugins#Installing_a_plugin

'SoS', Ken

回复Ken Task

Re: Could not upgrade or installing plugins from Moodle plugin directory

Tony Zhang -
Hi Ken,

I really appreciate your reply!

Follow the steps you mentioned, I think I may found the problem: I could download the zip file using CURL but couldn't unzip it and this is what I got trying to unzip it:

Archive: mod_bigbluebuttonbn_moodle311_2019101008.zip
End-of-central-directory signature not found. Either this file is not
a zipfile, or it constitutes one disk of a multi-part archive. In the
latter case the central directory and zipfile comment will be found on
the last disk(s) of this archive.
unzip: cannot find zipfile directory in one of mod_bigbluebuttonbn_moodle311_2019101008.zip or
mod_bigbluebuttonbn_moodle311_2019101008.zip.zip, and cannot find mod_bigbluebuttonbn_moodle311_2019101008.zip.ZIP, period.

But I tried the same file on my computer and it unzipped no problem.

My OS is Centos 7, do you have any suggestion?

Thank you again,
Tony
回复Tony Zhang

Re: Could not upgrade or installing plugins from Moodle plugin directory

Tony Zhang -
Also when I FILE the zip file I downloaded using CURL, it says it's a HTML document, but not a Zip archive data.

Any idea why?
回复Tony Zhang

Re: Could not upgrade or installing plugins from Moodle plugin directory

Ken Task -
Particularly helpful Moodlers的头像

On Centos 7, you probably don't have 'unzip' installed.

yum install unzip [ENTER] - that might also grab some related libraries ... just say yes! 微笑

What curl command are you using?

curl -LO urltozipfile

will display something like this:

  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 2123k  100 2123k    0     0  1226k      0  0:00:01  0:00:01 --:--:-- 1226k

And to check the zip ...

file -b nameofzipfiles.zip

should show:

Zip archive data, at least v2.0 to extract

Transferring (downloading) from Moodle plugins server a plugin zip, one can also use wget .... thusly ... wget https://URL to zip file.  That will save the zip where you are currently located.

'SoS', Ken

回复Ken Task

Re: Could not upgrade or installing plugins from Moodle plugin directory

Tony Zhang -
I have UNZIP installed. I used curl -LO downloaded this zip file and when I used FILE, this came up:

# file mod_bigbluebuttonbn_moodle311_2019101008.zip
mod_bigbluebuttonbn_moodle311_2019101008.zip: HTML document, ASCII text, with very long lines

When I used WGET I get this:

# wget https://moodle.org/plugins/download.php/24237/mod_bigbluebuttonbn_moodle311_2019101008.zip
--2021-06-08 13:19:39-- https://moodle.org/plugins/download.php/24237/mod_bigbluebuttonbn_moodle311_2019101008.zip
Resolving moodle.org (moodle.org)... 104.22.65.81, 104.22.64.81, 172.67.26.233, ...
Connecting to moodle.org (moodle.org)|104.22.65.81|:443... connected.
HTTP request sent, awaiting response... 403 Forbidden
2021-06-08 13:19:40 ERROR 403: Forbidden.

Any thoughts?

Thanks,
Tony
回复Tony Zhang

Re: Could not upgrade or installing plugins from Moodle plugin directory

Ken Task -
Particularly helpful Moodlers的头像

Strange ... on a CentOS 7 server when I use wget it works.

Difference in mine ... my server talks DNS v6 for resolving:

Resolving moodle.org (moodle.org)... 2606:4700:10::6816:4151, 2606:4700:10::ac43:1ae9, 2606:4700:10::6816:4051, ...
Connecting to moodle.org (moodle.org)|2606:4700:10::6816:4151|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 388931 (380K) [application/zip]
Saving to: ‘mod_bigbluebuttonbn_moodle311_2019101008.zip’

Might try again with -v (verbose) as an option so you might see something more.

Wonder if public IP address of your server has some how been ID'd as a 'bad actor' by cloudflare cause you report a denied.

Also try: curl -svo /dev/null https://moodle.org

Will give you info + CloudFlare ray.

'SoS', Ken

回复Ken Task

Re: Could not upgrade or installing plugins from Moodle plugin directory

Tony Zhang -
Hi Ken,

This is what I got using WGET -V:

# wget -v https://moodle.org/plugins/download.php/24237/mod_bigbluebuttonbn_moodle311_2019101008.zip
--2021-06-08 20:53:24-- https://moodle.org/plugins/download.php/24237/mod_bigbluebuttonbn_moodle311_2019101008.zip
Resolving moodle.org (moodle.org)... 172.67.26.233, 104.22.65.81, 104.22.64.81, ...
Connecting to moodle.org (moodle.org)|172.67.26.233|:443... connected.
HTTP request sent, awaiting response... 403 Forbidden
2021-06-08 20:53:25 ERROR 403: Forbidden.

And this is what I got after curl -svo /dev/null https://moodle.org:

# curl -svo /dev/null https://moodle.org
* About to connect() to moodle.org port 443 (#0)
* Trying 104.22.65.81...
* Connected to moodle.org (104.22.65.81) port 443 (#0)
* Initializing NSS with certpath: sql:/etc/pki/nssdb
* CAfile: /etc/pki/tls/certs/ca-bundle.crt
CApath: none
* SSL connection using TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256
* Server certificate:
* subject: CN=sni.cloudflaressl.com,O="Cloudflare, Inc.",L=San Francisco,ST=CA,C=US
* start date: Aug 02 00:00:00 2020 GMT
* expire date: Aug 02 12:00:00 2021 GMT
* common name: sni.cloudflaressl.com
* issuer: CN=Cloudflare Inc ECC CA-3,O="Cloudflare, Inc.",C=US
> GET / HTTP/1.1
> User-Agent: curl/7.29.0
> Host: moodle.org
> Accept: */*
>< HTTP/1.1 403 Forbidden < Date: Tue, 08 Jun 2021 12:54:09 GMT < Content-Type: text/html; charset=UTF-8 < Transfer-Encoding: chunked < Connection: close < CF-Chl-Bypass: 1 < Permissions-Policy: accelerometer=(),autoplay=(),camera=(),clipboard-read=(),clipboard-write=(),fullscreen=(),geolocation=(),gyroscope=(),hid=(),interest-cohort=(),magnetometer=(),microphone=(),payment=(),publickey-credentials-get=(),screen-wake-lock=(),serial=(),sync-xhr=(),usb=() < Cache-Control: private, max-age=0, no-store, no-cache, must-revalidate, post-check=0, pre-check=0 < Expires: Thu, 01 Jan 1970 00:00:01 GMT < X-Frame-Options: SAMEORIGIN < cf-request-id: 0a8d4912bc0000d1af4d951000000001 < Expect-CT: max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct" < Server: cloudflare < CF-RAY: 65c244646b86d1af-HKG <
{ [data not shown]
* Closing connection 0

It looks like that Cloudflare is rejecting the connection from our server.

Do you have some thoughts about this?

Thank you,
Tony
回复Tony Zhang

Re: Could not upgrade or installing plugins from Moodle plugin directory

Tony Zhang -
Is there a way to find out for sure if it's Cloudlfare?
回复Tony Zhang

Re: Could not upgrade or installing plugins from Moodle plugin directory

Ken Task -
Particularly helpful Moodlers的头像

Since file -b says the downloaded file is an html file, it is probably an error page from cloudflare ... rename the .zip file to .html then view with browser to see what CF might be telling you.

Also ... might want to check your certs using SSLabs checker.

https://www.ssllabs.com/ssltest/

One should not be running any ssl protocols these days ....   tls 1.2 or higher.

Also ciphers could be reduced ... SSLabs checker will tell ya.

IF you PM me the FQDN and real IP address of your server I can do some remote testing for ya and get back via PM.

'SoS', Ken

回复Tony Zhang

Re: Could not upgrade or installing plugins from Moodle plugin directory

Ken Task -
Particularly helpful Moodlers的头像

It is cloudflare ...

From workstation (Mac) clip:

*   Trying 2606:4700:10::6816:4151...
* TCP_NODELAY set
* Connected to moodle.org (2606:4700:10::6816:4151) port 443 (#0)
* ALPN, offering h2
* ALPN, offering http/1.1
* successfully set certificate verify locations:
*   CAfile: /etc/ssl/cert.pem
  CApath: none
* TLSv1.2 (OUT), TLS handshake, Client hello (1):
} [224 bytes data]
* TLSv1.2 (IN), TLS handshake, Server hello (2):
{ [100 bytes data]
* TLSv1.2 (IN), TLS handshake, Certificate (11):
{ [2211 bytes data]
* TLSv1.2 (IN), TLS handshake, Server key exchange (12):
{ [115 bytes data]
* TLSv1.2 (IN), TLS handshake, Server finished (14):
{ [4 bytes data]
* TLSv1.2 (OUT), TLS handshake, Client key exchange (16):
} [37 bytes data]
* TLSv1.2 (OUT), TLS change cipher, Change cipher spec (1):
} [1 bytes data]
* TLSv1.2 (OUT), TLS handshake, Finished (20):
} [16 bytes data]
* TLSv1.2 (IN), TLS change cipher, Change cipher spec (1):
{ [1 bytes data]
* TLSv1.2 (IN), TLS handshake, Finished (20):
{ [16 bytes data]
* SSL connection using TLSv1.2 / ECDHE-ECDSA-CHACHA20-POLY1305
* ALPN, server accepted to use h2
* Server certificate:
*  subject: C=US; ST=CA; L=San Francisco; O=Cloudflare, Inc.; CN=sni.cloudflaressl.com
*  start date: Aug  2 00:00:00 2020 GMT
*  expire date: Aug  2 12:00:00 2021 GMT

and

< cf-ray: 65c286a2dfc310e4-ORD

From Rackspace server:

curl -svo /dev/null https://moodle.org

Mine:

> GET / HTTP/1.1
> User-Agent: curl/7.29.0
> Host: moodle.org
> Accept: */*
>
and ok the rest from there.

Yours breaks down @
>< HTTP/1.1 403 Forbidden

Also see your ray as coming from Hong Kong

CF-RAY: 65c244646b86d1af-HKG

How's the setup of https on your server?   Certs OK?

You could use SSLabs checker to check your cert on your server.

You are not running selfsigned certs are ya?

'SoS', Ken