yokawasa / kubectl-plugin-ssh-jump

A kubectl plugin to access nodes or remote services using a SSH jump Pod
Apache License 2.0
176 stars 18 forks source link

More than one connection (Connection to machine closed by remote host.) #11

Open tomislater opened 3 years ago

tomislater commented 3 years ago

Hey 👋 great plugin! :)

It looks very promising, but I see that there are some problems if there is a one user, but with two connections.

Example:

Terminal 1:

➜ kubectl ssh-jump -i my-key.pem -u admin machine-a
using: port=22
Agent pid 31693
ssh-agent is already running
Forwarding from 127.0.0.1:2222 -> 22
Forwarding from [::1]:2222 -> 22
Handling connection for 2222
Linux machine-a 4.9.0-12-amd64 #1 SMP Debian 4.9.210-1+deb9u1 (2020-06-07) x86_64
...

Terminal 2:

➜ kubectl ssh-jump -i my-another-key.pem -u admin machine-b
using: port=22
Agent pid 31693
ssh-agent is already running
Linux machine-b 4.19.0-10-cloud-amd64 #1 SMP Debian 4.19.132-1 (2020-07-24) x86_64
...

Looks great so far, but if I log out from the machine-a:

admin@machine-a:~$ logout
Connection to machine-a closed.

It also closes a connection to machine-b

admin@machine-b:~$ Connection to 127.0.0.1 closed by remote host.
Connection to machine-b closed by remote host.
Connection to machine-b closed.

Do you have any suggestion how to deal with that problem? I can create a pod for every connection for example... But I need to edit the plugin then: https://github.com/yokawasa/kubectl-plugin-ssh-jump/blob/master/kubectl-ssh-jump#L131

I also wonder how it behaves if my whole team would want to ssh via this one pod :D I must run more tests...

Again, this plugin looks great!

tomislater commented 3 years ago

We can use different ports and different pods for instance 🤔

https://github.com/tomislater/kubectl-plugin-ssh-jump/blob/master/kubectl-ssh-jump here on my fork you will find some ideas

yokawasa commented 2 years ago

@tomislater thank you so much for your sharing your fork! I think your version is much simpler and better, which definitely gave me some ideas for future update 🚀 thanks again!!

yokawasa commented 2 years ago

In addtion, Adding options like -o HostkeyAlgorithms=+ssh-rsa -o PubkeyAcceptedAlgorithms=+ssh-rsa would work for newer ssh client scenario!!