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

Use pledge(2) on OpenBSD to restrict system calls #1264

Merged
merged 3 commits into from
Feb 18, 2024

Conversation

klemensn
Copy link
Contributor

@klemensn klemensn commented Feb 4, 2024

Limit the attack surface of spotifyd, an internet facing network daemon with read/write filesystem access and options to execute arbitrary commands.

Most importantly, prevent fork(2)/execve(2) unless onevent is used.

While the set of runtime promises retains full read/write filesystem as well as network access (for now), it does exclude a number of groups of unused system calls -- the manual[0] for details.

OpenBSD's official package has been shipping this patch for a month by now without any regressions or reports of breakage.

0: https://man.openbsd.org/pledge.2

klemensn and others added 3 commits February 4, 2024 07:37
Limit the attack surface of spotifyd, an internet facing network daemon with
read/write filesystem access and options to execute arbitrary commands.

Most importantly, prevent fork(2)/execve(2) unless `onevent` is used.

While the set of runtime promises retains full read/write filesystem as well
as network access (for now), it does exclude a number of groups of unused
system calls -- the manual[0] for details.

OpenBSD's official package has been shipping this patch for a month by now
without any regressions or reports of breakage.

0: https://man.openbsd.org/pledge.2
Copy link
Member

@eladyn eladyn left a comment

Choose a reason for hiding this comment

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

As with the other PRs, I didn't test it myself, but since it has been out in the wild in the form of a patch already, this looks good to me. (And thanks for the well documented code!)

src/main.rs Show resolved Hide resolved
@eladyn eladyn merged commit ff2f7a0 into Spotifyd:master Feb 18, 2024
6 checks passed
@klemensn klemensn deleted the openbsd-pledge branch February 18, 2024 18:31
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.

2 participants