Skip to content

Commit

Permalink
security.wrappers: copy source programs instead of wrapping in binaries
Browse files Browse the repository at this point in the history
Copying the wrapper code from NixOS and hoping that I managed to catch
all the relevant dyld environment variables was not particularly
confidence-inducing, so this commit removes the wrappers entirely and
simply copies the source programs before modifying permissions. This
means that the given source programs must safely handle being
setuid/setgid binaries and being located in `/run/wrappers/bin`.

There's now only `default.nix` in `modules/security/wrappers`, so I
could have removed the directory, but I have left it for now in
anticipation of other files potentially ending up there.
  • Loading branch information
Samasaur1 committed Jan 20, 2025
1 parent 374c57d commit 216f2ce
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 170 deletions.
8 changes: 2 additions & 6 deletions modules/security/wrappers/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,6 @@ let
(opts: mkWrapper opts)
(builtins.attrValues cfg.wrappers);

securityWrapper = sourceProg : pkgs.pkgsStatic.callPackage ./wrapper.nix {
inherit sourceProg;
};

mkWrapper =
{ program
, source
Expand All @@ -71,10 +67,10 @@ let
codesigned = if codesign
then ''
# codesign ${source} to "$wrapperDir/${program}" INSTEAD OF the next line
cp ${securityWrapper source}/bin/security-wrapper "$wrapperDir/${program}"
cp ${source} "$wrapperDir/${program}"
''
else ''
cp ${securityWrapper source}/bin/security-wrapper "$wrapperDir/${program}"
cp ${source} "$wrapperDir/${program}"
'';
in
''
Expand Down
145 changes: 0 additions & 145 deletions modules/security/wrappers/wrapper.c

This file was deleted.

19 changes: 0 additions & 19 deletions modules/security/wrappers/wrapper.nix

This file was deleted.

0 comments on commit 216f2ce

Please sign in to comment.