Open benarent opened 4 years ago
I think user profile should be more like ini
profile that never gets overwritten and our default ~/.tsh/profile.yaml
should be treated like internal state database file.
So devs can write things like this:
# cluster name
[staging]
k8s-cluster=
user=alice
[prod]
...
I was also thinking about using elisp
as prfofile engine:
(setq cluster 'staging)
(defun select-cluster ()
(mapc (lambda (K)
(let* ((key (car K)) (fun (cdr K)))
(define-key cluster-map (parse-cluster key) fun)))
'(("<right>" . cluster-next-match)
("<left>" . cluster-prev-match)
("<up>" . ignore )
("<down>" . ignore ))))
(add-hook 'select-cluster 'select-cluster-hook-local-keys)
...
Just kidding about lisp one :)
Would also be nice to let devs add port forwarding, agent forwarding etc to their profile files:
[staginghost21839]
login=staginguser
agent_forwarding=yes
port_forwarding=54321:localhost:12345,3434:localhost:3434
Then tsh ssh staginghost21839
would automatically do the same as tsh ssh -A -L 54321:localhost:12345,3434:localhost:3434 -l staginguser staginghost21839
For what it's worth I found a work around here for easily switching between two teleport instances:
alias t_one="echo teleport.one.url.without.port.io > ~/.tsh/current-profile"
alias t_two="echo teleport.two.url.without.port.io > ~/.tsh/current-profile"
Obviously replace the url with the real one.
We merged this recently: #5395 - it basically allows you to 'pin' a terminal to a given cluster by running eval $(tsh env)
after logging in.
For what it's worth I found a work around here for easily switching between two teleport instances:
alias t_one="echo teleport.one.url.without.port.io > ~/.tsh/current-profile" alias t_two="echo teleport.two.url.without.port.io > ~/.tsh/current-profile"
Obviously replace the url with the real one.
I can't believe this is the way to deal with multiple profiles. At th very least, tsh login
should factor in that you're already logged in and just switch the current profile over.
The easiest way to solve this is to expose an environment variable that can pick up the current profile. Then we can toggle that env variable on-demand to the profile we want.
See also #2972
What happened: If a customer has multiple Teleport proxies, customers use
➜ $ tsh login --proxy=work.example.com
to login.If you are working with multiple Teleport proxies you need to switch each time with, and
tsh
sets the profile to the last one it logged in.Examples of apps with different profile systems.
What you expected to happen
tsh
user should know what their default profile is.tsh
can set a default profile.tsh
users easily list all known profiles, and output current certificate status ( e.g. time left before reauthorisation )tsh
users can login to an account using a profile alais vs full URLtsh
users can remove accounts.