I'm dealing with a server that isn't mine to configure. Something somewhere between me and this server kills any connection after 5 minutes if no traffic passes between the two machines. This includes active connections where a command is running on the server; specifically, I've demonstrated that this disconnection occurs using an SSH connection (running a bash command that doesn't print any output for more than 5 minutes) and a SQL database (running a SQL command that lasts more than 5 minutes). It also disconnects if I go read something and don't send any commands for 5 minutes, of course.
For the SSH setting, the group responsible for the server has recommended that I enable keep alive client side. They haven't provided any suggestions for the database connections.
I'm completely confused, though. What is the security benefit here? For SSH, I can bypass their settings completely from the client side, and they even recommend doing so. (The latter means there cannot even be a "security through obscurity" argument, since it won't be obscure because every user will need to know about it. Not that I think this would foil an attack even if it were obscure, especially since I found out on my own before they even recommended it.) For both, this demonstrably degrades availability. I could potentially see that disconnecting active sessions after a few hours of inactivity might be beneficial (Although the possible threats of long open sessions aren't immediately clear to me.), but every 5 minutes? This means I can't even read a DBA.SE post while I'm working out my SQL without being disconnected. Is this as ludicrous as it sounds to me, or is there something I'm missing?
Clarifications
Some points have been mentioned in comments, so I'd like to clarify a little.
- I am able to consistently reproduce the timeout at 5 minutes. I used commands that record a timestamp server side every few seconds, and after a disconnect, the last timestamp recorded was always exactly 5 minutes after the first timestamp. So the disconnects were never sporadic.
- Shortly after I wrote this post, the system/network admins responded that this is indeed intentional. I quote, "More fallout from the 5 min time limit set on the F5s a few weeks back?" I'm not sure what an F5 is; some Googling suggests it's a very expensive switch, which corresponds to someone who was trying to find a workaround for my DB connections later mentioning the switch settings.
(I don't believe this information invalidates any answers.)
ServerAliveIntervaloptions .ssh/config? This induces periodic “ping” messages at the application layer going through the encrypted channel, so the proxy shouldn't be able to distinguish them from actual data still, slowly, flowing. That should work around the issue. – Jan Hudec Apr 28 '16 at 06:37TCPKeepAlivessh option is on by default. If it is not turned off on your side, it indicates terminating the connections is indeed deliberate, because firewalls/masquerades will not terminate connections that send TCP keepalives. Proxies will, though, because TCP keepalive sends empty packets that are not visible at the socket layer. – Jan Hudec Apr 28 '16 at 06:40ServerAliveInterval, but as I said, this isn't my server to manage. What you mention is of course the server side equivalent to the client side settings I mentioned. However, the database does not go through SSH, as far as I know, which indicates that the connection killing is more general than SSH. I'm really not entirely clear on where exactly they're enforcing this, which is why I tried not to be overly specific in the question and just focus on the connection termination itself. – jpmc26 Apr 28 '16 at 06:49ServerAliveIntervalis a client option.ServerAliveIntervalandTCPKeepAliveare very different options. Also, if you can SSH to the server and if you can keep SSH from timing out, you could use it's forwarding feature to tunnel the database connection through it to protect it. – Jan Hudec Apr 28 '16 at 07:04