Bug 907235

Summary: SELinux is preventing /usr/bin/postgres from 'create' accesses on the directory pg_log.
Product: [Fedora] Fedora Reporter: Niki Guldbrand <niki.guldbrand>
Component: selinux-policyAssignee: Miroslav Grepl <mgrepl>
Status: CLOSED CURRENTRELEASE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 18CC: dominick.grift, dwalsh, mgrepl
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Unspecified   
Whiteboard: abrt_hash:2bf97916433ddb5955896a7c8a877ede96eb5cedb439ab92e45b8dd4e6f4ee16
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-02-11 04:55:57 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Niki Guldbrand 2013-02-03 22:04:51 UTC
Description of problem:
Had done a postgres initdb, and this appeared when i tried to start postgres for the first time.

Postgres tried to create it's logging folder (per it's default config after initdb: /var/lib/pgsql/data/pg_log)
which was denied, after creating it manually everything was okay...
SELinux is preventing /usr/bin/postgres from 'create' accesses on the directory pg_log.

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

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

Additional Information:
Source Context                system_u:system_r:postgresql_t:s0
Target Context                system_u:object_r:postgresql_log_t:s0
Target Objects                pg_log [ dir ]
Source                        postgres
Source Path                   /usr/bin/postgres
Port                          <Unknown>
Host                          (removed)
Source RPM Packages           postgresql-server-9.2.2-1.fc18.x86_64
Target RPM Packages           
Policy RPM                    selinux-policy-3.11.1-73.fc18.noarch
Selinux Enabled               True
Policy Type                   targeted
Enforcing Mode                Enforcing
Host Name                     (removed)
Platform                      Linux (removed) 3.7.4-204.fc18.x86_64 #1 SMP Wed
                              Jan 23 16:44:29 UTC 2013 x86_64 x86_64
Alert Count                   1
First Seen                    2013-02-03 20:13:57 CET
Last Seen                     2013-02-03 20:13:57 CET
Local ID                      df240b59-c427-411d-90fd-ade5d285f432

Raw Audit Messages
type=AVC msg=audit(1359918837.918:830): avc:  denied  { create } for  pid=13841 comm="postgres" name="pg_log" scontext=system_u:system_r:postgresql_t:s0 tcontext=system_u:object_r:postgresql_log_t:s0 tclass=dir


type=SYSCALL msg=audit(1359918837.918:830): arch=x86_64 syscall=mkdir success=no exit=EACCES a0=1ab17a0 a1=1c0 a2=0 a3=7fff69ee8a90 items=0 ppid=1 pid=13841 auid=4294967295 uid=26 gid=26 euid=26 suid=26 fsuid=26 egid=26 sgid=26 fsgid=26 ses=4294967295 tty=(none) comm=postgres exe=/usr/bin/postgres subj=system_u:system_r:postgresql_t:s0 key=(null)

Hash: postgres,postgresql_t,postgresql_log_t,dir,create

audit2allow

#============= postgresql_t ==============
allow postgresql_t postgresql_log_t:dir create;

audit2allow -R

#============= postgresql_t ==============
allow postgresql_t postgresql_log_t:dir create;


Additional info:
hashmarkername: setroubleshoot
kernel:         3.7.4-204.fc18.x86_64
type:           libreport

Comment 1 Miroslav Grepl 2013-02-04 11:37:40 UTC
Fixed in selinux-policy-3.11.1-75.fc18.noarch

Comment 2 Fedora Update System 2013-02-05 09:24:20 UTC
selinux-policy-3.11.1-76.fc18 has been submitted as an update for Fedora 18.
https://admin.fedoraproject.org/updates/selinux-policy-3.11.1-76.fc18

Comment 3 Fedora Update System 2013-02-08 02:36:50 UTC
Package selinux-policy-3.11.1-76.fc18:
* should fix your issue,
* was pushed to the Fedora 18 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing selinux-policy-3.11.1-76.fc18'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2013-2101/selinux-policy-3.11.1-76.fc18
then log in and leave karma (feedback).

Comment 4 Fedora Update System 2013-02-11 04:55:58 UTC
selinux-policy-3.11.1-76.fc18 has been pushed to the Fedora 18 stable repository.  If problems still persist, please make note of it in this bug report.