-
Notifications
You must be signed in to change notification settings - Fork 3k
Description
Feature request description
It would be great if Podman offered an additional --security-opt option for improved isolation strength/security using the Landlock LSM (https://landlock.io/) which I believe has been included in the kernel of most distros for a while now.
Suggest potential solution
In theory, Podman already has knowledge about which filesystem and network operations a container needs access to. Hence, during the process of container creation, Podman could appropriately sandbox the container process (using Landlock) after setting up namespaces and before entering them.
Also, Landlock already provides a Go library to assist with integration at https://pkg.go.dev/github.com/landlock-lsm/go-landlock/landlock.
Have you considered any alternatives?
As per https://docs.podman.io/en/stable/markdown/podman-build.1.html#security-opt-option, Podman already has support for increased runtime security through the SELinux and AppArmor LSMs. This is great, but these are much more complex to use, require external tooling to configure and root access. Landlock on the other hand is designed to allow unprivileged processes to sandbox themselves and can thus offer increased security with very little added friction for the user.
Additional context
I am working on a tool for easily building/managing sandboxed development environments using Podman (https://github.com/Gerharddc/litterbox) which would greatly benefit from this feature. As per https://lore.kernel.org/landlock/20260119.eiphie8iNgu2@digikod.net/T/#t, there are potentially ways to use Landlock without requiring direct support from Podman, but this will be complex/hacky since the order of sandboxing and namespace operations is very important for things to work properly.
For this application, my original plan was to use SELinux + Udica. However, after trying to implement that, it turned out to be overly complex and require root permissions. Another problem is that most distros do not have SELinux support which means many users would not be able to benefit from the feature. Likewise, AppArmor would come with similar issues.