Note: This is a public test instance of Red Hat Bugzilla. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback at bugzilla.redhat.com.

Bug 1618790

Summary: SELinux 'dac_override' denial for cache_swap.sh
Product: [Fedora] Fedora Reporter: Daniel Alley <dalley>
Component: squidAssignee: LuboŇ° Uhliarik <luhliari>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 28CC: anon.amish, bmbouter, code, daviddavis, dkliban, ggainey, ipanova, jonathansteffan, j.orti.alcaine, luhliari, rchan, thozza, ttereshc
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: squid-4.2-2.fc28 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-08-23 10:33:39 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:

Description Daniel Alley 2018-08-17 15:14:58 UTC
Description of problem:

When starting squid on Fedora 28 inside an ansible job, it fails due to an selinux denial.  More details in the attached external bug, logs below.


Aug 16 18:13:55 f28-os-4786 systemd[1]: Starting Squid caching proxy...
Aug 16 18:13:55 f28-os-4786 audit[22168]: AVC avc:  denied  { dac_override } for  pid=22168 comm="cache_swap.sh" capability=1  scontext=system_u:system_r:squid_t:s0 tcontext=system_u:system_r:squid_t:s0 tclass=capability permissive=0
Aug 16 18:13:55 f28-os-4786 cache_swap.sh[22163]: init_cache_dir /var/spool/squid... /usr/libexec/squid/cache_swap.sh: line 14: /var/log/squid/squid.out: Permission denied
Aug 16 18:13:55 f28-os-4786 audit[1]: SERVICE_START pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:init_t:s0 msg='unit=squid comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=failed'

Comment 1 pulp-infra@redhat.com 2018-08-17 15:17:06 UTC
The Pulp upstream bug status is at NEW. Updating the external tracker on this bug.

Comment 2 pulp-infra@redhat.com 2018-08-17 15:17:10 UTC
The Pulp upstream bug priority is at Normal. Updating the external tracker on this bug.

Comment 3 Juan Orti 2018-08-20 14:29:16 UTC
Please,

Just change the permissions of /var/log/squid to squid:root 0770 or similar.

See: https://danwalsh.livejournal.com/79643.html

----
SELinux is preventing cache_swap.sh from using the dac_override capability.                                                                                                                                        
                                                                                                                                                                                                                   
*****  Plugin dac_override (91.4 confidence) suggests   **********************                                                                                                                                     
                                                                                                                                                                                                                   
If you want to help identify if domain needs this access or you have a file with the wrong permissions on your system                                                                                              
Then turn on full auditing to get path information about the offending file and generate the error again.                                                                                                          
Do                                                                                                                                                                                                                 
                                                                                                                                                                                                                   
Turn on full auditing                                                                                                                                                                                              
# auditctl -w /etc/shadow -p w                                                                                                                                                                                     
Try to recreate AVC. Then execute                                                                                                                                                                                  
# ausearch -m avc -ts recent                                                                                                                                                                                       
If you see PATH record check ownership/permissions on file, and fix it,                                                                                                                                            
otherwise report as a bugzilla.                                                                                                                                                                                    
                                                                                                                                                                                                                   
*****  Plugin catchall (9.59 confidence) suggests   **************************                                                                                                                                     
                                                                                                                                                                                                                   
If you believe that cache_swap.sh should have the dac_override 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 'cache_swap.sh' --raw | audit2allow -M my-cacheswapsh
# semodule -X 300 -i my-cacheswapsh.pp


Additional Information:
Source Context                system_u:system_r:squid_t:s0
Target Context                system_u:system_r:squid_t:s0
Target Objects                Unknown [ capability ]
Source                        cache_swap.sh
Source Path                   cache_swap.sh
Port                          <Unknown>
Host                          helio
Source RPM Packages
Target RPM Packages
Policy RPM                    selinux-policy-3.14.1-40.fc28.noarch
Selinux Enabled               True
Policy Type                   targeted
Enforcing Mode                Enforcing
Host Name                     helio
Platform                      Linux helio 4.17.14-202.fc28.x86_64 #1 SMP Wed Aug
                              15 12:29:25 UTC 2018 x86_64 x86_64
Alert Count                   1
First Seen                    2018-08-20 16:21:29 CEST
Last Seen                     2018-08-20 16:21:29 CEST
Local ID                      b9081661-7943-41ae-bad8-55f1e019258f

Raw Audit Messages
type=AVC msg=audit(1534774889.630:9172): avc:  denied  { dac_override } for  pid=8194 comm="cache_swap.sh" capability=1  scontext=system_u:system_r:squid_t:s0 tcontext=system_u:system_r:squid_t:s0 tclass=capability permissive=0


Hash: cache_swap.sh,squid_t,squid_t,capability,dac_override

Comment 4 Fedora Update System 2018-08-20 16:41:20 UTC
squid-4.2-2.fc28 has been submitted as an update to Fedora 28. https://bodhi.fedoraproject.org/updates/FEDORA-2018-902974a33b

Comment 5 pulp-infra@redhat.com 2018-08-20 17:59:37 UTC
The Pulp upstream bug status is at CLOSED - CURRENTRELEASE. Updating the external tracker on this bug.

Comment 6 Fedora Update System 2018-08-22 03:12:54 UTC
squid-4.2-2.fc28 has been pushed to the Fedora 28 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2018-902974a33b

Comment 7 Fedora Update System 2018-08-23 10:33:39 UTC
squid-4.2-2.fc28 has been pushed to the Fedora 28 stable repository. If problems still persist, please make note of it in this bug report.