-
Is it possible to get the content of a label in a Teleport role ? |
Beta Was this translation helpful? Give feedback.
Answered by
webvictim
Jun 12, 2025
Replies: 1 comment 2 replies
-
In a way, yes. You can use traits set on users themselves and match them against roles. Think about a SAML/OIDC user with these claims/attributes set against their user in Okta, Entra ID, ADFS etc:
If you created a role which references these: kind: role
metadata:
name: dev-access-role
spec:
allow:
node_labels:
environment: '{{external.allowed_environment}}'
region: '{{external.allowed_region}}'
version: v7 This user would then be able to access any node with this configuration: ...
ssh_service:
enabled: true
labels:
environment: dev
region: us-east-1
... This is detailed in the docs here: https://goteleport.com/docs/reference/access-controls/roles/#referring-to-external-traits-in-teleport-roles |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You can't use the contents of a label directly as part of a Teleport role.
You can match something set in a role against a label. So if you had
logins: test
set in your role and the label waslogins: test
, you can match on that. It won't work if the label has multiple usernames in the formlogins: test test2 test3
as per your example though.One way you could achieve this is to create one label per login (like
user_uchcb: true
) and then have a role which references that directly:This will mean you need
n
roles (wheren
is the number of total users you …