Skip to content

Commit

Permalink
Allow to sign path as unprivileged user
Browse files Browse the repository at this point in the history
User can now sign path as unprivileged/allowed user

refs #1708
  • Loading branch information
jfroche committed Jun 27, 2023
1 parent 7474a90 commit d903ba6
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
2 changes: 0 additions & 2 deletions src/libstore/daemon.cc
Original file line number Diff line number Diff line change
Expand Up @@ -856,8 +856,6 @@ static void performOp(TunnelLogger * logger, ref<Store> store,
auto path = store->parseStorePath(readString(from));
StringSet sigs = readStrings<StringSet>(from);
logger->startWork();
if (!trusted)
throw Error("you are not privileged to add signatures");
store->addSignatures(path, sigs);
logger->stopWork();
to << 1;
Expand Down
15 changes: 15 additions & 0 deletions tests/nixos/authorization.nix
Original file line number Diff line number Diff line change
Expand Up @@ -75,5 +75,20 @@
su --login bob -c '(! nix-store --verify --repair 2>&1)' | tee diag 1>&2
grep -F "you are not privileged to repair paths" diag
""")
machine.succeed("""
set -x
su --login mallory -c '
nix-store --generate-binary-cache-key cache1.example.org sk1 pk1
(! nix store sign --key-file sk1 ${pathFour} 2>&1)' | tee diag 1>&2
grep -F "cannot open connection to remote store 'daemon'" diag
""")
machine.succeed("""
su --login bob -c '
nix-store --generate-binary-cache-key cache1.example.org sk1 pk1
nix store sign --key-file sk1 ${pathFour}
'
""")
'';
}

0 comments on commit d903ba6

Please sign in to comment.