A prototype for sandboxing ruby stuff on Linux, with cgroups and Apparmor.
The ruby code is neutral, but the security wrapping is specific for Ubuntu Trusty.
cd box
make deps
make install
make apparmor
Add the box user
make user
Create cgroup settings. The settings is 25% CPU share, 32Mo of RAM.
make cgroup
Run the server
make init.d
sudo service sandbox start
You can now use the tiny client
cat toto.haml | ./cli.rb /run/box/box.sock
There is no limit to paranoia.
Restart the daemon periodicaly.
Install tcpspy
and auditd
, export syslog to a distant server.
Isolate the sandbox with virtualization, KVM or Xen, try grsec patch.
sudo apparmor_parser -Q --debug /etc/apparmor.d/opt.box.box
Only two writable things, /run/box and /run/box/box.sock
LPGL © 2015 Mathieu Lecarme