Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable Landlock #2158

Merged
merged 1 commit into from
Jul 30, 2024
Merged

Enable Landlock #2158

merged 1 commit into from
Jul 30, 2024

Conversation

l0kod
Copy link
Contributor

@l0kod l0kod commented Jul 26, 2024

Enable Landlock

Landlock is a feature to create security sandboxes thanks to 3 dedicated system calls. They are designed to be safe to used by any processes, which can only drop their privileges, similarly to seccomp.

The new Landlock LSM is build in the kernel (CONFIG_SECURITY_LANDLOCK=y) but it is not enough to make it usable by default. As a stackable LSM, it is required to enable it at boot time with the CONFIG_LSM list. See https://docs.kernel.org/userspace-api/landlock.html#kernel-support

As for other stackable LSMs, prepending Landlock to the default LSM list enables users to potentially get more protection by default by letting programs sandbox themselves.

Landlock is already enabled by default on Ubuntu 22.04 LTS, Fedora 35, Arch Linux, Alpine Linux, Gentoo, Debian, chromeOS, Azure Linux, WSL2, and more.

How to use

The full test suite is available in the kernel source code.

Alternatively, the sandboxer can be used to easily test Landlock.

Because the goal of sandboxing is to be seamlessly integrated in applications/services and work in a best-effort mode, no specific user space configuration should be needed to leverage Landlock.

Backport

After some time, it would be good to backport this configuration down to the 5.15 kernel to protect users as much as possible.

Testing done

I ran the sort_config.sh script and tested the configuration with a vanilla kernel (not a Flatcar system). It should be tested by someone with knowledge of the Flatcar SDK though.

  • Changelog entries added in the respective changelog/ directory (user-facing change, bug fix, security fix, update)
  • Inspected CI output for image differences: /boot and /usr size, packages, list files for any missing binaries, kernel modules, config files, kernel modules, etc.

@jepio
Copy link
Member

jepio commented Jul 29, 2024

Test failures look expected right now.
these fail for PRs from forks

devcontainer.docker
devcontainer.systemd-nspawn

this is a bug in the test runner right now:

cl.locksmith.cluster

Copy link

github-actions bot commented Jul 29, 2024

@@ -0,0 +1 @@
- Landlock is now enabled for programs to sandbox themselves.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you please add a PR ref here similar to 7d4917d#diff-b1db1840bbe6435ffd261eeff937e5e0ade3e082a99ed9dff6affc044b92a22dR1 ? Also, I would suggest adding some context - Linux kernel security module 'landlock' is now enabled for programs to be able to sandbox themselves ([flatcar/scripts#2158](https://github.com/flatcar/scripts/pull/2158))

@ader1990
Copy link
Contributor

I verified the image changes and it seems that the make config + defconfig also enabled CONFIG_SECURITY_PATH=y, worth a note here for tracking the changes.

@l0kod
Copy link
Contributor Author

l0kod commented Jul 29, 2024

I verified the image changes and it seems that the make config + defconfig also enabled CONFIG_SECURITY_PATH=y, worth a note here for tracking the changes.

That's indeed an automatic dependency. I'll update the commit message.

@l0kod l0kod force-pushed the landlock branch 2 times, most recently from 1d2d53e to aa1c948 Compare July 29, 2024 13:10
Landlock is a feature to create security sandboxes thanks to 3 dedicated
system calls.  They are designed to be safe to used by any processes,
which can only drop their privileges, similarly to seccomp.

The new Landlock LSM is build in the kernel (CONFIG_SECURITY_LANDLOCK=y)
but it is not enough to make it usable by default.  As a stackable LSM,
it is required to enable it at boot time with the CONFIG_LSM list.  See
https://docs.kernel.org/userspace-api/landlock.html#kernel-support

As for other stackable LSMs, prepending Landlock to the default LSM list
enables users to potentially get more protection by default by letting
programs sandbox themselves.

As a dependency, CONFIG_SECURITY_PATH=y will be automatically set.

Signed-off-by: Mickaël Salaün <[email protected]>
@jepio jepio merged commit b67648f into flatcar:main Jul 30, 2024
4 of 7 checks passed
@l0kod l0kod deleted the landlock branch July 30, 2024 12:10
@l0kod
Copy link
Contributor Author

l0kod commented Jul 30, 2024

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants