Bug 1788455

Summary: SELinux is preventing dnf from using the 'mac_admin' capabilities.
Product: [Fedora] Fedora Reporter: djraymond1
Component: selinux-policyAssignee: Lukas Vrabec <lvrabec>
Status: CLOSED DUPLICATE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 31CC: dwalsh, lvrabec, mgrepl, pantyshotlover, plautrba, zpytela
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Unspecified   
Whiteboard: abrt_hash:af406c01e613a5ffcdad7f813a3e80916b688c0f6ccdf30f87cf7254b223b8a8;VARIANT_ID=workstation;
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-01-09 21:22:32 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 djraymond1 2020-01-07 09:32:56 UTC
Description of problem:
I tried "sudo dnf reinstall snapd"


Downloading Packages:
snapd-2.42.2-1.fc31.x86_64.rpm                   1.6 MB/s |  16 MB     00:09    
---------------------------------------------------------------------------------
Total                                            1.5 MB/s |  16 MB     00:10     
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                         1/1 
  Running scriptlet: snapd-2.42.2-1.fc31.x86_64                              1/1 
  Reinstalling     : snapd-2.42.2-1.fc31.x86_64                              1/2 
error: lsetfilecon: (/etc/sysconfig/snapd, system_u:object_r:snappy_config_t:s0) Invalid argument
error: Plugin selinux: hook fsm_file_prepare failed

Error unpacking rpm package snapd-2.42.2-1.fc31.x86_64
  Verifying        : snapd-2.42.2-1.fc31.x86_64                              1/2 
  Verifying        : snapd-2.42.2-1.fc31.x86_64                              2/2 

Failed:
  snapd-2.42.2-1.fc31.x86_64              snapd-2.42.2-1.fc31.x86_64             

Error: Transaction failed
SELinux is preventing dnf from using the 'mac_admin' capabilities.

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

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

Additional Information:
Source Context                unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1
                              023
Target Context                unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1
                              023
Target Objects                Unknown [ capability2 ]
Source                        dnf
Source Path                   dnf
Port                          <Unknown>
Host                          (removed)
Source RPM Packages           
Target RPM Packages           
Policy RPM                    selinux-policy-3.14.4-43.fc31.noarch
Selinux Enabled               True
Policy Type                   targeted
Enforcing Mode                Enforcing
Host Name                     (removed)
Platform                      Linux (removed) 5.4.7-200.fc31.x86_64 #1 SMP Tue
                              Dec 31 22:25:12 UTC 2019 x86_64 x86_64
Alert Count                   1
First Seen                    2020-01-07 18:30:00 KST
Last Seen                     2020-01-07 18:30:00 KST
Local ID                      66308272-d8d0-4489-b059-61bcd92149b5

Raw Audit Messages
type=AVC msg=audit(1578389400.185:316): avc:  denied  { mac_admin } for  pid=5912 comm="dnf" capability=33  scontext=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 tcontext=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 tclass=capability2 permissive=0


Hash: dnf,unconfined_t,unconfined_t,capability2,mac_admin

Version-Release number of selected component:
selinux-policy-3.14.4-43.fc31.noarch

Additional info:
component:      selinux-policy
reporter:       libreport-2.11.3
hashmarkername: setroubleshoot
kernel:         5.4.7-200.fc31.x86_64
type:           libreport

Potential duplicate: bug 1557350

Comment 1 Lukas Vrabec 2020-01-09 21:22:32 UTC

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