Resource Access Requests
With Teleport Resource Access Requests, users can request access to specific resources without needing to know anything about the roles or RBAC controls used under the hood. The Access Request API makes it easy to dynamically approve or deny these requests.
Just-in-time Access Requests are a feature of Teleport Enterprise. Teleport Community Edition users can get a preview of how Access Requests work by requesting a role via the Teleport CLI. Full Access Request functionality, including Resource Access Requests and an intuitive and searchable UI are available in Teleport Enterprise.
Prerequisites
-
A running Teleport Enterprise cluster. If you want to get started with Teleport, sign up for a free trial or set up a demo environment.
-
The
tctlandtshclients.Installing
tctlandtshclients-
Determine the version of your Teleport cluster. The
tctlandtshclients must be at most one major version behind your Teleport cluster version. Send a GET request to the Proxy Service at/v1/webapi/findand use a JSON query tool to obtain your cluster version. Replace teleport.example.com:443 with the web address of your Teleport Proxy Service:TELEPORT_DOMAIN=teleport.example.com:443TELEPORT_VERSION="$(curl -s https://$TELEPORT_DOMAIN/v1/webapi/find | jq -r '.server_version')" -
Follow the instructions for your platform to install
tctlandtshclients:- Mac
- Windows - Powershell
- Linux
Download the signed macOS .pkg installer for Teleport, which includes the
tctlandtshclients:curl -O https://cdn.teleport.dev/teleport-${TELEPORT_VERSION?}.pkgIn Finder double-click the
pkgfile to begin installation.dangerUsing Homebrew to install Teleport is not supported. The Teleport package in Homebrew is not maintained by Teleport and we can't guarantee its reliability or security.
curl.exe -O https://cdn.teleport.dev/teleport-v${TELEPORT_VERSION?}-windows-amd64-bin.zipUnzip the archive and move the `tctl` and `tsh` clients to your %PATH%
NOTE: Do not place the `tctl` and `tsh` clients in the System32 directory, as this can cause issues when using WinSCP.
Use %SystemRoot% (C:\Windows) or %USERPROFILE% (C:\Users\<username>) instead.
All of the Teleport binaries in Linux installations include the
tctlandtshclients. For more options (including RPM/DEB packages and downloads for i386/ARM/ARM64) see our installation page.curl -O https://cdn.teleport.dev/teleport-v${TELEPORT_VERSION?}-linux-amd64-bin.tar.gztar -xzf teleport-v${TELEPORT_VERSION?}-linux-amd64-bin.tar.gzcd teleportsudo ./installTeleport binaries have been copied to /usr/local/bin
-
- To check that you can connect to your Teleport cluster, sign in with
tsh login, then verify that you can runtctlcommands using your current credentials. For example, run the following command, assigning teleport.example.com to the domain name of the Teleport Proxy Service in your cluster and [email protected] to your Teleport username:If you can connect to the cluster and run thetsh login --proxy=teleport.example.com --user=[email protected]tctl statusCluster teleport.example.com
Version 19.0.0-dev
CA pin sha256:abdc1245efgh5678abdc1245efgh5678abdc1245efgh5678abdc1245efgh5678
tctl statuscommand, you can use your current credentials to run subsequenttctlcommands from your workstation. If you host your own Teleport cluster, you can also runtctlcommands on the computer that hosts the Teleport Auth Service for full permissions.
Step 1/6. Grant roles to users
The built-in requester and reviewer roles have permissions to, respectively,
open and review Access Requests. Grant the requester and reviewer roles to
existing users, or create new users to test this feature. Make sure the
requester has a valid login so that they can view and access SSH nodes.
For the rest of the guide we will assume that the requester role has been
granted to a user named alice and the reviewer role has been granted to a
user named bob.
-
Assign the
requesterrole to a user namedalice:Assign the
requesterrole toaliceby running the appropriate commands for your authentication provider:- Local User
- GitHub
- SAML
- OIDC
-
Retrieve your local user's roles as a comma-separated list:
ROLES=$(tsh status -f json | jq -r '.active.roles | join(",")') -
Edit your local user to add the new role:
tctl users update $(tsh status -f json | jq -r '.active.username') \ --set-roles "${ROLES?},requester" -
Sign out of the Teleport cluster and sign in again to assume the new role.
-
Open your
githubauthentication connector in a text editor:tctl edit github/github -
Edit the
githubconnector, addingrequesterto theteams_to_rolessection.The team you should map to this role depends on how you have designed your organization's role-based access controls (RBAC). However, the team must include your user account and should be the smallest team possible within your organization.
Here is an example:
teams_to_roles: - organization: octocats team: admins roles: - access + - requester -
Apply your changes by saving closing the file in your editor.
-
Sign out of the Teleport cluster and sign in again to assume the new role.
-
Retrieve your
samlconfiguration resource:tctl get --with-secrets saml/mysaml > saml.yamlNote that the
--with-secretsflag adds the value ofspec.signing_key_pair.private_keyto thesaml.yamlfile. Because this key contains a sensitive value, you should remove the saml.yaml file immediately after updating the resource. -
Edit
saml.yaml, addingrequesterto theattributes_to_rolessection.The attribute you should map to this role depends on how you have designed your organization's role-based access controls (RBAC). However, the group must include your user account and should be the smallest group possible within your organization.
Here is an example:
attributes_to_roles: - name: "groups" value: "my-group" roles: - access + - requester -
Apply your changes:
tctl create -f saml.yaml -
Sign out of the Teleport cluster and sign in again to assume the new role.
-
Retrieve your
oidcconfiguration resource:tctl get oidc/myoidc --with-secrets > oidc.yamlNote that the
--with-secretsflag adds the value ofspec.signing_key_pair.private_keyto theoidc.yamlfile. Because this key contains a sensitive value, you should remove the oidc.yaml file immediately after updating the resource. -
Edit
oidc.yaml, addingrequesterto theclaims_to_rolessection.The claim you should map to this role depends on how you have designed your organization's role-based access controls (RBAC). However, the group must include your user account and should be the smallest group possible within your organization.
Here is an example:
claims_to_roles: - name: "groups" value: "my-group" roles: - access + - requester -
Apply your changes:
tctl create -f oidc.yaml -
Sign out of the Teleport cluster and sign in again to assume the new role.
-
Repeat these steps to assign the
reviewerrole to a user namedbob.
Consider defining custom roles to limit the scope of a requester or reviewer's permissions. Read the Access Request Configuration guide for available options.
Step 2/6. Search for resources
First, log in as alice.
tsh login --proxy teleport.example.com --user alice
Notice that tsh ls returns an empty list, because alice does not have access to any resources by default.
tsh lsNode Name Address Labels--------- ------- ------
Then try searching for all available ssh nodes.
tsh request search --kind nodeName Hostname Labels Resource ID------------------------------------ ----------- ------------ ------------------------------------------------------b1168402-9340-421a-a344-af66a6675738 iot test=test /teleport.example.com/node/b1168402-9340-421a-a344-af66a6675738bbb56211-7b54-4f9e-bee9-b68ea156be5f node test=test /teleport.example.com/node/bbb56211-7b54-4f9e-bee9-b68ea156be5f
To request access to these resources, run> tsh request create --resource /teleport.example.com/node/b1168402-9340-421a-a344-af66a6675738 --resource /teleport.example.com/node/bbb56211-7b54-4f9e-bee9-b68ea156be5f \ --reason <request reason>
You can search for resources of kind node, kube_cluster, db, app, and
windows_desktop. Teleport also supports searching and requesting access to
resources within Kubernetes clusters with kind kube_resource.
Advanced filters and queries are supported. See our filtering reference for more information.
Try narrowing your search to a specific resource you want to access.
tsh request search --kind node --search iotName Hostname Labels Resource ID------------------------------------ ----------- ------------ ------------------------------------------------------b1168402-9340-421a-a344-af66a6675738 iot test=test /teleport.example.com/node/b1168402-9340-421a-a344-af66a6675738
To request access to these resources, run> tsh request create --resource /teleport.example.com/node/b1168402-9340-421a-a344-af66a6675738 \ --reason <request reason>
Step 3/6. Request access to a resource
Copy the command output by tsh request search in the previous step, optionally filling in a request reason.
tsh request create --resource /teleport.example.com/node/bbb56211-7b54-4f9e-bee9-b68ea156be5f \ --reason "responding to incident 123"Creating request...Request ID: f406f5d8-3c2a-428f-8547-a1d091a4ddabUsername: aliceRoles: accessResources: ["/teleport.example.com/node/bbb56211-7b54-4f9e-bee9-b68ea156be5f"]Reason: "responding to incident 123"Reviewers: [none] (suggested)Status: PENDING
hint: use 'tsh login --request-id=<request-id>' to login with an approved request
Waiting for request approval...
The command will automatically wait until the request is approved.
Step 4/6. Approve the Access Request
First, log in as bob.
tsh login --proxy teleport.example.com --user bob
Then list, review, and approve the Access Request.
tsh request lsID User Roles Resources Created At (UTC) Status------------------------------------ ----- ------ --------------------------- ------------------- -------f406f5d8-3c2a-428f-8547-a1d091a4ddab alice access ["/teleport.example.... [+] 23 Jun 22 18:25 UTC PENDING
[+] Requested resources truncated, use `tsh request show <request-id>` to view the full list
hint: use 'tsh request show <request-id>' for additional details use 'tsh login --request-id=<request-id>' to login with an approved requesttsh request show f406f5d8-3c2a-428f-8547-a1d091a4ddabRequest ID: f406f5d8-3c2a-428f-8547-a1d091a4ddabUsername: aliceRoles: accessResources: ["/teleport.example.com/node/bbb56211-7b54-4f9e-bee9-b68ea156be5f"]Reason: "responding to incident 123"Reviewers: [none] (suggested)Status: PENDING
hint: use 'tsh login --request-id=<request-id>' to login with an approved requesttsh request review --approve f406f5d8-3c2a-428f-8547-a1d091a4ddabSuccessfully submitted review. Request state: APPROVED
Check out our Access Request integrations to notify the right people about new Access Requests.
Step 5/6. Access the requested resource
alice's tsh request create command should resolve now that the request has been approved.
tsh request create --resource /teleport.example.com/node/bbb56211-7b54-4f9e-bee9-b68ea156be5f \ --reason "responding to incident 123"Creating request...Request ID: f406f5d8-3c2a-428f-8547-a1d091a4ddabUsername: aliceRoles: accessResources: ["/teleport.example.com/node/bbb56211-7b54-4f9e-bee9-b68ea156be5f"]Reason: "responding to incident 123"Reviewers: [none] (suggested)Status: PENDING
hint: use 'tsh login --request-id=<request-id>' to login with an approved request
Waiting for request approval...
Approval received, getting updated certificates...
> Profile URL: https://teleport.example.com Logged in as: alice Active requests: f406f5d8-3c2a-428f-8547-a1d091a4ddab Cluster: teleport.example.com Roles: access, requester Logins: alice Kubernetes: disabled Allowed Resources: ["/teleport.example.com/node/bbb56211-7b54-4f9e-bee9-b68ea156be5f"] Valid until: 2022-06-23 22:46:22 -0700 PDT [valid for 11h16m0s] Extensions: permit-agent-forwarding, permit-port-forwarding, permit-pty
alice can now view and access the node.
tsh lsNode Name Address Labels--------- --------- ---------iot [::]:3022 test=testtsh ssh alice@iotiot:~ alice$
Step 6/6. Resume regular access
While logged in with a Resource Access Request, users will be blocked from access to any other resources.
This is necessary because their certificate now contains an elevated role,
so it is restricted to only allow access to the resources they were specifically approved for.
Use the tsh request drop command to "drop" the request and resume regular access.
tsh request drop
Once you have configured Resource Access Requests, tsh ssh is able to
automatically create a Resource Access Request for you when access is denied,
allowing you to skip the tsh request search and tsh request create steps.
tsh ssh alice@iotERROR: access denied to alice connecting to iot on cluster teleport.example.com
You do not currently have access to alice@iot, attempting to request access.
Enter request reason: pleaseCreating request...Request ID: ab43fc70-e893-471b-872e-ae65eb24fd76Username: aliceRoles: accessResources: ["/teleport.example.com/node/bbb56211-7b54-4f9e-bee9-b68ea156be5f"]Reason: "please"Reviewers: [none] (suggested)Status: PENDING
hint: use 'tsh login --request-id=<request-id>' to login with an approved request
Waiting for request approval...
Approval received, reason="okay"Getting updated certificates...
iot:~ alice$
Next steps
- Read about all of the ways you can configure Access Requests in the Access
Request Configuration Guide. For example,
you can configure the
search_as_rolesfields in a user's role to restrict the resources the user has access to list in order to request access. - With Teleport's Access Request plugins, users can manage Access Requests from within your organization's existing messaging and project management solutions. Read the documentation on Access Request plugins.
- Learn about Access Lists, which allow you to assign elevated privileges to a list of Teleport users for a limited time.