Skip to content

Commit

Permalink
Add plugin setup instructions for cloud users
Browse files Browse the repository at this point in the history
- Turn the identity file export and RBAC instructions into
includes, since these instructions are the same for each
plugin.

- Change the tab set re: an impersonation role to a detail box
scoped to cloud users.

- Add separate example config files for cloud and self-hosted
deployments of each plugin.

- Misc. changes for clarity

Fixes #8936
  • Loading branch information
ptgott committed Dec 20, 2021
1 parent d012a0b commit 559db29
Show file tree
Hide file tree
Showing 14 changed files with 323 additions and 444 deletions.
93 changes: 29 additions & 64 deletions docs/pages/access-controls/guides/dual-authz.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -41,84 +41,40 @@ two team members for a privileged role `dbadmin`.
```code
$ docker run --name mattermost-preview -d --publish 8065:8065 --add-host dockerhost:127.0.0.1 mattermost/mattermost-preview
```

</Admonition>

(!docs/pages/includes/tctl.mdx!)

## Set up Teleport bot

<Tabs>
<TabItem label="Mattermost">
### Create a bot within Mattermost

Enable bot account creation in "System Console -> Integrations".
Enable bot account creation in "System Console -> Integrations".

Toggle `Enable Bot Account Creation`.
Toggle `Enable Bot Account Creation`.

![Enable bots](../../../img/access-controls/dual-authz/mattermost-0-enable.png)
![Enable bots](../../../img/access-controls/dual-authz/mattermost-0-enable.png)

Go back to your team settings, navigate to "Integrations -> Bot Accounts". Press "Add Bot Account".
Go back to your team settings, navigate to "Integrations -> Bot Accounts". Press "Add Bot Account".

![Enable bots](../../../img/access-controls/dual-authz/mattermost-1-bot.png)
![Enable bots](../../../img/access-controls/dual-authz/mattermost-1-bot.png)

Add the "Post All" permission on the new account.
Add the "Post All" permission on the new account.

![Enable bots](../../../img/access-controls/dual-authz/mattermost-2-all-permissions@2x.png)
![Enable bots](../../../img/access-controls/dual-authz/mattermost-2-all-permissions@2x.png)

Create the bot and save the access token.
Create the bot and save the access token.

</TabItem>
</Tabs>
### Set up RBAC for the plugin
(!docs/pages/includes/plugins/rbac.mdx!)

Create a non-interactive bot `access-plugin` user and role.
### Export the access-plugin identity files
(!docs/pages/includes/plugins/identity-export.mdx!)

```yaml
kind: user
metadata:
name: access-plugin
spec:
roles: ['access-plugin']
version: v2
---
kind: role
version: v4
metadata:
name: access-plugin
spec:
allow:
rules:
- resources: ['access_request']
verbs: ['list', 'read']
- resources: ['access_plugin_data']
verbs: ['update']
# teleport currently refuses to issue certs for a user with 0 logins,
# this restriction may be lifted in future versions.
logins: ['access-plugin-not-used']
```
We'll reference the exported file(s) later when configuring the plugin.

<Admonition
type="note"
title="Creating resources"
>
Here and below follow along and create yaml resources using `tctl create -f`:

```code
$ tctl create -f access.yaml
```
</Admonition>


**Export access-plugin cert**

Teleport Plugin uses the `access-plugin` role and user to perform the approval.
We export the identify files, using `tctl auth sign`.

```code
$ tctl auth sign --format=tls --user=access-plugin --out=auth --ttl=720h
```

Teleport will generate `auth.crt`, `auth.key`, and `auth.cas` - a certificate, a private key, and a set of CA certs respectively.

**Install the plugin**
### Install the plugin

<Tabs>
<TabItem label="Download">
Expand Down Expand Up @@ -146,11 +102,20 @@ Teleport will generate `auth.crt`, `auth.key`, and `auth.cas` - a certificate, a
$ teleport-mattermost configure > /etc/teleport-mattermost.toml
```

Update the config with Teleport address, Mattermost URL, and a bot token.
Update the config with the Teleport address, Mattermost URL, and a bot token.

```toml
(!examples/resources/plugins/teleport-mattermost.toml!)
<Tabs>
<TabItem scope={["oss", "enterprise"]} label="Self-Hosted">
```yaml
(!examples/resources/plugins/teleport-mattermost-self.toml!)
```
</TabItem>
<TabItem scope={["cloud"]} label="Cloud">
```yaml
(!examples/resources/plugins/teleport-mattermost-cloud.toml!)
```
</TabItem>
</Tabs>

## Dual authorization

Expand Down Expand Up @@ -252,7 +217,7 @@ Bob can also assume granted access request roles using Web UI:

## Troubleshooting

**Cert errors**
### Cert errors in self-hosted deployments

You may be getting certificate errors if Teleport's auth server is missing an address in the server certificate:

Expand Down
102 changes: 33 additions & 69 deletions docs/pages/enterprise/workflow/ssh-approval-jira-cloud.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ h1: SSH login approvals using Jira

## Teleport Jira Plugin Setup

This guide will talk through how to setup Teleport with Jira. Teleport to Jira integration allows you to treat Teleport access and permission requests using Jira tickets.
This guide will talk through how to setup Teleport with Jira. Teleport's Jira integration allows you to treat Teleport access and permission requests using Jira tickets.

## Setup

Expand All @@ -16,60 +16,16 @@ This guide assumes that you have:
- Admin privileges with access to `tctl`
- Jira Server or Jira Cloud installation with an owner privileges, specifically to setup webhooks, issue types, and workflows

### Create an access-plugin role and user within Teleport
Teleport Cloud requires that plugins connect through the proxy service (`mytenant.teleport.sh:443`). Open Source and Enterprise installations can connect to the auth service (`auth.example.com:3025`) directly.

First off, using an existing Teleport Cluster, we are going to create a new Teleport User and Role to access Teleport.

#### Create User and Role for access
### Create User and Role for access
(!docs/pages/includes/plugins/rbac.mdx!)

Log into Teleport Authentication Server, this is where you normally run `tctl`. Create a
new user and role that only has API access to the `access_request` API. The below script
will create a yaml resource file for a new user and role.
### Export access-plugin Certificate
(!docs/pages/includes/plugins/identity-export.mdx!)

```bash
cat > rscs.yaml <<EOF
kind: user
metadata:
name: access-plugin-jira
spec:
roles: ['access-plugin-jira']
version: v2
---
kind: role
metadata:
name: access-plugin-jira
spec:
allow:
rules:
- resources: ['access_request']
verbs: ['list','read','update']
# teleport currently refuses to issue certs for a user with 0 logins,
# this restriction may be lifted in future versions.
logins: ['access-plugin-jira']
version: v4
EOF

# ...
$ tctl create -f rscs.yaml
```

#### Export access-plugin Certificate

Teleport Plugin use the `access-plugin-jira` role and user to perform the approval. We export the identity files, using [`tctl auth sign`](../../setup/reference/cli.mdx#tctl-auth-sign).

```bash
tctl auth sign --format=tls --user=access-plugin-jira --out=auth --ttl=2190h
# ...
```

The above sequence should result in three PEM encoded files being generated: auth.crt, auth.key, and auth.cas (certificate, private key, and CA certs respectively). We'll reference the auth.crt, auth.key, and auth.cas files later when [configuring the plugins](#configuration-file).

<Admonition
type="note"
title="Certificate Lifetime"
>
By default, [`tctl auth sign`](../../setup/reference/cli.mdx#tctl-auth-sign) produces certificates with a relatively short lifetime. For production deployments, the `--ttl` flag can be used to ensure a more practical certificate lifetime. `--ttl=8760h` exports a 1 year token
</Admonition>
We'll reference these files later when [configuring the plugins](#configuration-file).

## Setting up your Jira Project

Expand All @@ -80,18 +36,17 @@ All new permission requests are going to show up in a project you choose. We rec
You'll need the project Jira key to configure the plugin.

### Setting up the status board

Create a new board for tasks in the permission management project. The board has to have at least these three columns:

1. Pending
2. Approved
3. Denied

Teleport Jira Plugin will create a new issue for each new permission request in the first available column on the board. When you drag the request task to Approved column on Jira, the request will be approved. If you drag the request task to the Denied column in Jira, the request will be denied.
Teleport's Jira llugin will create a new issue for each new permission request in the first available column on the board. When you drag the request task to the Approved column in Jira, the request will be approved. If you drag the request task to the Denied column in Jira, the request will be denied.

### Setting up Request ID field on Jira

Teleport Jira Plugin requires a custom issue field to be created.
The Teleport Jira plugin requires a custom issue field to be created.

Go to your Jira Project settings → Issue Types → Select type `Task` → add a new Short Text field named `TeleportAccessRequestId`.

Expand All @@ -105,28 +60,28 @@ For Jira Server, the URL of the API tokens page will be different depending on y

### Setting up Jira Webhooks

Go to Settings → General → System → Webhooks and create a new Webhook for Jira to tell the Teleport Plugin about updates.
Go to Settings → General → System → Webhooks and create a new webhook for Jira to tell the Teleport plugin about updates.

For the webhook URL, use the URL that you'll run the plugin on. It needs to be a publicly accessible URL that we'll set up later. Jira requires the webhook listener to run over HTTPS.
For the webhook URL, use the URL that you'll run the plugin on. It needs to be a publicly accessible URL (we will show you how to set this up later). Jira requires the webhook listener to run over HTTPS.

The Teleport Jira plugin webhook needs to be notified only about new issues being created, issues being updated, or deleted. You can leave all the other boxes empty.
The webhook needs to be notified only about new issues being created, issues being updated, or deleted. You can leave all the other boxes empty.

<Admonition
type="note"
title="Plugin Defaults"
>
Jira Webhook will send updates about any issues in any projects in your Jira installation to the webhook. We suggest that you use JQL filters to limit which issues are being sent to the plugin.
Jira will send updates about any issues in any projects in your Jira installation to the webhook. We suggest that you use JQL filters to limit which issues are being sent to the plugin.

The Plugin's web server will run with TLS, but you can disable it with `--insecure-no-tls` to test things out in a dev environment.
The plugin's web server will run with TLS, but you can disable it with `--insecure-no-tls` to test things out in a dev environment.
</Admonition>

In the webhook settings page, make sure that the webhook will only send Issue Updated updates. It's not critical if anything else gets sent, the plugin will just ignore everything else.

## Installing

We recommend installing the Teleport Plugins alongside the Teleport Proxy. This is an ideal
We recommend installing Teleport plugins alongside the Teleport Proxy. This is an ideal
location as plugins have a low memory footprint, and will require both public internet access
and Teleport Auth access. We currently only provide linux-amd64 binaries, you can also
and Teleport Auth access. We currently only provide linux-amd64 binaries, you can also
compile these plugins from [source](https://github.com/gravitational/teleport-plugins/tree/master/access/jira).

```code
Expand All @@ -142,19 +97,28 @@ Run `./install` in from 'teleport-jira' or place the executable in the appropria

### Configuration file

Teleport Jira Plugin uses a config file in TOML format. Generate a boilerplate config by
The Teleport Jira plugin uses a config file in TOML format. Generate a boilerplate config by
running the following command:

```code
$ teleport-jira configure > teleport-jira.toml
$ sudo mv teleport-jira.toml /etc
```

By default, Jira Teleport Plugin will use a config in `/etc/teleport-jira.toml`, and you can override it with `-c config/file/path.toml` flag.
By default, the Jira Teleport plugin will use a config in `/etc/teleport-jira.toml`, and you can override it with `-c config/file/path.toml` flag.

<Tabs>
<TabItem label="Self Hosted" scopes={["oss", "enterprise"]}>
```toml
(!examples/resources/plugins/teleport-jira-self-hosted.toml!)
```
</TabItem>
<TabItem label="Cloud" scopes={["cloud"]}>
```toml
(!examples/resources/plugins/teleport-jira.toml!)
(!examples/resources/plugins/teleport-jira-cloud.toml!)
```
</TabItem>
</Tabs>

The `[teleport]` section describes where the teleport service running, and what keys should the plugin use to authenticate itself. Use the keys that you've generated.

Expand All @@ -165,10 +129,10 @@ The `[jira]` section requires a few things:
3. Your Jira API token that you've created above.
4. A Jira Project key, available in Project settings.

`[http]` setting block describes how the Plugin's HTTP server works. The HTTP server is responsible for listening for updates from Jira, and processing updates, like when someone drags a task from Inbox to Approved column.
The `[http]` setting block describes how the plugin's HTTP server works. The HTTP server is responsible for listening for updates from Jira, and processing updates, like when someone drags a task from Inbox to Approved column.

You must provide an address the server should listen on, and a certificate to use. It's possible to
setup on the same server as the Teleport Proxy, so you can use the same TLS certificate.
run the Jira plugin on the same server as the Teleport Proxy, so you can use the same TLS certificate.

## Testing

Expand All @@ -186,18 +150,18 @@ Go ahead and test it:
$ tsh login --request-roles=admin
```

That should create a new permission request on Teleport (you can test if it did with `tctl request ls` ), and you should see a new task on your Jira project board.
That should create a new permission request on Teleport (you can test if it did with `tctl request ls`), and you should see a new task on your Jira project board.

### Setup with SystemD

In production, we recommend starting teleport plugin daemon via an init system like systemd .
Here's the recommended Teleport Plugin service unit file for systemd:
Here's the recommended Teleport plugin service unit file for systemd:

```txt
(!examples/systemd/plugins/teleport-jira.service!)
```

Save this as `teleport-jira.service`.
Save this as `teleport-jira.service`. Make sure the `teleport-jira start` command includes a `--config` flag that refers to the configuration file you created earlier.

## Audit Log

Expand Down
Loading

0 comments on commit 559db29

Please sign in to comment.