Bug 1749870

Summary: SELinux is preventing pcp-pmda-named from executing /usr/sbin/rndc
Product: Red Hat Enterprise Linux 7 Reporter: Jan Kurik <jkurik>
Component: pcpAssignee: Nathan Scott <nathans>
Status: CLOSED ERRATA QA Contact: Jan Kurik <jkurik>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 7.8CC: agerstmayr, jkurik, lmiksik, mgoodwin, nathans, patrickm
Target Milestone: rcKeywords: Bugfix, Triaged
Target Release: 7.9   
Hardware: All   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: No Doc Update
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-09-29 19:24:55 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:
Bug Depends On:    
Bug Blocks: 1782202    

Description Jan Kurik 2019-09-06 15:46:48 UTC
Description of problem:
pcp-pmda-named uses /usr/sbin/rndc to get data from named.
Unfortunately when pcp-pmda-named executes /usr/sbin/rndc the execution fails due to missing SELinux rule allowing the execution of rndc.


Version-Release number of selected component (if applicable):
pcp-4.3.2-6.el7.x86_64
selinux-policy-3.13.1-258.el7.noarch
pcp-selinux-4.3.2-6.el7.x86_64
pcp-pmda-named-4.3.2-6.el7.x86_64


How reproducible:
Always

Steps to Reproduce:
1. Install pcp with pcp-pmda-named
2. Install bind, bind-chroot, caching-nameserver, bind-utils packages
3. Configure bind as a caching nameserver
4. Start PCP as well as bind
5. Use i.e. "dig @127.0.0.1" to query DNS

Actual results:
Output of "audit2allow -a" shows:
<stdout>
#============= pcp_pmcd_t ==============
allow pcp_pmcd_t ndc_exec_t:file execute;
</stdout>

Expected results:
Output of "audit2allow -a" should be empty


Additional info:

Comment 5 Nathan Scott 2020-04-05 23:07:21 UTC
Hmm, strange - the policy patch definitely has these changes...

$ grep ndc_exec_t *
selinux-policy.patch:+  allow [pcp_pmcd_t] [ndc_exec_t] : [file] { execute };
selinux-policy.patch:+        type ndc_exec_t;
selinux-policy.patch:+allow pcp_pmcd_t ndc_exec_t:file execute;

Bit of a mystery - is the AVC exactly the same as before Jan?  Thanks.

Comment 6 Jan Kurik 2020-04-06 05:31:18 UTC
You are right Nathan, it is a different AVC. I am sorry for the confusion.

The AVC it is throwing now is:

# grep 'type=AVC ' /var/log/audit/audit.log | head -n 1
type=AVC msg=audit(1586150510.119:1454): avc:  denied  { execute_no_trans } for  pid=30473 comm="perl" path="/usr/sbin/rndc" dev="vda1" ino=7449669 scontext=system_u:system_r:pcp_pmcd_t:s0 tcontext=system_u:object_r:ndc_exec_t:s0 tclass=file permissive=0

# audit2allow -a
#============= pcp_pmcd_t ==============
allow pcp_pmcd_t ndc_exec_t:file execute_no_trans;


When I apply this ^^^ selinux rule, the test is then passing.
Should I open a new bug for this ?

Comment 7 Nathan Scott 2020-04-06 05:36:40 UTC
> Should I open a new bug for this ?

Yes please Jan.  Since its relatively low priority and readily worked around, let's aim for 7.10 for that one, unless there's some other need for a 7.9 rebuild.

Comment 8 Jan Kurik 2020-04-06 05:52:00 UTC
Here is the follow-up: BZ1821122

Comment 10 errata-xmlrpc 2020-09-29 19:24:55 UTC
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 (Low: pcp security, bug fix, and enhancement update), 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://access.redhat.com/errata/RHSA-2020:3869