Bug 795422

Summary: SELinux is preventing /sbin/setfiles from 'relabelto' accesses on the file postgresql.conf.
Product: [Fedora] Fedora Reporter: Matthew Eichler <matthew.eichler>
Component: selinux-policyAssignee: Miroslav Grepl <mgrepl>
Status: CLOSED NOTABUG QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 15CC: dominick.grift, dwalsh, mgrepl
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard: setroubleshoot_trace_hash:9bd33b9b236a8b0a2f4141541fe4cdcb0c9593e8d0a44948f1f74c34ee387b9f
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-02-20 16:19: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 Matthew Eichler 2012-02-20 13:28:02 UTC
SELinux is preventing /sbin/setfiles from 'relabelto' accesses on the file postgresql.conf.

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

If you believe that setfiles should be allowed relabelto access on the postgresql.conf 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 restorecon /var/log/audit/audit.log | audit2allow -M mypol
# semodule -i mypol.pp

Additional Information:
Source Context                unconfined_u:unconfined_r:setfiles_t:s0-s0:c0.c102
                              3
Target Context                system_u:object_r:postgresql_port_t:s0
Target Objects                postgresql.conf [ file ]
Source                        restorecon
Source Path                   /sbin/setfiles
Port                          <Unknown>
Host                          (removed)
Source RPM Packages           policycoreutils-2.0.86-7.fc15
Target RPM Packages           
Policy RPM                    selinux-policy-3.9.16-50.fc15
Selinux Enabled               True
Policy Type                   targeted
Enforcing Mode                Enforcing
Host Name                     (removed)
Platform                      Linux sinn.aventinesolutions.org
                              2.6.41.10-3.fc15.x86_64 #1 SMP Mon Jan 23 15:46:37
                              UTC 2012 x86_64 x86_64
Alert Count                   1
First Seen                    Mon 20 Feb 2012 01:26:38 PM CET
Last Seen                     Mon 20 Feb 2012 01:26:38 PM CET
Local ID                      dddf0edc-9ef3-49b1-be12-afa085536df2

Raw Audit Messages
type=AVC msg=audit(1329740798.66:192): avc:  denied  { relabelto } for  pid=30306 comm="restorecon" name="postgresql.conf" dev=md0 ino=12100027 scontext=unconfined_u:unconfined_r:setfiles_t:s0-s0:c0.c1023 tcontext=system_u:object_r:postgresql_port_t:s0 tclass=file


type=SYSCALL msg=audit(1329740798.66:192): arch=x86_64 syscall=lsetxattr success=no exit=EACCES a0=7f705d8f1df0 a1=7f705c74dd8b a2=7f705d8a0550 a3=27 items=0 ppid=24610 pid=30306 auid=512 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=pts1 ses=1 comm=restorecon exe=/sbin/setfiles subj=unconfined_u:unconfined_r:setfiles_t:s0-s0:c0.c1023 key=(null)

Hash: restorecon,setfiles_t,postgresql_port_t,file,relabelto

audit2allow

#============= setfiles_t ==============
#!!!! This avc is allowed in the current policy

allow setfiles_t postgresql_port_t:file relabelto;

audit2allow -R

#============= setfiles_t ==============
#!!!! This avc is allowed in the current policy

allow setfiles_t postgresql_port_t:file relabelto;

Comment 1 Miroslav Grepl 2012-02-20 16:19:32 UTC
postgresql_port_t is not type for cofing files but for ports. Execute

$ setenforce 0
$ restorecon -R -v PATHTO/postgresql.conf
$ setenforce 1