Skip to content

Commit 4104cec

Browse files
authored
feat: Move codejail apparmor profile to public-dockerfiles (#117)
This is part of setting up to deploy to stage. See corresponding PR: edx/public-dockerfiles#106
1 parent 9a2067b commit 4104cec

File tree

3 files changed

+9
-121
lines changed

3 files changed

+9
-121
lines changed

codejail.profile

Lines changed: 0 additions & 113 deletions
This file was deleted.

docs/codejail.rst

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,21 +17,22 @@ These instructions are for Linux only. Additional research would be required to
1717

1818
In order to run the codejail devstack component:
1919

20-
1. Install AppArmor: ``sudo apt install apparmor``
21-
2. Add the provided codejail AppArmor profile to your OS: ``sudo apparmor_parser --add -W ./codejail.profile``
22-
3. Configure LMS and CMS to use the codejail-service by uncommenting ``# ENABLE_CODEJAIL_REST_SERVICE = True`` in ``py_configuration_files/{lms,cms}.py``
23-
4. Run ``make codejail-up``
20+
#. Install AppArmor: ``sudo apt install apparmor``
21+
#. Clone the `<https://github.com/edx/public-dockerfiles>`__ repo as a sibling to your devstack checkout.
22+
#. Add the provided codejail AppArmor profile to your OS: ``sudo apparmor_parser --replace -W ../public-dockerfiles/apparmor/openedx_codejail_service.profile``
23+
#. Configure LMS and CMS to use the codejail-service by uncommenting ``# ENABLE_CODEJAIL_REST_SERVICE = True`` in ``py_configuration_files/{lms,cms}.py``
24+
#. Run ``make codejail-up``
2425

2526
The service does not need any provisioning, and does not have dependencies.
2627

27-
Over time, the AppArmor profile may need to be updated. Changes to the file do not automatically cause changes to the version that has been installed in the OS. When significant changes have been made to the profile, you'll need to re-install the profile. This can be done by passing ``--replace`` instead of ``--add``, like so: ``sudo apparmor_parser --replace -W ./codejail.profile``
28+
Over time, the AppArmor profile may need to be updated. Changes to the file do not automatically cause changes to the version that has been installed in the OS. When significant changes have been made to the profile, you'll need to update the profile using the same ``apparmor_parser`` command you used to install it in the first place. (The ``--replace`` option acts to either add or update, as appropriate.)
2829

2930
Development
3031
***********
3132

3233
Changes to the AppArmor profile must be coordinated with changes to the Dockerfile, as they need to agree on filesystem paths.
3334

34-
Any time you update the profile file, you'll need to update the profile in your OS as well: ``sudo apparmor_parser --replace -W ./codejail.profile``
35+
Any time you update the profile file, you'll need to re-run the ``apparmor_parser`` command to add/replace the profile.
3536

3637
The profile file contains the directive ``profile openedx_codejail_service``. That defines the name of the profile when it is installed into the OS, and must agree with the relevant ``security_opt`` line in ``docker-compose.yml``. This name should not be changed, as it creates a confusing situation and would require every developer who uses codejail-service to do a number of manual steps. (Profiles can't be renamed *within* the OS; they must first be removed **under the old name**, and then a new profile must be installed under the new name.)
3738

py_configuration_files/codejail.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
CODEJAIL_ENABLED = True
1313

1414
CODE_JAIL = {
15-
# These values are coordinated with the Dockerfile (in edx/public-dockerfiles)
16-
# and the AppArmor profile (codejail.profile in edx/devstack).
15+
# These values are coordinated with the Dockerfile and the AppArmor
16+
# profile (openedx_codejail_service.profile) both in edx/public-dockerfiles.
1717
'python_bin': '/sandbox/venv/bin/python',
1818
'user': 'sandbox',
1919

0 commit comments

Comments
 (0)