totara / totara-docker-dev

A docker setup to create a development environment for Totara Learn
MIT License
49 stars 32 forks source link

Restrict access to some directories and files create continues error in SCORM activities #232

Closed angelakuznetsova closed 1 year ago

angelakuznetsova commented 1 year ago

In server configuration files, we have some code to restrict access to files and directories while using ngrok. If you are restricting access the SCROM activities not working properly.

To Reproduce

  1. Create a cource
  2. Create a SCORM activity and add SCORM to it
  3. Try to run SCROM module.
  4. You will see persistent errors

Expected behavior Should work without interrupting.

Screenshots Screenshot 2022-12-13 at 15 15 36

Screenshot 2022-12-13 at 15 21 11

Causing: Forbidden access to .txt file, particularly to checknet.txt We need to edit the regex expression to allow access to checknet.txt

location ~ .*.(txt|md|json|xml|mustache)$ { deny all; }

derschatta commented 1 year ago

Current workaround:

Modify the following to nginx/config/remote-server.conf

location ~ .*\.(txt|md|json|xml|mustache)$ {
    deny all;

    # Allow this one specifically to make sure SCORM network checks are successful
    location ~ ^/lib/yui/build/moodle-core-checknet/assets/checknet.txt$ {
        allow all;
    }
}

and for apache edit apache/config/remote-server.conf and change the Rewrite section to look like:

RewriteRule (\/cli\/|\/tests\/|\/db\/|\/lang\/|\/classes\/|\/amd\/src\/|/rb_sources/|\/yui\/src\/|\/templates\/) - [R=404]
RewriteRule \/\. - [R=404]
# Allow this one specifically to make sure SCORM network checks are successful
RewriteCond %{REQUEST_URI} !^/lib/yui/build/moodle-core-checknet/assets/checknet.txt$
RewriteRule \.(txt|md|json|xml|mustache) - [R=404]

After that run either tbuild nginx && tup nginx or tbuild apache && tup apache.

derschatta commented 1 year ago

PR is merged