Nix Daemon Trusted-User Gating¶
Source: src/libstore/daemon.cc in the Nix repo.
Ops Requiring trusted-users¶
Op |
Condition |
Error message |
|---|---|---|
|
input-addressed (non-CA) derivations |
|
|
|
|
|
|
same |
|
|
|
|
always |
|
|
always |
|
|
|
silently downgraded to |
|
restricted settings (build-timeout, trusted substituters, etc.) |
silently ignored for untrusted |
|
always |
untrusted only sees permanent roots, not temp roots |
Ops That Do NOT Require Trusted Status¶
All read queries (IsValidPath, QueryPathInfo, QueryValidPaths, QuerySubstitutablePaths, QueryReferrers, QueryDerivationOutputs, QueryMissing, QueryRealisation, etc.), AddTempRoot, AddIndirectRoot, BuildPaths/BuildPathsWithResults in normal mode, BuildDerivation for CA derivations, AddToStore/AddToStoreNar with sigs checked, AddTextToStore, EnsurePath, NarFromPath, OptimiseStore, SyncWithGC, RegisterDrvOutput, CollectGarbage (except ignoreLiveness — rejected for everyone).
Authentication Flow¶
Daemon creates socket with mode
0666Client connects → daemon calls
getPeerInfo(remote.get())→SO_PEERCREDgets PID, UID, GIDauthPeer(peer)maps UID againsttrusted-usersandallowed-usersin nix.confIf neither list matches → connection rejected entirely
If only
allowed-usersmatches →TrustedFlag = NotTrustedIf
trusted-usersmatches →TrustedFlag = TrustedThe
TrustedFlagis passed toperformOp()which gates operations per the table above