landlockpy
Dependency-free Python bindings for the Landlock Linux security module. Landlock lets unprivileged processes sandbox themselves with filesystem, network and IPC restrictions enforced by the kernel. Supports ABI versions 1 through 11 with best-effort degradation on older kernels.
Requires Python 3.10+ and Linux 5.13+ with Landlock enabled in the LSM list.
Install
pip install landlockpy
Usage
from landlockpy import AccessFS, AccessNet, Ruleset
with Ruleset() as ruleset:
ruleset.allow_path(
"/usr", AccessFS.READ_FILE | AccessFS.READ_DIR | AccessFS.EXECUTE
)
ruleset.allow_port(443, AccessNet.CONNECT_TCP)
ruleset.restrict()
# everything not granted above is now denied for this thread and its children
landlockpy.supported() reports whether the running kernel has Landlock,
and landlockpy.abi_version() returns its ABI version.
Documentation
- API: docstrings in
src/landlockpy/, mostlyruleset.py - Landlock API reference: https://docs.kernel.org/userspace-api/landlock.html
- Project site: https://landlock.io/
License: 0BSD.
Metadata
Release files for landlockpy 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| landlockpy-0.1.1.tar.gz | 79.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| landlockpy-0.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 91.3 kB
Release files / landlockpy-0.1.1.tar.gz
| Download URL | landlockpy-0.1.1.tar.gz |
|---|---|
| Size | 79.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3fa0664a17170b1ae0aa6a2d980503b7230aa51c9e6edfb25e58db0f71aed34b
|
|
BLAKE2b-256 checksum How to use checksums |
4931232a718dff1b96c125b768877e89eab4406dca9bcca637ac319fb2f51363
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 22, 2026.
Transparency logRelease files / landlockpy-0.1.1-py3-none-any.whl
| Download URL | landlockpy-0.1.1-py3-none-any.whl |
|---|---|
| Size | 11.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0e39be3c21fbc4875adccd1a775de921720807cc61471b12426f679999d33e5f
|
|
BLAKE2b-256 checksum How to use checksums |
40c401f436799913c95d27dd733fe8ef5470452fe03d4243e66c3557c1063c23
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 22, 2026.
Transparency log