You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: engine/cmd/cli/commands/teleport/SETUP.md
+37-22Lines changed: 37 additions & 22 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -297,7 +297,7 @@ supplied by the operator to match an existing Teleport taxonomy.
297
297
| `dblab` | `"true"` | Marks the resource as DBLab-managed; used by the agent matcher and user roles |
298
298
| `dblab_instance` | `<environment-id>` | Owning DBLab instance; used internally to keep reconciliation isolated per instance |
299
299
| `clone_id` | clone ID | DB resources only |
300
-
| `dblab_user` | authenticated user (email local part) | DB resources only, set when clone binding is enabled and the creator used a personal token |
300
+
| `dblab_user` | authenticated user (full email address) | DB resources only, set when clone binding is enabled and the creator used a personal token |
301
301
| `environment` | `<environment-id>` | Set **only** when no custom `environment` label is provided (backwards compatibility) |
302
302
303
303
> **Important:** Each DBLab instance must use a **unique** `--environment-id`.
@@ -366,17 +366,24 @@ platform:
366
366
```
367
367
368
368
When `bindClonesToUser` is enabled, a clone created with a **personal per-user
369
-
token** is labeled `dblab_user: <email local part>` — the part of the
370
-
authenticated user's email before `@`, matching Teleport's
371
-
`email.local(external.email)`. The clone's Postgres username (`db.username`) is
372
-
**not** changed, so existing connection strings, Joe, and CI automation keep
373
-
working.
369
+
token** is labeled `dblab_user: <email>` — the authenticated user's full email
370
+
address, matching Teleport's `external.email`. The clone's Postgres username
371
+
(`db.username`) is **not** changed, so existing connection strings, Joe, and CI
372
+
automation keep working.
374
373
375
374
Clones created with the shared `verificationToken` (for example CI pipelines or
376
375
Joe) carry **no** `dblab_user` label. They are created normally — not rejected —
377
376
but are not reachable through a per-user role that matches on `dblab_user`; grant
378
377
those callers access through a broader role instead.
379
378
379
+
A trusted proxy that authenticates with the shared `verificationToken` on behalf
380
+
of a known user (for example the PostgresAI Platform serving console requests)
381
+
can assert the acting user by sending the `X-Forwarded-User-Email` header. The
382
+
Engine then labels the clone exactly as if that user had used a personal token.
383
+
The header is ignored on personal-token requests and when authorization is
384
+
disabled; asserting an identity grants the caller nothing beyond what the shared
385
+
token already allows.
386
+
380
387
### Restrict access with a per-user role
381
388
382
389
```yaml
@@ -388,32 +395,40 @@ spec:
388
395
allow:
389
396
db_labels:
390
397
dblab: ['true']
391
-
dblab_user: ['{{email.local(external.email)}}']
398
+
dblab_user: ['{{external.email}}']
392
399
db_names: ['*']
393
400
db_users: ['*']
394
401
```
395
402
396
-
With this role a user can reach only the clones labeled with their own email
397
-
local part, e.g. `jsmith@acme.com` reaches resources labeled `dblab_user: jsmith`.
403
+
With this role a user can reach only the clones labeled with their own email,
404
+
e.g. `jsmith@acme.com` reaches resources labeled `dblab_user: jsmith@acme.com`.
398
405
399
406
### Limitations
400
407
401
-
- **Two identity sources must agree.** The label is computed from the email the
408
+
- **Two identity sources must agree.** The label is the full email the
402
409
PostgresAI Platform returns at clone-create time, while Teleport matches
403
-
against `email.local(external.email)` from its own SSO/IdP at connect time.
404
-
Both sides preserve case, and the `dblab_user` label is
405
-
case-sensitive, so the two emails must match **exactly, including case**
406
-
(`JSmith@acme.com` and `jsmith@acme.com` are different). If they differ, the
407
-
user is denied access to their own clone (it fails closed). Make sure the
408
-
Platform and the Teleport IdP emit the same address for each user.
409
-
- Users whose email local parts collide across domains
410
-
(`jsmith@acme.com` vs `jsmith@other.com`) map to the same `dblab_user` value.
411
-
- Email local parts that cannot be represented as a Teleport label value
412
-
(those containing `+` or other characters outside `[a-zA-Z0-9._-]`) cause the
413
-
personal-token clone-create request to be rejected rather than silently
414
-
rewritten, so the Engine label always equals Teleport's computed value.
410
+
against `external.email` from its own SSO/IdP at connect time. Both sides
411
+
preserve case, and the `dblab_user` label is case-sensitive, so the two emails
412
+
must match **exactly, including case** (`JSmith@acme.com` and `jsmith@acme.com`
413
+
are different). If they differ, the user is denied access to their own clone
414
+
(it fails closed). Make sure the Platform and the Teleport IdP emit the same
415
+
address for each user. This includes the **domain**: because the full address
416
+
is compared, a source that normalizes the domain case on only one side
417
+
(`user@Acme.io` vs `user@acme.io`) also fails closed, even though DNS treats
418
+
the two as the same mailbox.
419
+
- Email addresses that cannot be represented as a Teleport label value
420
+
(those containing `+` or other characters outside `[a-zA-Z0-9._@-]`) produce an
421
+
**unlabeled** clone with a warning in the Engine log — the label is never
422
+
silently rewritten, so when a label is present it always equals Teleport's
423
+
value. Such users need a broader role to reach their clones.
415
424
- Clones created before binding was enabled, or with the shared token, have no
416
425
`dblab_user`label; recreate them with a personal token to apply it.
426
+
- Upgrading from a build that labeled clones with the email **local part**:
427
+
existing Teleport `db` resources keep their old `dblab_user: <local part>`
428
+
label — reconciliation matches resources by name and does not relabel them —
429
+
so once the role matches on `{{external.email}}` those users lose access.
430
+
Remove the affected `db` resources (or recreate the clones) so the sidecar
0 commit comments