Bookmarks

RBAC — role-based access control

An access control model in which permissions are granted to roles rather than to individual users: a person is assigned a role and inherits its permissions.

Also: role-based access, role-based model, role model

checked 9 Nov

All terms

Instead of configuring permissions for each employee by hand, the administrator defines roles — “developer”, “on-call engineer”, “accountant” — and attaches permissions to them. The approach saves time and reduces the risk of excess privileges, which is why RBAC is built into databases, cloud platforms and Kubernetes.

How the model works

The base NIST model has four elements: users, roles, permissions and sessions. The administrator defines two kinds of relation — who holds which role and what a role is allowed to do — and an access check at request time looks like this:

ElementExample
UserAnna, an employee
Rolerelease-manager, “the one who ships releases”
Permissionrun deployments to production
SessionAnna logs in and activates the role for the duration of her work

Permissions are attached to the role, so when a person changes position they are given a different role rather than a rebuilt list of permissions; a new employee gets access with a single assignment.

The NIST standard

David Ferraiolo and Rick Kuhn formalised the model in 1992, and in 2004 it became the American standard ANSI/INCITS 359 (the current edition is INCITS 359-2012). The standard describes the model through four components:

  1. Core RBAC — the mandatory minimum: the “user — role” and “role — permission” relations, present in any RBAC system.
  2. Hierarchical RBAC — roles inherit permissions from one another: a senior engineer has everything an engineer can do.
  3. Static separation of duties — on role assignment: one person cannot hold conflicting roles, for example creating a payment and approving it.
  4. Dynamic separation of duties — the same restriction, but for the duration of a session: within a single session, conflicting roles cannot be activated together.

The hierarchy and both restrictions are independent of one another: adopt them as needed.

RBAC in Kubernetes

In Kubernetes, RBAC is one of the API server’s authorisation modes. A role lists actions (verbs) on objects; a binding grants the role to a user, group or service account; a Role applies within a single namespace, a ClusterRole across the whole cluster. There are four object kinds: Role, ClusterRole, RoleBinding and ClusterRoleBinding.

yamlA role that allows viewing deployments but not modifying them
apiVersion: rbac.authorization.k8s.io/v1kind: Rolemetadata:  name: deployment-reader  namespace: shoprules:  - apiGroups: ["apps"]    resources: ["deployments"]    verbs: ["get", "list", "watch"]

To check what an account is actually allowed to do, run kubectl auth can-i create deployments --namespace prod --as dave: it asks the API server’s authorisation layer.

Sources

the term is written from these pages

Verified 9 Nov

Not to be confused with

what it is mixed up with and how it differs

  • ABACattribute-based access control

    ABAC grants access by attributes — department, classification level, time, device; RBAC looks only at the role, without regard to the request context.

  • IAMidentity and access management

    IAM manages the full lifecycle of accounts and access in general, while RBAC is one of the permission models used within IAM.

In depth in the references

where the topic is covered in detail