All Projects → fubarnetes → libjail-rs

fubarnetes / libjail-rs

Licence: BSD-3-Clause License
Rust implementation of a FreeBSD jail library

Programming Languages

rust
11053 projects

Projects that are alternatives of or similar to libjail-rs

knast
Experimental OCI & CRI-compatible container runtimes for FreeBSD
Stars: ✭ 20 (-37.5%)
Mutual labels:  freebsd, freebsd-jail-manager, freebsd-jails
Mail-Toaster-6
Mail Toaster 6
Stars: ✭ 40 (+25%)
Mutual labels:  freebsd, jails
ansible-sshjail
An Ansible connection plugin for provisioning FreeBSD jails remotely
Stars: ✭ 57 (+78.13%)
Mutual labels:  freebsd, freebsd-jails
jailman
Automated iocage Jail manager for FreeNAS
Stars: ✭ 26 (-18.75%)
Mutual labels:  freebsd, freebsd-jails
ansible-role-bastille
An ansible role that helps configure a server as a BastilleBSD host
Stars: ✭ 15 (-53.12%)
Mutual labels:  freebsd, jails
fixie-trie
Compact tries for fixed-width keys
Stars: ✭ 23 (-28.12%)
Mutual labels:  rust-library
dotpr0n
Dotfiles for macOS, FreeBSD, fish, tmux, custom functions and lots more. Peekaboo!
Stars: ✭ 44 (+37.5%)
Mutual labels:  freebsd
opengnb
GNB is open source de-centralized VPN to achieve layer3 network via p2p with the ultimate capability of NAT Traversal.GNB是一个开源的去中心化的具有极致内网穿透能力的通过P2P进行三层网络交换的VPN。
Stars: ✭ 440 (+1275%)
Mutual labels:  freebsd
findlargedir
find all "blackhole" directories with a huge amount of filesystem entries in a flat structure
Stars: ✭ 15 (-53.12%)
Mutual labels:  freebsd
static-web-server
A blazing fast and asynchronous web server for static files-serving. ⚡
Stars: ✭ 230 (+618.75%)
Mutual labels:  freebsd
envmnt
Environment variables utility functions.
Stars: ✭ 16 (-50%)
Mutual labels:  rust-library
aktors
Rust actor library with a bit of inspiration from Akka/Pykka
Stars: ✭ 44 (+37.5%)
Mutual labels:  rust-library
meyda-rs
This may become an audio feature extraction library for Rust.
Stars: ✭ 15 (-53.12%)
Mutual labels:  rust-library
cheribsd
FreeBSD adapted for CHERI-RISC-V and Arm Morello.
Stars: ✭ 95 (+196.88%)
Mutual labels:  freebsd
transaction-rs
The transaction abstraction library and its executors for rust
Stars: ✭ 16 (-50%)
Mutual labels:  rust-library
jail exporter
A Prometheus exporter for FreeBSD jail metrics
Stars: ✭ 21 (-34.37%)
Mutual labels:  freebsd
maildir
A simple library to deal with maildir folders
Stars: ✭ 19 (-40.62%)
Mutual labels:  rust-library
dotfiles
personal dotfiles with stow
Stars: ✭ 16 (-50%)
Mutual labels:  freebsd
unifi-pfsense
A script that installs the UniFi Controller software on pfSense and other FreeBSD systems
Stars: ✭ 617 (+1828.13%)
Mutual labels:  freebsd
digitalocean
A prototype API for Digital Ocean.
Stars: ✭ 35 (+9.38%)
Mutual labels:  rust-library

libjail-rs

Crates.io GitHub last commit Gitter Libraries.io for releases Crates.io Crates.io BuildBot Travis Docs: x86_64-unknown-freebsd Docs: i686-unknown-freebsd FOSSA Status

libjail-rs aims to be a rust implementation of the FreeBSD jail(3) library. While feature parity is a goal, a one-to-one implementation of all functions in jail(3) is not.

Is it any good?

Yes.

Can I use it?

This library is still under heavy development, but seems to work so far. No stability guarantees are made.

How do I use it?

jail = "*"

Execute a command in a jail:

use jail::process::Jailed;
use jail::StoppedJail;
use std::process::Command;

fn main() {
    let stopped = StoppedJail::new("/path/to/root")
        .name("alcatraz")
        .ip("127.0.1.2".parse().unwrap())
        .ip("fe80::2".parse().unwrap * ())
        .param("allow.raw_sockets", param::Value::Int(1));

    let running = stopped.start().expect("Couldn't start Jail");

    let output = Command::new("hostname")
        .jail(&running)
        .output()
        .expect("Failed to execute command");

    println!("output: {:?}", output.stdout);

    running.kill();
}

Is it fast?

There are a few benchmarks included. Run them with sudo cargo bench (yes, starting a jail requires being root).

These are some results on my laptop, on slow, spinning disks:

test echo_helloworld_free       ... bench:     271,418 ns/iter (+/- 17,522)
test echo_helloworld_jailed     ... bench:     461,749 ns/iter (+/- 26,267)
test get_ips                    ... bench:      29,591 ns/iter (+/- 3,315)
test start_echo_helloworld_stop ... bench:     504,978 ns/iter (+/- 23,717)
test start_stop_ipjail          ... bench:      27,220 ns/iter (+/- 2,141)
test start_stop_ipv4jail        ... bench:      26,307 ns/iter (+/- 2,159)
test start_stop_ipv6jail        ... bench:      26,988 ns/iter (+/- 2,486)
test start_stop_jail            ... bench:      25,760 ns/iter (+/- 2,244)

License

FOSSA Status

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].