Bug 1152825 - virt-rescue --selinux can not work well, when enable selinux in the command line the value of 'getenforce' is still Disabled in virt-rescue appliance
Summary: virt-rescue --selinux can not work well, when enable selinux in the command l...
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: libguestfs
Version: 7.1
Hardware: Unspecified
OS: Unspecified
medium
low
Target Milestone: rc
: ---
Assignee: Richard W.M. Jones
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On:
Blocks: 1152832 1288337 1301891
TreeView+ depends on / blocked
 
Reported: 2014-10-15 03:19 UTC by Lingfei Kong
Modified: 2016-07-14 14:50 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
: 1152832 (view as bug list)
Environment:
Last Closed: 2016-07-14 14:50:15 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Lingfei Kong 2014-10-15 03:19:33 UTC
Description of problem:
virt-rescue --selinux can not work well, when enable selinux in the command line the value of 'getenforce' is still Disabled in virt-rescue appliance


Version-Release number of selected component (if applicable):
libguestfs-1.27.62-1.1.el7


How reproducible:
100%


Steps to Reproduce:
1. Get a rhel guest image: rhel.img
2. #virt-rescue --selinux -a rhel.img
><rescue> getenforce
Disabled
><rescue> ls -Z /
lrwxrwxrwx root root ?                                bin -> usr/bin
dr-xr-xr-x root root ?                                boot
drwxr-xr-x root root ?                                dev
drwxr-xr-x root root ?                                etc


Actual results:
#virt-rescue --selinux -a rhel.img
><rescue> getenforce
Disabled
><rescue> ls -Z /
lrwxrwxrwx root root ?                                bin -> usr/bin
dr-xr-xr-x root root ?                                boot
drwxr-xr-x root root ?                                dev
drwxr-xr-x root root ?                                etc


Expected results:
selinux should be enabled in virt-rescue appliance and works well


Additional info:

Comment 1 Pino Toscano 2014-10-17 09:03:00 UTC
SELinux is never enabled in enforcing mode within the appliance. Doing so would possibly result in conflicts between the kernel and enforced policy within the appliance (which is usually a copy of the host system) and the SELinux attributes possibly set in file systems of guests. Because of this, in recent versions we had to disable SELinux completely in virt-builder and virt-customize.

Thus I don't agree "enabling SELinux" should also make it enforcing, since it might lead to unusable tools.

Comment 2 Lingfei Kong 2014-10-17 10:17:03 UTC
(In reply to Pino Toscano from comment #1)
> SELinux is never enabled in enforcing mode within the appliance. Doing so
> would possibly result in conflicts between the kernel and enforced policy
> within the appliance (which is usually a copy of the host system) and the
> SELinux attributes possibly set in file systems of guests. Because of this,
> in recent versions we had to disable SELinux completely in virt-builder and
> virt-customize.
> 
> Thus I don't agree "enabling SELinux" should also make it enforcing, since
> it might lead to unusable tools.

Thanks, i agree with you. If virt-rescue will never enable selinux then the --selinux option should removed from the man page or at least add some text to describe it.


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