Bug 1262909

Summary: SELinux is preventing PCP's PostgreSQL PMDA to collect metrics
Product: [Fedora] Fedora Reporter: Tadej Janež <tadej.j>
Component: selinux-policyAssignee: Lukas Vrabec <lvrabec>
Status: CLOSED EOL QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: medium    
Version: 22CC: dominick.grift, dwalsh, lvrabec, mgrepl, plautrba
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-07-19 20:37:41 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:

Description Tadej Janež 2015-09-14 15:20:11 UTC
Description of problem:
Current SELinux policy is preventing the Performance Metrics Domain Agent (PMDA) for PostgreSQL (part of the Performance Co-Pilot (PCP) suite) access to PostgreSQL's metrics.

Version-Release number of selected components:
selinux-policy-targeted-3.13.1-128.12.fc22.noarch
pcp-pmda-postgresql-3.10.6-1.fc22.x86_64
postgresql-server-9.4.4-1.fc22.x86_64

How reproducible:
Always.

Steps to Reproduce:
1. sudo dnf install postgresql-server
2. sudo postgresql-setup --initdb
3. sudo systemctl enable postgresql.service
4. sudo systemctl restart postgresql.service
5. sudo dnf install "perl(DBI)" "perl(DBD::Pg)" pcp-collector
6. sudo touch /var/lib/pcp/pmdas/postgresql/.NeedInstall
7. sudo systemctl restart pmcd.service
8. sudo pmval postgresql.stat.database.blks_read

Actual results:
[root@collector vagrant]# pmval postgresql.stat.database.blks_read

metric:    postgresql.stat.database.blks_read
host:      collector
semantics: cumulative counter (converting to rate)
units:     count (converting to count / sec)
samples:   all
No values available
No values available
No values available

The relevant lines from /var/log/audit/audit.log:
type=AVC msg=audit(1442243822.349:478): avc:  denied  { search } for  pid=491 comm="perl" name="pgsql" dev="sda1" ino=15399 scontext=system_u:system_r:pcp_pmcd_t:s0 tcontext=system_u:object_r:postgresql_db_t:s0 tclass=dir permissive=0
type=AVC msg=audit(1442243822.349:479): avc:  denied  { write } for  pid=491 comm="perl" name=".s.PGSQL.5432" dev="tmpfs" ino=13323 scontext=system_u:system_r:pcp_pmcd_t:s0 tcontext=system_u:object_r:postgresql_var_run_t:s0 tclass=sock_file permissive=0
type=AVC msg=audit(1442243837.356:482): avc:  denied  { connectto } for  pid=491 comm="perl" path="/run/postgresql/.s.PGSQL.5432" scontext=system_u:system_r:pcp_pmcd_t:s0 tcontext=system_u:system_r:postgresql_t:s0 tclass=unix_stream_socket permissive=1

Expected results:
[root@collector vagrant]# pmval postgresql.stat.database.blks_read

metric:    postgresql.stat.database.blks_read
host:      collector
semantics: cumulative counter (converting to rate)
units:     count (converting to count / sec)
samples:   all

  template1   template0    postgres 
     0.0         0.0         0.0    
     0.0         0.0         0.0    
     0.0         0.0         0.0

Comment 1 Fedora End Of Life 2016-07-19 20:37:41 UTC
Fedora 22 changed to end-of-life (EOL) status on 2016-07-19. Fedora 22 is
no longer maintained, which means that it will not receive any further
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this
bug.

Thank you for reporting this bug and we are sorry it could not be fixed.