Bug 732228

Summary: postgresql initdb problems with unconfined disabled
Product: [Fedora] Fedora Reporter: Robin Powell <rlpowell>
Component: selinux-policyAssignee: Miroslav Grepl <mgrepl>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 15CC: dominick.grift, dwalsh, mgrepl
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: selinux-policy-3.9.16-39.fc15 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-10-06 00:03:05 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 Robin Powell 2011-08-21 04:52:35 UTC
Running "sudo /etc/init.d/postgresql initdb" gives this:



type=AVC msg=audit(1313902281.411:164863): avc:  denied  { create } for  pid=28395 comm="mkdir" name="pg_log" scontext=staff_u:system_r:initrc_t:s0 tcontext=staff_u:object_r:postgresql_db_t:s0 tclass=dir
type=AVC msg=audit(1313902281.424:164865): avc:  denied  { setattr } for  pid=28396 comm="chown" name="pg_log" dev=vda2 ino=153795 scontext=staff_u:system_r:initrc_t:s0 tcontext=staff_u:object_r:postgresql_db_t:s0 tclass=dir


-Robin

Comment 1 Miroslav Grepl 2011-08-22 12:22:25 UTC
Could you add me your output of

grep mkdir /etc/init.d/postgresql

Comment 2 Daniel Walsh 2011-08-22 16:09:44 UTC
Lets just change postgresql_manage_db to the following.

#
interface(`postgresql_manage_db',`
	gen_require(`
		type postgresql_db_t;
	')

	manage_dirs_pattern($1, postgresql_db_t, postgresql_db_t)
	manage_files_pattern($1, postgresql_db_t, postgresql_db_t)
	manage_lnk_files_pattern($1, postgresql_db_t, postgresql_db_t)
')

Comment 3 Daniel Walsh 2011-08-22 16:11:47 UTC
I checked this change into F16, should be back ported to RHEL6.

Comment 4 Robin Powell 2011-08-22 16:37:39 UTC
I suppose it doesn't matter anymore, but since you asked:

rlpowell@morji> sudo grep mkdir /etc/init.d/postgresql                                                                        
                mkdir -p "$PGDATA" || return 1
        mkdir "$PGDATA/pg_log"

-Robin

Comment 5 Miroslav Grepl 2011-08-24 06:16:50 UTC
Robin,
thanks. I will add a patch from F16 which Dan added.

Comment 6 Fedora Update System 2011-09-08 08:12:36 UTC
selinux-policy-3.9.16-39.fc15 has been submitted as an update for Fedora 15.
https://admin.fedoraproject.org/updates/selinux-policy-3.9.16-39.fc15

Comment 7 Fedora Update System 2011-09-09 05:28:42 UTC
Package selinux-policy-3.9.16-39.fc15:
* should fix your issue,
* was pushed to the Fedora 15 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.9.16-39.fc15'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/selinux-policy-3.9.16-39.fc15
then log in and leave karma (feedback).

Comment 8 Fedora Update System 2011-10-06 00:03:05 UTC
selinux-policy-3.9.16-39.fc15 has been pushed to the Fedora 15 stable repository.  If problems still persist, please make note of it in this bug report.