Skip to content

Commit 574f0e8

Browse files
committed
Add specific rules for individual policy sub modules
The problem is that rule `configure_custom_crypto_policy_cis` covers multiple requirements in a single rule. That is insufficient granularity for our project. We will solve this problem by introducing specialized rules that check if the current crypto policy respects a given security requirement (e.g. no weak mac), this rule would simply check if the individual crypto policy sub module contains the right algorithm restriction. These fine granular rules have the same remediation as the other rules using the `configure_custom_crypto_policy` template, so it would simply reapply the same custom crypto-policy (with all the requirements from the individual controls) if any of the individual rule is failing.
1 parent 4b3ff4c commit 574f0e8

File tree

21 files changed

+205
-23
lines changed

21 files changed

+205
-23
lines changed

components/crypto-policies.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ rules:
1313
- configure_openssl_tls_crypto_policy
1414
- configure_ssh_crypto_policy
1515
- configure_custom_crypto_policy_cis
16+
- configure_custom_crypto_policy_cis_mac
17+
- configure_custom_crypto_policy_cis_ssh_cbc
18+
- configure_custom_crypto_policy_cis_ssh_ciphers
19+
- configure_custom_crypto_policy_cis_ssh_macs
1620
- harden_openssl_crypto_policy
1721
- harden_ssh_client_crypto_policy
1822
- harden_sshd_ciphers_openssh_conf_crypto_policy

controls/cis_rhel10.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -624,7 +624,7 @@ controls:
624624
- l1_workstation
625625
status: automated
626626
rules:
627-
- configure_custom_crypto_policy_cis
627+
- configure_custom_crypto_policy_cis_mac
628628

629629
- id: 1.6.4
630630
title: Ensure system wide crypto policy disables cbc for ssh (Automated)
@@ -633,7 +633,7 @@ controls:
633633
- l1_workstation
634634
status: automated
635635
rules:
636-
- configure_custom_crypto_policy_cis
636+
- configure_custom_crypto_policy_cis_ssh_cbc
637637

638638
- id: 1.7.1
639639
title: Ensure /etc/motd is configured (Automated)
@@ -1628,7 +1628,7 @@ controls:
16281628
- l1_workstation
16291629
status: automated
16301630
rules:
1631-
- configure_custom_crypto_policy_cis
1631+
- configure_custom_crypto_policy_cis_ssh_ciphers
16321632

16331633
- id: 5.1.7
16341634
title: Ensure sshd ClientAliveInterval and ClientAliveCountMax are configured (Automated)
@@ -1729,7 +1729,7 @@ controls:
17291729
- l1_workstation
17301730
status: automated
17311731
rules:
1732-
- configure_custom_crypto_policy_cis
1732+
- configure_custom_crypto_policy_cis_ssh_macs
17331733

17341734
- id: 5.1.16
17351735
title: Ensure sshd MaxAuthTries is configured (Automated)

controls/cis_rhel8.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -557,7 +557,7 @@ controls:
557557
- l1_workstation
558558
status: automated
559559
rules:
560-
- configure_custom_crypto_policy_cis
560+
- configure_custom_crypto_policy_cis_ssh_cbc
561561

562562
- id: 1.6.4
563563
title: Ensure system wide crypto policy disables macs less than 128 bits (Automated)
@@ -566,7 +566,7 @@ controls:
566566
- l1_workstation
567567
status: automated
568568
rules:
569-
- configure_custom_crypto_policy_cis
569+
- configure_custom_crypto_policy_cis_mac
570570

571571
- id: 1.7.1
572572
title: Ensure message of the day is configured properly (Automated)
@@ -1497,7 +1497,7 @@ controls:
14971497
notes: |-
14981498
Introduced in CIS RHEL8 v3.0.0
14991499
rules:
1500-
- configure_custom_crypto_policy_cis
1500+
- configure_custom_crypto_policy_cis_ssh_ciphers
15011501

15021502
- id: 4.2.7
15031503
title: Ensure sshd ClientAliveInterval and ClientAliveCountMax are configured (Automated)
@@ -1586,7 +1586,7 @@ controls:
15861586
- l1_workstation
15871587
status: automated
15881588
rules:
1589-
- configure_custom_crypto_policy_cis
1589+
- configure_custom_crypto_policy_cis_ssh_macs
15901590

15911591
- id: 4.2.15
15921592
title: Ensure sshd MaxAuthTries is configured (Automated)
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
documentation_complete: true
2+
3+
title: Use Only Strong MACs Globally for CIS Benchmark
4+
5+
description: |-
6+
Create a custom crypto policy module to enforce the use of strong MACs globally.
7+
{{{ describe_crypto_sub_policy("NO-WEAKMAC", sub_policies["NO-WEAKMAC"].key, sub_policies["NO-WEAKMAC"].value) }}}
8+
Then, set the system wide crypto policy to use the custom policy.
9+
<pre>
10+
$ sudo update-crypto-policies --set {{{ base_policy }}}:{{{ sub_policies.keys() | join(":") }}}
11+
</pre>
12+
13+
rationale: |-
14+
Implementing a custom crypto policy that disables weak MAC algorithms helps ensure that only strong, proven
15+
cryptographic algorithms are used globally.
16+
17+
severity: medium
18+
19+
identifiers:
20+
cce@rhel8: CCE-86661-6
21+
cce@rhel9: CCE-86662-4
22+
cce@rhel10: CCE-86663-2
23+
24+
ocil_clause: 'the custom crypto policy modules do not exist'
25+
26+
ocil: |-
27+
{{{ ocil_crypto_sub_policy("NO-WEAKMAC", sub_policies["NO-WEAKMAC"].key, sub_policies["NO-WEAKMAC"].value) }}}
28+
29+
template:
30+
name: crypto_sub_policies
31+
vars:
32+
base_policy: {{{ base_policy }}}
33+
sub_policies: {{{ sub_policies }}}
34+
specific_module: "NO-WEAKMAC"
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
documentation_complete: true
2+
3+
title: Disable CBC Mode Ciphers in SSHD for CIS Benchmark
4+
5+
description: |-
6+
Create a custom crypto policy module to enforce the disabling of CBC mode ciphers in SSHD.
7+
{{{ describe_crypto_sub_policy("NO-SSHCBC", sub_policies["NO-SSHCBC"].key, sub_policies["NO-SSHCBC"].value) }}}
8+
Then, set the system wide crypto policy to use the custom policy.
9+
<pre>
10+
$ sudo update-crypto-policies --set {{{ base_policy }}}:{{{ sub_policies.keys() | join(":") }}}
11+
</pre>
12+
13+
rationale: |-
14+
CBC mode ciphers are vulnerable to certain attacks, such as the BEAST attack.
15+
Disabling CBC mode ciphers helps protect against these attacks and ensures that only
16+
strong, proven cryptographic algorithms are used to protect SSH communications.
17+
18+
severity: medium
19+
20+
identifiers:
21+
cce@rhel8: CCE-86647-5
22+
cce@rhel9: CCE-86648-3
23+
cce@rhel10: CCE-86650-9
24+
25+
ocil_clause: 'the custom crypto policy modules do not exist'
26+
27+
ocil: |-
28+
{{{ ocil_crypto_sub_policy("NO-SSHCBC", sub_policies["NO-SSHCBC"].key, sub_policies["NO-SSHCBC"].value) }}}
29+
30+
template:
31+
name: crypto_sub_policies
32+
vars:
33+
base_policy: {{{ base_policy }}}
34+
sub_policies: {{{ sub_policies }}}
35+
specific_module: "NO-SSHCBC"
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
documentation_complete: true
2+
3+
title: Use Only Strong Ciphers in SSHD for CIS Benchmark
4+
5+
description: |-
6+
Create a custom crypto policy module to enforce the use of strong ciphers in SSHD.
7+
{{{ describe_crypto_sub_policy("NO-SSHWEAKCIPHERS", sub_policies["NO-SSHWEAKCIPHERS"].key, sub_policies["NO-SSHWEAKCIPHERS"].value) }}}
8+
Then, set the system wide crypto policy to use the custom policy.
9+
<pre>
10+
$ sudo update-crypto-policies --set {{{ base_policy }}}:{{{ sub_policies.keys() | join(":") }}}
11+
</pre>
12+
13+
rationale: |-
14+
Weak ciphers that are used for authentication to the cryptographic module cannot be
15+
relied upon to provide confidentiality or integrity, and system data may be compromised.
16+
17+
severity: medium
18+
19+
identifiers:
20+
cce@rhel8: CCE-86701-0
21+
cce@rhel9: CCE-86702-8
22+
cce@rhel10: CCE-86703-6
23+
24+
ocil_clause: 'the custom crypto policy modules do not exist'
25+
26+
ocil: |-
27+
{{{ ocil_crypto_sub_policy("NO-SSHWEAKCIPHERS", sub_policies["NO-SSHWEAKCIPHERS"].key, sub_policies["NO-SSHWEAKCIPHERS"].value) }}}
28+
29+
template:
30+
name: crypto_sub_policies
31+
vars:
32+
base_policy: {{{ base_policy }}}
33+
sub_policies: {{{ sub_policies }}}
34+
specific_module: "NO-SSHWEAKCIPHERS"
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
documentation_complete: true
2+
3+
title: Use Only Strong MACs in SSHD for CIS Benchmark
4+
5+
description: |-
6+
Create a custom crypto policy module to enforce the use of strong MACs in SSHD.
7+
{{{ describe_crypto_sub_policy("NO-SSHWEAKMACS", sub_policies["NO-SSHWEAKMACS"].key, sub_policies["NO-SSHWEAKMACS"].value) }}}
8+
Then, set the system wide crypto policy to use the custom policy.
9+
<pre>
10+
$ sudo update-crypto-policies --set {{{ base_policy }}}:{{{ sub_policies.keys() | join(":") }}}
11+
</pre>
12+
13+
rationale: |-
14+
Message Authentication Codes (MACs) are cryptographic mechanisms used to verify the
15+
integrity and authenticity of data transmitted over SSH connections. Weak MACs that
16+
are used for authentication to the cryptographic module cannot be relied upon to
17+
provide integrity, and system data may be compromised. Implementing a custom crypto
18+
policy that disables weak MAC algorithms helps ensure that only strong, proven
19+
cryptographic algorithms are used to protect SSH communications.
20+
21+
severity: medium
22+
23+
identifiers:
24+
cce@rhel8: CCE-86726-7
25+
cce@rhel9: CCE-86728-3
26+
cce@rhel10: CCE-86730-9
27+
28+
ocil_clause: 'the custom crypto policy modules do not exist'
29+
30+
ocil: |-
31+
{{{ ocil_crypto_sub_policy("NO-SSHWEAKMACS", sub_policies["NO-SSHWEAKMACS"].key, sub_policies["NO-SSHWEAKMACS"].value) }}}
32+
33+
template:
34+
name: crypto_sub_policies
35+
vars:
36+
base_policy: {{{ base_policy }}}
37+
sub_policies: {{{ sub_policies }}}
38+
specific_module: "NO-SSHWEAKMACS"

products/rhel9/controls/cis_rhel9.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -580,7 +580,7 @@ controls:
580580
- l1_workstation
581581
status: automated
582582
rules:
583-
- configure_custom_crypto_policy_cis
583+
- configure_custom_crypto_policy_cis_mac
584584

585585
- id: 1.6.5
586586
title: Ensure system wide crypto policy disables cbc for ssh (Automated)
@@ -589,7 +589,7 @@ controls:
589589
- l1_workstation
590590
status: automated
591591
rules:
592-
- configure_custom_crypto_policy_cis
592+
- configure_custom_crypto_policy_cis_ssh_cbc
593593

594594
- id: 1.6.6
595595
title: Ensure system wide crypto policy disables chacha20-poly1305 for ssh (Automated)
@@ -1515,7 +1515,7 @@ controls:
15151515
- l1_workstation
15161516
status: automated
15171517
rules:
1518-
- configure_custom_crypto_policy_cis
1518+
- configure_custom_crypto_policy_cis_ssh_ciphers
15191519

15201520
- id: 5.1.5
15211521
title: Ensure sshd KexAlgorithms is configured (Automated)
@@ -1537,7 +1537,7 @@ controls:
15371537
- l1_workstation
15381538
status: automated
15391539
rules:
1540-
- configure_custom_crypto_policy_cis
1540+
- configure_custom_crypto_policy_cis_ssh_macs
15411541

15421542
- id: 5.1.7
15431543
title: Ensure sshd access is configured (Automated)

shared/references/cce-redhat-avail.txt

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,8 @@ CCE-86631-9
4444
CCE-86633-5
4545
CCE-86637-6
4646
CCE-86641-8
47-
CCE-86648-3
48-
CCE-86650-9
4947
CCE-86652-5
5048
CCE-86654-1
51-
CCE-86661-6
52-
CCE-86662-4
53-
CCE-86663-2
5449
CCE-86664-0
5550
CCE-86665-7
5651
CCE-86666-5
@@ -65,19 +60,13 @@ CCE-86690-5
6560
CCE-86692-1
6661
CCE-86693-9
6762
CCE-86694-7
68-
CCE-86701-0
69-
CCE-86702-8
70-
CCE-86703-6
7163
CCE-86704-4
7264
CCE-86706-9
7365
CCE-86708-5
7466
CCE-86709-3
7567
CCE-86710-1
7668
CCE-86712-7
7769
CCE-86713-5
78-
CCE-86726-7
79-
CCE-86728-3
80-
CCE-86730-9
8170
CCE-86732-5
8271
CCE-86733-3
8372
CCE-86734-1

tests/data/profile_stability/rhel10/cis.profile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,10 @@ chronyd_run_as_chrony_user
122122
chronyd_specify_remote_server
123123
cis_banner_text=cis
124124
configure_custom_crypto_policy_cis
125+
configure_custom_crypto_policy_cis_mac
126+
configure_custom_crypto_policy_cis_ssh_cbc
127+
configure_custom_crypto_policy_cis_ssh_ciphers
128+
configure_custom_crypto_policy_cis_ssh_macs
125129
coredump_disable_backtraces
126130
coredump_disable_storage
127131
dconf_db_up_to_date

0 commit comments

Comments
 (0)