Bug 2159019

Summary: SELinux is preventing systemctl from getattr access on the filesystem /.
Product: Red Hat Enterprise Linux 8 Reporter: Brian J. Murrell <brian>
Component: selinux-policyAssignee: Zdenek Pytela <zpytela>
Status: CLOSED DUPLICATE QA Contact: Milos Malik <mmalik>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 8.7CC: lvrabec, mmalik, nknazeko, ssekidde
Target Milestone: rcFlags: pm-rhel: mirror+
Target Release: ---   
Hardware: x86_64   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2023-01-09 14:33:13 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Brian J. Murrell 2023-01-07 20:50:25 UTC
SELinux is preventing systemctl from getattr access on the filesystem /.

*****  Plugin catchall (100. confidence) suggests   **************************

If you believe that systemctl should be allowed getattr access on the  filesystem by default.
Then you should report this as a bug.
You can generate a local policy module to allow this access.
Do
allow this access for now by executing:
# ausearch -c 'systemctl' --raw | audit2allow -M my-systemctl
# semodule -X 300 -i my-systemctl.pp


Additional Information:
Source Context                system_u:system_r:spamd_update_t:s0
Target Context                system_u:object_r:fs_t:s0
Target Objects                / [ filesystem ]
Source                        systemctl
Source Path                   systemctl
Port                          <Unknown>
Host                          server.interlinx.bc.ca
Source RPM Packages           
Target RPM Packages           filesystem-3.8-6.el8.x86_64
SELinux Policy RPM            selinux-policy-targeted-3.14.3-108.el8.noarch
Local Policy RPM              selinux-policy-targeted-3.14.3-108.el8.noarch
Selinux Enabled               True
Policy Type                   targeted
Enforcing Mode                Enforcing
Host Name                     server.interlinx.bc.ca
Platform                      Linux server.interlinx.bc.ca
                              4.18.0-425.3.1.el8.x86_64 #1 SMP Tue Nov 8
                              14:08:25 EST 2022 x86_64 x86_64
Alert Count                   92
First Seen                    2022-11-19 00:33:37 EST
Last Seen                     2023-01-07 00:31:12 EST
Local ID                      7a355dbb-e393-41b1-b0ee-3b1c65801892

Raw Audit Messages
type=AVC msg=audit(1673069472.646:145202): avc:  denied  { getattr } for  pid=4042248 comm="systemctl" name="/" dev="dm-4" ino=2 scontext=system_u:system_r:spamd_update_t:s0 tcontext=system_u:object_r:fs_t:s0 tclass=filesystem permissive=0


Hash: systemctl,spamd_update_t,fs_t,filesystem,getattr

Comment 1 Zdenek Pytela 2023-01-09 10:50:24 UTC
Brian,

Do you know when this denial appears? Just starting the sa-update.service did not reproduce it on my system.
What filesystem is on the dm-4 device?

Perhaps with full auditing there will be more details:
1) Open the /etc/audit/rules.d/audit.rules file in an editor.
2) Remove the following line if it exists:
-a task,never
3) Add the following line to the end of the file:
-w /etc/shadow -p w
4) Restart the audit daemon:
  # service auditd restart
5) Re-run your scenario.
6) Collect AVC denials:
  # ausearch -i -m avc,user_avc,selinux_err,user_selinux_err -ts today

Comment 2 Milos Malik 2023-01-09 12:02:55 UTC
I believe this BZ is a duplicate of BZ#2144501.

Comment 3 Brian J. Murrell 2023-01-09 13:28:12 UTC
(In reply to Milos Malik from comment #2)
> I believe this BZ is a duplicate of BZ#2144501.

I would tend to agree.  Unfortunately, because AVC error reporting on headless systems is manual (copy and paste from sealert -l) and the duplicate issue detection in BZ didn't find the duplicate even with the exact same issue title, and the amount of time between reports (BZ#2144501 was reported a month and a half ago) and fixes landing to production systems, it can be that duplicates get forgotten about before the fixes appear on production systems.

Even though BZ#2144501 reports the issue fixed in selinux-policy-3.14.3-112.el8 on 2022-12-02 12:26:20 UTC and verified on 2022-12-04 08:49:20 UTC, the current version of selinux-policy in current EL8.7 is still 3.14.3-108.el8.  Would be better if the gap between verified and users actually getting the updated package could be closed.

Comment 4 Zdenek Pytela 2023-01-09 14:33:13 UTC
(In reply to Brian J. Murrell from comment #3)
> Even though BZ#2144501 reports the issue fixed in
> selinux-policy-3.14.3-112.el8 on 2022-12-02 12:26:20 UTC and verified on
> 2022-12-04 08:49:20 UTC, the current version of selinux-policy in current
> EL8.7 is still 3.14.3-108.el8.  Would be better if the gap between verified
> and users actually getting the updated package could be closed.

Although the request is understandable, the gap which actually can be up to 7 months is a result of the current RHEL development life cycle.
For RHEL 9, there is the option to use centos stream when the packages are available immediately when the build is created.

Closing dup.

*** This bug has been marked as a duplicate of bug 2144501 ***