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.
Bug 1825957 - SELinux is preventing PCP's PostgreSQL PMDA to collect metrics
Summary: SELinux is preventing PCP's PostgreSQL PMDA to collect metrics
Keywords:
Status: CLOSED DUPLICATE of bug 1792971
Alias: None
Product: Red Hat Enterprise Linux 8
Classification: Red Hat
Component: pcp
Version: 8.2
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: rc
: 8.0
Assignee: Mark Goodwin
QA Contact: Jan Kurik
URL:
Whiteboard:
: 1835161 (view as bug list)
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2020-04-20 15:03 UTC by Jan Kurik
Modified: 2021-09-17 12:48 UTC (History)
5 users (show)

Fixed In Version: pcp-5.1.1
Doc Type: No Doc Update
Doc Text:
Clone Of:
Environment:
Last Closed: 2020-05-05 02:49:51 UTC
Type: Bug
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Jan Kurik 2020-04-20 15:03:37 UTC
Description of problem:
After installation of pcp-pmda-postgresql this PMDA does not collect statistics from a PostgreSQL instance due to a SELinux issue.

Version-Release number of selected component (if applicable):
pcp-5.0.2-5.el8
selinux-policy-3.14.3-41.el8

How reproducible:
Always

Steps to Reproduce:
1. Install RHEL-8.2 release
2. Install RPMs of pcp, pcp-pmda-postgresql, postgresql-server
3. Start the postgresql server and pmcd
4. Install PMDA
# cd /var/lib/pcp/pmdas/postgresql
# ./Install

Actual results:
* Installation throws errors:
[Mon Apr 20 10:21:08] pmdapostgresql(87409) Info: Connecting to host 'local', port '5432', db 'postgres' as user 'postgres'
[Mon Apr 20 10:21:08] pmdapostgresql(87409) Info: Error connecting to db postgres as user postgres: could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?

* Only one postgres metric is reported as active after the installation:
Check postgresql metrics have appeared ... 1 warnings, 1 metrics and 0 values

* /var/log/pcp/pmcd/postgresql.log contains error messages:
[Mon Apr 20 10:56:23] pmdapostgresql(64495) Info: Error connecting to db postgres as user postgres: could not connect to server: Permission denied
Is the server running locally and accepting
connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?

* "ausearch -m AVC" reports AVCs
type=AVC msg=audit(04/20/2020 10:15:43.559:1167) : avc:  denied  { write } for  pid=71727 comm=python3 name=.s.PGSQL.5432 dev="tmpfs" ino=66228 scontext=system_u:system_r:pcp_pmcd_t:s0tcontext=system_u:object_r:postgresql_var_run_t:s0 tclass=sock_file permissive=0 

* after the PMDA installation "pminfo -f postgresql" fails with an error message
postgresql: pmLookupName: No PMCD agent for domain of request

* "audit2allow -a" reports the following missing SELinux rule:
#============= pcp_pmcd_t ==============
allow pcp_pmcd_t postgresql_var_run_t:sock_file write;



Expected results:
* No AVC errors reported
* No error messages during the installation
* Collection of statistics works and "pminfo -f postgresql" shows real values.

Comment 1 Mark Goodwin 2020-05-01 05:42:04 UTC
Fixed upstream for pcp-5.1.1

commit b092126f0eb39065ab0e4072e2c93c5f356025dc
Author: Mark Goodwin <mgoodwin>
Date:   Fri May 1 15:34:49 2020 +1000

    selinux: fix AVC for pmdapostgresql socket write, plus QA
    
    RHBZ#1825957
    allow pcp_pmcd_t postgresql_var_run_t:sock_file write;
    
    Also update qa/917

Comment 3 Mark Goodwin 2020-05-13 10:12:37 UTC
*** Bug 1835161 has been marked as a duplicate of this bug. ***

Comment 4 Jan Kurik 2020-06-12 15:54:57 UTC
Verified on pcp-5.1.1-2.el8 build.


Note You need to log in before you can comment on or make changes to this bug.