Bug 1271209 - add file context for /usr/libexec/mock/mock
add file context for /usr/libexec/mock/mock
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: selinux-policy (Show other bugs)
All Linux
medium Severity low
: rc
: ---
Assigned To: Lukas Vrabec
Milos Malik
Depends On: 1270972 1271211
Blocks: 1246810
  Show dependency treegraph
Reported: 2015-10-13 07:46 EDT by Miroslav Suchý
Modified: 2016-11-03 22:23 EDT (History)
7 users (show)

See Also:
Fixed In Version: selinux-policy-3.13.1-93.el7
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: 1270972
Last Closed: 2016-11-03 22:23:13 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Miroslav Suchý 2015-10-13 07:46:08 EDT
+++ This bug was initially created as a clone of Bug #1270972 +++

Description of problem:
In bug 1246810 we are thinking about moving /usr/sbin/mock to /usr/libexec/mock/mock. But before we do that, we need to have correct selinux context for /usr/libexec/mock/mock.

Can you please add new selinux file context for:
and make it the same type as file

However we will need this on all platforms where mock run: all Fedoras, EL6 and EL7.
Is this possible?

--- Additional comment from Miroslav Grepl on 2015-10-13 07:36:00 EDT ---

Thank you for this info.

Could you create clone bugs for RHELs?

--- Additional comment from Miroslav Grepl on 2015-10-13 07:39:20 EDT ---

Comment 2 Mike McCune 2016-03-28 18:59:28 EDT
This bug was accidentally moved from POST to MODIFIED via an error in automation, please see mmccune@redhat.com with any questions
Comment 7 Miroslav Suchý 2016-04-27 02:24:17 EDT
The test is IMHO incorrect. Mock does not yet have the script in /usr/libexec/mock/mock. The script can be moved only and only after the selinux policy will change.
So you cannot test functionality of mock per se.

Test should be as simple as
  touch /usr/libexec/mock/mock
  ls -lZ /usr/libexec/mock/mock
  ls -lZ /usr/sbin/mock
and compare that those files have identical selinux context.
Comment 8 Milos Malik 2016-04-27 02:37:43 EDT
Both files have the same context:

# matchpathcon /usr/libexec/mock/mock
/usr/libexec/mock/mock	system_u:object_r:mock_exec_t:s0
# matchpathcon /usr/sbin/mock
/usr/sbin/mock	system_u:object_r:mock_exec_t:s0

There are several transitions into the mock_t domain. I chose one of them (staff_t, one of the confined users) and the AVCs were results of running the mock program in that domain:

# sesearch -t mock_exec_t -T
Found 5 semantic te rules:
   type_transition staff_consolehelper_t mock_exec_t : process mock_t; 
   type_transition abrt_retrace_worker_t mock_exec_t : process mock_t; 
   type_transition rhev_agentd_consolehelper_t mock_exec_t : process mock_t; 
   type_transition realmd_consolehelper_t mock_exec_t : process mock_t; 
   type_transition staff_t mock_exec_t : process mock_t; 
# rpm -qa selinux-policy\*
Comment 13 Lukas Vrabec 2016-07-11 11:05:20 EDT
Could you run it in permissive mode? 

Thank you.
Comment 14 Miroslav Grepl 2016-07-12 04:04:20 EDT
I believe you will need to run it also with

semodule -DB

to collect all needed AVCs.
Comment 16 Lukas Vrabec 2016-07-12 09:15:27 EDT
This is weird, that you don't catch AVCs from comment 12. 

Could you create local policy to check if it working with these rules? 

Thank you!
Comment 24 Miroslav Suchý 2016-08-08 13:29:43 EDT
Hmm what does it mean? That mock_t is trying to open /etc/pki/nssdb/key4.db? This seems to do urlgrabber, which should be ok. Does this happen when urlgrabber is trying to access https pages? Or I am reading the logs incorrectly?
Comment 25 Milos Malik 2016-08-09 03:07:37 EDT
The AVCs mentioned in comment#22 are generated by urlgrabber (comm=urlgrabber-ext-), but the urlgrabber process still runs under mock_t, because transition from mock_t to rpm_t (yum) is not allowed. If it was allowed then urlgrabber would run under the same context as yum and everything would be fine.
Comment 26 Miroslav Grepl 2016-08-09 04:36:14 EDT
I don't see a way for this transition. There is no rpm_exec_t labeling for urlgrabber.
Comment 27 Miroslav Grepl 2016-08-09 04:40:09 EDT
does it work correctly though AVC msgs.
Comment 32 errata-xmlrpc 2016-11-03 22:23:13 EDT
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.


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