You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Behaviors declare exact sudo calls; osapi generates and checks the sudoers rules #1907
Today a behavior declares only a program name for sudo (osapi dsl behavior get --name netplan --json prints "sudo":["netplan"]). The sudoers lines are written by hand in docs/docs/sidebar/operate/secure/agent-hardening.md, nothing ties them to the code, and the build-a-behavior skill does not mention sudo. An agent that builds a behavior from source or through the DSL must guess a rule. Review of #1707 found a wildcard rule that matched more than its unit for this reason.
Build:
One source. A behavior declares each sudo call as a program and an argument shape, for example systemctl start on units from a fixed set. osapi generates the sudoers lines from these declarations. The hardening page, the agent preflight and osapi dsl behavior get print the same data.
A check.osapi dsl behavior validate and a test refuse a rule with * or ? in its arguments, a shell or an interpreter, and a command that takes a free path or free options as root. The test runs known attack strings through a matcher with sudo's glob rules. A call with a variable argument goes through a small root-owned helper that checks its input.
The written rule. A short section in specs, in CONTRIBUTING.md and in the build-a-behavior skill, read through the DSL commands.
Order: after #1707 merges (it edits the same hardening page and the netplan sudo declaration), before the round 1 cherry-picks of #1900. Findings about the current rules go in a private draft advisory, not here.
Owner, 5 Dec 2026: every lab VM runs the agent as the unprivileged osapi user with privilege escalation on and the rendered sudoers drop-in, with no ambient capabilities. Thus just int tests the real rules, and each rule or command that does not fit gets fixed here. The image makes the user and the unit; just bump installs the drop-in from the new build after visudo -c. The osapi-lab change goes with this issue.
Owner, 5 Dec 2026: osapi-lab gets a flag, lab_least_privilege. When it is on, the lab installs each component by osapi's least-privilege rules, each as its own system user: NATS, the controller and each agent. The lab follows the rules that osapi documents; where osapi has no rule yet for the controller or NATS, the rule goes into osapi's docs first.
A root broker replaces sudo. A socket-activated root service accepts requests only from the agent's user, matches them exactly against the behavior's declaration, and runs each one in a transient systemd unit with only that behavior's paths and capabilities. The agent unit gets NoNewPrivileges=yes, an empty bounding set and no sudo rules. The design change goes in docs(osapi): a root broker for declared work specs#756 first.
osapi start is for tests only: it runs in the foreground as the person who runs it, refuses root and has no service install. A real single-host install is three services under three users.
Activity
retr0h commentedon Dec 5, 2026
Owner, 5 Dec 2026: every lab VM runs the agent as the unprivileged
osapiuser with privilege escalation on and the rendered sudoers drop-in, with no ambient capabilities. Thusjust inttests the real rules, and each rule or command that does not fit gets fixed here. The image makes the user and the unit;just bumpinstalls the drop-in from the new build aftervisudo -c. The osapi-lab change goes with this issue.retr0h commentedon Dec 5, 2026
Owner, 5 Dec 2026: osapi-lab gets a flag,
lab_least_privilege. When it is on, the lab installs each component by osapi's least-privilege rules, each as its own system user: NATS, the controller and each agent. The lab follows the rules that osapi documents; where osapi has no rule yet for the controller or NATS, the rule goes into osapi's docs first.docs(osapi-lab): run each component as its own user
8 remaining items
docs(osapi): behaviors declare exact sudo calls
docs(osapi-lab): run each component as its own user
docs(osapi): behaviors declare exact sudo calls (#751)
retr0h commentedon Dec 5, 2026
Owner decisions, 5 Dec 2026:
osapi startis for tests only: it runs in the foreground as the person who runs it, refuses root and has no service install. A real single-host install is three services under three users.docs(osapi): privileges get, call writes, used files
docs(osapi): a root broker runs the declared work
docs(osapi): privileges get, call writes, used files
docs(osapi): a root broker runs the declared work
docs(osapi): a root broker for declared work (#756)