Skip to content

Commit 5ab82b4

Browse files
matejakredhatrises
authored andcommitted
Set the sshd_set_keepalive rule to set the option to zero.
All other values don't make any sense from the security POV, so the parametrization has been removed. Thanks to that, the rule may now use a template.
1 parent 1ffc4d3 commit 5ab82b4

File tree

18 files changed

+14
-98
lines changed

18 files changed

+14
-98
lines changed

linux_os/guide/services/ssh/ssh_server/sshd_set_idle_timeout/oval/shared.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
{{% endif %}}
2828
<criterion comment="Check ClientAliveInterval in /etc/ssh/sshd_config"
2929
test_ref="test_sshd_idle_timeout" />
30-
<extend_definition comment="The SSH ClientAliveCountMax is set to zero" definition_ref="sshd_set_keepalive_0" />
30+
<extend_definition comment="The SSH ClientAliveCountMax is set to zero" definition_ref="sshd_set_keepalive" />
3131
</criteria>
3232
</criteria>
3333
</definition>

linux_os/guide/services/ssh/ssh_server/sshd_set_idle_timeout/rule.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ description: |-
88
<br /><br />
99
To set an idle timeout interval, edit the following line in <tt>/etc/ssh/sshd_config</tt> as
1010
follows:
11-
<pre>ClientAliveInterval <b>{{{ xccdf_value("sshd_idle_timeout_value") }}}</b></pre>.
11+
<pre>ClientAliveInterval <b>{{{ xccdf_value("sshd_idle_timeout_value") }}}</b></pre>
1212
<br/><br/>
1313
The timeout <b>interval</b> is given in seconds. For example, have a timeout
1414
of 10 minutes, set <b>interval</b> to 600.

linux_os/guide/services/ssh/ssh_server/sshd_set_keepalive/ansible/shared.yml

-8
This file was deleted.

linux_os/guide/services/ssh/ssh_server/sshd_set_keepalive/bash/shared.sh

-8
This file was deleted.

linux_os/guide/services/ssh/ssh_server/sshd_set_keepalive/oval/shared.xml

-52
This file was deleted.

linux_os/guide/services/ssh/ssh_server/sshd_set_keepalive/rule.yml

+12-9
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,7 @@ description: |-
1212
1313
To ensure the SSH idle timeout occurs precisely when the
1414
<tt>ClientAliveInterval</tt> is set, set the <tt>ClientAliveCountMax</tt> to
15-
value of <tt>0</tt>. This profile sets <tt>ClientAliveCountMax</tt> to
16-
<tt>{{{ xccdf_value("var_sshd_set_keepalive") }}}</tt>. To modify the
17-
<tt>ClientAliveCountMax</tt> option, edit <tt>/etc/ssh/sshd_config</tt> as
18-
follows:
19-
<pre>ClientAliveCountMax {{{ xccdf_value("var_sshd_set_keepalive") }}}</pre>
15+
value of <tt>0</tt>.
2016
2117
rationale: |-
2218
This ensures a user login will be terminated as soon as the <tt>ClientAliveInterval</tt>
@@ -59,8 +55,15 @@ ocil: |-
5955
To ensure <tt>ClientAliveInterval</tt> is set correctly, run the following command:
6056
<pre>$ sudo grep ClientAliveCountMax /etc/ssh/sshd_config</pre>
6157
If properly configured, the output should be:
62-
<pre>ClientAliveCountMax {{{ xccdf_value("var_sshd_set_keepalive") }}}</pre>
63-
If the option is set to <tt>0</tt>, then the SSH idle timeout occurs precisely when
58+
<pre>ClientAliveCountMax 0</pre>
59+
60+
In this case, the SSH idle timeout occurs precisely when
6461
the <tt>ClientAliveInterval</tt> is set.
65-
If the option is set to a number greater than <tt>0</tt>, then the idle session will be disconnected after
66-
<tt>ClientAliveInterval * ClientAliveCountMax</tt> seconds.
62+
63+
template:
64+
name: sshd_lineinfile
65+
vars:
66+
parameter: "ClientAliveCountMax"
67+
value: "0"
68+
missing_parameter_pass: "false"
69+
kubernetes: "off"

ol8/profiles/ospp.profile

-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ selections:
5454
- sshd_disable_empty_passwords
5555
- sshd_disable_kerb_auth
5656
- sshd_disable_gssapi_auth
57-
- var_sshd_set_keepalive=0
5857
- sshd_set_keepalive
5958
- sshd_enable_warning_banner
6059
- sshd_rekey_limit

rhcos4/profiles/moderate.profile

-1
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,6 @@ selections:
7676
#- sshd_disable_empty_passwords
7777
#- sshd_disable_kerb_auth
7878
#- sshd_disable_gssapi_auth
79-
#- var_sshd_set_keepalive=0
8079
# AC-2(5)
8180
- sshd_set_keepalive
8281
#- sshd_enable_warning_banner

rhcos4/profiles/ncp.profile

-1
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,6 @@ selections:
7777
#- sshd_disable_empty_passwords
7878
#- sshd_disable_kerb_auth
7979
#- sshd_disable_gssapi_auth
80-
#- var_sshd_set_keepalive=0
8180
#- sshd_set_keepalive
8281
#- sshd_enable_warning_banner
8382
#- sshd_rekey_limit

rhel7/profiles/rhelh-stig.profile

-1
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,6 @@ selections:
211211
- sshd_do_not_permit_user_env
212212
- sshd_enable_strictmodes
213213
- sshd_enable_warning_banner
214-
- var_sshd_set_keepalive=3
215214
- sshd_set_keepalive
216215
- sshd_use_approved_ciphers
217216
- sshd_use_approved_macs

rhel8/profiles/cis.profile

-1
Original file line numberDiff line numberDiff line change
@@ -827,7 +827,6 @@ selections:
827827
- sshd_set_idle_timeout
828828

829829
# ClientAliveCountMax 0
830-
- var_sshd_set_keepalive=0
831830
- sshd_set_keepalive
832831

833832
### 5.2.14 Ensure SSH LoginGraceTime is set to one minute

rhel8/profiles/ospp.profile

-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@ selections:
6363
- sshd_disable_empty_passwords
6464
- sshd_disable_kerb_auth
6565
- sshd_disable_gssapi_auth
66-
- var_sshd_set_keepalive=0
6766
- sshd_set_keepalive
6867
- sshd_enable_warning_banner
6968
- sshd_rekey_limit

rhv4/profiles/rhvh-stig.profile

-1
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,6 @@ selections:
210210
- sshd_do_not_permit_user_env
211211
- sshd_enable_strictmodes
212212
- sshd_enable_warning_banner
213-
- var_sshd_set_keepalive=3
214213
- sshd_set_keepalive
215214
- sshd_use_priv_separation
216215
- var_system_crypto_policy=fips_ospp

shared/templates/extra_ovals.yml

-8
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,3 @@ service_sssd_disabled:
4343
vars:
4444
servicename: sssd
4545
packagename: sssd-common
46-
47-
48-
sshd_set_keepalive_0:
49-
name: sshd_lineinfile
50-
vars:
51-
parameter: "ClientAliveCountMax"
52-
value: "0"
53-
missing_parameter_pass: "false"

sle15/profiles/cis.profile

-1
Original file line numberDiff line numberDiff line change
@@ -693,7 +693,6 @@ selections:
693693
- sshd_set_idle_timeout
694694

695695
# ClientAliveCountMax 0
696-
- var_sshd_set_keepalive=0
697696
- sshd_set_keepalive
698697

699698
### 5.2.17 Ensure SSH LoginGraceTime is set to one minute

tests/data/profile_stability/rhel8/ospp.profile

-1
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,6 @@ selections:
228228
- zipl_page_poison_argument
229229
- zipl_slub_debug_argument
230230
- zipl_vsyscall_argument
231-
- var_sshd_set_keepalive=0
232231
- var_rekey_limit_size=1G
233232
- var_rekey_limit_time=1hour
234233
- var_accounts_user_umask=027

tests/data/profile_stability/rhel8/stig.profile

-1
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,6 @@ selections:
243243
- timer_dnf-automatic_enabled
244244
- usbguard_allow_hid_and_hub
245245
- use_pam_wheel_for_su
246-
- var_sshd_set_keepalive=0
247246
- var_rekey_limit_size=1G
248247
- var_rekey_limit_time=1hour
249248
- var_accounts_user_umask=027

ubuntu1804/profiles/cis.profile

-1
Original file line numberDiff line numberDiff line change
@@ -709,7 +709,6 @@ selections:
709709
- sshd_set_idle_timeout
710710

711711
# ClientAliveCountMax 0
712-
- var_sshd_set_keepalive=0
713712
- sshd_set_keepalive
714713

715714
### 5.2.13 Ensure SSH LoginGraceTime is set to one minute

0 commit comments

Comments
 (0)