gravitational / teleport

The easiest, and most secure way to access and protect all of your infrastructure.
https://goteleport.com
GNU Affero General Public License v3.0
17k stars 1.71k forks source link

Improve output of `tsh sessions ls` #42253

Open russjones opened 1 month ago

russjones commented 1 month ago

What would you like Teleport to do?

When using Teleport with Kubernetes Access and Moderated Sessions, typing tsh sessions ls is missing potentially useful information like the initiator (or participants) of the session and the contents of the --reason flag.

$ tsh sessions ls              
ID                                   Kind Created              Hostname                   Address Login Command   
------------------------------------ ---- -------------------- -------------------------- ------- ----- --------- 
9c8b9ef7-d77b-4c42-aa94-414d19f2e492 k8s  2024-06-01T00:20:39Z hello-node-67949d9db-gmp4z         root  /bin/bash 

This information is already in the session_tracker resource and can be seen if you type tsh sessions ls --format=yaml. It would be a small lift to make it presentable to the user.

What problem does this solve?

It makes it easier to understand what sessions are ongoing and what sessions are user can/should join as a moderator.

If a workaround exists, please include it.

zmb3 commented 1 month ago

I'm not convinced that adding every possible field improves the output. Tables are good for 4-5 columns and then get unwieldy.

The JSON or YAML formats include the full resource, any reason why that is not a sufficient workaround?

russjones commented 1 month ago

In general I agree with you, but in this case we show the Linux login which in the above example is root. IMO, it's more useful to show the Teleport identity (or show both).

zmb3 commented 1 month ago

It would be cool if we could truncate the session ID and just put the last few characters. Most people don't need or care about the full session ID, the just want something they can copy/paste and use in a tsh join command.