Bug 717463

Summary: SELinux is preventing /usr/sbin/sanlock from 'read' accesses on the file /var/log/sanlock.log.
Product: [Fedora] Fedora Reporter: Eric Blake <eblake>
Component: selinux-policyAssignee: Miroslav Grepl <mgrepl>
Status: CLOSED NOTABUG QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: medium    
Version: rawhideCC: dominick.grift, dwalsh, mgrepl
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard: setroubleshoot_trace_hash:cc5e77e1feb02dfe8314d950e7f3afb1fe41593509c7326dd2cf0d7ac0c0f852
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-06-29 06:21: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:

Description Eric Blake 2011-06-28 21:16:40 UTC
SELinux is preventing /usr/sbin/sanlock from 'read' accesses on the file /var/log/sanlock.log.

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

If you believe that sanlock should be allowed read access on the sanlock.log file 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:
# grep sanlock /var/log/audit/audit.log | audit2allow -M mypol
# semodule -i mypol.pp

Additional Information:
Source Context                system_u:system_r:sanlock_t:s0
Target Context                system_u:object_r:var_log_t:s0
Target Objects                /var/log/sanlock.log [ file ]
Source                        sanlock
Source Path                   /usr/sbin/sanlock
Port                          <Unknown>
Host                          (removed)
Source RPM Packages           sanlock-1.2.0-3.fc16
Target RPM Packages           
Policy RPM                    selinux-policy-3.9.16-29.1.fc16
Selinux Enabled               True
Policy Type                   targeted
Enforcing Mode                Enforcing
Host Name                     (removed)
Platform                      Linux (removed) 2.6.39-1.fc16.x86_64 #1 SMP Sat
                              May 21 02:34:01 UTC 2011 x86_64 x86_64
Alert Count                   8
First Seen                    Mon 20 Jun 2011 11:18:04 AM MDT
Last Seen                     Tue 28 Jun 2011 02:33:33 PM MDT
Local ID                      17bfe48f-819a-4af3-9ff4-4628b19abec9

Raw Audit Messages
type=AVC msg=audit(1309293213.708:10): avc:  denied  { read } for  pid=945 comm="sanlock" name="sanlock.log" dev=dm-1 ino=104 scontext=system_u:system_r:sanlock_t:s0 tcontext=system_u:object_r:var_log_t:s0 tclass=file


type=AVC msg=audit(1309293213.708:10): avc:  denied  { open } for  pid=945 comm="sanlock" name="sanlock.log" dev=dm-1 ino=104 scontext=system_u:system_r:sanlock_t:s0 tcontext=system_u:object_r:var_log_t:s0 tclass=file


type=SYSCALL msg=audit(1309293213.708:10): arch=x86_64 syscall=open success=yes exit=ESRCH a0=715800 a1=442 a2=1b6 a3=9 items=0 ppid=1 pid=945 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=4294967295 comm=sanlock exe=/usr/sbin/sanlock subj=system_u:system_r:sanlock_t:s0 key=(null)

Hash: sanlock,sanlock_t,var_log_t,file,read

audit2allow

#============= sanlock_t ==============
allow sanlock_t var_log_t:file { read open };

audit2allow -R

#============= sanlock_t ==============
allow sanlock_t var_log_t:file { read open };

Comment 1 Miroslav Grepl 2011-06-29 06:21:32 UTC
the log file is mislabeled. I guess you started the service without using service script and the log file got the bad label.

Execute

# restorecon -R -v /var/log/sanlock.log