Bug 1061064

Summary: Policy for ostree - needs mac_admin
Product: [Fedora] Fedora Reporter: Colin Walters <walters>
Component: selinux-policyAssignee: Miroslav Grepl <mgrepl>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: dominick.grift, dustymabe, dwalsh, james.antill, lvrabec, mattdm, mgrepl, walters
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-03-27 07:02:31 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:

Description Colin Walters 2014-02-04 10:31:41 UTC
OSTree is an atomic upgrade system that goes below RPM, but above block storage. Among other things, it was designed from the ground up for SELinux.

In order to work though, it needs "mac_admin", because the *new* chroot it's constructing may have contexts that don't exist in the *current* policy.  And that's a normal condition.

I think we should start with an ostree_t that's just unconfined_t + mac_admin.

Comment 1 Miroslav Grepl 2014-02-04 10:58:26 UTC
Yes, we will need to create a policy and allow mac_admin for it.

Comment 2 Daniel Walsh 2014-02-14 19:03:11 UTC
If you label your binaries as livecd_exec_t does everything work?

Comment 3 Colin Walters 2014-02-21 14:57:56 UTC
(In reply to Daniel Walsh from comment #2)
> If you label your binaries as livecd_exec_t does everything work?

It appears to work as is (run as unconfined_t) - except it will just blow up if an upgrade includes *new* labels not known by current policy =/

Is livecd_t already unconfined?  I need something that's like rpm_t except also with mac_admin.

Comment 4 Daniel Walsh 2014-02-21 21:25:10 UTC
Yes livecd_t is just an unconfined domain that will not transition and is allowed to put down "bad" labels.

Comment 5 Miroslav Grepl 2014-03-13 10:09:26 UTC
Colin,
you you test it with the latest rawhide build together with install_exec_t label?

Comment 6 Colin Walters 2014-03-26 22:56:33 UTC
(In reply to Miroslav Grepl from comment #5)
> Colin,
> you you test it with the latest rawhide build together with install_exec_t
> label?

That appears to work fine.  Also, can we give /usr/bin/rpm-ostree the same label?  Thanks!

Comment 7 Dusty Mabe 2014-07-27 16:52:54 UTC
As a user who hit this I'd like to copy some of the error output here so that others might find this bug and thus a solution/workaround sooner. The error I was seeing was the following:

[root@localhost yum.repos.d]# rpm -q ostree
ostree-2014.5.39.gd5e813c-3.fc22.x86_64
[root@localhost yum.repos.d]# ostree pull dustyserver fedora-atomic/rawhide/x86_64/base/core

error: fsetxattr: Invalid argument

I was pointed[1] to this bug and also told to workaround by disabling selinux temporarily, which worked fine. 

[1] - https://mail.gnome.org/archives/ostree-list/2014-July/msg00006.html

Comment 8 Colin Walters 2015-01-06 20:14:26 UTC
Note that some SELinux policy versions may have install_t but *not* have a domain transition from unconfined_t -> (install_exec_t) -> install_t.  If that's the case, a cleaner workaround that does not involve full permissive mode is:

# runcon -r system_r -t install_t rpm-ostree upgrade

Comment 9 Daniel Walsh 2015-01-06 20:52:18 UTC
Strange that we have the transition rule in fedora but not in rhel.

Comment 10 Dusty Mabe 2015-05-15 01:50:03 UTC
(In reply to Daniel Walsh from comment #9)
> Strange that we have the transition rule in fedora but not in rhel.

Do we need this in rhel? I am "playing" with the centos Atomic image (unreleased) from [1] and I just hit this:

-bash-4.2# rpm-ostree upgrade                                                                                                                                                                                 
Updating from: centos-atomic-host:centos/7/atomic/x86_64/cloud-docker-host

Receiving objects: 13% (649/4806) 409.7 kB/s 17.2 MB
error: fsetxattr: Invalid argument


[1] - http://buildlogs.centos.org/rolling/7/isos/x86_64/CentOS-7-x86_64-AtomicHost-20150228_01.qcow2.xz

Comment 11 Miroslav Grepl 2015-05-15 09:29:01 UTC
What does

rpm -q selinux-policy-targeted