Skip to content

Is it possible to get the content of a resource label as a variable in a Teleport role ? #55581

Answered by webvictim
naelhrrd asked this question in Q&A
Discussion options

You must be logged in to vote

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 was logins: test, you can match on that. It won't work if the label has multiple usernames in the form logins: 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:

kind: role
metadata:
  name: uchcb-access-role
spec:
  allow:
    logins:
    - uchcb
    node_labels:
      user_uchcb: true
version: v7

This will mean you need n roles (where n is the number of total users you …

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@naelhrrd
Comment options

@webvictim
Comment options

Answer selected by webvictim
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants