Bug 2059166

Summary: SELinux is preventing rngd from using the 'setgid' capabilities.
Product: [Fedora] Fedora Reporter: Fabio Valentini <decathorpe>
Component: selinux-policyAssignee: Zdenek Pytela <zpytela>
Status: CLOSED DUPLICATE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 35CC: dwalsh, grepl.miroslav, lvrabec, mmalik, omosnace, pkoncity, vdronov, vmojzis, zpytela
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Unspecified   
Whiteboard: abrt_hash:f98b1f95d3fcc4ba24814d5ddbc1c7bd7ec3bafda192d6ed6f56c19b27e60e2c;VARIANT_ID=workstation;
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-03-01 07:50:53 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Fabio Valentini 2022-02-28 11:24:52 UTC
Description of problem:
SELinux is preventing rngd from using the 'setgid' capabilities.

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

If you believe that rngd should have the setgid capability 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 'rngd' --raw | audit2allow -M my-rngd
# semodule -X 300 -i my-rngd.pp

Additional Information:
Source Context                system_u:system_r:rngd_t:s0
Target Context                system_u:system_r:rngd_t:s0
Target Objects                Unknown [ capability ]
Source                        rngd
Source Path                   rngd
Port                          <Unknown>
Host                          (removed)
Source RPM Packages           
Target RPM Packages           
SELinux Policy RPM            selinux-policy-targeted-35.15-1.fc35.noarch
Local Policy RPM              selinux-policy-targeted-35.15-1.fc35.noarch
Selinux Enabled               True
Policy Type                   targeted
Enforcing Mode                Enforcing
Host Name                     (removed)
Platform                      Linux (removed) 5.16.11-200.fc35.x86_64 #1 SMP
                              PREEMPT Wed Feb 23 17:08:49 UTC 2022 x86_64 x86_64
Alert Count                   10
First Seen                    2022-02-28 12:19:34 CET
Last Seen                     2022-02-28 12:20:14 CET
Local ID                      517876c9-1106-49b8-96f8-cbd27c072506

Raw Audit Messages
type=AVC msg=audit(1646047214.689:206): avc:  denied  { setgid } for  pid=941 comm="rngd" capability=6  scontext=system_u:system_r:rngd_t:s0 tcontext=system_u:system_r:rngd_t:s0 tclass=capability permissive=0


Hash: rngd,rngd_t,rngd_t,capability,setgid

Version-Release number of selected component:
selinux-policy-targeted-35.15-1.fc35.noarch

Additional info:
component:      selinux-policy
reporter:       libreport-2.15.2
hashmarkername: setroubleshoot
kernel:         5.16.11-200.fc35.x86_64
type:           libreport

Potential duplicate: bug 2058914

Comment 1 Zdenek Pytela 2022-03-01 07:50:53 UTC

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

Comment 2 Vladislav Dronov 2022-03-01 16:34:01 UTC
thanks a lot for your report, Fabio! indeed, rngd was updated with a code that drops privileges so rngd process
runs as non-root user. uid/gid/cap-changing syscalls are used for that. the selinux part indeed has issues with
that. we'll handle the fix in bz2058914. for now i can think of the following workarounds:

1) a workaround with audit2allow/semodule described in bz2058914.
2) remove "-D daemon:daemon" from /etc/sysconfig/rngd. this will make rngd to run as root as before.
3) downgrade to the previous v6.14 rng-tools. the update was unpushed so fedora repos should have the previous v6.14 version.