The commercial edition of Teleport allows users to login and retrieve their SSH credentials through a Single Sign-On (SSO) system used by the rest of the organization.
Examples of supported SSO systems include commercial solutions like Okta, Auth0, SailPoint, OneLogin or Active Directory, as well as open source products like Keycloak. Other identity management systems are supported as long as they provide an SSO mechanism based on either SAML or OAuth2/OpenID Connect.
From the user's perspective they need to execute the following command login:
# this command will automatically open the default web browser and take a user
# through the login process with an SSO provider:
$ tsh login --proxy=proxy.example.com
# output:
If browser window does not open automatically, open it by clicking on the link:
http://127.0.0.1:45235/055a310a-1099-43ea-8cf6-ffc41d88ad1f
Teleport will wait for up to 3 minutes for a user to authenticate. If authentication
succeeds, Teleport will retrieve an SSH certificate and will store it in
~/.tsh/keys/proxy.example.com
directory and also will add it to an
SSH agent if there's one running.
Teleport works with SSO providers by relying on a concept called "authentication connector". An auth connector is a plugin which controls how a user logs in and which group he or she belongs to.
The following connectors are supported:
local
connector type uses the built-in user database. This database can be
manipulated by the tctl users
command.saml
connector type uses the SAML protocol
to authenticate users and query their group membership.oidc
connector type uses the OpenID Connect protocol
to authenticate users and query their group membership.To configure SSO, a Teleport administrator must:
/etc/teleport.yaml
on the auth server to set the default
authentication connector.connector.yaml
)tctl create connector.yaml
.# snippet from /etc/teleport.yaml on the auth server:
auth_service:
# defines the default authentication connector type:
authentication:
type: saml
An example of a connector:
# connector.yaml
kind: saml
version: v2
metadata:
name: corporate
spec:
# display allows to set the caption of the "login" button
# in the Web interface
display: "Okta"
acs: https://teleport-proxy.example.com:3080/v1/webapi/saml/acs
attributes_to_roles:
- {name: "groups", value: "okta-admin", roles: ["admin"]}
- {name: "groups", value: "okta-dev", roles: ["dev"]}
# note that wildcards can also be used. the next line instructs Teleport
# to assign "admin" role to any user who has the SAML attribute that begins with "admin":
- { name: "group", value: "admin*", roles: ["admin"] }
# regular expressions with capture are also supported. the next line instructs Teleport
# to assign users to roles `admin-1` if his SAML "group" attribute equals 'ssh_admin_1':
- { name: "group", value: "^ssh_admin_(.*)$", roles: ["admin-$1"] }
entity_descriptor: |
<paste SAML XML contents here>
entity_descriptor_url
, in lieu of entity_descriptor
, to fetch the entity descriptor from
your IDP. Though, we recommend "pinning" the entity descriptor by including the XML rather than fetching from a URL.Often it is required to restrict SSO users to their unique UNIX logins when they connect to Teleport nodes. To support this:
{{external.unix_login}}
variable into the list of allowed logins:kind: role
version: v3
metadata:
name: sso_user
spec:
allow:
logins:
- '{{external.unix_login}}'
node_labels:
'*': '*'
Along with sending groups, an SSO provider will also provide a user's email address.
In many organizations, the username that a person uses to log into a system is the
same as the first part of their email address - the 'local' part. For example, [email protected]
might log in with the username dave.smith
. Teleport 4.2.6+ adds an easy way to
extract the first part of an email address so it can be used as a username - this
is the {{email.local}}
function.
If the email claim from the identity provider (which can be accessed via {{external.email}}
) is sent and contains an email address, you can extract the 'local' part of the email address before the @ sign like this: {{email.local(external.email)}}
Here's how this looks in a Teleport role:
kind: role
version: v3
metadata:
name: sso_user
spec:
allow:
logins:
# Extracts the local part of [email protected], so the login will
# now support dave.smith.
- '{{email.local(external.email)}}'
node_labels:
'*': '*'
Teleport can also support multiple connectors, i.e. a Teleport administrator
can define and create multiple connector resources using tctl create
as shown above.
To see all configured connectors, execute this on the auth server:
$ tctl get connectors
To delete/update connectors, use the usual tctl rm
and tctl create
commands
as described in the Resources section in the Admin Manual.
If multiple authentication connectors exist, the clients must supply a
connector name to tsh login
via --auth
argument:
# use "okta" SAML connector:
$ tsh --proxy=proxy.example.com login --auth=okta
# use local Teleport user DB:
$ tsh --proxy=proxy.example.com login --auth=local --user=admin
Refer to the following guides to configure authentication connectors of both SAML and OIDC types:
Provider | YAML | Example |
---|---|---|
Github | display: Github | |
Microsoft | display: Microsoft | |
display: Google | ||
BitBucket | display: Bitbucket | |
OpenID | display: Okta |
Troubleshooting SSO configuration can be challenging. Usually a Teleport administrator must be able to:
If something is not working, we recommend to:
/var/lib/teleport/log
directory.ad