sshportal icon indicating copy to clipboard operation
sshportal copied to clipboard

Sessions are closed after port-forwarded connection completes

Open systemmonkey42 opened this issue 2 years ago • 4 comments

Using the latest MASTER of SSHPortal, I noticed my client connections disconnected randomly.

It turns out the session check in pkg/bastion/ssh.go calls "conn.close" within 30 seconds of a port-forward session completing. This consistently disconnected the client.

I've commented it out for now, since it isnt clear what it achieves (the pipe() handling has already closed the session afaict).

Is there a correct way to handle those? Port forwarding is a critical feature for me.

...

systemmonkey42 avatar Sep 21 '23 01:09 systemmonkey42

This bug has been introduced in this commit you cherry-picked and is not present in the latest release of the original project (which is unmaintained btw)

We faced the same issue in our fork. The fix is here but we found out the feature was not working at all so I decided to completely remove the feature.

FYI, you should maybe consider rebasing your fork on our fork which is up to date and includes multiple security improvements / fixes. Keep in mind, our fork is on MAINTENANCE mode and only security issues and major bugs will be fixed. We don't plan to add and accept new features.

libvoid avatar Sep 22 '23 13:09 libvoid

Hi @libvoid, Thanks for the tips. I'll let you know how I go.

Do you still use sshportal or is there an alternative you prefer?

EDIT: I saw in the Readme you clearly recommend Teleport. I've tried it a couple of times, but the infrastructure requirements for managing a single remote raspberry pi is a little excessive. When I get a second pi. I'll try again.

systemmonkey42 avatar Sep 24 '23 07:09 systemmonkey42

Hi @libvoid

It didn't take much testing to prove you were correct. Thanks for pointing me in the right direction.

systemmonkey42 avatar Sep 25 '23 00:09 systemmonkey42

Hi,

Sorry for the late reply

Do you still use sshportal or is there an alternative you prefer?

We still use sshportal but we plan to change. Warpgate looks promising (:crab:) but Teleport is the only alternative that is not a one-person project.

libvoid avatar Oct 16 '23 15:10 libvoid