Commit 771de938 by Ned Batchelder

Update the instructions for setting up the sandbox.

parent ec7a04fd
Choose a place for the virtualenv, call it <SANDENV> Choose a place for the virtualenv, call it <SANDENV>. It will be automatically
detected and used if you put it right alongside your existing virtualenv, but
with -sandbox appended. So if your existing virtualenv is in ~/mitx_all/python,
make <SANDENV> be ~/mitx_all/python-sandbox (but you'll need to spell out your
home directory instead of ~).
Other details here that depend on your configuration:
- Your mitx working tree is <MITX>, for example, ~/mitx_all/mitx
- The user running the LMS is <USER>, for example, you on a dev machine,
or www-data on a server.
Create a virtualenv: Create a virtualenv:
virtualenv <SANDENV> $ sudo virtualenv <SANDENV>
Install the sandbox requirements Install the sandbox requirements
$ source <SANDENV>/bin/activate
$ sudo pip install -r sandbox-requirements.txt
Add a sandbox user:
$ sudo addgroup sandbox
$ sudo adduser --disabled-login sandbox --ingroup sandbox
Let the web server run the sandboxed Python as sandbox. Create the file
/etc/sudoers.d/01-sandbox:
Edit an AppArmor profile: $ visudo -f /etc/sudoers.d/01-sandbox
<USER> ALL=(sandbox) NOPASSWD:<SANDENV>/bin/python
<USER> ALL=(ALL) NOPASSWD:/bin/kill
Edit an AppArmor profile. The file must be named for the python executable,
but with slashes changed to dots:
#include <tunables/global>
<SANDENV>/bin/python { <SANDENV>/bin/python {
... #include <abstractions/base>
<SANDENV>/** mr,
<MITX>/common/lib/sandbox-packages/** r,
/usr/local/lib/python2.7/** r,
/usr/lib/python2.7/** rix,
/tmp/** rix,
} }
Parse the profiles Parse the profiles
$ apparmor_parser $ sudo apparmor_parser <APPARMOR_FILE>
$ aaenforce <SANDENV>/bin/python
Reactivate your real virtualenv again
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment