Skip to content

Added support to select database roles from tsh.#35867

Merged
greedy52 merged 11 commits intomasterfrom
STeve/35566_select_db_role
Jan 10, 2024
Merged

Added support to select database roles from tsh.#35867
greedy52 merged 11 commits intomasterfrom
STeve/35566_select_db_role

Conversation

@greedy52
Copy link
Copy Markdown
Contributor

@greedy52 greedy52 commented Dec 18, 2023

Related

changelog: Added support to select database roles from tsh.

Example:
Default db_roles is ["role1", "role3"]

$ tsh db connect --db-user STeve --db-name test aurora-postgres-auto --db-roles role1 
psql (16.1, server 15.2)
SSL connection (protocol: TLSv1.3, cipher: TLS_AES_128_GCM_SHA256, compression: off)
Type "help" for help.

test=> select rolname from pg_auth_members join pg_roles on roleid = oid where member=(select oid from pg_roles where rolname = (select current_user));
      rolname       
--------------------
 rds_iam
 role1
 teleport-auto-user
(3 rows)

test=> ^D\q

$ tsh proxy db --db-roles role3 aurora-postgres-auto
...

Audit:
Screenshot 2023-12-18 at 4 04 00 PM

@greedy52 greedy52 force-pushed the STeve/35566_select_db_role branch from 69298db to d42c980 Compare December 18, 2023 20:53
@greedy52 greedy52 marked this pull request as ready for review December 19, 2023 19:22
@greedy52 greedy52 added tsh tsh - Teleport's command line tool for logging into nodes running Teleport. database-access Database access related issues and PRs labels Dec 19, 2023
@github-actions github-actions Bot requested a review from camscale December 19, 2023 19:23
Comment thread tool/tsh/common/db_test.go
Comment thread tool/tsh/common/tsh.go Outdated
Comment thread tool/tsh/common/db.go Outdated
@greedy52
Copy link
Copy Markdown
Contributor Author

greedy52 commented Jan 4, 2024

Friendly ping @gabrielcorado

@greedy52 greedy52 requested review from GavinFrazar and r0mant January 9, 2024 14:11
Copy link
Copy Markdown
Collaborator

@r0mant r0mant left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall lgtm but one comment about the CLI flag.

Comment thread tool/tsh/common/tsh.go Outdated
@greedy52 greedy52 force-pushed the STeve/35566_select_db_role branch from 840d13d to 1be28a5 Compare January 10, 2024 02:29
@greedy52 greedy52 enabled auto-merge January 10, 2024 02:29
@greedy52 greedy52 added this pull request to the merge queue Jan 10, 2024
Merged via the queue into master with commit 9402a41 Jan 10, 2024
@greedy52 greedy52 deleted the STeve/35566_select_db_role branch January 10, 2024 03:05
@public-teleport-github-review-bot
Copy link
Copy Markdown

@greedy52 See the table below for backport results.

Branch Result
branch/v14 Failed

greedy52 added a commit that referenced this pull request Jan 10, 2024
* Support selecting db roles.

* add active roles in tsh db ls

* add select db role ut

* add a warning when connecting to older version

* review comments

* chnage slices import

* --db-roles to --db-role

* fix ut
github-merge-queue Bot pushed a commit that referenced this pull request Jan 11, 2024
* Added support to select database roles from `tsh`. (#35867)

* Support selecting db roles.

* add active roles in tsh db ls

* add select db role ut

* add a warning when connecting to older version

* review comments

* chnage slices import

* --db-roles to --db-role

* fix ut

* fix build and ut
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

database-access Database access related issues and PRs size/md tsh tsh - Teleport's command line tool for logging into nodes running Teleport.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants