Open rayzchen opened 3 years ago
If you're running as root you can try using --disable_clone_newuser
.
Or yet better as the warning message suggest compile in/enable unprivileged user namespace and run as non-root.
[E][2021-07-19T20:13:00+0100][5543] bool subproc::runChild(nsjconf_t*, int, int, int)():455 nsjail tried to use the CLONE_NEWCGROUP clone flag, which is supported under kernel versions >= 4.6 only. Try disabling this flag: Invalid argument
Are u running on kernel <4.6? IF so, try passing --disable_clone_newcgroup
flag.
Also, why --user 0
? You probably shouldn't use the real root user within the jail.
If u want an example where we sandboxed a Python app for a CTF challenge, exposed on a port, see https://github.com/justcatthefish/justctf-2020/blob/master/challenges/pwn_mylittlepwny/private/private/nsjail.cfg and the upper dir etc.
I would like to use nsjail to run a python script with limited permissions, e.g this script:
I don't want the script to be able to create a file in the parent directory, so I only want to limit their scope of access to the current working directory and/or
/tmp
. This was my approach:I am running as root. What am I doing wrong? Is this even the right way to do it? I built nsjail by source using
make
.