Okta User Sync
Okta user sync imports Okta users as Teleport users via a continuous reconciliation loop. User sync works in tandem with the Teleport SCIM integration.
Unlike the SCIM integration, user sync is initiated from the Teleport side, and therefore requires API access to Okta. It is also slower than SCIM. However, it fetches Okta users configured before SCIM was enabled, captures changes if a SCIM request does not reach your Teleport cluster, and works with Teleport clusters that are inaccessible over the public internet. User sync is required for application and group sync.
In this guide, you will set up Okta user sync with the guided Okta integration enrollment flow.
How it works
Okta API services app provides credentials for Teleport to access Okta API. It authenticates Teleport by verifying the JWT tokens issued by Teleport. This app will have Okta custom admin role and Okta resource set assigned to it allowing limiting Teleport access to the Okta organization resources.
Prerequisites
-
A running Teleport Enterprise (v17.3.0 or higher) cluster accessible at a hostname with a valid TLS certificate. 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:- Mac/Linux
- Windows - Powershell
TELEPORT_DOMAIN=teleport.example.com:443TELEPORT_VERSION="$(curl -s https://$TELEPORT_DOMAIN/v1/webapi/find | jq -r '.server_version')"$TELEPORT_DOMAIN = "teleport.example.com:443"$TELEPORT_VERSION = (Invoke-RestMethod -Uri "https://${TELEPORT_DOMAIN}/v1/webapi/find").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
Connecting with TLS routing disabled
This guide's commands assume your Teleport cluster uses TLS routing (
proxy_listener_mode: multiplex), where thetctlandtshclients reach every Teleport service through the Proxy Service's web address on port443. If you're not sure whether this applies to your cluster, check with whoever manages it.If your cluster uses separate listener ports instead, adjust ports as follows:
-
tshcommands (e.g.,tsh login --proxy=...): continue using the Proxy Service web address on port3080(or443if behind a load balancer). Do not change these to port3025. -
Direct
tctlor Auth Service API commands: use port3025for the Auth Service gRPC listener:tctl status --auth-server=teleport.example.com:3025
-
-
An Okta authentication connector.
importantBefore following the guided user sync integration flow, you must have completed the guided Okta single sign-on flow.
-
(Optional) The Okta SCIM integration. To set up the SCIM integration, you can follow the guided integration flow.
-
Check that you can connect to your Teleport cluster and verify that you can run
tctlandtshcommands using your current credentials.-
Assign teleport.example.com to the domain name of the Teleport Proxy Service in your cluster and [email protected] to your Teleport username.
-
Authenticate to your Teleport cluster. This depends on whether your shell is interactive or not.
In an interactive shell: Run the following command. By default, this triggers a multi-factor authentication prompt:
tsh login --proxy=teleport.example.com --user=[email protected]tctl statusCluster teleport.example.com
Version 19.0.0
CA pin sha256:abdc1245efgh5678abdc1245efgh5678abdc1245efgh5678abdc1245efgh5678
On non-interactive environments: If you are running
tshandtctlas an AI agent, in a CI/CD environment, or similar, make sure theTELEPORT_IDENTITY_FILEenvironment variable is assigned to a valid file path with credentials for your cluster.tshandtctlread the file path from the environment variable and do not require a separate authentication step. If there is no identity file available, we recommend that you set up Machine ID to provision one automatically.When executing
tctlcommands with an identity file, you must pass the--auth-serverflag to provide the Teleport Auth Service address, which is not included in the identity file. If you provide the Proxy Service address,tctlconnects to the Proxy Service, which forwards traffic to and from the Teleport Auth Service. Update 443 to3025if you are contacting the Auth Service directly withtctl:tctl status --auth-server=teleport.example.com:443For
tshcommands that read an identity file, you must pass the--proxyflag, which pointstshto the address of the Teleport Proxy Service:tsh status --proxy=teleport.example.comEnsure client commands can access your identity file. Replace path/to/identity/file with the path to your identity file:
export TELEPORT_IDENTITY_FILE="${TELEPORT_IDENTITY_FILE:-path/to/identity/file}"Add the
--auth-serveror--proxyflags to all subsequenttctlandtshcommands.
If you can connect to the cluster and run the
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. -
-
An Okta organization with admin access.
Enabling the Okta integration will make Teleport take ownership over app and group assignments in Okta and can make changes within Okta based on your Teleport RBAC configuration. To limit the scope of the integration, ensure that:
- In the Teleport roles you have assigned to users, no role contains an app_labels field with a wildcard value. Since Teleport uses this field to govern access to Okta applications, wildcard values will grant Teleport users access to all Okta applications.
- (Optional) You have organized your Okta applications and groups into Okta resource sets, which allow you to limit the scope your Okta access token.
Step 1/4. Create a custom admin role for the app
-
Create an admin role for the app. Okta API Services apps require assigning admin roles to be able to provide access to Okta resources. From the main navigation menu, select Security -> Administrators, then go to the Roles tab and click Create new role.
-
Type in the role name and optionally the description and select the following permissions for the role:
User
- View users and their details
- Edit users' group membership
- Edit users' application assignments
Group
- View groups and their details
- Manage group membership
Application
- View an application and its details
- Edit application's user or group assignments
-
Click Save role.
Step 2/4. Create a resource set for the app
Create an Okta resource set, which we will need to assign the custom admin role created in the previous section.
-
Navigate to Security -> Administrators, then go to the Resources tab and click Create new resource set.
-
Click + Add Resource to add 3 resource types: Users, Groups and Applications.
You can limit Teleport's access to Okta resources by adjusting the resources in the set. Remember to always include the Okta SAML 2.0 application that you created as a prerequisite to the User Sync integration. The simplest setup should look like this:
Users
All users
Groups
All groups
Applications
All applications
-
After setting up the resources and filling out the name and optional description click Create and proceed.
Step 3/4. Create and configure Okta API Services app
This step assumes you are still in the Okta Integration configuration wizard on the Sync Users step. If not you can get back there with the instructions provided below.
Editing User Sync configuration
- Navigate to Zero Trust Access on the left sidebar, then select Integrations and click on the Okta row.
- Click 3-dots on the top-right corner of the User Sync tile and select Enable/Edit Configuration.
-
In Okta web UI, from the main navigation menu, select Applications -> Applications, and click Create App Integration. Select API Services, then click Next.
-
Give your application a name, select Use Okta-generated client ID and click Save.
-
Disable proof of possession. Teleport does not support DPoP when using OAuth authorization for an Okta API Services app. The previous step should end up in the General configuration tab for the application. Scroll down to the General Settings tile and click Edit. Then uncheck Require Demonstrating Proof of *Possession (DPoP) header in token requests and click Save.
-
To allow Teleport access to Okta, the Okta API Services app must be able to verify the JWT tokens issued by Teleport. In order to do this, you will configure the app with the Teleport public key for Okta.
The procedure varies slightly depending on whether your Teleport cluster is accessible over the public internet:
- Public Teleport cluster
- Private Teleport cluster
Setup public key. While still in General configuration tab, scroll to the Public keys tile and click Edit.
If your cluster is public: Select Use a URL to fetch keys dynamically and paste this URL:
https://example.teleport.sh/v1/.well-known/jwks-oktaThen click Save.
Setup public key. While still in General configuration tab, scroll to the Public keys tile and click Edit.
If your cluster is private: Open the URL below and copy the content of first key:
https://example.teleport.sh/v1/.well-known/jwks-oktaE.g. for a JWKS like:
{"keys":[{"kty":"EC","alg":"ES256","crv":"P-256","x":"6MwmQ3MygmD684xGM4KgCuNp43yyMUPFPD0VBR3E7OE","y":"wTXK7Eu1YSUzaUklkAQulD1dyjtjPCKfH1_2mbwB3vI","use":"sig","kid":"6DmMGc_gW-9A7qvbyHez_lrVCi8pHttesITktBMwl4A"}]}The part that has to be copied is:
{"kty":"EC","alg":"ES256","crv":"P-256","x":"6MwmQ3MygmD684xGM4KgCuNp43yyMUPFPD0VBR3E7OE","y":"wTXK7Eu1YSUzaUklkAQulD1dyjtjPCKfH1_2mbwB3vI","use":"sig","kid":"6DmMGc_gW-9A7qvbyHez_lrVCi8pHttesITktBMwl4A"}Select Save keys in Okta, click Add key, paste the copied key in the box and click Done. Then click Save.
-
Setup public key credentials. While still in General tab, scroll to Client Credentials. Click Edit, select Public key / Private key and click Save.
Note: Sometimes, due to a bug in Okta, you may encounter an error like:
An active client authentication (sig) key or URL is required.. If this is the case and you set up the key, reload the page and try again. -
Set up Okta API scopes. In the Okta API Scopes tab grant the following scopes:
okta.apps.readokta.apps.manageokta.groups.readokta.groups.manageokta.users.readokta.users.manage
If you are setting up the integration in the read-only mode (Access Requests and bidirectional Access List sync disabled), you can skip all the
*.managescopes. -
Assign an admin role to the app. Navigate to the Admin roles configuration tab, and click Edit assignments. Then select the custom admin role and resource set created earlier and click Save Changes.
Step 4/4. Provide your client ID
-
In the Okta admin UI, in Applications -> Applications, find your Okta API services app. In the app settings in the General tab you will find the client ID.
-
Paste the client ID to the App Sync enrollment screen and click Update.
-
Click Update to finish configuring user sync.
User import
During synchronization, the Okta integration will create Teleport user accounts for all users assigned to the Okta SAML app for the Teleport auth connector used to enroll the Okta integration.
The Teleport users created by the synchronization process or SCIM provisioning
all inherit their username from the upstream Okta organization, and are given a
default role of okta-requester.
The okta-requester role allows requesting JIT access to Okta-originated Teleport
resources (see App and Group Sync), but does not grant any
standing access. The Teleport admin can use Access Requests and Access Lists to grant
access to Teleport resources as they see fit, once the user is imported. Default role
assignment can be disabled with tctl edit plugins/okta by setting
okta.sync_settings.disable_assign_default_roles: true and setting custom Okta SAML
connector role mapping.
User traits
All non-empty values in the Okta User/AppUser profile are converted to Teleport user
traits and prefixed with okta/. The only non-prefixed traits are username and
groups. The username and groups traits are set only if the Okta connector
contains role mappings for those traits.
For example, an imported Okta user might look like this:
kind: user
metadata:
name: [email protected]
labels:
okta/org: https://enzos-pizza.okta.com
teleport.dev/origin: okta
roles:
- okta-requester
spec:
traits:
# note that "username" and "groups" mappings are set only if the SAML connector
# contains role mappings based on those traits.
username:
- [email protected]
groups:
- Drivers
- Everyone
okta/email:
- [email protected]
okta/firstName:
- Hiro
okta/lastName:
- Protagonist
okta/login:
- [email protected]
Teleport administrators can then use these traits as eligibility conditions in Access Lists in order to grant (or deny) the Okta-derived Teleport users access to Teleport resources.
Traits derived from SAML assertions and Login Rules
Added in Teleport v19.0.0.
When a user managed by Okta User Sync successfully logs in with a SAML connector, Teleport stores traits from the SAML assertion and the traits produced by Login Rules on the user's Teleport resource as described in the User traits section. User Sync retains these traits while the credentials issued by that login are expected to remain valid. This prevents the next synchronization from immediately replacing traits that are available only at login.
Teleport calculates the login traits retention deadline from the login time and the TTL of the credentials issued by that login. After the deadline passes, the next synchronization removes traits that are not supplied by the current Okta profile or otherwise managed by User Sync.
Note: In the edge case where a user's roles are updated during the SAML login flow, the login traits retention deadline may not be exactly equal to the generated certificate TTL. The login traits are cleared only during the next Okta User Sync reconciliation, which may start with a delay of up to 30 minutes.
The following limitations apply:
- User Sync always refreshes all traits with the
okta/prefix from the current Okta profile. It does not retainokta/prefixed login traits. This is because SAML login flow retainsokta/prefixed traits. This ensures that removed Okta profile attributes do not remain on the Teleport user forever. usernameandgroupstraits are retained, but for backward compatibility reasons they are replaced with the values from the Okta API if a role mapping for those traits exists in the SAML connector.- Each successful SAML login replaces the recorded login time and session TTL. A subsequent login with a shorter TTL can therefore shorten the retention deadline, even while a session from an earlier login remains valid. With concurrent logins, the recorded login is not guaranteed to be the most recent one.
- Logging out or locking the user does not shorten the retention period.
- Teleport supports login traits retention from version v19.0.0 onwards. Login traits are preserved only for SAML logins successfully completed on upgraded clusters.
User deletion
Given a case where
- the synchronization process detects that an Okta user has been deactivated, deleted or removed from the Okta App, or
- the Okta organization explicitly disables the account via SCIM,
The Okta integration will immediately delete the corresponding Teleport account and create a temporary Teleport user lock. The user lock will
- terminate any active Teleport sessions, and
- prevent the disabled user from accessing any Teleport resources with credentials issued before their Teleport account was deleted.
The user lock will expire after the maximum possible credential lifetime, plus a small safety margin.
Suspended Okta users will not be locked by Teleport.
When a user is suspended in Okta, Okta does not communicate the suspension to Teleport and so Teleport will not automatically lock and remove that user.
Be sure to either deactivate the user, or unassign them from the Okta SAML Application in order to make sure their status is updated in Teleport.
Next steps
After completing the guided enrollment flow for the Okta SCIM integration, you can proceed to the Okta app and group sync integration.
To learn how Teleport can use synced Okta profile name and email attributes in the Web UI, see User Display Names.