Landlock 26.10.6631
dotnet add package Landlock --version 26.10.6631
NuGet\Install-Package Landlock -Version 26.10.6631
<PackageReference Include="Landlock" Version="26.10.6631" />
<PackageVersion Include="Landlock" Version="26.10.6631" />
<PackageReference Include="Landlock" />
paket add Landlock --version 26.10.6631
#r "nuget: Landlock, 26.10.6631"
#:package Landlock@26.10.6631
#addin nuget:?package=Landlock&version=26.10.6631
#tool nuget:?package=Landlock&version=26.10.6631
Landlock for .NET
A lightweight C# wrapper for the Linux https://landlock.io/ kernel sandboxing feature.
📦 Installation
Add the NuGet package:
dotnet add package Landlock
Or visit: https://www.nuget.org/packages/Landlock
🔍 What is Landlock?
Landlock is a Linux kernel security feature (available since Linux 5.13) that lets unprivileged applications restrict their own filesystem access using an allow-list model. Once a ruleset is enforced, the process—and any child processes—can only access explicitly permitted paths, providing simple but effective sandboxing without requiring root privileges or system-wide configuration.
📌 Library Overview
This library provides a clean and idiomatic C# interface for working with Landlock, allowing you to define filesystem rulesets, grant specific directory or file permissions, and enforce permanent access restrictions at runtime. It is intended for sandboxing plugins, securing file operations, or adding defense-in-depth to applications running on Linux.
🛠️ Usage
using Landlock;
var supported = Landlock.IsSupported();
if (supported)
{
var sandbox = Landlock.CreateRuleset(Landlock.FileSystem.CORE);
sandbox.AddPathBeneathRule(
AllowedDir,
Landlock.FileSystem.READ_FILE,
Landlock.FileSystem.READ_DIR
);
sandbox.Enforce();
}
This example checks for kernel support, creates a ruleset controlling core filesystem operations, allows read access to a specific directory, and enforces the sandbox so the process cannot access anything outside the allowed paths.
Restricting TCP connections
On Linux 6.7+ (Landlock ABI 4) a ruleset can also handle TCP. Every port not named by a rule is denied:
var sandbox = Landlock.CreateRuleset(
new[] { Landlock.FileSystem.CORE },
new[] { Landlock.Network.CONNECT_TCP });
sandbox.AddPathBeneathRule("/usr", Landlock.FileSystem.READ_FILE, Landlock.FileSystem.READ_DIR, Landlock.FileSystem.EXECUTE);
sandbox.AddPortRule(443, Landlock.Network.CONNECT_TCP);
sandbox.Enforce();
Landlock restricts the calling thread and every process it starts afterwards, irrevocably. To confine a child process without confining your application, enforce the ruleset on a dedicated thread and start the process from that thread.
🧪 Requirements
- Linux kernel 5.13+ (6.7+ for TCP port rules), x86_64 or arm64
- .NET 6.0+
- No root privileges required
📝 License
MIT License.
Landlock logo © 2024 by Mickaël Salaün is licensed under CC BY-SA 4.0
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 is compatible. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- No dependencies.
-
net6.0
- No dependencies.
-
net7.0
- No dependencies.
-
net8.0
- No dependencies.
-
net9.0
- No dependencies.
NuGet packages (1)
Showing the top 1 NuGet packages that depend on Landlock:
| Package | Downloads |
|---|---|
|
Computerwelt.Playwright
Playwright's Python sync API inside the Computerwelt sandbox, over the .NET Playwright driver. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 26.10.6631 | 243 | 10/12/2026 |
| 25.12.63045 | 6,053 | 12/7/2025 |
| 25.12.63002 | 754 | 12/3/2025 |
| 25.12.63000 | 719 | 12/3/2025 |