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

Added support to select database roles from tsh. #35867

Merged
merged 11 commits into from
Jan 10, 2024

Conversation

greedy52
Copy link
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 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
tool/tsh/common/tsh.go Outdated Show resolved Hide resolved
tool/tsh/common/db.go Outdated Show resolved Hide resolved
@greedy52
Copy link
Contributor Author

greedy52 commented Jan 4, 2024

Friendly ping @gabrielcorado

Copy link
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.

tool/tsh/common/tsh.go Outdated Show resolved Hide resolved
@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
37 checks passed
@greedy52 greedy52 deleted the STeve/35566_select_db_role branch January 10, 2024 03:05
@public-teleport-github-review-bot

@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
backport/branch/v14 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