Note: This bug is displayed in read-only format because
the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
DescriptionDustin C. Hatch
2015-11-16 17:18:26 UTC
Description of problem:
SELinux prevents confined users from initializing a PostgreSQL instance. It seems there is nothing in the policy that allows users to execute files labeled postgresql_exec_t.
Version-Release number of selected component (if applicable):
selinux-policy-3.13.1-23.el7_1.21.noarch
postgresql-server-9.2.13-1.el7_1.x86_64
How reproducible:
Always
Steps to Reproduce:
1. semanage login -a -s staff_u user
2. yum install postgresql-server
3. sudo -r sysadm_r postgresql-setup
Actual results:
SELinux prevents the user from executing /usr/bin/initdb
Expected results:
The user should be allowed to execute initdb in order to create the database instance.
Additional info:
[root@c7-264e57 ~]# semanage login -l
Login Name SELinux User MLS/MCS Range Service
__default__ unconfined_u s0-s0:c0.c1023 *
user staff_u s0-s0:c0.c1023 *
root unconfined_u s0-s0:c0.c1023 *
system_u system_u s0-s0:c0.c1023 *
[user@c7-264e57 ~]$ id -Z
staff_u:staff_r:staff_t:s0-s0:c0.c1023
[user@c7-264e57 ~]$ sudo id -Z
staff_u:staff_r:staff_t:s0-s0:c0.c1023
[user@c7-264e57 ~]$ sudo -r sysadm_r id -Z
staff_u:sysadm_r:sysadm_t:s0-s0:c0.c1023
[user@c7-264e57 ~]$ sudo postgresql-setup initdb
Failed to issue method call: Access denied
failed to find PGDATA setting in postgresql.service
[user@c7-264e57 ~]$ sudo -r sysadm_r postgresql-setup initdb
Initializing database ... failed, see /var/lib/pgsql/initdb.log
[user@c7-264e57 ~]$ sudo -r sysadm_r cat /var/lib/pgsql/initdb.log
-bash: /usr/bin/initdb: Permission denied
Note: No AVC denial is logged unless "don't audit" is disabled (i.e. `semodule -DB`). Afterward, this denial is logged:
type=AVC msg=audit(1447694151.916:305): avc: denied { execute } for pid=1258 comm="bash" name="initdb" dev="dm-1" ino=25684747 scontext=staff_u:sysadm_r:sysadm_t:s0-s0:c0.c1023 tcontext=system_u:object_r:postgresql_exec_t:s0 tclass=file
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.
For information on the advisory, and where to find the updated
files, follow the link below.
If the solution does not work for you, open a new bug report.
https://rhn.redhat.com/errata/RHBA-2016-2283.html
Description of problem: SELinux prevents confined users from initializing a PostgreSQL instance. It seems there is nothing in the policy that allows users to execute files labeled postgresql_exec_t. Version-Release number of selected component (if applicable): selinux-policy-3.13.1-23.el7_1.21.noarch postgresql-server-9.2.13-1.el7_1.x86_64 How reproducible: Always Steps to Reproduce: 1. semanage login -a -s staff_u user 2. yum install postgresql-server 3. sudo -r sysadm_r postgresql-setup Actual results: SELinux prevents the user from executing /usr/bin/initdb Expected results: The user should be allowed to execute initdb in order to create the database instance. Additional info: [root@c7-264e57 ~]# semanage login -l Login Name SELinux User MLS/MCS Range Service __default__ unconfined_u s0-s0:c0.c1023 * user staff_u s0-s0:c0.c1023 * root unconfined_u s0-s0:c0.c1023 * system_u system_u s0-s0:c0.c1023 * [user@c7-264e57 ~]$ id -Z staff_u:staff_r:staff_t:s0-s0:c0.c1023 [user@c7-264e57 ~]$ sudo id -Z staff_u:staff_r:staff_t:s0-s0:c0.c1023 [user@c7-264e57 ~]$ sudo -r sysadm_r id -Z staff_u:sysadm_r:sysadm_t:s0-s0:c0.c1023 [user@c7-264e57 ~]$ sudo postgresql-setup initdb Failed to issue method call: Access denied failed to find PGDATA setting in postgresql.service [user@c7-264e57 ~]$ sudo -r sysadm_r postgresql-setup initdb Initializing database ... failed, see /var/lib/pgsql/initdb.log [user@c7-264e57 ~]$ sudo -r sysadm_r cat /var/lib/pgsql/initdb.log -bash: /usr/bin/initdb: Permission denied Note: No AVC denial is logged unless "don't audit" is disabled (i.e. `semodule -DB`). Afterward, this denial is logged: type=AVC msg=audit(1447694151.916:305): avc: denied { execute } for pid=1258 comm="bash" name="initdb" dev="dm-1" ino=25684747 scontext=staff_u:sysadm_r:sysadm_t:s0-s0:c0.c1023 tcontext=system_u:object_r:postgresql_exec_t:s0 tclass=file