Skip to content

Commit

Permalink
Add option to disable the seccomp filter
Browse files Browse the repository at this point in the history
I needed this to test ACL/xattr removal in
canonicalisePathMetaData(). Might also be useful if you need to build
old Nixpkgs that doesn't have the required patches to remove
setuid/setgid creation.
  • Loading branch information
edolstra committed Oct 12, 2017
1 parent 9730781 commit 1dd29d7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/libstore/build.cc
Expand Up @@ -2351,6 +2351,8 @@ void DerivationGoal::doExportReferencesGraph()
void setupSeccomp()
{
#if __linux__
if (!settings.filterSyscalls) return;

scmp_filter_ctx ctx;

if (!(ctx = seccomp_init(SCMP_ACT_ALLOW)))
Expand Down
6 changes: 6 additions & 0 deletions src/libstore/globals.hh
Expand Up @@ -336,6 +336,12 @@ public:
"String appended to the user agent in HTTP requests."};

#if __linux__
Setting<bool> filterSyscalls{this, true, "filter-syscalls",
"Whether to prevent certain dangerous system calls, such as "
"creation of setuid/setgid files or adding ACLs or extended "
"attributes. Only disable this if you're aware of the "
"security implications."};

Setting<bool> allowNewPrivileges{this, false, "allow-new-privileges",
"Whether builders can acquire new privileges by calling programs with "
"setuid/setgid bits or with file capabilities."};
Expand Down

1 comment on commit 1dd29d7

@dtzWill
Copy link
Member

Choose a reason for hiding this comment

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

This is also useful on systems where the required syscomp support isn't available or enabled in the kernel.

I have such a machine, not sure if it's normal for other SL6 (~=RHEL6) machines or not.

Please sign in to comment.