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 reference: https://quad4-software.github.io/landlockpy/
- 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.2.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 | Provenance | Actions |
|---|---|---|---|---|
| landlockpy-0.2.1.tar.gz | 131.1 kB | With provenance | Details for landlockpy-0.2.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| landlockpy-0.2.1-py3-none-any.whl | Python 3 | none | any | Details for landlockpy-0.2.1-py3-none-any.whl |
Total release size: 143.8 kB
Release files / landlockpy-0.2.1.tar.gz
| Download URL | landlockpy-0.2.1.tar.gz |
|---|---|
| Size | 131.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1fdd407136e7cffe433c37da4af9e988dcf179db017d7ade0fa654d237cee503
|
|
BLAKE2b-256 checksum How to use checksums |
0d650fd214803a95d3fa45d85dcc2a9a3c20c873b6b11841bde0c9bd527eff44
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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 Nov 1, 2026.
Transparency logRelease files / landlockpy-0.2.1-py3-none-any.whl
| Download URL | landlockpy-0.2.1-py3-none-any.whl |
|---|---|
| Size | 12.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ec25c9975a6e8a1803f021394cc21debe6c37e1daaa9a790af9cec7c452cc454
|
|
BLAKE2b-256 checksum How to use checksums |
5c512cceb89a60ec9a48d884b6b72fdfad872404bcc325c2251864de8e695d91
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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 Nov 1, 2026.
Transparency logSecurity for landlockpy 0.2.1
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.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for landlockpy-0.2.1.tar.gz
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 Nov 1, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.