strapyourself.in and flouri.sh
How to set up the ruby sandbox
April 4th, 2009
There's very little recent work on the MRI ruby sandbox, so here's a quick guide to getting the sandbox installed and running. Unfortunately, the sandbox requires a patched ruby, but luckily it's not that hard to set up.
- Download the latest version of ruby 1.8.6 from ftp://ftp.ruby-lang.org/pub/ruby/1.8 (does not work with 1.8.7 or 1.9, sorry)
- Download the sandbox gem source from git://github.com/why/sandbox.git
-
Patch ruby:
patch -p1 < ../sandbox_gem/patch/ruby-1.8.6-sandbox_needs.patch
patching file error.c -
Compile and install the patched ruby:
./configure
make
sudo make install - Download and install rubygems from RubyForge
-
Install the sandbox gem:
cd sandbox_gem && sudo ruby setup.rb -
Test the sandbox:
require "sandbox" Sandbox.safe.eval("2+2") # yields 4
Now that you've got the sandbox running, read more about it in my article on Advanced Sandboxing, or my Sandbox Introduction.
1 Response to “How to set up the ruby sandbox”
Sorry, comments are closed for this article.
April 4th, 2009 at 04:07 PM David, are you planning on getting this project up and live again? I'm interested in seeing it running some more modern versions of the MRI.