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

Any option to auto close ssh session after some inactive time #79

Open
sendtogeo opened this issue Nov 9, 2021 · 6 comments
Open

Any option to auto close ssh session after some inactive time #79

sendtogeo opened this issue Nov 9, 2021 · 6 comments

Comments

@sendtogeo
Copy link

Hi Team,

Thanks for this wonderful project.

Can you please update, Is there any option to close session after some inactive time Eg: 5mins of inactivity

I have checked in docs and issues and i couldn't find it.

@sendtogeo sendtogeo changed the title Any option to close ssh session after some inactive time Any option to auto close ssh session after some inactive time Nov 9, 2021
@shiipou
Copy link
Contributor

shiipou commented Nov 9, 2021

I think it's the job of the remote server that accept connection.
So you can made it custom by customizing your sshd_config.
Am I wrong ?

@tg123
Copy link
Owner

tg123 commented Nov 9, 2021

Hi could you please define inactive time.
per shiipou, it may refer to http://man.openbsd.org/sshd_config#ClientAliveInterval in sshd

but client can bypass it by sending empty packages.

sshpiper does not have such kind of option today, but it is easy for piper to add a timeout for pipes.

@sendtogeo
Copy link
Author

sendtogeo commented Nov 10, 2021

Thanks @tg123 @shiipou for your reply. Yes that will work.

We have many servers in the system and it will be difficult to set in each server. We need a feature like once inactive time set from our system, all users in sshpiper connection will auto close it when inactive time limit reached.

I will check it with code how we can implement it. It would be great If you can provide some guidelines for that code.

@shiipou
Copy link
Contributor

shiipou commented Nov 10, 2021

To set it, you can easily create a script on a machine that can reach all servers in SSH. Use the an echo 'ClientAliveInterval=300' | sudo tee /etc/sshd_config.
Or use sed command for regex if the first didn't work.
This command can be executed by one of your server using a for loop in bash that connect to each ip you need and printing ip of servers that throw a connection error.
I think this is the easiest way.

To configure it in sshpiper you'll need to add a timer on each connection that will be reset on each data received from the client in this file : sshpiperd/sshpiperd.go

@sendtogeo
Copy link
Author

Thanks again for your input, I will work on sshpiperd/sshpiperd.go to implement the feature.

@tg123
Copy link
Owner

tg123 commented Nov 10, 2021

PR is welcomed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants