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

tsh proxy db --tunnel ignores --db-roles #52943

Open
GavinFrazar opened this issue Mar 10, 2025 · 1 comment
Open

tsh proxy db --tunnel ignores --db-roles #52943

GavinFrazar opened this issue Mar 10, 2025 · 1 comment
Labels
bug database-access Database access related issues and PRs db/postgres PostgreSQL related database access issues rbac Issues related to Role Based Access Control tsh tsh - Teleport's command line tool for logging into nodes running Teleport.

Comments

@GavinFrazar
Copy link
Contributor

Expected behavior:
tsh proxy db <db> --tunnel --db-roles=role1 should start a local proxy tunnel where automatic user provisioning will grant only role1 for the session.

Current behavior:

  • if an unexpired db cert for <db> still exists, then it will uses the --db-roles from that cert, if any were requested
  • if there is no unexpired db cert, then a new one is issued in memory but unfortunately doesn't respect role1 - instead it will grant all allowed db_roles from the user's role set.

Bug details:

  • Teleport version: v17.3 but it affects all versions since --db-roles was added to tsh.

Recreation steps:

  1. create a Teleport user with automatic db role provisioning 1
  2. make sure the user has at least two db_roles values granted to them
  3. login with tsh tsh login
  4. run tsh proxy db <yourdatabase> --tunnel --db-roles=<role1>
  5. observe in the session that all db_roles were granted instead of only <role1>

Footnotes

  1. https://goteleport.com/docs/enroll-resources/database-access/auto-user-provisioning/postgres/

@GavinFrazar GavinFrazar added bug tsh tsh - Teleport's command line tool for logging into nodes running Teleport. rbac Issues related to Role Based Access Control database-access Database access related issues and PRs db/postgres PostgreSQL related database access issues labels Mar 10, 2025
@GavinFrazar
Copy link
Contributor Author

cc @greedy52 we missed updating the tunnel mode's cert reissuer to include db roles here:

RouteToDatabase: proto.RouteToDatabase{
ServiceName: c.RouteToApp.ServiceName,
Protocol: c.RouteToApp.Protocol,
Username: c.RouteToApp.Username,
Database: c.RouteToApp.Database,
},

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug database-access Database access related issues and PRs db/postgres PostgreSQL related database access issues rbac Issues related to Role Based Access Control tsh tsh - Teleport's command line tool for logging into nodes running Teleport.
Projects
None yet
Development

No branches or pull requests

1 participant