codejail icon indicating copy to clipboard operation
codejail copied to clipboard

No exception raised when testing

Open odevia opened this issue 8 years ago • 1 comments

Hi, I'm trying to install codejail. I followed all the instructions but when i run this code

import codejail.jail_code
codejail.jail_code.configure('python', '/home/jail/env/sandenv/bin/python', 'sandbox')
import codejail.safe_exec
codejail.safe_exec.safe_exec("import os\nos.system('ls /etc')", {})

It runs but doesn't raise any exceptions or error. Here is my configurations:

ls -al total 16 drwxrwxr-x 4 jail jail 4096 19 18:37 . drwxr-xr-x 22 jail jail 4096 19 18:39 .. drwxrwxr-x 7 jail jail 4096 19 18:37 main drwxr-xr-x 7 jail jail 4096 19 14:49 sandenv

/etc/apparmor.d/home.jail.env.sandenv.bin.python

#include <tunables/global>

/home/jail/env/sandenv/bin/python {
    #include <abstractions/base>
    #include <abstractions/python>

    /home/jail/env/sandenv/** mr,
    # If you have code that the sandbox must be able to access, add lines
    # pointing to those directories:
    /home/jail/env/sandenv/lib/python2.7/site-packages/** r,

    /tmp/codejail-*/ rix,
    /tmp/codejail-*/** wrix,
}

/etc/sudoers.d/01-sandbox

jail ALL=(sandbox) SETENV:NOPASSWD:/home/jail/env/sandenv/bin/python jail ALL=(sandbox) SETENV:NOPASSWD:/usr/bin/find jail ALL=(ALL) NOPASSWD:/usr/bin/pkill

Any idea?

odevia avatar Jun 19 '16 19:06 odevia

Me too. Unable to get exception.

shubhamjain0594 avatar Feb 27 '18 13:02 shubhamjain0594