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 1292318 - SELinux is preventing /usr/sbin/ip from mounton access on the directory /.
Summary: SELinux is preventing /usr/sbin/ip from mounton access on the directory /.
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: selinux-policy
Version: 7.1
Hardware: x86_64
OS: Linux
medium
medium
Target Milestone: rc
: ---
Assignee: Lukas Vrabec
QA Contact: Milos Malik
URL:
Whiteboard:
Depends On:
Blocks: 1301700
TreeView+ depends on / blocked
 
Reported: 2015-12-17 02:53 UTC by Britt Houser
Modified: 2016-11-04 02:26 UTC (History)
8 users (show)

Fixed In Version: selinux-policy-3.13.1-80.el7
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2016-11-04 02:26:23 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
Output of sealert (2.29 KB, text/plain)
2015-12-17 12:04 UTC, Britt Houser
no flags Details


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2016:2283 0 normal SHIPPED_LIVE selinux-policy bug fix and enhancement update 2016-11-03 13:36:25 UTC

Description Britt Houser 2015-12-17 02:53:11 UTC
Description of problem:

As part of adding an interface to a running container, we execute the following command:
  ip netns exec $pid ip link set dev mgmt-in name mgmt

When that command is executed, SELinux kicks in and the following entries are see in audit.log

type=AVC msg=audit(1450281422.633:9548): avc:  denied  { mounton } for  pid=56100 comm="ip" path="/" dev="dm-1" ino=128 scontext=system_u:system_r:ifconfig_t:s0 tcontext=system_u:object_r:root_t:s0 tclass=dir

type=SYSCALL msg=audit(1450281422.633:9548): arch=x86_64 syscall=mount success=yes exit=0 a0=43c4d4 a1=4372cf a2=43838d a3=84000 items=0 ppid=56063 pid=56100 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=4294967295 comm=ip exe=/usr/sbin/ip subj=system_u:system_r:ifconfig_t:s0 key=(null)


Version-Release number of selected component (if applicable):
# rpm -qa | grep selinux
selinux-policy-targeted-3.13.1-23.el7.noarch
docker-selinux-1.8.2-7.el7.x86_64
selinux-policy-3.13.1-23.el7.noarch

How reproducible:
Every time

Steps to Reproduce:
1. Launch a container with net=none
2. Add interface
pid=$(docker inspect -f '{{.State.Pid}}' `docker ps -a |  grep my_container  | awk '{print $1}'`)
ip link add mgmt-out type veth peer name mgmt-in
ip link set mgmt-out up
ip link set mgmt-in netns $pid
ip netns exec $pid ip link set dev mgmt-in name mgmt

Actual results:

type=AVC msg=audit(1450281422.633:9548): avc:  denied  { mounton } for  pid=56100 comm="ip" path="/" dev="dm-1" ino=128 scontext=system_u:system_r:ifconfig_t:s0 tcontext=system_u:object_r:root_t:s0 tclass=dir

type=SYSCALL msg=audit(1450281422.633:9548): arch=x86_64 syscall=mount success=yes exit=0 a0=43c4d4 a1=4372cf a2=43838d a3=84000 items=0 ppid=56063 pid=56100 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=4294967295 comm=ip exe=/usr/sbin/ip subj=system_u:system_r:ifconfig_t:s0 key=(null)


Expected results:
NO SELinux violations

Additional info:

Comment 2 Britt Houser 2015-12-17 12:04:44 UTC
Created attachment 1106714 [details]
Output of sealert

Comment 3 Britt Houser 2015-12-17 12:25:15 UTC
Just for t-shooting, I also upgraded to rhel7.2 packaging, but still see the violation:

# rpm -qa | grep selinux
libselinux-python-2.2.2-6.el7.x86_64
libselinux-2.2.2-6.el7.x86_64
libselinux-utils-2.2.2-6.el7.x86_64
selinux-policy-3.13.1-60.el7.noarch
docker-selinux-1.8.2-10.el7.x86_64
selinux-policy-targeted-3.13.1-60.el7.noarch

Comment 4 Miroslav Grepl 2016-01-04 12:37:33 UTC
Where is 

"ip netns exec $pid ip link set dev mgmt-in name mgmt"

placed?

Thank you.

Comment 5 Britt Houser 2016-01-04 14:14:22 UTC
The "ip netns exec $pid ip link set dev mgmt-in name mgmt" command is executed outside of the container namespace.  Is that what you're asking?

Comment 9 errata-xmlrpc 2016-11-04 02:26:23 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, 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


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