Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
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 1340572

Summary: Policy for "ip netns add" should cover dirs, not just files
Product: Red Hat Enterprise Linux 7 Reporter: Garrett Holmstrom <gholms>
Component: selinux-policyAssignee: Lukas Vrabec <lvrabec>
Status: CLOSED ERRATA QA Contact: Milos Malik <mmalik>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.2CC: lvrabec, mgrepl, mmalik, plautrba, pvrabec, ssekidde
Target Milestone: rc   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: selinux-policy-3.13.1-76.el7 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1340952 (view as bug list) Environment:
Last Closed: 2016-11-04 02:29:59 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: 1340952    

Description Garrett Holmstrom 2016-05-27 23:36:11 UTC
Description of problem:
There appears to be policy written to handle the way ``ip netns add foo'' handles mounting, but it is only for files, not directories:

    allow ifconfig_t ifconfig_var_run_t:file mounton;

This policy should cover directories as well, as running the command above fails with the following audit messages:

type=EXECVE msg=audit(1464390580.741:115465): argc=4 a0="ip" a1="netns" a2="add" a3="foo"
type=CWD msg=audit(1464390580.741:115465):  cwd="/"
type=PATH msg=audit(1464390580.741:115465): item=0 name="/usr/sbin/ip" inode=671152156 dev=fd:00 mode=0100755 ouid=0 ogid=0 rdev=00:00 obj=system_u:object_r:ifconfig_exec_t:s0 objtype=NORMAL
type=PATH msg=audit(1464390580.741:115465): item=1 name="/lib64/ld-linux-x86-64.so.2" inode=134225977 dev=fd:00 mode=0100755 ouid=0 ogid=0 rdev=00:00 obj=system_u:object_r:ld_so_t:s0 objtype=NORMAL
type=AVC msg=audit(1464390580.742:115466): avc:  denied  { mounton } for  pid=6336 comm="ip" path="/run/netns" dev="tmpfs" ino=144036 scontext=system_u:system_r:ifconfig_t:s0 tcontext=system_u:object_r:ifconfig_var_run_t:s0 tclass=dir
type=SYSCALL msg=audit(1464390580.742:115466): arch=c000003e syscall=165 success=no exit=-22 a0=440894 a1=43b3ea a2=43c5ed a3=104000 items=2 ppid=1064 pid=6336 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)
type=CWD msg=audit(1464390580.742:115466):  cwd="/"
type=PATH msg=audit(1464390580.742:115466): item=0 name="/var/run/netns" objtype=UNKNOWN
type=PATH msg=audit(1464390580.742:115466): item=1 name="/var/run/netns" inode=144036 dev=00:12 mode=040755 ouid=0 ogid=0 rdev=00:00 obj=system_u:object_r:ifconfig_var_run_t:s0 objtype=NORMAL


Version-Release number of selected component (if applicable):
iproute-3.10.0-54.el7.x86_64
selinux-policy-3.13.1-60.el7_2.3.noarch


How reproducible:
When enforcing


Steps to Reproduce:
1. setenforce 1
2. ip netns add foo
3. ip netns list


Actual results:
mount --make-shared /var/run/netns failed: Permission denied


Expected results:
foo

Comment 6 errata-xmlrpc 2016-11-04 02:29:59 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