Skip to content

Commit 1d8543b

Browse files
authored
Merge pull request #11335 from marcusburghardt/rpm_verify_permissions_review
Review rpm_verify_permissions rule
2 parents c69454d + ddb6efb commit 1d8543b

File tree

2 files changed

+42
-33
lines changed
  • linux_os/guide/system/software/integrity/software-integrity/rpm_verification/rpm_verify_permissions

2 files changed

+42
-33
lines changed
Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,33 @@
11
<def-group>
2-
<definition class="compliance" id="rpm_verify_permissions" version="3">
3-
{{{ oval_metadata("Verify the permissions of installed packages
4-
by comparing the installed files with information about the
5-
files taken from the package metadata stored in the RPM
6-
database.") }}}
2+
<definition class="compliance" id="{{{ rule_id }}}" version="3">
3+
{{{ oval_metadata("Verify the permissions of installed packages by comparing the installed
4+
files with information about the files taken from the package metadata stored in the RPM
5+
database.") }}}
76
<criteria>
8-
<criterion test_ref="test_verify_all_rpms_mode" comment="mode of all files matches local rpm database" />
7+
<criterion test_ref="test_rpm_verify_permissions"
8+
comment="mode of all files matches local rpm database"/>
99
</criteria>
1010
</definition>
11-
<linux:rpmverifyfile_test check_existence="none_exist" id="test_verify_all_rpms_mode" version="1" check="all" comment="mode of all files matches local rpm database">
12-
<linux:object object_ref="object_files_fail_mode"/>
13-
</linux:rpmverifyfile_test>
14-
<linux:rpmverifyfile_object id="object_files_fail_mode" version="1" comment="rpm verify of all files">
11+
12+
<linux:rpmverifyfile_state id="state_rpm_verify_permissions_files_fail_mode" version="1">
13+
<linux:mode_differs>fail</linux:mode_differs>
14+
</linux:rpmverifyfile_state>
15+
16+
<linux:rpmverifyfile_object id="object_rpm_verify_permissions_files_fail_mode" version="1"
17+
comment="rpm verify permissions of all files">
1518
<linux:behaviors nomd5="true" noghostfiles="true"/>
1619
<linux:name operation="pattern match">.*</linux:name>
1720
<linux:epoch operation="pattern match">.*</linux:epoch>
1821
<linux:version operation="pattern match">.*</linux:version>
1922
<linux:release operation="pattern match">.*</linux:release>
2023
<linux:arch operation="pattern match">.*</linux:arch>
2124
<linux:filepath operation="pattern match">.*</linux:filepath>
22-
<filter action="include">state_files_fail_mode</filter>
25+
<filter action="include">state_rpm_verify_permissions_files_fail_mode</filter>
2326
</linux:rpmverifyfile_object>
24-
<linux:rpmverifyfile_state id="state_files_fail_mode" version="1">
25-
<linux:mode_differs>fail</linux:mode_differs>
26-
</linux:rpmverifyfile_state>
27+
28+
<linux:rpmverifyfile_test id="test_rpm_verify_permissions" version="1"
29+
check="all" check_existence="none_exist"
30+
comment="mode of all files matches local rpm database">
31+
<linux:object object_ref="object_rpm_verify_permissions_files_fail_mode"/>
32+
</linux:rpmverifyfile_test>
2733
</def-group>

linux_os/guide/system/software/integrity/software-integrity/rpm_verification/rpm_verify_permissions/rule.yml

Lines changed: 22 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -5,27 +5,24 @@ prodtype: alinux2,alinux3,anolis23,anolis8,fedora,ol7,ol8,ol9,rhcos4,rhel7,rhel8
55
title: 'Verify and Correct File Permissions with RPM'
66

77
description: |-
8-
The RPM package management system can check file access permissions
9-
of installed software packages, including many that are important
10-
to system security.
11-
Verify that the file permissions of system files
12-
and commands match vendor values. Check the file permissions
13-
with the following command:
8+
The RPM package management system can check file access permissions of installed software
9+
packages, including many that are important to system security. Verify that the file
10+
permissions of system files and commands match vendor values. Check the file permissions with
11+
the following command:
1412
<pre>$ sudo rpm -Va | awk '{ if (substr($0,2,1)=="M") print $NF }'</pre>
1513
Output indicates files that do not match vendor defaults.
16-
After locating a file with incorrect permissions,
17-
run the following command to determine which package owns it:
14+
15+
After locating a file with incorrect permissions, run the following command to determine which
16+
package owns it:
1817
<pre>$ rpm -qf <i>FILENAME</i></pre>
1918
<br />
20-
Next, run the following command to reset its permissions to
21-
the correct values:
19+
Next, run the following command to reset its permissions to the correct values:
2220
<pre>$ sudo rpm --setperms <i>PACKAGENAME</i></pre>
2321
2422
rationale: |-
25-
Permissions on system binaries and configuration files that are too generous
26-
could allow an unauthorized user to gain privileges that they should not have.
27-
The permissions set by the vendor should be maintained. Any deviations from
28-
this baseline should be investigated.
23+
Permissions on system binaries and configuration files that are too generous could allow an
24+
unauthorized user to gain privileges that they should not have. The permissions set by the
25+
vendor should be maintained. Any deviations from this baseline should be investigated.
2926
3027
severity: high
3128

@@ -74,7 +71,6 @@ fixtext: |-
7471
7572
$ sudo rpm -qf [path to file]
7673
77-
7874
Reset the permissions of files within a package with the following command:
7975
8076
$ sudo rpm --setperms [package]
@@ -83,7 +79,14 @@ srg_requirement: '{{{ full_name }}} must be configured so that the file permissi
8379

8480
warnings:
8581
- general: |-
86-
Profiles may require that specific files have stricter file permissions than defined by the
87-
vendor.
88-
Such files will be reported as a finding and need to be evaluated according to your policy
89-
and deployment environment.
82+
Profiles may require that specific files have stricter file permissions than defined by
83+
the vendor. Such files will be reported as a finding and need to be evaluated according to
84+
your policy and deployment environment.
85+
- general: |-
86+
This rule can take a long time to perform the check and might consume a considerable
87+
amount of resources depending on the number of packages present on the system. It is not a
88+
problem in most cases, but especially systems with a large number of installed packages
89+
can be affected.
90+
{{% if "rhel" in product %}}
91+
See <code>https://access.redhat.com/articles/6999111</code>.
92+
{{% endif %}}

0 commit comments

Comments
 (0)