Re: Livecd-creator is disabling selinux

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



[Moving this to the libguestfs mailing list]

On Mon, Jan 13, 2014 at 03:05:14PM -0500, Daniel J Walsh wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> On 01/13/2014 11:49 AM, Richard W.M. Jones wrote:
> > On Mon, Jan 13, 2014 at 10:20:22AM -0500, Daniel J Walsh wrote:
> >> Secondly we prevent even unconfined_t from putting down labels on the
> >> file system that the kernel does not understand.  IE If I am building a
> >> F21 image on a RHEL6 box, it would blow up in enforcing mode if run as
> >> unconfined_t.  We added a special policy called livecd_t that is allowed
> >> to put down labels which the kernel does not understand, and unconfined_t
> >> will transition to this domain.
> > 
> > Slightly off-topic, but this (in-)ability to label files with labels which
> > the kernel doesn't know about affects libguestfs negatively too. Is there
> > some reason why it's bad?
>
> Well we could add a label to libguestfs to allow these labels.  From
> the running kernel point of view you end up with unlabeled_t.

I think it's more complex with libguestfs because of the appliance,
and because libguestfs normally runs with SELinux disabled inside the
appliance.

  [Note to peanut gallery: libguestfs uses and endorses SELinux and
  sVirt to implement containment of qemu *in the host*.  The above
  applies only to the appliance.]

I know you wrote a good blog posting and we have a (very very old)
open bug to fix libguestfs's SELinux support:

  https://bugzilla.redhat.com/show_bug.cgi?id=554829

After thinking about this for some years and Pino Toscano implementing
a new & useful copy-attributes API in libguestfs, I think what we
really want is to copy security.selinux xattr from one file to
another.  This gives us almost all we need, doesn't require us to run
loadpolicy, and should work independent of guest policy.

Luckily for us ... it works!

  $ virt-builder fedora-20
  $ guestfish -a fedora-20.img -i
  ><fs> getxattrs /etc/shadow
  [0] = {
    attrname: security.selinux
    attrval: system_u:object_r:shadow_t:s0\x00
  }
  ><fs> cp /etc/shadow /etc/shadow.copy
  ><fs> setxattr security.selinux system_u:object_r:shadow_t:s0 29 /etc/shadow.copy 
  ><fs> getxattrs /etc/shadow.copy [0] = {
    attrname: security.selinux
    attrval: system_u:object_r:shadow_t:s0
  }

Is this expected?  Are we bypassing the kernel/SELinux in some way?
Note that the libguestfs appliance kernel doesn't (AFAIK) know about
the system_u:object_r:shadow_t:s0 label.

> We also would like to prevent users from making mistakes like
> assigning httpd_t to a file when it is a process type.
>
> SELinux is going to check before you put the label down unless you have the
> mac_admin capability.

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Fedora Windows cross-compiler. Compile Windows programs, test, and
build Windows installers. Over 100 libraries supported.
http://fedoraproject.org/wiki/MinGW
-- 
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxxx
https://admin.fedoraproject.org/mailman/listinfo/devel
Fedora Code of Conduct: http://fedoraproject.org/code-of-conduct





[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Fedora Announce]     [Fedora Kernel]     [Fedora Testing]     [Fedora Formulas]     [Fedora PHP Devel]     [Kernel Development]     [Fedora Legacy]     [Fedora Maintainers]     [Fedora Desktop]     [PAM]     [Red Hat Development]     [Gimp]     [Yosemite News]
  Powered by Linux