Native FreeBSD jail bindings with libc.
Project description
py-jail
A native Python wrapper for FreeBSD jails using libc.
Usage
jail_set
>>> import jail
>>> jiov = jail.Jiov(dict(persist=None, jid=23, path="/rescue"))
>>> jail.dll.jail_set(jiov.pointer, len(jiov), 1)
23
jail_remove
>>> import jail
>>> jiov = jail.Jiov(dict(persist=None, jid=23, path="/rescue"))
>>> jail.dll.jail_remove(23)
-1
>>> jail.dll.jail_set(jiov.pointer, len(jiov), 1)
23
>>> jail.dll.jail_set(jiov.pointer, len(jiov), 1)
-1
>>> jiov.errmsg.value
b'jail 23 already exists'
>>> jail.dll.jail_remove(23)
0
>>> jail.dll.jail_set(jiov.pointer, len(jiov), 1)
23
Parameters
Networking
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 192.168.1.42/24 inet6 add 2001:db8:10C::42/64
import ipaddress
import jail
jiov = jail.Jiov({
"persist": None,
"jid": 23,
"path": "/rescue",
"ip4.addr": ipaddress.IPv4Address("192.168.1.42")
"ip6.addr": ipaddress.IPv6Address("2001:db8:10C::42")
})
jail.dll.jail_set(jiov.pointer, len(jiov), 1)
Development
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
Releases
We try to manually keep a Changelog, following the style on changelog.md. 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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file jail-0.0.14.tar.gz
.
File metadata
- Download URL: jail-0.0.14.tar.gz
- Upload date:
- Size: 7.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.9.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1db2bee0ece866b62ccec5658e0d96cc31826e77ea57cab17f6e1b62ec88f6e1 |
|
MD5 | f687378190432a2850c6371371bb2198 |
|
BLAKE2b-256 | c9d9c1ba16c16d07fdf8b28c9af2d0a572e7b9bf21090e96fd30dd1226861422 |