commit | a12687bc602fe52f75c5a61b6d49f18bba909787 | [log] [tgz] |
---|---|---|
author | Matt Delco <[email protected]> | Fri Feb 07 17:12:47 2020 -0800 |
committer | Treehugger Robot <[email protected]> | Wed Feb 12 15:59:49 2020 +0000 |
tree | 7f5f73eff5fe1e21acb23c11efe67a6f4b9c84db | |
parent | 6123e5aea63e669b9df73f7fa287e27ad28db426 [diff] |
add support for python installer The best I could come up with for allowing compile_seccomp_policy to be an executable script installed via setup.py. Originally I cooked up a trick where setup.py also had: data_files=[('minijail', ['constants.json'])], and compile_seccomp_policy.py used: constants_file = 'constants.json' if pkg_resources.resource_exists(__name__, constants_file): constants_file = pkg_resources.resource_filename(__name__, constants_file) so that a package can ship with a constants.json and auotmatically use it. This works when installed as a 'dist-package' egg, but CrOS installs as a 'site-package' where this trick don't work (constants.json ends up in another location under /usr, not to mention being stored with a board) and it complicates the dependency story for the Makefile so I punted. For both 'dist-package' and 'site-package' the plain "import XXX" form doesn't work for files located in the same directory (results in a ModuleNotFoundError error), so I've added a "from minijail import XXX" fallback so new & original cases both work okay. Bug: None Test: `make tests`. Ran 'python3 setup.py install --record files.txt' and verified the stubs in /usr/local/bin could be used to launch the 3 scripts without import errors. Change-Id: I61fe0b624960c89fd715c1c60213edc2b736ad1c
The Minijail homepage and main repo is https://android.googlesource.com/platform/external/minijail/.
There might be other copies floating around, but this is the official one!
Minijail is a sandboxing and containment tool used in Chrome OS and Android. It provides an executable that can be used to launch and sandbox other programs, and a library that can be used by code to sandbox itself.
You're one git clone
away from happiness.
$ git clone https://android.googlesource.com/platform/external/minijail $ cd minijail
Releases are tagged as linux-vXX
: https://android.googlesource.com/platform/external/minijail/+refs
See the HACKING.md document for more details.
See the RELEASE.md document for more details.
See the tools/README.md document for more details.
We've got a couple of contact points.
The following talk serves as a good introduction to Minijail and how it can be used.
The Chromium OS project has a comprehensive sandboxing document that is largely based on Minijail.
After you play with the simple examples below, you should check that out.
# id uid=0(root) gid=0(root) groups=0(root),128(pkcs11) # minijail0 -u jorgelo -g 5000 /usr/bin/id uid=72178(jorgelo) gid=5000(eng) groups=5000(eng)
# minijail0 -u jorgelo -c 3000 -- /bin/cat /proc/self/status Name: cat ... CapInh: 0000000000003000 CapPrm: 0000000000003000 CapEff: 0000000000003000 CapBnd: 0000000000003000