Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
771de938
Commit
771de938
authored
Feb 25, 2013
by
Ned Batchelder
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update the instructions for setting up the sandbox.
parent
ec7a04fd
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
42 additions
and
7 deletions
+42
-7
common/lib/codejail/README
+42
-7
No files found.
common/lib/codejail/README
View file @
771de938
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:
virtualenv <SANDENV>
$ sudo
virtualenv <SANDENV>
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 {
...
#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
$ apparmor_parser
$ aaenforce <SANDENV>/bin/python
$ sudo apparmor_parser <APPARMOR_FILE>
Reactivate your real virtualenv again
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment