6 releases (3 breaking)

0.4.1 Sep 13, 2024
0.4.0 Jun 19, 2024
0.3.1 Mar 26, 2024
0.3.0 Oct 10, 2023
0.1.0 Apr 14, 2021

#44 in Unix APIs

Download history 30740/week @ 2024-07-20 26142/week @ 2024-07-27 28993/week @ 2024-08-03 40988/week @ 2024-08-10 25769/week @ 2024-08-17 36474/week @ 2024-08-24 41581/week @ 2024-08-31 37013/week @ 2024-09-07 32850/week @ 2024-09-14 36295/week @ 2024-09-21 35070/week @ 2024-09-28 38605/week @ 2024-10-05 38437/week @ 2024-10-12 41574/week @ 2024-10-19 33333/week @ 2024-10-26 40121/week @ 2024-11-02

158,579 downloads per month
Used in 16 crates (5 directly)

MIT/Apache

135KB
2.5K SLoC

Rust Landlock library

Landlock is a security feature available since Linux 5.13. The goal is to enable to restrict ambient rights (e.g., global filesystem access) for a set of processes by creating safe security sandboxes as new security layers in addition to the existing system-wide access-controls. This kind of sandbox is expected to help mitigate the security impact of bugs, unexpected or malicious behaviors in applications. Landlock empowers any process, including unprivileged ones, to securely restrict themselves. More information about Landlock can be found in the official website.

This Rust crate provides a safe abstraction for the Landlock system calls along with some helpers.

Use cases

This crate is especially useful to protect users' data by sandboxing:

  • trusted applications dealing with potentially malicious data (e.g., complex file format, network request) that could exploit security vulnerabilities;
  • sandbox managers, container runtimes or shells launching untrusted applications.

Examples

A simple example can be found with the path_beneath_rules() helper. More complex examples can be found with the Ruleset documentation and the sandboxer example.

Crate documentation

Changelog

Dependencies

~0.3–0.8MB
~19K SLoC