tutor-contrib-codejail 21.0.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- tutor_contrib_codejail-21.0.1.dist-info/METADATA +145 -0
- tutor_contrib_codejail-21.0.1.dist-info/RECORD +25 -0
- tutor_contrib_codejail-21.0.1.dist-info/WHEEL +4 -0
- tutor_contrib_codejail-21.0.1.dist-info/entry_points.txt +3 -0
- tutor_contrib_codejail-21.0.1.dist-info/licenses/LICENSE +671 -0
- tutorcodejail/__about__.py +3 -0
- tutorcodejail/__init__.py +1 -0
- tutorcodejail/patches/.gitignore +0 -0
- tutorcodejail/patches/cms-env +4 -0
- tutorcodejail/patches/k8s-deployments +133 -0
- tutorcodejail/patches/k8s-services +14 -0
- tutorcodejail/patches/kustomization-configmapgenerator +17 -0
- tutorcodejail/patches/lms-env +4 -0
- tutorcodejail/patches/local-docker-compose-dev-services +8 -0
- tutorcodejail/patches/local-docker-compose-services +45 -0
- tutorcodejail/plugin.py +150 -0
- tutorcodejail/templates/codejail/apps/.gitignore +0 -0
- tutorcodejail/templates/codejail/apps/codejail/tutor.py +18 -0
- tutorcodejail/templates/codejail/apps/codejail-service-v2/tutor.py +34 -0
- tutorcodejail/templates/codejail/apps/profiles/docker-edx-sandbox.profile +80 -0
- tutorcodejail/templates/codejail/apps/profiles/openedx-codejail-service.profile +132 -0
- tutorcodejail/templates/codejail/build/.gitignore +0 -0
- tutorcodejail/templates/codejail/build/codejail/Dockerfile +100 -0
- tutorcodejail/templates/codejail/build/codejail-service/Dockerfile +173 -0
- tutorcodejail/templates/codejail/build/codejail_apparmor/Dockerfile +14 -0
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: tutor-contrib-codejail
|
|
3
|
+
Version: 21.0.1
|
|
4
|
+
Summary: Codejail plugin for Tutor
|
|
5
|
+
Author: eduNEXT
|
|
6
|
+
License-File: LICENSE
|
|
7
|
+
Classifier: Development Status :: 3 - Alpha
|
|
8
|
+
Classifier: Intended Audience :: Developers
|
|
9
|
+
Classifier: Operating System :: OS Independent
|
|
10
|
+
Classifier: Programming Language :: Python
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
15
|
+
Requires-Dist: tutor~=21.0
|
|
16
|
+
Requires-Python: >=3.10
|
|
17
|
+
Project-URL: Code, https://github.com/edunext/tutor-contrib-codejail
|
|
18
|
+
Project-URL: Issue tracker, https://github.com/edunext/tutor-contrib-codejail/issues
|
|
19
|
+
Project-URL: Homepage, https://github.com/github/tutor-contrib-codejail
|
|
20
|
+
Description-Content-Type: text/markdown
|
|
21
|
+
|
|
22
|
+
# Codejail plugin for [Tutor](https://docs.tutor.overhang.io)
|
|
23
|
+
|
|
24
|
+
[Codejail](https://github.com/openedx/codejail) is a Python library used to
|
|
25
|
+
manage the execution of Python code in a sandboxed environment.
|
|
26
|
+
|
|
27
|
+
This plugin configures and runs a remote CodeJail Service instance that
|
|
28
|
+
implements the safe-exec API used by the Open edX platform to offer more
|
|
29
|
+
advanced capabilities to course authors.
|
|
30
|
+
|
|
31
|
+
Starting from the Ulmo release, the codejail plugin is transitioning to an
|
|
32
|
+
alternative implementation of the safe-exec API (
|
|
33
|
+
[Codejail Service V2](https://github.com/openedx/codejail-service)). You can
|
|
34
|
+
opt-in to use this new implementation on Ulmo before it finally becomes the
|
|
35
|
+
default on the Verawood release.
|
|
36
|
+
|
|
37
|
+
> [!NOTE]
|
|
38
|
+
> The new CodeJail Service implementation is based on Django instead of Flask,
|
|
39
|
+
> therefore settings changed with the `codejail-*-settings` patches must be
|
|
40
|
+
> adjusted accordingly.
|
|
41
|
+
|
|
42
|
+
## Installation
|
|
43
|
+
|
|
44
|
+
To install the latest version, run:
|
|
45
|
+
|
|
46
|
+
``` bash
|
|
47
|
+
pip install tutor-contrib-codejail
|
|
48
|
+
# or install from the source
|
|
49
|
+
pip install git+https://github.com/edunext/tutor-contrib-codejail
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## Requisites
|
|
53
|
+
|
|
54
|
+
By it's very nature of allowing arbitrary code execution, the CodeJail service
|
|
55
|
+
must be run under a hardened environment. The security guarantees are enforced
|
|
56
|
+
through AppArmor security profiles and thus necessitates the use of a Linux host
|
|
57
|
+
with support for AppArmor security module (usually Debian derived
|
|
58
|
+
distributions).
|
|
59
|
+
|
|
60
|
+
You can validate if your Linux host has AppArmor enabled by running:
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
aa-enabled
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## Configuration
|
|
67
|
+
|
|
68
|
+
To customize the configuration, update the following settings in Tutor:
|
|
69
|
+
|
|
70
|
+
- `CODEJAIL_APPARMOR_DOCKER_IMAGE`: (default: `docker.io/ednxops/codejail_apparmor_loader:latest`)
|
|
71
|
+
- `CODEJAIL_DOCKER_IMAGE_V2` : (default: `{{ CODEJAIL_DOCKER_IMAGE }}-v2`)
|
|
72
|
+
- `CODEJAIL_DOCKER_IMAGE`: (default: `docker.io/ednxops/codejailservice:{{__version__}}`)
|
|
73
|
+
- `CODEJAIL_ENABLE_K8S_DAEMONSET` (default: `False`)
|
|
74
|
+
- `CODEJAIL_ENFORCE_APPARMOR` (default: `True`)
|
|
75
|
+
- `CODEJAIL_EXTRA_PIP_REQUIREMENTS` (default: `[]`)
|
|
76
|
+
- `CODEJAIL_SANDBOX_PYTHON_VERSION` (default: `3.11.9`)
|
|
77
|
+
- `CODEJAIL_SERVICE_REPOSITORY` (default: `https://github.com/edunext/codejailservice.git`\`)
|
|
78
|
+
- `CODEJAIL_SERVICE_VERSION` (default: `{{ OPENEDX_COMMON_VERSION }}`),
|
|
79
|
+
- `CODEJAIL_SERVICE_V2_REPOSITORY`: (default: `https://github.com/openedx/codejail-service.git`)
|
|
80
|
+
- `CODEJAIL_SERVICE_V2_VERSION`: (default: `{{ OPENEDX_COMMON_VERSION }}`)
|
|
81
|
+
- `CODEJAIL_USE_SERVICE_V2`: (default: `False`)
|
|
82
|
+
|
|
83
|
+
The `CODEJAIL_*_SERVICE_V2` settings are meant to be used only during the Ulmo
|
|
84
|
+
release and will be phased-out during the Verawood release.
|
|
85
|
+
|
|
86
|
+
To opt-in to the new implementation of the code-exec API set
|
|
87
|
+
`CODEJAIL_USE_SERVICE_V2` to `True` and re-deploy your environment. If you are
|
|
88
|
+
using a a custom image for the codejail service you will need to rebuild
|
|
89
|
+
it with `CODEJAIL_USE_SERVICE_V2` set to `True`.
|
|
90
|
+
|
|
91
|
+
### Custom Image
|
|
92
|
+
|
|
93
|
+
In most cases, you can work with the provided Docker image for the
|
|
94
|
+
release. You will need to build a custom image if you either:
|
|
95
|
+
|
|
96
|
+
- Need additional packages installed in the sandbox environment. Use the setting
|
|
97
|
+
`CODEJAIL_EXTRA_PIP_REQUIREMENTS` to define the list of additional packages.
|
|
98
|
+
- Need to run the sandbox environment under a different Python version. The
|
|
99
|
+
default Python version of the sandbox might get updated between releases,
|
|
100
|
+
potentially breaking instructor generated code. You can set
|
|
101
|
+
`CODEJAIL_SANDBOX_PYTHON_VERSION` to an older version to avoid disruption
|
|
102
|
+
while figuring out a migration plan.
|
|
103
|
+
|
|
104
|
+
## Kubernetes Support
|
|
105
|
+
|
|
106
|
+
The CodeJail service provides a sandbox to run arbitrary code. Security
|
|
107
|
+
enforcement in the sandbox is done through *AppArmor*, this means that
|
|
108
|
+
AppArmor must be installed in the host machine, and the [provided
|
|
109
|
+
profile](tutorcodejail/templates/codejail/apps/profiles/docker-edx-sandbox)
|
|
110
|
+
must be loaded.
|
|
111
|
+
|
|
112
|
+
For Kubernetes environments, you must ensure each node has AppArmor installed
|
|
113
|
+
and has successfully loaded the profile.
|
|
114
|
+
|
|
115
|
+
You can enable a helper Daemon Set that will load the profile onto all the nodes
|
|
116
|
+
by setting `CODEJAIL_ENABLE_K8S_DAEMONSET` to true.
|
|
117
|
+
|
|
118
|
+
If you choose to run the service without enforcing the AppArmor profile
|
|
119
|
+
(absolutely discouraged, and not possible on the newer implementation of
|
|
120
|
+
codejail-service), you can set `CODEJAIL_ENFORCE_APPARMOR` to `False`.
|
|
121
|
+
|
|
122
|
+
More info about this discussion can be found on [this
|
|
123
|
+
issue](https://github.com/eduNEXT/tutor-contrib-codejail/issues/24).
|
|
124
|
+
|
|
125
|
+
## Testing Functionality
|
|
126
|
+
|
|
127
|
+
To verify if Codejail is working, use a course with loncapa problems in `Studio`
|
|
128
|
+
and check for correct execution. You can import the provided
|
|
129
|
+
[example course](https://github.com/eduNEXT/tutor-contrib-codejail/blob/main/docs/resources/course_codejail_example.tar.gz).
|
|
130
|
+
|
|
131
|
+
Once the course is imported, go to any section and select an exercise
|
|
132
|
+
([section example](http://studio.local.overhang.io:8001/container/block-v1:edX+DemoX+Demo_Course+type@vertical+block@v-integral1)),
|
|
133
|
+
the proper result is:
|
|
134
|
+
|
|
135
|
+
{.align-center
|
|
136
|
+
width="725px"}
|
|
137
|
+
|
|
138
|
+
In this case, the section\'s content will render correctly and work as
|
|
139
|
+
specified in the instructions of the problem.
|
|
140
|
+
|
|
141
|
+
## License
|
|
142
|
+
|
|
143
|
+
This software is licensed under the terms of the AGPLv3. See the LICENSE
|
|
144
|
+
file for details.
|
|
145
|
+
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
tutorcodejail/__about__.py,sha256=-8WwBNLVP6KDDLjvWTaDSqdWJAx9UPVbDOKivq732qs,89
|
|
2
|
+
tutorcodejail/__init__.py,sha256=OEfOPh3AfOhZMr7Htulro8oImpx8KM8B13EcU7fNKcE,46
|
|
3
|
+
tutorcodejail/patches/.gitignore,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
4
|
+
tutorcodejail/patches/cms-env,sha256=p3sNpSho5ey_GAqzLwRnv5WD4PK3O8LPwaN1T17Ft0A,183
|
|
5
|
+
tutorcodejail/patches/k8s-deployments,sha256=Dx4JZKaB0hHNPzZGRjvVPYP3gZ8wnxTYBBlL4WCP9xo,3606
|
|
6
|
+
tutorcodejail/patches/k8s-services,sha256=vxogWCH8xwaREJZoNstQM2jtUuE1Lt_Af1eNSresvCY,247
|
|
7
|
+
tutorcodejail/patches/kustomization-configmapgenerator,sha256=lRtm0jp0y-WtFwkEyK8B9WSTqSjix2f7X05la5MN8tI,505
|
|
8
|
+
tutorcodejail/patches/lms-env,sha256=p3sNpSho5ey_GAqzLwRnv5WD4PK3O8LPwaN1T17Ft0A,183
|
|
9
|
+
tutorcodejail/patches/local-docker-compose-dev-services,sha256=HIdoPNxxiv5kyiDp60mduV8Clqi-1qOE1Kk08Q5hIF0,224
|
|
10
|
+
tutorcodejail/patches/local-docker-compose-services,sha256=Ems9EVgjAJayaOelfwu-FNHd-sIbMVJV5eecykzmWwM,1290
|
|
11
|
+
tutorcodejail/plugin.py,sha256=LwOJArd8F54nmI4QtBekvP4EKE_eaz3WiYqJYIW9ixk,4925
|
|
12
|
+
tutorcodejail/templates/codejail/apps/.gitignore,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
13
|
+
tutorcodejail/templates/codejail/apps/codejail/tutor.py,sha256=_3wK0fmvlYo4MF5zVxJWamRna9i9dsbU10SwkNZatD0,698
|
|
14
|
+
tutorcodejail/templates/codejail/apps/codejail-service-v2/tutor.py,sha256=fVqExZAIjUr-sAPYyn_dhekHeko06ky48dtnuRrsLsQ,890
|
|
15
|
+
tutorcodejail/templates/codejail/apps/profiles/docker-edx-sandbox.profile,sha256=SlBFhPa-l_WjohgdcL59cOmsSWCdiCAi2dj9OuGL4AQ,2693
|
|
16
|
+
tutorcodejail/templates/codejail/apps/profiles/openedx-codejail-service.profile,sha256=rsiQbCIgQi0DcKBIiL-8o-vIezxLKmDgRVP7yOMCftc,6215
|
|
17
|
+
tutorcodejail/templates/codejail/build/.gitignore,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
18
|
+
tutorcodejail/templates/codejail/build/codejail/Dockerfile,sha256=iDurNXmTPI43BAdLExx_D1pkvwKWHW4ZCugF_0Mfy3M,3530
|
|
19
|
+
tutorcodejail/templates/codejail/build/codejail-service/Dockerfile,sha256=PiVZ7uUreRxD1dGnyRBG4n02oVqRU1z5pdPSDXZMuOs,6532
|
|
20
|
+
tutorcodejail/templates/codejail/build/codejail_apparmor/Dockerfile,sha256=4yE8DvB1p1-eXTpkwigLQsAHwuMuZj5yCw3FgsJ3bFk,527
|
|
21
|
+
tutor_contrib_codejail-21.0.1.dist-info/licenses/LICENSE,sha256=mMDJ5pDEC9Gsj98_TBQD_6JLz7nx5ICJ5beKL5fc_TQ,35117
|
|
22
|
+
tutor_contrib_codejail-21.0.1.dist-info/WHEEL,sha256=iCTolw4aw2dP3yfM-EQCGTDsFCXL_ymmbYnBRVH7plA,81
|
|
23
|
+
tutor_contrib_codejail-21.0.1.dist-info/entry_points.txt,sha256=k4kbrj4TxiTadInHhTWGi8POsyevWtIKpVElNqlKGFw,51
|
|
24
|
+
tutor_contrib_codejail-21.0.1.dist-info/METADATA,sha256=SG2qzhDHlTBgj3DBjIa0bN88R6K8dxGcxQadh_D8Uc4,6119
|
|
25
|
+
tutor_contrib_codejail-21.0.1.dist-info/RECORD,,
|