Bug 1282543
| Summary: | Confined users cannot run postgresql-setup | ||
|---|---|---|---|
| Product: | Red Hat Enterprise Linux 7 | Reporter: | Dustin C. Hatch <dustin> |
| Component: | selinux-policy | Assignee: | Lukas Vrabec <lvrabec> |
| Status: | CLOSED ERRATA | QA Contact: | Jan Zarsky <jzarsky> |
| Severity: | medium | Docs Contact: | |
| Priority: | medium | ||
| Version: | 7.1 | CC: | bressers, jzarsky, lvrabec, mgrepl, mmalik, plautrba, pvrabec, ssekidde |
| Target Milestone: | rc | Keywords: | FutureFeature |
| Target Release: | --- | ||
| Hardware: | All | ||
| OS: | Linux | ||
| Whiteboard: | |||
| Fixed In Version: | selinux-policy-3.13.1-81.el7 | Doc Type: | Enhancement |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2016-11-04 02:24:36 UTC | Type: | Bug |
| Regression: | --- | Mount Type: | --- |
| Documentation: | --- | CRM: | |
| Verified Versions: | Category: | --- | |
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
| Cloudforms Team: | --- | Target Upstream Version: | |
| Embargoed: | |||
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