Bug 674798

Summary: SELinux is preventing /usr/libexec/postfix/master from 'lock' accesses on the file /var/spool/postfix/pid/master.pid.
Product: [Fedora] Fedora Reporter: robb <redzilla>
Component: selinux-policyAssignee: Miroslav Grepl <mgrepl>
Status: CLOSED NOTABUG QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 14CC: dwalsh, mgrepl
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard: setroubleshoot_trace_hash:ad198787675f8b87e45d4152fb2e3035f12c859125d9c2633418d5c4a44128d9
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-02-03 16:31:16 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 robb 2011-02-03 12:07:08 UTC
SELinux is preventing /usr/libexec/postfix/master from 'lock' accesses on the file /var/spool/postfix/pid/master.pid.

*****  Plugin restorecon (99.5 confidence) suggests  *************************

If you want to fix the label. 
/var/spool/postfix/pid/master.pid default label should be postfix_var_run_t.
Then you can run restorecon.
Do
# /sbin/restorecon -v /var/spool/postfix/pid/master.pid

*****  Plugin catchall (1.49 confidence) suggests  ***************************

If you believe that master should be allowed lock access on the master.pid 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 master /var/log/audit/audit.log | audit2allow -M mypol
# semodule -i mypol.pp

Additional Information:
Source Context                system_u:system_r:postfix_master_t:s0
Target Context                unconfined_u:object_r:var_run_t:s0
Target Objects                /var/spool/postfix/pid/master.pid [ file ]
Source                        master
Source Path                   /usr/libexec/postfix/master
Port                          <Unknown>
Host                          (removed)
Source RPM Packages           postfix-2.7.1-1.fc14
Target RPM Packages           
Policy RPM                    selinux-policy-3.9.7-25.fc14
Selinux Enabled               True
Policy Type                   targeted
Enforcing Mode                Enforcing
Host Name                     (removed)
Platform                      Linux think 2.6.35.10-74.fc14.x86_64 #1 SMP Thu
                              Dec 23 16:04:50 UTC 2010 x86_64 x86_64
Alert Count                   1
First Seen                    Thu 27 Jan 2011 09:51:07 AM CET
Last Seen                     Thu 27 Jan 2011 09:51:07 AM CET
Local ID                      b9f24aa7-f2e1-415c-819a-9e077b2d9b07

Raw Audit Messages
type=AVC msg=audit(1296118267.928:10): avc:  denied  { lock } for  pid=1663 comm="master" path="/var/spool/postfix/pid/master.pid" dev=sda2 ino=131321 scontext=system_u:system_r:postfix_master_t:s0 tcontext=unconfined_u:object_r:var_run_t:s0 tclass=file


type=SYSCALL msg=audit(1296118267.928:10): arch=x86_64 syscall=flock success=no exit=EACCES a0=9 a1=6 a2=6 a3=7fff6463cca0 items=0 ppid=1658 pid=1663 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=4294967295 comm=master exe=/usr/libexec/postfix/master subj=system_u:system_r:postfix_master_t:s0 key=(null)

Hash: master,postfix_master_t,var_run_t,file,lock

audit2allow

#============= postfix_master_t ==============
allow postfix_master_t var_run_t:file lock;

audit2allow -R

#============= postfix_master_t ==============
allow postfix_master_t var_run_t:file lock;

If I then try to take the "yellow" option i.e. that the postfix daemon should be allowed access to its own lockfile, I get:
[root@think ~]# grep master /var/log/audit/audit.log | audit2allow -M mypol
compilation failed:
mypol.te:6:ERROR 'syntax error' at token '' on line 6:


/usr/bin/checkmodule:  error(s) encountered while parsing configuration
/usr/bin/checkmodule:  loading policy configuration from mypol.te

Comment 1 Daniel Walsh 2011-02-03 16:31:16 UTC
The problem is labeling.  Adding the allow rule is not what you want to do.

restorecon -R -v /var/spool

Will fix the problem

Also 
yum update setroubleshoot*