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 838347 - 3.1 vdsm-created /etc/sysconfig/network-scripts/ifcfg-* have bad selinux context
Summary: 3.1 vdsm-created /etc/sysconfig/network-scripts/ifcfg-* have bad selinux context
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: vdsm
Version: 6.3
Hardware: Unspecified
OS: Linux
medium
medium
Target Milestone: rc
: ---
Assignee: Dan Kenigsberg
QA Contact: Meni Yakove
URL:
Whiteboard: network
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2012-07-08 16:17 UTC by Dan Kenigsberg
Modified: 2022-07-09 05:36 UTC (History)
12 users (show)

Fixed In Version: vdsm-4.9.6-32.0
Doc Type: Bug Fix
Doc Text:
Previously, VDSM created files under /etc/sysconfig/network-scripts via sudo when configuring host networking. The files were created in the context of system_u:object_r:net_conf_t:s0 instead of system_u:object_r:bin_t:s0. This caused it to be impossible to acquire ip addresses via dhclient because the context mandated by SELinux was not provided. VDSM has been patched and now provides the context mandated by SELinux when creating ifcfg files.
Clone Of:
Environment:
Last Closed: 2012-12-04 19:02:12 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2012:1508 0 normal SHIPPED_LIVE Important: rhev-3.1.0 vdsm security, bug fix, and enhancement update 2012-12-04 23:48:05 UTC

Description Dan Kenigsberg 2012-07-08 16:17:40 UTC
Description of problem:
vdsm (system_u:system_r:virtd_t:s0-s0:c0.c1023) creates files under /etc/sysconfig/network-scripts via sudo, to configure host networking. They are created system_u:object_r:net_conf_t:s0 instead of system_u:object_r:bin_t:s0.

vdsm also calls /sbin/ifup via sudo.

This leads to errors like

avc:  denied  { getattr } for  pid=3273 comm="dhclient-script" path="/etc/sysconfig/network-scripts/ifcfg-ovirtmgmt" dev=dm-0 ino=1044497 scontext=unconfined_u:system_r:dhcpc_t:s0 tcontext=unconfined_u:object_r:virt_var_lib_t:s0 tclass=file

I suspect this would lead to failures to acquire ip address via dhclient.

Version-Release number of selected component (if applicable):
selinux-policy-3.7.19-155.el6_3.noarch

How reproducible:
100%

Steps to Reproduce:
1. edit host networking via vdsm
  
Actual results:
# ls -lZ /etc/sysconfig/network-scripts/ifcfg-eth0 
-rw-rw-r--. vdsm root unconfined_u:object_r:virt_var_lib_t:s0 /etc/sysconfig/network-scripts/ifcfg-eth0


Expected results:
-rw-r--r--. root root system_u:object_r:net_conf_t:s0  /etc/sysconfig/network-scripts/ifcfg-lo

Comment 1 Daniel Walsh 2012-07-11 01:54:37 UTC
How does this script create the files?  It looks like it creates them in /var/lib/libvirt and then mv's them into place.  It is probably best if the tool would just execute restorecon after it moves the files into place.

restorecon /etc/sysconfig/network-scripts/ifcfg-eth0 /etc/sysconfig/network-scripts/ifcfg-lo /etc/sysconfig/network-scripts/ifcfg-ovirtmgmt

Comment 2 Dan Kenigsberg 2012-07-23 09:30:07 UTC
Ok, we'll take it to vdsm. Thanks.

http://gerrit.ovirt.org/6489/

Comment 3 Dan Kenigsberg 2012-08-26 18:28:42 UTC
Patch of comment #2 has been abandoned due to a complete overhaul of relevant function. The following patch is what I suggest instead:

http://gerrit.ovirt.org/7478

Comment 5 Meni Yakove 2012-09-05 13:36:11 UTC
Verified on vdsm-4.9.6-32.0.el6_3.x86_64

-rw-rw-r--. root root system_u:object_r:net_conf_t:s0  ifcfg-eth0

Comment 8 errata-xmlrpc 2012-12-04 19:02:12 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.

http://rhn.redhat.com/errata/RHSA-2012-1508.html


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