swetland / mkbox Goto Github PK
View Code? Open in Web Editor NEWexperiments in linux sandbox stuff
experiments in linux sandbox stuff
mkbox: an experiment in nonprivileged sandboxing in Linux --------------------------------------------------------- Requires kernel 3.12 or newer with CONFIG_USER_NS. Tested on Ubuntu 14.04 LTS / Linux 3.13.7. Huge thanks to Andy Lutomirski, who provided the roadmap in the form of a patch to Sandstorm (sandstorm-io/sandstorm#12) as well as kindly assisting with some early debugging as I fell into various pits he had previously explored. Disclaimer: This is a toy built to learn about these APIs and is certainly incomplete, likely buggy, etc. Use at your own risk. "make test" will build mkbox and create sandbox (which will be r/o /), and databox (which will be r/w /data), and copy /bin/busybox into sandbox/bin and create busybox's symlinks in there as well, then invoke: mkbox sandbox `pwd`/databox computer$ id uid=1000(somebody) gid=1000(somebody) groups=1000(somebody) computer$ make test cc -Wall -O1 -g -o mkbox mkbox.c mkdir -p sandbox databox sandbox/bin cp /bin/busybox sandbox/bin chmod 755 sandbox/bin/busybox ( cd sandbox/bin && for x in $(busybox --list) ; do ln -fs busybox $x ; done ) ./mkbox sandbox `pwd`/databox mkbox: pid=14259, child=14260 BusyBox v1.21.1 (Ubuntu 1:1.21.0-1ubuntu1) built-in shell (ash) Enter 'help' for a list of built-in commands. / $ id uid=3333 gid=3333 groups=65534,3333 / $ ls -l drwxrwxr-x 2 3333 3333 4096 Apr 27 04:34 bin drwxrwxr-x 2 3333 3333 4096 Apr 27 04:33 data drwxr-xr-x 2 3333 3333 80 Apr 27 04:34 dev /* in another shell */ computer$ cat /proc/14259/mounts rootfs / rootfs rw 0 0 /dev/root / ext3 ro,nosuid,noatime,errors=remount-ro,barrier=0,data=writeback 0 0 /dev/root /data ext3 rw,noatime,errors=remount-ro,barrier=0,data=writeback 0 0 sandbox-dev /dev tmpfs ro,nosuid,noexec,noatime,size=64k,nr_inodes=16,mode=755,uid=1000,gid=1000 0 0 devtmpfs /dev/null devtmpfs rw,relatime,size=1019296k,nr_inodes=254824,mode=755 0 0 devtmpfs /dev/zero devtmpfs rw,relatime,size=1019296k,nr_inodes=254824,mode=755 0 0
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.