A process sandboxing library written in Rust.
Please note that this sandboxing library is a work in progress and has not yet been reviewed for correctness and overall security, so use at your own risk.
At the time of writing, Arch Linux chose to enable unprivileged namespace
support with kernel version +5.1.8, meaning that gaol now finally works
on Arch Linux. However, it relies on a chroot
jail which is rather easy to
escape, and the API is also incompatible with std::command::Command
.
rusty-sandbox works as expected on macOS using more secure methods, but Linux
is unsupported and it does not allow for filesystem mapping and mounting nor
fine-grained access control.
std::process::Command
builder.std::process::Command
builder (this is currently unsupported until rust-lang/rust#44434 is
resolved).clone(2)
ensures
process isolation between parent and sandbox).setfsuid
and capset
are per-thread rather than per-process, and any
times that Bastille does call setuid
, we are in a separate child
process).setuid
).tmpfs
mount point for the new root in $base_path
, create a dir
$base_path/new_root
, pivot_root()
to $base_path
, put the old root in
$base_path/old_root
. Next, set up new_root
with all the mounts,
directories, symlinks, etc. and pivot_root()
again to /new_root
,
unmount /old_root
, and unshare mount permissions.sandboxd
(very heavy WIP).capsicum
(don't have a box to test with ATM).pledge
(don't have a box to test with ATM).Design for the Linux backend implementation is loosely inspired by Bubblewrap.
Bastille is free and open source software distributed under the terms of the MIT and the Apache 2.0 licenses.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.