Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Runas handoff: read-only bridge ACL

The root-owned handoff directory remains mode 3770, with the per-operation agent handoff group. The bridge remains outside that group, unprivileged and with no supplementary groups. One non-recursive tmpfiles a+ rule adds an explicit named bridge access ACL (r-x) and default file ACL (r--). The full base entries explicitly preserve directory group rwx, access mask rwx, and other ---. Consequently stat still reports 3770; using mask r-x instead would both remove agent write permission and break the root claim predicate.

Default entries are owner rw-, bridge r--, group r--, mask r--, other ---. The request tool creates the final manifest name directly, with a noclobber redirection: an existing name is refused atomically, and there is no temporary name for the requester to delete. Because the directory has a default ACL, the tool’s umask 0227 does not apply. The new file takes the default entries, limited by the redirection’s creation mode, so bridge and group can read it from creation and others cannot. The tool’s chmod 0440 then drops the owner’s write bit and leaves the mask at r--, so the bridge never gains write or execute permission. Setgid inheritance preserves the handoff gid. Extended ACLs are compatible with the helper’s directory 3770, file 0440, gid and single-link checks; no relaxation of those checks is needed.

The ACL is deliberately not recursive: old pending files do not acquire named bridge entries retroactively. The agent can remove an inherited ACL on its own file and deny service; that does not elevate bridge rights. This rule is not a sanitizer for arbitrary pre-existing ACLs: a+ merges the declared entries. The parent directory must remain root-controlled. Only the directory’s named bridge ACL, not group membership, authorizes bridge traversal.

Validation

tests/test_runas_handoff_acl.py checks the declaration in pkgs/runas/module.nix: the exact a+ rule, the 3770 directory, the noclobber create and chmod 0440 with no mktemp or rm -f, and a bridge with no groups and no privilege. Its native test applies the tmpfiles rule twice to a scratch directory and creates a manifest exclusively with mode 0440. It then compares the exact directory and file ACL entries, the inherited gid, the mode and the link count. It runs the root helper’s own directory and file predicates against that file, and shows that setfacl -b removes the bridge entry without widening the mode. The bridge is a distinct numeric uid, not an account, and only the helper’s expected directory owner is changed, so this is not a root claim test. It skips when systemd-tmpfiles, getfacl or setfacl is missing or the sandbox refuses to run them.

The vm-runas-security flake check boots a NixOS guest with the generated rules and the real agent, bridge and operator accounts. The agent publishes a manifest. The bridge, which is in no handoff group, reads it, and is refused opening it for writing, unlinking it and creating a file in the directory. The root claim, started through systemd and polkit as the bridge, accepts the extended-ACL file and consumes it.

Neither covers the request tool’s own shell write path: both create the manifest from Python. Neither has the bridge list or rename in the directory, reapplies tmpfiles on a running system, or shows that stripping a file’s ACL yields a clean read failure with no privileged fallback.