Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[v9] Add RBAC instructions for DB tctl auth sign #15453

Merged
merged 2 commits into from
Aug 12, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 60 additions & 0 deletions docs/pages/database-access/reference/cli.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,66 @@ $ tctl auth sign --format=db --host=host1,localhost,127.0.0.1 --out=db --ttl=219
| `--out` | Name prefix for output files. |
| `--ttl` | Certificate validity period. |

<Details title="Setting up RBAC for signing database certificates">

The `tctl` user must have permissions to impersonate the Teleport Database
Service role, `Db`, in order to generate a signed database certificate. To add
these impersonation privileges to your Teleport user, run the following
commands.

First, define a role that can impersonate the `Db` user. Add the following
content to a file called `db-impersonator.yaml`:

```yaml
kind: role
version: v5
metadata:
name: db-impersonator
spec:
options:
allow:
impersonate:
users: ['Db']
roles: ['Db']
```

Create the fole:

```code
$ tctl create -f db-impersonator.yaml
```

Retrieve your Teleport user's dynamic configuration resource so you can add the
`db-impersonator` role:

```code
$ TELEPORT_USER=<your user>
$ tctl get user/${TELEPORT_USER?} > myuser.yaml
```

Edit `myuser.yaml` to add the `db-impersonator` role:

```diff
spec:
- access
- auditor
- editor
+ - db-impersonator
status:
is_locked: false
```

Update your user:

```code
$ tctl create -f myuser.yaml
```

Log out of your Teleport cluster and log in again. You will now be able to run
`tctl auth sign` for database-specific certificate formats.

</Details>

(!docs/pages/includes/database-access/ttl-note.mdx!)

## tctl db ls
Expand Down