Teleport’s role-based access control (RBAC) system lets you define exactly which users can reach which infrastructure resources — SSH nodes, Kubernetes clusters, databases, applications, and desktops — and under what conditions. Every access decision is evaluated against a set of Teleport roles assigned to the authenticated user.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/gravitational/teleport/llms.txt
Use this file to discover all available pages before exploring further.
How Teleport roles work
A Teleport role is a YAML resource with two rule lists:allow and deny. Teleport evaluates rules using the following logic:
- Nothing is allowed by default.
denyrules are evaluated first and always take priority overallowrules.- Multiple roles are merged; the most restrictive option typically wins for options like timeouts, while logical OR applies for capabilities like port forwarding.
Deny rules take precedence over allow rules in all cases. If a user holds two roles where one allows access to a node and another denies it, access will be denied. Use deny rules deliberately and avoid placing them on roles granted through Access Lists.
Example role YAML
The following role grants a developer access to staging servers, a Kubernetes cluster, and a PostgreSQL database. It uses template variables to automatically populate logins and Kubernetes groups from the user’s stored traits.Creating and assigning roles
Usetctl to apply a role resource and assign it to a user:
Attribute-based access control with labels
Teleport extends RBAC with label-based ABAC — you match resources by their labels rather than by name. This makes policies dynamic: a newly enrolled server automatically receives access (or is automatically denied) based on the labels it carries.environment=production AND the specified region to be accessible.
Label expressions
For more complex logic — OR across keys, negative matches, or trait-based comparisons — usenode_labels_expression (and the equivalent for other resource types):
app_labels_expression, db_labels_expression, kubernetes_labels_expression, and others.
Role traits and template variables
Teleport substitutes template variables at authentication time, drawing values from the user’s internal traits (stored in Teleport’s local user database) or external traits from your SSO provider.Internal traits
| Variable | Description |
|---|---|
{{internal.logins}} | SSH logins allowed for the user |
{{internal.kubernetes_groups}} | Kubernetes groups for the user |
{{internal.kubernetes_users}} | Kubernetes usernames for the user |
{{internal.db_names}} | Allowed database names |
{{internal.db_users}} | Allowed database users |
External traits (SSO)
When a user authenticates through an SSO provider, Teleport populates theexternal namespace from the IdP’s claims or attributes:
Setting traits on local users
For local (non-SSO) users, set traits directly on the user resource:Role options reference
Key options that control session behavior when multiple roles are assigned:| Option | Description | Multi-role behavior |
|---|---|---|
max_session_ttl | Maximum certificate TTL | Shortest wins |
forward_agent | SSH agent forwarding | OR (any role allows → allowed) |
client_idle_timeout | Idle session termination | Shortest timeout wins |
require_session_mfa | Per-session MFA | OR (any role requires → required) |
device_trust_mode | Trusted device enforcement | See Device Trust |
record_session | Session recording mode | Most strict wins |
Preset roles
Teleport ships with several built-in roles:access
Default role for human users. Grants access to resources based on the user’s traits.
editor
Allows editing cluster configuration and most dynamic resources.
auditor
Read-only access to audit logs and session recordings.
reviewer
Can review and approve Access Requests submitted by other users.
Next steps
SSO Integration
Map identity provider groups to Teleport roles automatically.
Access Requests
Let users request temporary elevated roles with approval workflows.
MFA
Require multi-factor authentication for login and per-session access.
Device Trust
Restrict access to only registered, managed devices.
