@JFL is right. There is no generic solution for gateways as they are just forwarding the connections. But the manufacturer do provide solutions for such configurations on top of a basic router/gateway/switch. Hence different products provide different settings to achieve this and some don't even provide anything like this.
Like Cisco has something @Hung Tran mentioned.
Brocade provides something like this ::
device(config)#ip ssh idle-time 30
Syntax: ip ssh idle-time minutes
If an established SSH session has no activity for the specified number
of minutes, the Brocade device closes it. An idle time of 0 minutes
(the default value) means that SSH sessions never time out. The
maximum idle time for SSH sessions is 240 minutes.