Skip to main content

landlockpy

PyPI CI CodeQL OpenSSF Scorecard License: 0BSD

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.

Used in: MeshChatX, LXMFy

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

License: 0BSD.

Metadata

Release files for landlockpy 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for landlockpy 0.2.0
File Size Uploaded
landlockpy-0.2.0.tar.gz 117.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for landlockpy 0.2.0
File Interpreter ABI Platform
landlockpy-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 130.0 kB

Release files / landlockpy-0.2.0.tar.gz

Download URL landlockpy-0.2.0.tar.gz
Size 117.2 kB
Tags Source
SHA-256 checksum
How to use checksums
2a915db59a2c1970d181f9c2bff786d6040d8f9105380da64390f5fe61b4148d
BLAKE2b-256 checksum
How to use checksums
ce4d68125d88aaf547726daad59ff7b17d33e9ffeee3083ba95eb29d21a9c25a
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 26, 2026.

Transparency log

Release files / landlockpy-0.2.0-py3-none-any.whl

Download URL landlockpy-0.2.0-py3-none-any.whl
Size 12.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c61b7fe84ead14ff6b091baa2e5f52c7b81e509571ebe5e707e92f1aaf90f2c9
BLAKE2b-256 checksum
How to use checksums
d36486b6ffd07b6359d51f1cedca35846998fd90df92aa027d661fa181715fba
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 26, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page