daemon: restore daemon-trust-override

apparently this feature got lost in the migration to exec'ing daemons.

Change-Id: Iac9425cf6d20781bb49e5cf12f2056f4a3ec23ba
This commit is contained in:
eldritch horrors
2025-07-22 12:33:49 +00:00
parent cb96940042
commit 9eb3c1be80
4 changed files with 40 additions and 1 deletions
+5
View File
@@ -364,6 +364,11 @@ try {
{.dup = SUBDAEMON_SETTINGS_FD, .from = settings.readSide.get()},
}
};
if (forceTrustClientOpt) {
options.args.push_back(
*forceTrustClientOpt ? "--force-trusted" : "--force-untrusted"
);
}
runProgram2(options).release();
FdSink sink(settings.writeSide.get());
@@ -98,7 +98,7 @@ startDaemon() {
fi
# Start the daemon, wait for the socket to appear.
rm -f $NIX_DAEMON_SOCKET_PATH
PATH=$DAEMON_PATH nix --extra-experimental-features 'nix-command' daemon &
PATH=$DAEMON_PATH nix --extra-experimental-features 'nix-command' daemon "$@" &
_NIX_TEST_DAEMON_PID=$!
export _NIX_TEST_DAEMON_PID
for ((i = 0; i < 300; i++)); do
+33
View File
@@ -0,0 +1,33 @@
source common.sh
clearStore
withDaemonTrusting() {
local trusting="$1"
shift
trap killDaemon EXIT
NIX_CONFIG="
extra-experimental-features = daemon-trust-override
trusted-users = $trusting
" startDaemon "$@"
}
(
withDaemonTrusting "" --default-trust
nix store ping --json | jq -e '.trusted | not'
)
(
withDaemonTrusting "" --force-trusted
nix store ping --json | jq -e '.trusted'
)
(
withDaemonTrusting "$(whoami)" --default-trust
nix store ping --json | jq -e '.trusted'
)
(
withDaemonTrusting "$(whoami)" --force-untrusted
nix store ping --json | jq -e '.trusted | not'
)
+1
View File
@@ -169,6 +169,7 @@ functional_tests_scripts = [
'regression-484.sh',
'regression-reference-checks.sh',
'redirected-filter-source.sh',
'daemon-trust.sh',
]
# Plugin tests require shared libraries support.