Bug 691551

Summary: SELinux is preventing /usr/bin/postgres from 'setattr' accesses on the directory postgres_data.
Product: [Fedora] Fedora Reporter: roland
Component: selinux-policyAssignee: Miroslav Grepl <mgrepl>
Status: CLOSED DUPLICATE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 14CC: dwalsh, mgrepl, roland
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard: setroubleshoot_trace_hash:392fac71efec180bae951409c3cada4be088446fbb8041842cf0961ea9c74778
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-03-29 11:04:06 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 roland 2011-03-28 19:53:21 UTC
SELinux is preventing /usr/bin/postgres from 'setattr' accesses on the directory postgres_data.

*****  Plugin file (36.8 confidence) suggests  *******************************

If you think this is caused by a badly mislabeled machine.
Then you need to fully relabel.
Do
touch /.autorelabel; reboot

*****  Plugin file (36.8 confidence) suggests  *******************************

If you think this is caused by a badly mislabeled machine.
Then you need to fully relabel.
Do
touch /.autorelabel; reboot

*****  Plugin catchall_labels (23.2 confidence) suggests  ********************

If you want to allow postgres to have setattr access on the postgres_data directory
Then you need to change the label on postgres_data
Do
# semanage fcontext -a -t FILE_TYPE 'postgres_data'
where FILE_TYPE is one of the following: postgresql_var_run_t, postgresql_tmp_t, postgresql_db_t. 
Then execute: 
restorecon -v 'postgres_data'


*****  Plugin catchall (5.04 confidence) suggests  ***************************

If you believe that postgres should be allowed setattr access on the postgres_data directory 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 postmaster /var/log/audit/audit.log | audit2allow -M mypol
# semodule -i mypol.pp

Additional Information:
Source Context                unconfined_u:system_r:postgresql_t:s0
Target Context                unconfined_u:object_r:file_t:s0
Target Objects                postgres_data [ dir ]
Source                        postmaster
Source Path                   /usr/bin/postgres
Port                          <Unknown>
Host                          (removed)
Source RPM Packages           postgresql-server-8.4.7-1.fc14
Target RPM Packages           
Policy RPM                    selinux-policy-3.9.7-37.fc14
Selinux Enabled               True
Policy Type                   targeted
Enforcing Mode                Enforcing
Host Name                     (removed)
Platform                      Linux (removed)
                              2.6.35.11-83.fc14.x86_64 #1 SMP Mon Feb 7 07:06:44
                              UTC 2011 x86_64 x86_64
Alert Count                   2
First Seen                    Mon 28 Mar 2011 02:48:39 PM CDT
Last Seen                     Mon 28 Mar 2011 02:51:17 PM CDT
Local ID                      12f99c25-3f4f-4815-ba27-d605413510c4

Raw Audit Messages
type=AVC msg=audit(1301341877.970:26134): avc:  denied  { setattr } for  pid=2854 comm="postmaster" name="postgres_data" dev=sda7 ino=32769 scontext=unconfined_u:system_r:postgresql_t:s0 tcontext=unconfined_u:object_r:file_t:s0 tclass=dir


type=SYSCALL msg=audit(1301341877.970:26134): arch=x86_64 syscall=chmod success=no exit=EACCES a0=203afb0 a1=1c0 a2=0 a3=10 items=0 ppid=2504 pid=2854 auid=500 uid=26 gid=26 euid=26 suid=26 fsuid=26 egid=26 sgid=26 fsgid=26 tty=(none) ses=1 comm=postmaster exe=/usr/bin/postgres subj=unconfined_u:system_r:postgresql_t:s0 key=(null)

Hash: postmaster,postgresql_t,file_t,dir,setattr

audit2allow

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

allow postgresql_t file_t:dir setattr;

audit2allow -R

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

allow postgresql_t file_t:dir setattr;

Comment 1 Miroslav Grepl 2011-03-29 11:04:06 UTC

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