Skip to main content

Native FreeBSD jail bindings with libc.

Project description


A native Python wrapper for FreeBSD jails using libc.



>>> import jail
>>> jiov = jail.Jiov(dict(persist=None, jid=23, path="/rescue"))
>>> jail.dll.jail_set(jiov.pointer, len(jiov), 1)


>>> import jail
>>> jiov = jail.Jiov(dict(persist=None, jid=23, path="/rescue"))
>>> jail.dll.jail_remove(23)
>>> jail.dll.jail_set(jiov.pointer, len(jiov), 1)
>>> jail.dll.jail_set(jiov.pointer, len(jiov), 1)
>>> jiov.errmsg.value
b'jail 23 already exists'
>>> jail.dll.jail_remove(23)
>>> jail.dll.jail_set(jiov.pointer, len(jiov), 1)



Non-VNET jails accept ip.addr and ip6.addr params. Those can be defined from Python ipaddress.IPv4Address and ipaddress.IPv6Address.

ifconfig bridge create inet inet6 add 2001:db8:10C::42/64
import ipaddress
import jail

jiov = jail.Jiov({
	"persist": None,
	"jid": 23,
	"path": "/rescue",
	"ip4.addr": ipaddress.IPv4Address("")
	"ip6.addr": ipaddress.IPv6Address("2001:db8:10C::42")

jail.dll.jail_set(jiov.pointer, len(jiov), 1)


Unit Tests

Unit tests may run on FreeBSD or HardenedBSD.

Static Code Analysis

The project enforces PEP-8 code style and MyPy strong typing via flake8, that is required to pass before merging any changes. Together with Bandit checks for common security issues the static code analysis can be ran on Linux and BSD code execution.

make install-dev
make check


We try to manually keep a Changelog, following the style on New releases are tagged according to Semver, released on PyPi, and published as port.

To get a port published, we need to create a Bugzilla Issue in the Ports category

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

jail-0.0.14.tar.gz (7.1 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page