From 2d1ff2b9431393ad99ef496d5e3b9dd0d4f5ac8c Mon Sep 17 00:00:00 2001 From: "djm@openbsd.org" Date: Fri, 6 Jan 2023 02:47:18 +0000 Subject: upstream: Implement channel inactivity timeouts This adds a sshd_config ChannelTimeouts directive that allows channels that have not seen traffic in a configurable interval to be automatically closed. Different timeouts may be applied to session, X11, agent and TCP forwarding channels. Note: this only affects channels over an opened SSH connection and not the connection itself. Most clients close the connection when their channels go away, with a notable exception being ssh(1) in multiplexing mode. ok markus dtucker OpenBSD-Commit-ID: ae8bba3ed9d9f95ff2e2dc8dcadfa36b48e6c0b8 --- channels.h | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'channels.h') diff --git a/channels.h b/channels.h index b8daaea3..c80b55d0 100644 --- a/channels.h +++ b/channels.h @@ -1,4 +1,4 @@ -/* $OpenBSD: channels.h,v 1.146 2023/01/06 02:42:34 djm Exp $ */ +/* $OpenBSD: channels.h,v 1.147 2023/01/06 02:47:18 djm Exp $ */ /* * Author: Tatu Ylonen @@ -203,6 +203,13 @@ struct Channel { void *mux_ctx; int mux_pause; int mux_downstream_id; + + /* Inactivity timeouts */ + + /* Last traffic seen for OPEN channels */ + time_t lastused; + /* Inactivity timeout deadline in seconds (0 = no timeout) */ + u_int inactive_deadline; }; #define CHAN_EXTENDED_IGNORE 0 @@ -299,6 +306,10 @@ void channel_cancel_cleanup(struct ssh *, int); int channel_close_fd(struct ssh *, Channel *, int *); void channel_send_window_changes(struct ssh *); +/* channel inactivity timeouts */ +void channel_add_timeout(struct ssh *, const char *, u_int); +void channel_clear_timeouts(struct ssh *); + /* mux proxy support */ int channel_proxy_downstream(struct ssh *, Channel *mc); -- cgit v1.2.3