Skip to content

Commit

Permalink
Include Machine ID instructions in plugin guides (gravitational#35429)
Browse files Browse the repository at this point in the history
* Include Machine ID instructions in plugin guides

Closes gravitational#15062

This change incorporates Machine ID instructions into how-to guides for
Teleport plugins.

The alternative was to write a separate guide for using Machine ID with
plugins. However, the current how-to guides assume that the user is
providing long-lived credentials via `tctl`, so it makes sense to modify
the instructions in these guides. Otherwise, a user would need to get
familiar with the Machine ID guide, then work out for themselves which
parts of the how-to guides are relevant or not.

- Use a partial for the initial plugin config as well as for a Machine
  ID prerequisite.
- Add partial for providing identity files via Machine ID.
- Edit impersonation partials to mention Machine ID.
- Add a `refresh-plugin-identity.mdx` partial for configuring plugins to
  periodically refresh their identities.
- Make Access Request plugin guides more consistent with how they use
  the identity-export.mdx partial.

* Fix "susceptible" usage

Responds to zmb3 feedback

* Respond to strideynet feedback

Change Event Handler instructions to mention the
`teleport-refresh-enabled` flag instead of a config option.

* Fix spelling issue
  • Loading branch information
ptgott authored Dec 11, 2023
1 parent 49477f2 commit 5f26498
Show file tree
Hide file tree
Showing 17 changed files with 220 additions and 126 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ compromising productivity.

(!docs/pages/includes/commercial-prereqs-tabs.mdx!)

(!docs/pages/includes/machine-id/plugin-prerequisites.mdx!)

- Admin account on your Discord server. Installing a bot requires at least the
"manager server" permission.
- Either a Linux host or Kubernetes cluster where you will run the Discord plugin.
Expand All @@ -45,29 +47,17 @@ in your Teleport cluster.

## Step 4/8. Export the access plugin identity

(!docs/pages/includes/plugins/identity-export.mdx user="access-plugin"!)
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`:

<Tabs>
<TabItem label="Virtual Machine">

The rest of this guide assumes that you have placed any files generated by this
command into `/var/lib/teleport/plugins/discord` for later reference when
configuring the plugin:

```code
# create a data directory to hold certificate files for the plugin.
$ sudo mkdir -p /var/lib/teleport/plugins/discord
$ sudo mv auth.* /var/lib/teleport/plugins/discord
```
<TabItem label="Machine ID">
(!docs/pages/includes/plugins/tbot-identity.mdx secret="teleport-plugin-discord-identity"!)
</TabItem>
<TabItem label="Kubernetes">

Create a Kubernetes secret that contains the Teleport identity file:

```code
$ kubectl -n teleport create secret generic --from-file=auth.pem teleport-plugin-discord-identity
```

<TabItem label="Long-lived identity files">
(!docs/pages/includes/plugins/identity-export.mdx user="access-plugin" secret="teleport-plugin-discord-identity"!)
</TabItem>
</Tabs>

Expand Down Expand Up @@ -159,6 +149,8 @@ The Discord plugin uses this section to connect to the Teleport Auth Service.

(!docs/pages/includes/plugins/config-toml-teleport.mdx!)

(!docs/pages/includes/plugins/refresh-plugin-identity.mdx!)

**`[discord]`**

`token`: Paste the bot token saved previously in this field.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ letting you implement security best practices without compromising productivity.

(!docs/pages/includes/commercial-prereqs-tabs.mdx!)

(!docs/pages/includes/machine-id/plugin-prerequisites.mdx!)

- 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.
Expand Down Expand Up @@ -59,29 +61,17 @@ because the plugin dials out to the Teleport Proxy Service or Teleport Auth Serv

## Step 4/7. Export the access plugin identity

(!docs/pages/includes/plugins/identity-export.mdx user="access-plugin"!)
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`:

<Tabs>
<TabItem label="Virtual Machine">

The rest of this guide assumes that you have placed any files generated by this
command into `/var/lib/teleport/plugins/email` for later reference when
configuring the plugin:

```code
# create a data directory to hold certificate files for the plugin.
$ sudo mkdir -p /var/lib/teleport/plugins/email
$ sudo mv auth.* /var/lib/teleport/plugins/email
```
<TabItem label="Machine ID">
(!docs/pages/includes/plugins/tbot-identity.mdx secret="teleport-plugin-email-identity"!)
</TabItem>
<TabItem label="Kubernetes">

Create a Kubernetes secret that contains the Teleport identity file:

```code
$ kubectl -n teleport create secret generic --from-file=auth.pem teleport-plugin-email-identity
```

<TabItem label="Long-lived identity files">
(!docs/pages/includes/plugins/identity-export.mdx user="access-plugin" secret="teleport-plugin-email-identity" !)
</TabItem>
</Tabs>

Expand Down Expand Up @@ -126,6 +116,8 @@ each value below.

(!docs/pages/includes/plugins/config-toml-teleport.mdx!)

(!docs/pages/includes/plugins/refresh-plugin-identity.mdx!)

### `[mailgun]` or `[smtp]`

Provide the credentials for your SMTP service depending on whether you are using
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ compromising productivity.

(!docs/pages/includes/commercial-prereqs-tabs.mdx!)

(!docs/pages/includes/machine-id/plugin-prerequisites.mdx!)

- A Mattermost account with admin privileges. This plugin has been tested with
Mattermost v7.0.1.
- Either a Linux host or Kubernetes cluster where you will run the Teleport Mattermost plugin.
Expand Down Expand Up @@ -63,29 +65,17 @@ Teleport Proxy Service and your Mattermost deployment.

## Step 4/8. Export the access plugin identity

(!docs/pages/includes/plugins/identity-export.mdx user="access-plugin"!)
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`:

<Tabs>
<TabItem label="Virtual Machine">

The rest of this guide assumes that you have placed any files generated by this
command into `/var/lib/teleport/plugins/mattermost` for later reference when
configuring the plugin:

```code
# create a data directory to hold certificate files for the plugin.
$ sudo mkdir -p /var/lib/teleport/plugins/mattermost
$ sudo mv auth.* /var/lib/teleport/plugins/mattermost
```
<TabItem label="Machine ID">
(!docs/pages/includes/plugins/tbot-identity.mdx secret="teleport-plugin-mattermost-identity"!)
</TabItem>
<TabItem label="Kubernetes">

Create a Kubernetes secret that contains the Teleport identity file:

```code
$ kubectl -n teleport create secret generic --from-file=auth.pem teleport-plugin-mattermost-identity
```

<TabItem label="Long-lived identity files">
(!docs/pages/includes/plugins/identity-export.mdx user="access-plugin" secret="teleport-plugin-mattermost-identity"!)
</TabItem>
</Tabs>

Expand Down Expand Up @@ -156,6 +146,8 @@ Edit the configuration as explained below:

(!docs/pages/includes/plugins/config-toml-teleport.mdx!)

(!docs/pages/includes/plugins/refresh-plugin-identity.mdx!)

### `[mattermost]`

**`url`**: Include the scheme (`https://`) and fully qualified domain name of
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ compromising productivity.

(!docs/pages/includes/commercial-prereqs-tabs.mdx!)

(!docs/pages/includes/machine-id/plugin-prerequisites.mdx!)

- A Microsoft Teams License (Microsoft 365 Business).
- Azure console access in the organization/directory holding the Microsoft Teams
License.
Expand Down Expand Up @@ -53,29 +55,17 @@ to generate an application archive to upload later in this guide.

## Step 4/9. Export the access plugin identity

(!docs/pages/includes/plugins/identity-export.mdx user="access-plugin"!)
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`:

<Tabs>
<TabItem label="Virtual Machine">

The rest of this guide assumes that you have placed any files generated by this
command into `/var/lib/teleport/plugins/msteams` for later reference when
configuring the plugin:

```code
# create a data directory to hold certificate files for the plugin.
$ sudo mkdir -p /var/lib/teleport/plugins/msteams
$ sudo mv auth.* /var/lib/teleport/plugins/msteams
```
<TabItem label="Machine ID">
(!docs/pages/includes/plugins/tbot-identity.mdx secret="teleport-plugin-msteams-identity"!)
</TabItem>
<TabItem label="Kubernetes">

Create a Kubernetes secret that contains the Teleport identity file:

```code
$ kubectl -n teleport create secret generic --from-file=auth.pem teleport-plugin-msteams-identity
```

<TabItem label="Long-lived identity files">
(!docs/pages/includes/plugins/identity-export.mdx user="access-plugin" secret="teleport-plugin-msteams-identity"!)
</TabItem>
</Tabs>

Expand Down Expand Up @@ -245,6 +235,8 @@ cluster.

(!docs/pages/includes/plugins/config-toml-teleport.mdx!)

(!docs/pages/includes/plugins/refresh-plugin-identity.mdx!)

#### `[msapi]`/`msTeams`

<Tabs>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ PagerDuty.

(!docs/pages/includes/commercial-prereqs-tabs.mdx!)

(!docs/pages/includes/machine-id/plugin-prerequisites.mdx!)

- A PagerDuty account with the "Admin", "Global Admin", or "Account Owner"
roles. These roles are necessary for generating an API token that can list and
look up user profiles.
Expand Down Expand Up @@ -369,29 +371,17 @@ Teleport cluster.

## Step 4/8. Export the access plugin identity

(!docs/pages/includes/plugins/identity-export.mdx user="access-plugin"!)
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`:

<Tabs>
<TabItem label="Virtual Machine">

The rest of this guide assumes that you have placed any files generated by this
command into `/var/lib/teleport/plugins/pagerduty` for later reference when
configuring the plugin:

```code
# create a data directory to hold certificate files for the plugin.
$ sudo mkdir -p /var/lib/teleport/plugins/pagerduty
$ sudo mv auth.* /var/lib/teleport/plugins/pagerduty
```
<TabItem label="Machine ID">
(!docs/pages/includes/plugins/tbot-identity.mdx secret="teleport-plugin-pagerduty-identity"!)
</TabItem>
<TabItem label="Kubernetes">

Create a Kubernetes secret that contains the Teleport identity file:

```code
$ kubectl -n teleport create secret generic --from-file=auth.pem teleport-plugin-pagerduty-identity
```

<TabItem label="Long-lived identity files">
(!docs/pages/includes/plugins/identity-export.mdx user="access-plugin" secret="teleport-plugin-pagerduty-identity"!)
</TabItem>
</Tabs>

Expand Down Expand Up @@ -460,6 +450,8 @@ The PagerDuty plugin uses this section to connect to your Teleport cluster:

(!docs/pages/includes/plugins/config-toml-teleport.mdx!)

(!docs/pages/includes/plugins/refresh-plugin-identity.mdx!)

### `[pagerduty]`

Assign `api_key` to the PagerDuty API key you generated earlier.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ Here is an example of sending an Access Request via Teleport's Slack plugin:

(!docs/pages/includes/commercial-prereqs-tabs.mdx!)

(!docs/pages/includes/machine-id/plugin-prerequisites.mdx!)

- Slack admin privileges to create an app and install it to your workspace. Your
Slack profile must have the "Workspace Owner" or "Workspace Admin" banner
below your profile picture.
Expand All @@ -63,29 +65,17 @@ in your Teleport cluster.

## Step 4/8. Export the access plugin identity

(!docs/pages/includes/plugins/identity-export.mdx user="access-plugin"!)
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`:

<Tabs>
<TabItem label="Virtual Machine">

The rest of this guide assumes that you have placed any files generated by this
command into `/var/lib/teleport/plugins/slack` for later reference when
configuring the plugin:

```code
# create a data directory to hold certificate files for the plugin.
$ sudo mkdir -p /var/lib/teleport/plugins/slack
$ sudo mv auth.* /var/lib/teleport/plugins/slack
```
<TabItem label="Machine ID">
(!docs/pages/includes/plugins/tbot-identity.mdx secret="teleport-plugin-slack-identity"!)
</TabItem>
<TabItem label="Kubernetes">

Create a Kubernetes secret that contains the Teleport identity file:

```code
$ kubectl -n teleport create secret generic --from-file=auth.pem teleport-plugin-slack-identity
```

<TabItem label="Long-lived identity files">
(!docs/pages/includes/plugins/identity-export.mdx user="access-plugin" secret="teleport-plugin-slack-identity"!)
</TabItem>
</Tabs>

Expand Down Expand Up @@ -199,6 +189,8 @@ The Slack plugin uses this section to connect to your Teleport cluster:

(!docs/pages/includes/plugins/config-toml-teleport.mdx!)

(!docs/pages/includes/plugins/refresh-plugin-identity.mdx!)

**`[slack]`**

`token`: Open [`https://api.slack.com/apps`](https://api.slack.com/apps), find
Expand Down
6 changes: 6 additions & 0 deletions docs/pages/includes/machine-id/plugin-prerequisites.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
**Recommended:** Configure Machine ID to provide short-lived Teleport
credentials to the plugin. Before following this guide, follow a Machine ID
[deployment guide](../../machine-id/deployment.mdx) to run the `tbot` binary on
your infrastructure.


4 changes: 4 additions & 0 deletions docs/pages/includes/plugins/machine-id-exporter-config.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
If you are providing credentials to the Event Handler using a `tbot` binary that
runs on a Linux server, make sure the value of `identity` in the Event Handler
configuration is the same as the path of the identity file you configured `tbot`
to generate, `/opt/machine-id`.
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,9 @@ Next, create the role:
$ tctl create teleport-event-handler-impersonator.yaml
```

Add this role to the user that generates signed credentials for the Event
Handler:
If you are using Machine ID to provide short-lived credentials to the Event
Handler, add this role to the Machine ID bot user. Otherwise, add this role to
the user that generates signed credentials for the Event Handler:

(!docs/pages/includes/add-role-to-user.mdx role="teleport-event-handler-impersonator"!)

7 changes: 6 additions & 1 deletion docs/pages/includes/plugins/rbac-impersonate.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,12 @@ Create the `access-plugin-impersonator` role:
$ tctl create -f access-plugin-impersonator.yaml
```

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:

(!docs/pages/includes/add-role-to-user.mdx role="access-plugin-impersonator"!)

You will now be able to generate signed certificates for the `access-plugin`
role and user.
role and user.
13 changes: 13 additions & 0 deletions docs/pages/includes/plugins/refresh-plugin-identity.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
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`.

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:

```toml
refresh_identity = true
```
Loading

0 comments on commit 5f26498

Please sign in to comment.