Skip to content

feat: add homebrew-sandbox subpackage#13

Draft
HastD wants to merge 6 commits intosecureblue:mainfrom
HastD:sandbox
Draft

feat: add homebrew-sandbox subpackage#13
HastD wants to merge 6 commits intosecureblue:mainfrom
HastD:sandbox

Conversation

@HastD
Copy link
Collaborator

@HastD HastD commented Feb 1, 2026

This subpackage sets up brew to be sandboxed using the Landlock LSM, restricting its filesystem, network, and IPC access.

Note, this change by itself won't enable the sandbox on secureblue images; that won't happen until we start installing homebrew-sandbox on the images. The only impact this will have on secureblue without further action is to change the directory that Homebrew uses for temporary files to /var/tmp/homebrew (instead of the default /var/tmp).

Also, the landlock crate used by the sandbox currently isn't packaged for Fedora, so it will need to be added to the Copr repo for this to build. This is easy to do—the following custom build script will generate its spec file:

#!/bin/sh
rust2rpm landlock

@HastD HastD requested a review from RoyalOughtness February 1, 2026 16:05
@HastD HastD marked this pull request as draft February 11, 2026 13:56
This subpackage sets up brew to be sandboxed using the Landlock LSM,
restricting its filesystem and network access.
The version installed by apt is too outdated.
This limits inter-process communication via signals or abstract Unix
sockets to processes in the same or a nested Landlock domain.
Landlock attempts to set the no_new_privs bit when restricting the
process. If this fails for whatever reason, we should warn the user.
* Simplify Landlock sandbox by dropping support for non-standard
  Homebrew prefixes (which are already unsupported by Homebrew).
* Warn about sandbox escapes via pathname sockets--unfortunately
  the current version of Landlock doesn't protect against that escape
  vector, but the next Landlock version is expected to.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant