Skip to content

RBAC

grlx includes a role-based access control (RBAC) system that governs who can perform actions on which sprouts. Permissions are tied to public keys, so every CLI user has an auditable identity.

  • User: Identified by their CLI public key. Each key maps to a username and role.
  • Role: A named set of permissions. Roles define which actions a user can perform on which cohorts.
  • Action: An operation type — cook, cmd, ssh, or view.
  • Cohort scope: Permissions are granted per-cohort. A user may have different permissions on different cohorts.

Roles and users are defined in the farmer configuration file:

[rbac.roles.operator]
actions = ["cook", "cmd", "ssh", "view"]
cohorts = ["*"]
[rbac.roles.deployer]
actions = ["cook", "view"]
cohorts = ["staging", "production"]
[rbac.roles.viewer]
actions = ["view"]
cohorts = ["*"]

Users are mapped to roles by their public key:

[[rbac.users]]
name = "alice"
pubkey = "UABC...XYZ"
role = "operator"
[[rbac.users]]
name = "bob"
pubkey = "UDEF...UVW"
role = "deployer"

Users with only the view action can:

  • List sprouts, jobs, props, cohorts
  • Read job details and audit logs

They cannot cook recipes, run commands, or open SSH sessions.

ActionDescription
cookExecute recipes on sprouts
cmdRun arbitrary commands via cmd run
sshOpen interactive shell sessions
viewRead-only access to all resources

The farmer validates the RBAC configuration at startup:

  • Referenced cohorts must exist in the cohort configuration
  • Public keys must be unique across all users
  • Role names must be unique

If validation fails, the farmer will not start and will report the configuration errors.

Terminal window
grlx auth whoami

Shows the current CLI user’s public key and assigned role.

Terminal window
grlx auth users
Terminal window
grlx auth roles
Terminal window
grlx auth explain

Shows the current user’s effective permissions across all cohorts — which actions are allowed where.

Every request to the farmer is checked against RBAC before execution. If the requesting user lacks the required action on the target cohort, the request is denied with a clear error message.

The enforcement middleware covers:

  • cook — recipe execution
  • cmd.run — arbitrary command dispatch
  • ssh — interactive shell sessions
  • Read endpoints — restricted to users with at least view permission

For development or single-user setups, the farmer supports a dangerously_allow_root flag that bypasses RBAC checks:

[farmer]
dangerously_allow_root = true

All actions are recorded in the audit log with the acting user’s identity. See Audit Logging for details.