Bug 691559

Summary: SELinux is preventing /usr/bin/postgres from 'read' 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
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard: setroubleshoot_trace_hash:af843527495204be5c31bfa8b5e8f6887576b8dc0ea038d40222104f5a133a84
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-03-29 11:04:44 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 20:09:56 UTC
SELinux is preventing /usr/bin/postgres from 'read' 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 read 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: var_log_t, net_conf_t, sysctl_crypto_t, sysctl_kernel_t, pcscd_var_run_t, abrt_t, lib_t, root_t, usr_t, device_t, etc_t, postgresql_var_run_t, var_lock_t, bin_t, cert_t, selinux_config_t, textrel_shlib_t, tmp_t, usr_t, mail_spool_t, sysctl_type, device_t, devpts_t, locale_t, etc_t, postgresql_tmp_t, proc_t, sysfs_t, tmpfs_t, var_run_t, postgresql_db_t, postgresql_t, postgresql_etc_t, postgresql_log_t, security_t, udev_tbl_t, var_lib_t, var_run_t, dbusd_etc_t, nscd_var_run_t, security_t, root_t. 
Then execute: 
restorecon -v 'postgres_data'


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

If you believe that postgres should be allowed read 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                   1
First Seen                    Mon 28 Mar 2011 03:08:46 PM CDT
Last Seen                     Mon 28 Mar 2011 03:08:46 PM CDT
Local ID                      1d03fed1-9f7e-495d-8353-277764850106

Raw Audit Messages
type=AVC msg=audit(1301342926.354:26195): avc:  denied  { read } for  pid=3075 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(1301342926.354:26195): arch=x86_64 syscall=open success=no exit=EACCES a0=203afb0 a1=90800 a2=3d8 a3=10 items=0 ppid=2504 pid=3075 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,read

audit2allow

#============= postgresql_t ==============
allow postgresql_t file_t:dir read;

audit2allow -R

#============= postgresql_t ==============
allow postgresql_t file_t:dir read;

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

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