Skip to content

Commit 9cbb2a0

Browse files
authored
Merge pull request #14653 from vojtapolasek/update_stig_rhel9_vr27_to_v2r8
Update RHEL 9 STIG to v2r8
2 parents 5f6685b + 3766896 commit 9cbb2a0

21 files changed

Lines changed: 1487 additions & 998 deletions

File tree

linux_os/guide/services/fapolicyd/fapolicy_default_deny/oval/shared.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
<ind:textfilecontent54_object id="object_fapolicy_default_deny_policy_compiled_rules"
2525
version="1">
2626
<ind:filepath>/etc/fapolicyd/compiled.rules</ind:filepath>
27-
<ind:pattern operation="pattern match">^\s*deny\s*perm=any\s*all\s*:\s*all\s*\z</ind:pattern>
27+
<ind:pattern operation="pattern match">^\s*deny(_log|_audit)?\s*perm=any\s*all\s*:\s*all\s*\z</ind:pattern>
2828
<ind:instance datatype="int">1</ind:instance>
2929
</ind:textfilecontent54_object>
3030

@@ -37,7 +37,7 @@
3737
<ind:textfilecontent54_object id="object_fapolicy_default_deny_policy_fapolicyd_rules"
3838
version="2">
3939
<ind:filepath>/etc/fapolicyd/fapolicyd.rules</ind:filepath>
40-
<ind:pattern operation="pattern match">^\s*deny\s*perm=any\s*all\s*:\s*all\s*\z</ind:pattern>
40+
<ind:pattern operation="pattern match">^\s*deny(_log|_audit)?\s*perm=any\s*all\s*:\s*all\s*\z</ind:pattern>
4141
<ind:instance datatype="int">1</ind:instance>
4242
</ind:textfilecontent54_object>
4343

linux_os/guide/services/fapolicyd/fapolicy_default_deny/rule.yml

Lines changed: 33 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,25 @@
11
documentation_complete: true
22

33

4-
title: 'Configure Fapolicy Module to Employ a Deny-all, Permit-by-exception Policy to Allow the Execution of Authorized Software Programs.'
4+
title: "Configure Fapolicy Module to Employ a Deny-all, Permit-by-exception Policy to Allow the
5+
Execution of Authorized Software Programs."
56

67
description: |-
7-
The Fapolicy module must be configured to employ a deny-all, permit-by-exception policy to allow the execution of authorized software programs and to prevent unauthorized software from running.
8+
The Fapolicy module must be configured to employ a deny-all, permit-by-exception policy to
9+
allow the execution of authorized software programs and to prevent unauthorized software from
10+
running.
811
912
rationale: |-
10-
Utilizing a whitelist provides a configuration management method for allowing the execution of only authorized software.
11-
Using only authorized software decreases risk by limiting the number of potential vulnerabilities. Verification of whitelisted software occurs prior to execution or at system startup.
13+
Utilizing a whitelist provides a configuration management method for allowing the execution of
14+
only authorized software.
15+
Using only authorized software decreases risk by limiting the number of potential
16+
vulnerabilities.
17+
Verification of whitelisted software occurs prior to execution or at system startup.
1218
1319
Proceed with caution with enforcing the use of this daemon.
1420
Improper configuration may render the system non-functional.
15-
The "fapolicyd" API is not namespace aware and can cause issues when launching or running containers.
21+
The "fapolicyd" API is not namespace aware and can cause issues when launching or running
22+
containers.
1623
1724
severity: medium
1825

@@ -22,11 +29,12 @@ identifiers:
2229
cce@rhel10: CCE-90343-5
2330

2431
references:
25-
nist: CM-7 (2),CM-7 (5) (b),CM-6 b
26-
srg: SRG-OS-000368-GPOS-00154,SRG-OS-000370-GPOS-00155,SRG-OS-000480-GPOS-00232
27-
stigid@ol8: OL08-00-040137
32+
nist: CM-7 (2),CM-7 (5) (b),CM-6 b
33+
srg: SRG-OS-000368-GPOS-00154,SRG-OS-000370-GPOS-00155,SRG-OS-000480-GPOS-00232
34+
stigid@ol8: OL08-00-040137
2835

29-
ocil_clause: 'fapolicyd is not running in enforcement mode with a deny-all, permit-by-exception policy'
36+
ocil_clause: "fapolicyd is not running in enforcement mode with a deny-all, permit-by-exception
37+
policy"
3038

3139
ocil: |-
3240
Verify the {{{ full_name }}} "fapolicyd" employs a deny-all, permit-by-exception policy.
@@ -52,23 +60,33 @@ ocil: |-
5260
deny_audit perm=any pattern=ld_so : all
5361
deny perm=any all : all
5462
63+
Note: The "deny_log" and "deny_audit" actions also meet the security requirements as they deny
64+
execution while additionally providing logging.
65+
5566
fixtext: |-
56-
Configure {{{ full_name }}} to employ a deny-all, permit-by-exception application whitelisting policy with "fapolicyd".
67+
Configure {{{ full_name }}} to employ a deny-all, permit-by-exception application whitelisting
68+
policy with "fapolicyd".
5769
58-
With the "fapolicyd" installed and enabled, configure the daemon to function in permissive mode until the whitelist is built correctly to avoid system lockout. Do this by editing the "/etc/fapolicyd/fapolicyd.conf" file with the following line:
70+
With the "fapolicyd" installed and enabled, configure the daemon to function in permissive mode
71+
until the whitelist is built correctly to avoid system lockout.
72+
Do this by editing the "/etc/fapolicyd/fapolicyd.conf" file with the following line:
5973
6074
permissive = 1
6175
6276
{{%- if product in ["ol8", "rhel8"] %}}
6377
For {{{ product_short_name }}} 8.5 systems and older:
64-
Build the whitelist in the "/etc/fapolicyd/fapolicyd.rules" file ensuring the last rule is "deny perm=any all : all".
78+
Build the whitelist in the "/etc/fapolicyd/fapolicyd.rules" file ensuring
79+
the last rule is "deny perm=any all : all".
6580
6681
For {{{ product_short_name }}} 8.6 systems and newer:
6782
{{%- endif %}}
68-
Build the whitelist in a file within the "/etc/fapolicyd/rules.d" directory ensuring the last rule is "deny perm=any all : all".
83+
Build the whitelist in a file within the "/etc/fapolicyd/rules.d" directory ensuring
84+
the last rule implements a deny-all policy, such as "deny perm=any all : all".
6985
70-
Once it is determined the whitelist is built correctly, set the fapolicyd to enforcing mode by editing the "permissive" line in the /etc/fapolicyd/fapolicyd.conf file.
86+
Once it is determined the whitelist is built correctly, set the fapolicyd to enforcing mode by
87+
editing the "permissive" line in the /etc/fapolicyd/fapolicyd.conf file.
7188
7289
permissive = 0
7390
74-
srg_requirement: 'The {{{ full_name }}} fapolicy module must be configured to employ a deny-all, permit-by-exception policy to allow the execution of authorized software programs.'
91+
srg_requirement: "The {{{ full_name }}} fapolicy module must be configured to employ a deny-all,
92+
permit-by-exception policy to allow the execution of authorized software programs."
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/bin/bash
2+
# packages = fapolicyd
3+
4+
if [ -f /etc/fapolicyd/compiled.rules ]; then
5+
active_rules_file="/etc/fapolicyd/compiled.rules"
6+
else
7+
active_rules_file="/etc/fapolicyd/fapolicyd.rules"
8+
fi
9+
10+
truncate -s 0 $active_rules_file
11+
echo "allow exe=/usr/bin/python3.7 : ftype=text/x-python" >> $active_rules_file
12+
echo "deny_audit perm=any all : all" >> $active_rules_file
13+
14+
{{{ set_config_file(path="/etc/fapolicyd/fapolicyd.conf",
15+
parameter="permissive",
16+
value="0",
17+
create=true,
18+
insensitive=true,
19+
separator=" = ",
20+
separator_regex="\s*=\s*",
21+
prefix_regex="^\s*", rule_id=rule_id) }}}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/bin/bash
2+
# packages = fapolicyd
3+
4+
if [ -f /etc/fapolicyd/compiled.rules ]; then
5+
active_rules_file="/etc/fapolicyd/compiled.rules"
6+
else
7+
active_rules_file="/etc/fapolicyd/fapolicyd.rules"
8+
fi
9+
10+
truncate -s 0 $active_rules_file
11+
echo "allow exe=/usr/bin/python3.7 : ftype=text/x-python" >> $active_rules_file
12+
echo "deny_log perm=any all : all" >> $active_rules_file
13+
14+
{{{ set_config_file(path="/etc/fapolicyd/fapolicyd.conf",
15+
parameter="permissive",
16+
value="0",
17+
create=true,
18+
insensitive=true,
19+
separator=" = ",
20+
separator_regex="\s*=\s*",
21+
prefix_regex="^\s*", rule_id=rule_id) }}}

linux_os/guide/system/permissions/partitions/mount_option_boot_efi_nosuid/policy/stig/shared.yml

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,20 @@
1-
srg_requirement: |-
2-
{{{ full_name }}} must prevent files with the setuid and setgid bit set from being executed on the /boot/efi directory.
3-
4-
vuldiscussion: |-
5-
The "nosuid" mount option causes the system not to execute "setuid" and "setgid" files with owner privileges. This option must be used for mounting any file system not containing approved "setuid" and "setguid" files. Executing files from untrusted file systems increases the opportunity for nonprivileged users to attain unauthorized administrative access.
6-
7-
8-
1+
srg_requirement: >-
2+
{{{ full_name }}} must prevent files with the
3+
setuid and setgid bit set from being executed
4+
on the /boot/efi directory.
5+
6+
vuldiscussion: >-
7+
The "nosuid" mount option causes the system
8+
not to execute "setuid" and "setgid" files
9+
with owner privileges. This option must be
10+
used for mounting any file system not
11+
containing approved "setuid" and "setguid"
12+
files. Executing files from untrusted file
13+
systems increases the opportunity for
14+
nonprivileged users to attain unauthorized
15+
administrative access.
16+
17+
# yamllint disable rule:line-length
918
checktext: |-
1019
Note: For systems that use BIOS, this requirement is not applicable.
1120
@@ -17,7 +26,6 @@ checktext: |-
1726
1827
If the /boot/efi file system does not have the "nosuid" option set, this is a finding.
1928
29+
# yamllint enable rule:line-length
2030
fixtext: |-
2131
Modify "/etc/fstab" to use the "nosuid" option on the "/boot/efi" directory.
22-
23-

linux_os/guide/system/permissions/partitions/mount_option_boot_efi_nosuid/tests/vfat_with_nosuid.pass.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#!/bin/bash
22

33
# This test verifies that the rule passes when /boot/efi is mounted with vfat filesystem
4+
# with the nosuid option set
45

56
# packages = dosfstools
67

linux_os/guide/system/permissions/partitions/mount_option_nodev_nonroot_local_partitions/ansible/shared.yml

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131
- lustre
3232
- davfs
3333
- fuse.sshfs
34-
- vfat
3534

3635
- name: "{{{ rule_title }}}: Ensure non-root local partitions are mounted with nodev option"
3736
ansible.posix.mount:
@@ -46,13 +45,19 @@
4645
- "item.options is not search('nodev')"
4746
- "item.fstype not in excluded_fstypes"
4847
# Attempting to change polyinstantiated mounts for /tmp and /var/tmp, if present, will fail
49-
- "(not accounts_polyinstantiated_var_tmp | default(false)) or item.mount != '/var/tmp/tmp-inst'"
48+
- >-
49+
(not accounts_polyinstantiated_var_tmp |
50+
default(false)) or item.mount !=
51+
'/var/tmp/tmp-inst'
5052
- "(not accounts_polyinstantiated_tmp | default(false)) or item.mount != '/tmp/tmp-inst'"
5153
with_items:
5254
- "{{ ansible_facts.mounts }}"
5355

54-
- name: "{{{ rule_title }}}: Ensure non-root local partitions are present with nodev option in /etc/fstab"
56+
- name: >-
57+
{{{ rule_title }}}: Ensure nodev option in
58+
/etc/fstab for non-root local partitions
5559
ansible.builtin.replace:
5660
path: /etc/fstab
57-
regexp: '^\s*(?!#)(/dev/\S+|UUID=\S+)\s+(/(?!boot|efi)\w\S*)\s+(?!vfat\s)(\S+)\s+(?!.*\bnodev\b)(\S+)(.*)$'
61+
# yamllint disable-line rule:line-length
62+
regexp: '^\s*(?!#)(/dev/\S+|UUID=\S+)\s+(/(?!boot|efi)\w\S*)\s+(\S+)\s+(?!.*\bnodev\b)(\S+)(.*)$'
5863
replace: '\1 \2 \3 \4,nodev \5'

linux_os/guide/system/permissions/partitions/mount_option_nodev_nonroot_local_partitions/bash/shared.sh

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ excluded_fstypes=(
3030
lustre
3131
davfs
3232
fuse.sshfs
33-
vfat
3433
)
3534

3635
for partition_record in "${partitions_records[@]}"; do
@@ -65,5 +64,5 @@ for partition_record in "${partitions_records[@]}"; do
6564
{{{ bash_ensure_partition_is_mounted("$mount_point") | indent(4) }}}
6665
done
6766

68-
# Remediate unmounted /etc/fstab entries, excluding /boot, /efi, and vfat partitions
69-
sed -i -E '/nodev/! { /^\s*(\/dev\/\S+|UUID=\S+)\s+\/(boot|efi)/! { /^\s*(\/dev\/\S+|UUID=\S+)\s+\/\w\S*\s+vfat\s/! s;^\s*(/dev/\S+|UUID=\S+)\s+(/\w\S*)\s+(\S+)\s+(\S+)(.*)$;\1 \2 \3 \4,nodev \5; } }' /etc/fstab
67+
# Remediate unmounted /etc/fstab entries, excluding /boot and /efi partitions
68+
sed -i -E '/nodev/! { /^\s*(\/dev\/\S+|UUID=\S+)\s+\/(boot|efi)/! s;^\s*(/dev/\S+|UUID=\S+)\s+(/\w\S*)\s+(\S+)\s+(\S+)(.*)$;\1 \2 \3 \4,nodev \5; }' /etc/fstab

linux_os/guide/system/permissions/partitions/mount_option_nodev_nonroot_local_partitions/oval/shared.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
<linux:partition_state id="state_local_nodev" version="1">
3434
<!-- this check defines a local partition as one which has a device node in /dev -->
3535
<linux:device operation="pattern match">^/dev/.*$</linux:device>
36-
<linux:fs_type operation="pattern match">^(?!afs$|autofs$|ceph$|cifs$|smb3$|smbfs$|sshfs$|ncpfs$|ncp$|nfs$|nfs4$|gfs$|gfs2$|glusterfs$|gpfs$|pvfs2$|ocfs2$|lustre$|davfs$|fuse\.sshfs$|vfat$).+</linux:fs_type>
36+
<linux:fs_type operation="pattern match">^(?!afs$|autofs$|ceph$|cifs$|smb3$|smbfs$|sshfs$|ncpfs$|ncp$|nfs$|nfs4$|gfs$|gfs2$|glusterfs$|gpfs$|pvfs2$|ocfs2$|lustre$|davfs$|fuse\.sshfs$).+</linux:fs_type>
3737
<linux:mount_options datatype="string" entity_check="all"
3838
operation="not equal">nodev</linux:mount_options>
3939
</linux:partition_state>
@@ -46,7 +46,7 @@
4646
</ind:textfilecontent54_test>
4747
<ind:textfilecontent54_object version="1" id="object_non_root_partitions_in_fstab">
4848
<ind:filepath>/etc/fstab</ind:filepath>
49-
<ind:pattern operation="pattern match">^\s*(?!#)(?:/dev/\S+|UUID=\S+)\s+/(?!boot|efi)\w\S*\s+(?!vfat\s)\S+\s+(\S+)</ind:pattern>
49+
<ind:pattern operation="pattern match">^\s*(?!#)(?:/dev/\S+|UUID=\S+)\s+/(?!boot|efi)\w\S*\s+\S+\s+(\S+)</ind:pattern>
5050
<ind:instance datatype="int" operation="greater than or equal">1</ind:instance>
5151
</ind:textfilecontent54_object>
5252
<ind:textfilecontent54_state version="1"

linux_os/guide/system/permissions/partitions/mount_option_nodev_nonroot_local_partitions/rule.yml

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,11 @@ rationale: |-
1818
to set <tt>nodev</tt> on these filesystems.
1919
2020
ocil: |
21-
To verify the <tt>nodev</tt> option is configured for non-root local partitions, run the following command:
21+
To verify the <tt>nodev</tt> option is configured for non-root local partitions,
22+
run the following command:
2223
<pre>$ sudo mount | grep '^/dev\S* on /\S' | grep --invert-match 'nodev'</pre>
23-
The output shows local non-root partitions mounted without the <tt>nodev</tt> option, and there should be no output at all.
24+
The output shows local non-root partitions mounted without the <tt>nodev</tt> option,
25+
and there should be no output at all.
2426
2527
ocil_clause: "some mounts appear among output lines"
2628

@@ -38,10 +40,17 @@ identifiers:
3840
references:
3941
cis-csc: 11,14,3,9
4042
cobit5: BAI10.01,BAI10.02,BAI10.03,BAI10.05,DSS05.02,DSS05.05,DSS06.06
41-
isa-62443-2009: 4.3.3.5.1,4.3.3.5.2,4.3.3.5.3,4.3.3.5.4,4.3.3.5.5,4.3.3.5.6,4.3.3.5.7,4.3.3.5.8,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.1,4.3.3.7.2,4.3.3.7.3,4.3.3.7.4,4.3.4.3.2,4.3.4.3.3
42-
isa-62443-2013: 'SR 1.1,SR 1.10,SR 1.11,SR 1.12,SR 1.13,SR 1.2,SR 1.3,SR 1.4,SR 1.5,SR 1.6,SR 1.7,SR 1.8,SR 1.9,SR 2.1,SR 2.2,SR 2.3,SR 2.4,SR 2.5,SR 2.6,SR 2.7,SR 7.6'
43+
isa-62443-2009: "4.3.3.5.1,4.3.3.5.2,4.3.3.5.3,4.3.3.5.4,4.3.3.5.5,\
44+
4.3.3.5.6,4.3.3.5.7,4.3.3.5.8,4.3.3.6.1,4.3.3.6.2,4.3.3.6.3,\
45+
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,\
46+
4.3.3.7.1,4.3.3.7.2,4.3.3.7.3,4.3.3.7.4,4.3.4.3.2,4.3.4.3.3"
47+
isa-62443-2013: "SR 1.1,SR 1.10,SR 1.11,SR 1.12,SR 1.13,SR 1.2,\
48+
SR 1.3,SR 1.4,SR 1.5,SR 1.6,SR 1.7,SR 1.8,SR 1.9,SR 2.1,\
49+
SR 2.2,SR 2.3,SR 2.4,SR 2.5,SR 2.6,SR 2.7,SR 7.6"
4350
iso27001-2013: A.12.1.2,A.12.5.1,A.12.6.2,A.14.2.2,A.14.2.3,A.14.2.4,A.9.1.2
44-
nerc-cip: CIP-003-8 R5.1.1,CIP-003-8 R5.3,CIP-004-6 R2.3,CIP-007-3 R2.1,CIP-007-3 R2.2,CIP-007-3 R2.3,CIP-007-3 R5.1,CIP-007-3 R5.1.1,CIP-007-3 R5.1.2
51+
nerc-cip: "CIP-003-8 R5.1.1,CIP-003-8 R5.3,CIP-004-6 R2.3,\
52+
CIP-007-3 R2.1,CIP-007-3 R2.2,CIP-007-3 R2.3,\
53+
CIP-007-3 R5.1,CIP-007-3 R5.1.1,CIP-007-3 R5.1.2"
4554
nist: CM-7(a),CM-7(b),CM-6(a),AC-6,AC-6(1),MP-7
4655
nist-csf: PR.IP-1,PR.PT-3
4756
srg: SRG-OS-000368-GPOS-00154,SRG-OS-000480-GPOS-00227
@@ -61,7 +70,4 @@ warnings:
6170
device nodes. The <tt>/boot</tt> and <tt>/efi</tt> partitions are
6271
excluded because they are special partitions usually handled by a
6372
systemd mount unit, and enforcing <tt>nodev</tt> on them during
64-
operating system installation causes issues. Partitions with the
65-
<tt>vfat</tt> file system type are excluded because vfat does not
66-
support Unix device special files, so <tt>nodev</tt> enforcement on
67-
them is not meaningful.
73+
operating system installation causes issues.

0 commit comments

Comments
 (0)