Any option to auto close ssh session after some inactive time
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.
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 ?
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.
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.
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
Thanks again for your input, I will work on sshpiperd/sshpiperd.go to implement the feature.
PR is welcomed