{"description": "SSH allows administrators to set a network responsiveness timeout interval.\nAfter this interval has passed, the unresponsive client will be automatically logged out.\n<br /><br />\nTo set this timeout interval, edit the following line in <tt>/etc/ssh/sshd_config</tt> as\nfollows:\n<pre>ClientAliveInterval <b><sub idref=\"sshd_idle_timeout_value\" /></b></pre>\n<br/><br/>\nThe timeout <b>interval</b> is given in seconds. For example, have a timeout\nof 10 minutes, set <b>interval</b> to 600.\n<br /><br />\nIf a shorter timeout has already been set for the login shell, that value will\npreempt any SSH setting made in <tt>/etc/ssh/sshd_config</tt>. Keep in mind that\nsome processes may stop SSH from correctly detecting that the user is idle.", "rationale": "Terminating an idle ssh session within a short time period reduces the window of\nopportunity for unauthorized personnel to take control of a management session\nenabled on the console or console port that has been let unattended.", "severity": "medium", "references": {"cis-csc": ["1", "12", "13", "14", "15", "16", "18", "3", "5", "7", "8"], "cjis": ["5.5.6"], "cobit5": ["APO13.01", "BAI03.01", "BAI03.02", "BAI03.03", "DSS01.03", "DSS03.05", "DSS05.04", "DSS05.05", "DSS05.07", "DSS05.10", "DSS06.03", "DSS06.10"], "cui": ["3.1.11"], "isa-62443-2009": ["4.3.3.2.2", "4.3.3.5.1", "4.3.3.5.2", "4.3.3.6.1", "4.3.3.6.2", "4.3.3.6.3", "4.3.3.6.4", "4.3.3.6.5", "4.3.3.6.6", "4.3.3.6.7", "4.3.3.6.8", "4.3.3.6.9", "4.3.3.7.2", "4.3.3.7.3", "4.3.3.7.4", "4.3.4.3.3"], "isa-62443-2013": ["SR 1.1", "SR 1.10", "SR 1.2", "SR 1.3", "SR 1.4", "SR 1.5", "SR 1.7", "SR 1.8", "SR 1.9", "SR 2.1", "SR 6.2"], "iso27001-2013": ["A.12.4.1", "A.12.4.3", "A.14.1.1", "A.14.2.1", "A.14.2.5", "A.18.1.4", "A.6.1.2", "A.6.1.5", "A.7.1.1", "A.9.1.2", "A.9.2.1", "A.9.2.2", "A.9.2.3", "A.9.2.4", "A.9.2.6", "A.9.3.1", "A.9.4.1", "A.9.4.2", "A.9.4.3", "A.9.4.4", "A.9.4.5"], "nerc-cip": ["CIP-004-6 R2.2.3", "CIP-007-3 R5.1", "CIP-007-3 R5.2", "CIP-007-3 R5.3.1", "CIP-007-3 R5.3.2", "CIP-007-3 R5.3.3"], "nist": ["CM-6(a)", "AC-17(a)", "AC-2(5)", "AC-12", "AC-17(a)", "SC-10", "CM-6(a)"], "nist-csf": ["DE.CM-1", "DE.CM-3", "PR.AC-1", "PR.AC-4", "PR.AC-6", "PR.AC-7", "PR.IP-2"], "pcidss": ["Req-8.1.8"], "srg": ["SRG-OS-000126-GPOS-00066", "SRG-OS-000163-GPOS-00072", "SRG-OS-000279-GPOS-00109", "SRG-OS-000395-GPOS-00175"], "cis": ["5.1.7"], "pcidss4": ["8.2.8", "8.2"], "stigid": ["UBTU-22-255035"], "stigref": ["SV-260528r970703_rule"]}, "control_references": {"cis": ["5.1.7"], "pcidss4": ["8.2.8", "8.2"], "stigid": ["UBTU-22-255035"]}, "components": [], "identifiers": {}, "ocil_clause": "it is commented out or not configured properly", "ocil": "Run the following command to see what the timeout interval is:\n<pre>$ sudo grep ClientAliveInterval /etc/ssh/sshd_config</pre>\nIf properly configured, the output should be:\n<pre>ClientAliveInterval <sub idref=\"sshd_idle_timeout_value\" /></pre>", "oval_external_content": null, "fixtext": "", "checktext": "", "vuldiscussion": "", "srg_requirement": "", "warnings": [{"dependency": "SSH disconnecting unresponsive clients will not have desired effect without also\nconfiguring ClientAliveCountMax in the SSH service configuration."}, {"general": "Following conditions may prevent the SSH session to time out:\n<ul>\n<li>Remote processes on the remote machine generates output. As the output has to be transferred over the network to the client, the timeout is reset every time such transfer happens.</li>\n<li>Any <tt>scp</tt> or <tt>sftp</tt> activity by the same user to the host resets the timeout.</li>\n</ul>"}], "conflicts": [], "requires": ["sshd_set_keepalive"], "policy_specific_content": {"stig": {"srg_requirement": "The Ubuntu 22.04 SSH daemon must be configured with a timeout interval.", "vuldiscussion": "Terminating an idle SSH session within a short time period reduces the window of opportunity for unauthorized personnel to take control of a management session enabled on the console or console port that has been left unattended. In addition, quickly terminating an idle SSH session will also free up resources committed by the managed network element.\n\nTerminating network connections associated with communications sessions includes, for example, de-allocating associated TCP/IP address/port pairs at the operating system level and de-allocating networking assignments at the application level if multiple application sessions are using a single operating system-level network connection. This does not mean that the operating system terminates all sessions or network access; it only ends the inactive session and releases the resources associated with that session.\n\nUbuntu 22.04 utilizes /etc/ssh/sshd_config for configurations of OpenSSH. Within the sshd_config the product of the values of \"ClientAliveInterval\" and \"ClientAliveCountMax\" are used to establish the inactivity threshold. The \"ClientAliveInterval\" is a timeout interval in seconds after which if no data has been received from the client, sshd will send a message through the encrypted channel to request a response from the client. The \"ClientAliveCountMax\" is the number of client alive messages that may be sent without sshd receiving any messages back from the client. If this threshold is met, sshd will disconnect the client. For more information on these settings and others, refer to the sshd_config man pages.", "checktext": "Verify that the \"ClientAliveInterval\" variable is set to a value of \"600\" or less by performing the following command:\n\n$ sudo grep -i interval /etc/ssh/sshd_config\n\nClientAliveInterval 600\n\nIf \"ClientAliveInterval\" does not exist, does not have a value of \"600\" or less in \"/etc/ssh/sshd_config\", or is commented out, this is a finding.", "fixtext": "Configure Ubuntu 22.04 to automatically terminate all network connections associated with SSH traffic at the end of a session or after 10 minutes of inactivity.\n\nModify or append the following lines in the \"/etc/ssh/sshd_config\" file:\n\nClientAliveInterval 600\n\nIn order for the changes to take effect, the SSH daemon must be restarted.\n\n$ sudo systemctl restart sshd.service"}}, "platform": null, "platforms": [], "sce_metadata": {}, "inherited_platforms": ["system_with_kernel"], "cpe_platform_names": [], "inherited_cpe_platform_names": ["system_with_kernel"], "bash_conditional": null, "fixes": {}, "title": "Set SSH Client Alive Interval", "definition_location": "/aptdata/openscap/scap-security-guide/linux_os/guide/services/ssh/ssh_server/sshd_set_idle_timeout/rule.yml", "template": {"name": "sshd_lineinfile", "vars": {"parameter": "ClientAliveInterval", "xccdf_variable": "sshd_idle_timeout_value", "datatype": "int", "backends": {"oval": "off"}}, "backends": {}}}