Bug 2135811 - RFE: implement a "sftp_timeout" property on backend to automatically close idle connections
Summary: RFE: implement a "sftp_timeout" property on backend to automatically close id...
Keywords:
Status: NEW
Alias: None
Product: Red Hat Enterprise Linux 8
Classification: Red Hat
Component: openssh
Version: 8.6
Hardware: All
OS: Linux
medium
medium
Target Milestone: rc
: ---
Assignee: Dmitry Belyavskiy
QA Contact: BaseOS QE Security Team
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2022-10-18 13:47 UTC by Renaud Métrich
Modified: 2022-12-26 13:20 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed:
Type: Bug
Target Upstream Version:


Attachments (Terms of Use)
Proposed implementation (3.03 KB, patch)
2022-10-19 11:59 UTC, Renaud Métrich
no flags Details | Diff


Links
System ID Private Priority Status Summary Last Updated
OpenSSH Project 3484 0 None None None 2022-10-18 14:54:23 UTC
Red Hat Issue Tracker CRYPTO-8557 0 None None None 2022-10-18 14:06:06 UTC
Red Hat Issue Tracker RHELPLAN-136898 0 None None None 2022-10-18 13:54:39 UTC
Red Hat Knowledge Base (Solution) 6982095 0 None None None 2022-10-27 12:50:53 UTC

Description Renaud Métrich 2022-10-18 13:47:12 UTC
Description of problem:

Currently there is no way for the sftp backend (sftp-server or internal-sftp) to close idle connections (by idle I mean no order sent for some time by the sftp client).

This is very problematic for SFTP servers because clients can remain connected, which consumes file descriptors and resources in general, causing potentially system limits to be reached.
This is a case I handled recently, where system-wide file descriptors were exhausted, due to left-opened sftp sessions + corresponding systemd sessions.

There are "ClientAlive*" properties but these only work for dead clients.

So far, the only solution I found is to have a script that runs regularly and checks if /proc/<sftpserver>/fd/0 access time is older than a certain timestamp, and kill the PID accordingly. 

Version-Release number of selected component (if applicable):

openssh RHEL8, 9 and Upstream

How reproducible:

Always

Steps to Reproduce:

1. sftp localhost

Actual results:

Connection remains connected forever

Expected results:

Be able to kill the connection

Comment 5 Renaud Métrich 2022-10-19 11:59:29 UTC
Created attachment 1919019 [details]
Proposed implementation


Note You need to log in before you can comment on or make changes to this bug.