Access Requests with Email
This guide will explain how to set up Teleport to send Just-in-Time Access Request notifications to users via email. Since all organizations use email for at least some of their communications, Teleport's email plugin makes it straightforward to integrate Access Requests into your existing workflows, letting you implement security best practices without compromising productivity.
This integration is hosted on Teleport Enterprise (Cloud)
In Teleport Enterprise Cloud, Teleport manages the Email integration for you, and you can enroll the Email integration from the Teleport Web UI.
Visit the Teleport Web UI and on the left sidebar, click Access followed by Integrations. Then click Enroll New Integration to visit the "Enroll New Integration" page:
On the "Select Integration Type" menu, click the tile for your integration. You will see a page with instructions to set up the integration, as well as a form that you can use to configure the integration.
Configure and connect email integration by providing the following configuration values:
Sender: Configures the sender address.
Fallback Recipient: Configures the default recipient for Access Request
notifications.
Email Service: Selects the desired email service. Note: only Mailgun is
supported for Teleport Enterprise (Cloud).
Complete Mailgun integration by providing the following Mailgun API configuration values:
Domain: Configures the Mailgun sending domain.
Mailgun Private Key: Configures the Mailgun API key.
Prerequisites
-
A running Teleport Enterprise cluster version 17.4.8 or above. If you want to get started with Teleport, sign up for a free trial.
-
The
tctladmin tool andtshclient tool.Visit Installation for instructions on downloading
tctlandtsh.
Recommended: Configure Machine ID to provide short-lived Teleport
credentials to the plugin. Before following this guide, follow a Machine ID
deployment guide
to run the tbot binary on your infrastructure.
- Access to an SMTP service. The Teleport email plugin supports either Mailgun or a generic SMTP service that authenticates via username and password.
- Either a Linux host or Kubernetes cluster where you will run the email plugin.
The Teleport plugin needs to use a username and password to authenticate to your SMTP service. To mitigate the risk of these credentials being leaked, you should set up a dedicated email account for the Teleport plugin and rotate the password regularly.
- 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@example.com to your Teleport username:If you can connect to the cluster and run thetsh login --proxy=teleport.example.com --user=email@example.comtctl statusCluster teleport.example.com
Version 17.4.8
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/7. Define RBAC resources
Before you set up the email plugin, enable Role Access Requests in your Teleport cluster.
For the purpose of this guide, we will define an editor-requester role, which
can request the built-in editor role, and an editor-reviewer role that can
review requests for the editor role.
Create a file called editor-request-rbac.yaml with the following content:
kind: role
version: v7
metadata:
name: editor-reviewer
spec:
allow:
review_requests:
roles: ['editor']
---
kind: role
version: v7
metadata:
name: editor-requester
spec:
allow:
request:
roles: ['editor']
thresholds:
- approve: 1
deny: 1
Create the roles you defined:
tctl create -f editor-request-rbac.yamlrole 'editor-reviewer' has been createdrole 'editor-requester' has been created
You can also create and edit roles using the Web UI. Go to Access -> Roles and click Create New Role or pick an existing role to edit.
Allow yourself to review requests by users with the editor-requester role by
assigning yourself the editor-reviewer role.
Assign the editor-reviewer role to your Teleport user by 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?},editor-reviewer" -
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, addingeditor-reviewerto 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 + - editor-reviewer -
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, addingeditor-reviewerto 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 + - editor-reviewer -
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, addingeditor-reviewerto 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 + - editor-reviewer -
Apply your changes:
tctl create -f oidc.yaml -
Sign out of the Teleport cluster and sign in again to assume the new role.
Create a user called myuser who has the editor-requester role. This user
cannot edit your cluster configuration unless they request the editor role:
tctl users add myuser --roles=editor-requester
tctl will print an invitation URL to your terminal. Visit the URL and log in
as myuser for the first time, registering credentials as configured for your
Teleport cluster.
Later in this guide, you will have myuser request the editor role so you can
review the request using the Teleport plugin.
Step 2/7. Install the Teleport email plugin
Using a local SMTP server?
If you are using a local SMTP server to test the plugin, you should install the plugin on your local machine to ensure the plugin can connect to the SMTP server and perform any necessary DNS lookups to send email.
Your Teleport cluster does not need to perform DNS lookups for your plugin because the plugin dials out to the Teleport Proxy Service or Teleport Auth Service.
- Download
- Docker Image
- From Source
- Helm Chart
Access Request Plugins are available as amd64 and arm64 Linux binaries for downloading.
Replace ARCH with your required version.
curl -L -O https://cdn.teleport.dev/teleport-access-email-v17.4.8-linux-ARCH-bin.tar.gztar -xzf teleport-access-email-v17.4.8-linux-ARCH-bin.tar.gzcd teleport-access-emailsudo ./install
Make sure the binary is installed:
teleport-email versionteleport-email v17.4.8 git:teleport-email-v17.4.8-fffffffff go1.23.8
docker pull public.ecr.aws/gravitational/teleport-plugin-email:17.4.8
Make sure the plugin is installed by running the following command:
docker run public.ecr.aws/gravitational/teleport-plugin-email:17.4.8 versionteleport-email v17.4.8 git:teleport-email-v17.4.8-api/14.0.0-gd1e081e 1.23.8
For a list of available tags, visit Amazon ECR Public Gallery.
To install from source you need git and go installed. If you do not have Go
installed, visit the Go downloads page.
git clone https://github.com/gravitational/teleport -b branch/v17cd teleport/integrations/access/emailgit checkout v17.4.8make build/teleport-email
Move the teleport-email binary into your PATH.
Make sure the binary is installed:
teleport-email versionteleport-email v17.4.8 git:teleport-email-v17.4.8-fffffffff go1.23.8
Allow Helm to install charts that are hosted in the Teleport Helm repository:
helm repo add teleport https://charts.releases.teleport.dev
Update the cache of charts from the remote repository:
helm repo update
Step 3/7. Create a user and role for the plugin
Teleport's Access Request plugins authenticate to your Teleport cluster as a user with permissions to list and read Access Requests. This way, plugins can retrieve Access Requests from the Teleport Auth Service and present them to reviewers.
Define a user and role called access-plugin by adding the following content to
a file called access-plugin.yaml:
kind: role
version: v7
metadata:
name: access-plugin
spec:
allow:
rules:
- resources: ['access_request']
verbs: ['list', 'read']
- resources: ['access_plugin_data']
verbs: ['update']
# Optional: Required to use access monitoring rules.
- resources: ['access_monitoring_rule']
verbs: ['list', 'read']
# Optional: In order to provide access list review reminders, permissions to list and read access lists
# are necessary. This is currently only supported for a subset of plugins.
- resources: ['access_list']
verbs: ['list', 'read']
# Optional: To display logins permitted by roles, the plugin also needs
# permission to read the role resource.
- resources: ['role']
verbs: ['read']
# Optional: To have the users traits apply when evaluating the roles,
# the plugin also needs permission to read users.
- resources: ['user']
verbs: ['read']
# Optional: To display user-friendly names in resource-based Access
# Requests instead of resource IDs, the plugin also needs permission
# to list the resources being requested. Include this along with the
# list-access-request-resources role definition.
review_requests:
preview_as_roles:
- list-access-request-resources
---
kind: user
metadata:
name: access-plugin
spec:
roles: ['access-plugin']
version: v2
---
# Optional, for displaying friendly names of resources. Resource types and
# labels can be further limited to only the resources that access can be
# requested to.
kind: role
version: v7
metadata:
name: list-access-request-resources
spec:
allow:
rules:
- resources: ['node', 'app', 'db', 'kube_cluster']
verbs: ['list', 'read']
node_labels:
'*': '*'
kubernetes_labels:
'*': '*'
db_labels:
'*': '*'
app_labels:
'*': '*'
group_labels:
'*': '*'
Create the user and role:
tctl create -f access-plugin.yaml
You can also create and edit roles using the Web UI. Go to Access -> Roles and click Create New Role or pick an existing role to edit.
As with all Teleport users, the Teleport Auth Service authenticates the
access-plugin user by issuing short-lived TLS credentials. In this case, we
will need to request the credentials manually by impersonating the
access-plugin role and user.
If you are running a self-hosted Teleport Enterprise deployment and are using
tctl from the Auth Service host, you will already have impersonation
privileges.
To grant your user impersonation privileges for access-plugin, define a role
called access-plugin-impersonator by pasting the following YAML document into
a file called access-plugin-impersonator.yaml:
kind: role
version: v7
metadata:
name: access-plugin-impersonator
spec:
allow:
impersonate:
roles:
- access-plugin
users:
- access-plugin
Create the access-plugin-impersonator role:
tctl create -f access-plugin-impersonator.yaml
You can also create and edit roles using the Web UI. Go to Access -> Roles and click Create New Role or pick an existing role to edit.
If you are providing identity files to the plugin with Machine ID, assign the
access-plugin role to the Machine ID bot user. Otherwise, assign this role to
the user you plan to use to generate credentials for the access-plugin role
and user:
Assign the access-plugin-impersonator role to your Teleport user by 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?},access-plugin-impersonator" -
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, addingaccess-plugin-impersonatorto 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 + - access-plugin-impersonator -
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, addingaccess-plugin-impersonatorto 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 + - access-plugin-impersonator -
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, addingaccess-plugin-impersonatorto 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 + - access-plugin-impersonator -
Apply your changes:
tctl create -f oidc.yaml -
Sign out of the Teleport cluster and sign in again to assume the new role.
You will now be able to generate signed certificates for the access-plugin
role and user.
Step 4/7. Export the access plugin identity
Give the plugin access to a Teleport identity file. We recommend using Machine
ID for this in order to produce short-lived identity files that are less
dangerous if exfiltrated, though in demo deployments, you can generate
longer-lived identity files with tctl:
- Machine ID
- Long-lived identity files
Configure tbot with an output that will produce the credentials needed by
the plugin. As the plugin will be accessing the Teleport API, the correct
output type to use is identity.
For this guide, the directory destination will be used. This will write these
credentials to a specified directory on disk. Ensure that this directory can
be written to by the Linux user that tbot runs as, and that it can be read by
the Linux user that the plugin will run as.
Modify your tbot configuration to add an identity output.
If running tbot on a Linux server, use the directory output to write
identity files to the /opt/machine-id directory:
outputs:
- type: identity
destination:
type: directory
# For this guide, /opt/machine-id is used as the destination directory.
# You may wish to customize this. Multiple outputs cannot share the same
# destination.
path: /opt/machine-id
If running tbot on Kubernetes, write the identity file to Kubernetes secret
instead:
outputs:
- type: identity
destination:
type: kubernetes_secret
name: teleport-plugin-email-identity
If operating tbot as a background service, restart it. If running tbot in
one-shot mode, execute it now.
You should now see an identity file under /opt/machine-id or a Kubernetes
secret named teleport-plugin-email-identity. This contains the private key and signed
certificates needed by the plugin to authenticate with the Teleport Auth
Service.
Like all Teleport users, access-plugin needs signed credentials in order to
connect to your Teleport cluster. You will use the tctl auth sign command to
request these credentials.
The following tctl auth sign command impersonates the access-plugin user,
generates signed credentials, and writes an identity file to the local
directory:
tctl auth sign --user=access-plugin --out=identity
The plugin connects to the Teleport Auth Service's gRPC endpoint over TLS.
The identity file, By default, Note that you cannot issue certificates that are valid longer than your existing credentials.
For example, to issue certificates with a 1000-hour TTL, you must be logged in with a session that is
valid for at least 1000 hours. This means your user must have a role allowing
a identity, includes both TLS and SSH credentials. The
plugin uses the SSH credentials to connect to the Proxy Service, which
establishes a reverse tunnel connection to the Auth Service. The plugin
uses this reverse tunnel, along with your TLS credentials, to connect to the
Auth Service's gRPC endpoint.Details
Certificate Lifetime
tctl auth sign produces certificates with a relatively short
lifetime. For production deployments, we suggest using Machine
ID to programmatically issue and renew
certificates for your plugin. See our Machine ID getting started
guide to learn more.max_session_ttl of at least 1000 hours (60000 minutes), and you must specify a --ttl
when logging in:
If you are running the plugin on a Linux server, create a data directory to hold certificate files for the plugin:
sudo mkdir -p /var/lib/teleport/plugins/api-credentialssudo mv identity /var/lib/teleport/plugins/api-credentials
If you are running the plugin on Kubernetes, Create a Kubernetes secret that contains the Teleport identity file:
kubectl -n teleport create secret generic --from-file=identity teleport-plugin-email-identity
Once the Teleport credentials expire, you will need to renew them by running the
tctl auth sign command again.
Step 5/7. Configure the plugin
At this point, you have generated credentials that the email plugin will use to connect to Teleport. You will now configure the plugin to use these credentials to receive Access Request notifications from Teleport and email them to your chosen recipients.
Create a config file
- Executable or Docker
- Helm Chart
The Teleport email plugin uses a configuration file in TOML format. Generate a boilerplate configuration by running the following command:
teleport-email configure | sudo tee /etc/teleport-email.toml
The email plugin Helm Chart uses a YAML values file to configure the plugin.
On your local workstation, create a file called teleport-email-helm.yaml
based on the following example:
teleport:
address: teleport.example.com:443
identitySecretName: teleport-plugin-email-identity
identitySecretPath: identity
mailgun:
enabled: false
domain: ""
privateKey: ""
privateKeyFromSecret: ""
privateKeySecretPath: "mailgunPrivateKey"
smtp:
enabled: false
host: ""
port: 587
username: ""
password: ""
passwordFromSecret: ""
passwordSecretPath: "smtpPassword"
starttlsPolicy: "mandatory"
delivery:
sender: ""
recipients: []
roleToRecipients: {}
secretVolumeName: "password-file"
Edit the configuration file
Edit the configuration file for your environment. We will show you how to set each value below.
[teleport]
- Executable or Docker
- Helm Chart
addr: Include the hostname and HTTPS port of your Teleport Proxy Service
or Teleport Enterprise Cloud account (e.g., teleport.example.com:443 or
mytenant.teleport.sh:443).
identity: Fill this in with the path to the identity file you exported
earlier.
client_key, client_crt, root_cas: Comment these out, since we
are not using them in this configuration.
address: Include the hostname and HTTPS port of your Teleport Proxy Service
or Teleport Enterprise Cloud tenant (e.g., teleport.example.com:443 or
mytenant.teleport.sh:443).
identitySecretName: Fill in the identitySecretName field with the name
of the Kubernetes secret you created earlier.
identitySecretPath: Fill in the identitySecretPath field with the path
of the identity file within the Kubernetes secret. If you have followed the
instructions above, this will be identity.
If you are providing credentials to the plugin using a tbot binary that runs
on a Linux server, make sure the value of identity is the same as the path of
the identity file you configured tbot to generate, /opt/machine-id/identity.
Configure the plugin to periodically reload the identity file, ensuring that it does not attempt to connect to the Teleport Auth Service with expired credentials.
Add the following to the teleport section of the configuration:
refresh_identity = true
[mailgun] or [smtp]
Provide the credentials for your SMTP service depending on whether you are using Mailgun or SMTP service.
- Mailgun
- Generic SMTP Service
If you are deploying the email plugin on a Linux host:
- In the
mailgunsection, assigndomainto the domain name and subdomain of your Mailgun account. - Assign
mailgun.private_keyto your Mailgun private key.
If you are deploying the email plugin on Kubernetes:
- Write your Mailgun private key to a local file called
mailgun-private-key. - Create a Kubernetes secret from the file:
kubectl -n teleport create secret generic mailgun-private-key --from-file=mailgun-private-key
- Assign
mailgun.privateKeyFromSecrettomailgun-private-key.
Assign host to the fully qualified domain name of your SMTP service, omitting
the URL scheme and port. (If you're using a local SMTP server for testing, use
"localhost" for host.) Assign port to the port of your SMTP service.
If you are running the email plugin on a Linux host, fill in username and
password.
You can also save your password to a separate file and assign password_file to
the file's path. The plugin reads the file and uses the file's content as the
password.
If you are deploying the email plugin on Kubernetes:
- Write your SMTP service's password a local file called
smtp-password.txt. - Create a Kubernetes secret from the file:
kubectl -n teleport create secret generic smtp-password --from-file=smtp-password
- Assign
smtp.passwordFromSecrettosmtp-password.
Disabling TLS for testing
If you are testing the email plugin against a trusted internal SMTP server where
you would rather not use TLS—e.g., a local SMTP server on your development
machine—you can assign the starttls_policy setting to disabled (always
disable TLS) or opportunistic (disable TLS if the server does not advertise
the STARTTLS extension). The default is to always enforce TLS, and you should
leave this setting unassigned unless you know what you are doing and understand
the risks.
For Kubernetes deployments, starttls_policy is called smtp.starttlsPolicy in
the Helm values file for the email plugin.
[delivery]
Assign sender to the email address from which you would like the Teleport
plugin to send messages.
[role_to_recipients]
The role_to_recipients map (roleToRecipients for Helm users) configures the
recipients that the email plugin will notify when a user requests access to a
specific role. When the plugin receives an Access Request from the Auth Service,
it will look up the role being requested and identify the recipients to notify.
- Executable or Docker
- Helm Chart
Here is an example of a role_to_recipients map. Each value can be a single
string or an array of strings:
[role_to_recipients]
"*" = ["security@example.com", "executive-team@example.com"]
"dev" = "eng@example.com"
"dba" = "mallory@example.com"
In the Helm chart, the role_to_recipients field is called roleToRecipients
and uses the following format, where keys are strings and values are arrays of
strings:
roleToRecipients:
"*": ["security@example.com", "executive-team@example.com"]
"dev": ["eng@example.com"]
"dba": ["mallory@example.com"]
In the role_to_recipients map, each key is the name of a Teleport role. Each
value configures the recipients the plugin will email when it receives an Access
Request for that role. Each string must be an email address.
The role_to_recipients map must also include an entry for "*", which the
plugin looks up if no other entry matches a given role name. In the example
above, requests for roles aside from dev and dba will notify
security@example.com and executive-team@example.com.
Suggested reviewers
Users can suggest reviewers when they create an Access Request, e.g.,:
tsh request create --roles=dbadmin --reviewers=alice@example.com,ivan@example.com
If an Access Request includes suggested reviewers, the email plugin will add
these to the list of recipients to notify. If a suggested reviewer is an email
address, the plugin will send a message to that recipient in addition to those
configured in role_to_recipients.
Configure the email plugin to notify you when a user requests the editor role
by adding the following to your role_to_recipients config, replacing
YOUR_EMAIL_ADDRESS with the appropriate address:
- Executable or Docker
- Helm Chart
[role_to_recipients]
"*" = "YOUR_EMAIL_ADDRESS"
"editor" = "YOUR_EMAIL_ADDRESS"
roleToRecipients:
"*": "YOUR_EMAIL_ADDRESS"
"editor": "YOUR_EMAIL_ADDRESS"
Configuring recipients without role mapping
If you do not plan to use role-to-recipient mapping, you can configure the
Teleport email plugin to notify a static list of recipients for every Access
Request event by using the delivery.recipients field:
- Executable or Docker
- Helm Chart
[delivery]
recipients = ["eng@exmaple.com", "dev@example.com"]
delivery:
recipients: ["eng@exmaple.com", "dev@example.com"]
If you use delivery.recipients, you must remove the role_to_recipients
configuration section. Behind the scenes, delivery.recipients assigns the
recipient list to a role_to_recipients mapping under the wildcard value "*".
You configuration should resemble the following:
- Executable or Docker
- Helm Chart
# /etc/teleport-email.toml
[teleport]
addr = "example.com:443"
identity = "/var/lib/teleport/plugins/email/identity"
refresh_identity = true
[mailgun]
domain = "sandbox123abc.mailgun.org"
private_key = "xoxb-fakekey62b0eac53565a38c8cc0316f6"
# As an alternative, you can use SMTP server credentials:
#
# [smtp]
# host = "smtp.gmail.com"
# port = 587
# username = "username@gmail.com"
# password = ""
# password_file = "/var/lib/teleport/plugins/email/smtp_password"
# starttls_policy = "mandatory"
[delivery]
sender = "noreply@example.com"
[role_to_recipients]
"*" = "eng@example.com"
"editor" = ["admin@example.com", "execs@example.com"]
[log]
output = "stderr" # Logger output. Could be "stdout", "stderr" or "/var/lib/teleport/email.log"
severity = "INFO" # Logger severity. Could be "INFO", "ERROR", "DEBUG" or "WARN".
# teleport-email-helm.yaml
teleport:
address: "teleport.example.com:443"
identitySecretName: teleport-plugin-email-identity
identitySecretPath: identity
mailgun:
domain: "sandbox123abc.mailgun.org"
privateKeyFromSecret: "mailgun-private-key"
# As an alternative, you can use SMTP server credentials:
#
# smtp:
# host: "smtp.gmail.com"
# port: 587
# username: "username@gmail.com"
# passwordFromSecret: "smtp-password"
# starttls_policy = "mandatory"
delivery:
sender: "noreply@example.com"
roleToRecipients:
"*": "eng@example.com"
"editor": ["admin@example.com", "execs@example.com"]
Step 6/7. Test the email plugin
After finishing your configuration, you can now run the plugin and test your email-based Access Request flow:
- Executable
- Docker
- Helm Chart
teleport-email start
If everything works as expected, the log output should look like this:
teleport-email startINFO Starting Teleport Access Email Plugin (): email/app.go:80INFO Plugin is ready email/app.go:101
Start the plugin:
docker run -v <path-to-config>:/etc/teleport-email.toml public.ecr.aws/gravitational/teleport-plugin-email:17.4.8 start
Install the plugin:
helm upgrade --install teleport-plugin-email teleport/teleport-plugin-email --values teleport-email-helm.yaml
To inspect the plugin's logs, use the following command:
kubectl logs deploy/teleport-plugin-email
Debug logs can be enabled by setting log.severity to DEBUG in
teleport-email-helm.yaml and executing the helm upgrade ... command
above again. Then you can restart the plugin with the following command:
kubectl rollout restart deployment teleport-plugin-email
Create an Access Request
- As an Admin
- As a User
- From the Web UI
A Teleport admin can create an Access Request for another user with tctl:
tctl request create myuser --roles=editor
Users can use tsh to create an Access Request and log in with approved roles:
tsh request create --roles=editorSeeking request approval... (id: 8f77d2d1-2bbf-4031-a300-58926237a807)
Users can request access using the Web UI by visiting "Identity", clicking "Access Requests" and then "New Request":

The recipients you configured earlier should receive notifications of the request by email.
Resolve the request
Once you receive an Access Request message, click the link to visit Teleport and approve or deny the request:
Details
Reviewing from the command line
You can also review an Access Request from the command line:
- As an Admin
- As a User
Replace REQUEST_ID with the id of the request
tctl request approve REQUEST_IDtctl request deny REQUEST_ID
Replace REQUEST_ID with the id of the request
tsh request review --approve REQUEST_IDtsh request review --deny REQUEST_ID
Step 7/7. Set up systemd
This section is only relevant if you are running the Teleport email plugin on a Linux host.
In production, we recommend starting the Teleport plugin daemon via an init system like systemd. Here's the recommended Teleport plugin service unit file for systemd:
[Unit]
Description=Teleport Email Plugin
After=network.target
[Service]
Type=simple
Restart=on-failure
ExecStart=/usr/local/bin/teleport-email start --config=/etc/teleport-email.toml
ExecReload=/bin/kill -HUP $MAINPID
PIDFile=/run/teleport-email.pid
[Install]
WantedBy=multi-user.target
Save this as teleport-email.service in either /usr/lib/systemd/system/ or
another unit file load
path
supported by systemd.
Enable and start the plugin:
sudo systemctl enable teleport-emailsudo systemctl start teleport-email