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.
DescriptionMichele Baldessari
2021-03-16 17:00:27 UTC
Description of problem:
The context here is that we're adding BGP support to OSP via a container that runs the network daemons (FRR). We've noticed the following denials when we start (and only at start time) of the container:
type=AVC msg=audit(1615820022.436:5242): avc: denied { read } for pid=17999 comm="zebra" dev="nsfs" ino=4026531992 scontext=system_u:system_r:container_t:s0:c479,c590
tcontext=system_u:system_r:NetworkManager_t:s0 tclass=file permissive=0
type=AVC msg=audit(1615820022.436:5243): avc: denied { read } for pid=17999 comm="zebra" dev="nsfs" ino=4026531992 scontext=system_u:system_r:container_t:s0:c479,c590 tcontext=system_u:system_r:NetworkManager_t:s0 tclass=file permissive=0
type=AVC msg=audit(1615820022.598:5245): avc: denied { read } for pid=18015 comm="bgpd" dev="nsfs" ino=4026531992 scontext=system_u:system_r:container_t:s0:c479,c590 tcontext=system_u:system_r:NetworkManager_t:s0 tclass=file permissive=0
type=AVC msg=audit(1615820022.783:5246): avc: denied { read } for pid=18024 comm="staticd" dev="nsfs" ino=4026531992 scontext=system_u:system_r:container_t:s0:c479,c590 tcontext=system_u:system_r:NetworkManager_t:s0 tclass=file permissive=0
type=AVC msg=audit(1615820022.922:5247): avc: denied { read } for pid=18029 comm="bfdd" dev="nsfs" ino=4026531992 scontext=system_u:system_r:container_t:s0:c479,c590 tcontext=system_u:system_r:NetworkManager_t:s0 tclass=file permissive=0
I dug a bit more and the inode 4026531992 is the inode backing the fd of the default network namespace:
[root@localhost ~]# ls -l /proc/1/ns/net
lrwxrwxrwx. 1 root root 0 Mar 16 12:51 /proc/1/ns/net -> 'net:[4026531992]'
I can replicate the issue with a small program that only calls open("/proc/self/ns/net") or more simply with 'cat /proc/self/ns/net' (cat makes no sense on a socket and will return 'Invalid argument' when not denied, but it makes thing simpler to reproduce):
podman run -it --net=host --cap-add NET_BIND_SERVICE --cap-add NET_RAW --cap-add NET_ADMIN --cap-add SYS_ADMIN -u root quay.io/cloudbgp/openstack-frr:7.5 sh -c 'cat /proc/self/ns/net'
This triggers:
type=AVC msg=audit(1615913490.269:274): avc: denied { read } for pid=17361 comm="cat" dev="nsfs" ino=4026531992 scontext=system_u:system_r:container_t:s0:c255,c654 tcontext=system_u:system_r:NetworkManager_t:s0 tclass=file permissive=0
Version-Release number of selected component (if applicable):
[root@localhost ~]# rpm -q podman container-selinux runc selinux-policy
podman-3.0.1-3.module+el8.4.0+10197+7c295612.x86_64
container-selinux-2.158.0-1.module+el8.4.0+10197+7c295612.noarch
runc-1.0.0-70.rc92.module+el8.4.0+10197+7c295612.x86_64
selinux-policy-3.14.3-65.el8.noarch
This is RHEL-8.4-beta1 with container-tools:3.0
How reproducible:
100%
Additional Info:
1) As soon as I do a "systemctl disable --now NetworkManager" there are no denials at all
2) This works when using --privileged but we'd like to avoid that for obvious reasons. Also CAP_SYS_ADMIN should be enough in this case? (Since it allows setns() calls)
3) This reproducer, for a reason yet not clear to me, shows no denied AVCs on Fedora 33
4) The code in FRR that is likely triggering this denial is here:
https://github.com/FRRouting/frr/blob/master/lib/netns_linux.c#L105
You should just disable SELinux for this container if you need to interact with the networkmanager on the host. We are not going to allow this in default selinux-policy
--security-opt label=disable
Comment 4Michele Baldessari
2021-03-27 10:45:25 UTC
(In reply to Daniel Walsh from comment #3)
> You should just disable SELinux for this container if you need to interact
> with the networkmanager on the host.
I do not need to interact with NM on the host. But NM on the host took over /proc/self/ns/net
> We are not going to allow this in
> default selinux-policy
>
> --security-opt label=disable
Then I guess RHEL9/Fedora are allowing more than they should, since it works just fine there.
No in those cases /proc/self/ns/net is not controlled by networkmanager_t.
podman run -ti --rm fedora ls -lZ /proc/self/ns/net
lrwxrwxrwx. 1 root root system_u:system_r:container_t:s0:c759,c952 0 Mar 28 11:07 /proc/self/ns/net -> 'net:[4026534657]'
Description of problem: The context here is that we're adding BGP support to OSP via a container that runs the network daemons (FRR). We've noticed the following denials when we start (and only at start time) of the container: type=AVC msg=audit(1615820022.436:5242): avc: denied { read } for pid=17999 comm="zebra" dev="nsfs" ino=4026531992 scontext=system_u:system_r:container_t:s0:c479,c590 tcontext=system_u:system_r:NetworkManager_t:s0 tclass=file permissive=0 type=AVC msg=audit(1615820022.436:5243): avc: denied { read } for pid=17999 comm="zebra" dev="nsfs" ino=4026531992 scontext=system_u:system_r:container_t:s0:c479,c590 tcontext=system_u:system_r:NetworkManager_t:s0 tclass=file permissive=0 type=AVC msg=audit(1615820022.598:5245): avc: denied { read } for pid=18015 comm="bgpd" dev="nsfs" ino=4026531992 scontext=system_u:system_r:container_t:s0:c479,c590 tcontext=system_u:system_r:NetworkManager_t:s0 tclass=file permissive=0 type=AVC msg=audit(1615820022.783:5246): avc: denied { read } for pid=18024 comm="staticd" dev="nsfs" ino=4026531992 scontext=system_u:system_r:container_t:s0:c479,c590 tcontext=system_u:system_r:NetworkManager_t:s0 tclass=file permissive=0 type=AVC msg=audit(1615820022.922:5247): avc: denied { read } for pid=18029 comm="bfdd" dev="nsfs" ino=4026531992 scontext=system_u:system_r:container_t:s0:c479,c590 tcontext=system_u:system_r:NetworkManager_t:s0 tclass=file permissive=0 I dug a bit more and the inode 4026531992 is the inode backing the fd of the default network namespace: [root@localhost ~]# ls -l /proc/1/ns/net lrwxrwxrwx. 1 root root 0 Mar 16 12:51 /proc/1/ns/net -> 'net:[4026531992]' I can replicate the issue with a small program that only calls open("/proc/self/ns/net") or more simply with 'cat /proc/self/ns/net' (cat makes no sense on a socket and will return 'Invalid argument' when not denied, but it makes thing simpler to reproduce): podman run -it --net=host --cap-add NET_BIND_SERVICE --cap-add NET_RAW --cap-add NET_ADMIN --cap-add SYS_ADMIN -u root quay.io/cloudbgp/openstack-frr:7.5 sh -c 'cat /proc/self/ns/net' This triggers: type=AVC msg=audit(1615913490.269:274): avc: denied { read } for pid=17361 comm="cat" dev="nsfs" ino=4026531992 scontext=system_u:system_r:container_t:s0:c255,c654 tcontext=system_u:system_r:NetworkManager_t:s0 tclass=file permissive=0 Version-Release number of selected component (if applicable): [root@localhost ~]# rpm -q podman container-selinux runc selinux-policy podman-3.0.1-3.module+el8.4.0+10197+7c295612.x86_64 container-selinux-2.158.0-1.module+el8.4.0+10197+7c295612.noarch runc-1.0.0-70.rc92.module+el8.4.0+10197+7c295612.x86_64 selinux-policy-3.14.3-65.el8.noarch This is RHEL-8.4-beta1 with container-tools:3.0 How reproducible: 100% Additional Info: 1) As soon as I do a "systemctl disable --now NetworkManager" there are no denials at all 2) This works when using --privileged but we'd like to avoid that for obvious reasons. Also CAP_SYS_ADMIN should be enough in this case? (Since it allows setns() calls) 3) This reproducer, for a reason yet not clear to me, shows no denied AVCs on Fedora 33 4) The code in FRR that is likely triggering this denial is here: https://github.com/FRRouting/frr/blob/master/lib/netns_linux.c#L105