Bug 951819 - SELinux is preventing /usr/bin/bash from using the 'transition' accesses on a process.
Summary: SELinux is preventing /usr/bin/bash from using the 'transition' accesses on a...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: selinux-policy
Version: 18
Hardware: x86_64
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Miroslav Grepl
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard: abrt_hash:1f113abaef8325a956f8e251352...
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2013-04-13 12:39 UTC by Mads Kiilerich
Modified: 2013-04-20 01:02 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2013-04-20 01:02:31 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description Mads Kiilerich 2013-04-13 12:39:03 UTC
Description of problem:
Trying to build a livecd I got this error.

I was launching livecd-creator from a sh script in my home directory, launching it with sudo.

It is m understanding that it should work with SE enabled - or at least give a hint and option for making it work.
SELinux is preventing /usr/bin/bash from using the 'transition' accesses on a process.

*****  Plugin catchall (100. confidence) suggests  ***************************

If you believe that bash should be allowed transition access on processes labeled rpm_script_t by default.
Then you should report this as a bug.
You can generate a local policy module to allow this access.
Do
allow this access for now by executing:
# grep sh /var/log/audit/audit.log | audit2allow -M mypol
# semodule -i mypol.pp

Additional Information:
Source Context                unconfined_u:system_r:livecd_t:s0-s0:c0.c1023
Target Context                unconfined_u:system_r:rpm_script_t:s0-s0:c0.c1023
Target Objects                /usr/bin/bash [ process ]
Source                        sh
Source Path                   /usr/bin/bash
Port                          <Unknown>
Host                          (removed)
Source RPM Packages           bash-4.2.45-1.fc18.x86_64
Target RPM Packages           bash-4.2.45-1.fc18.x86_64
Policy RPM                    selinux-policy-3.11.1-87.fc18.noarch
Selinux Enabled               True
Policy Type                   targeted
Enforcing Mode                Permissive
Host Name                     (removed)
Platform                      Linux (removed) 3.8.3-201.fc18.x86_64 #1 SMP Thu
                              Mar 14 21:28:05 UTC 2013 x86_64 x86_64
Alert Count                   1
First Seen                    2013-04-13 14:31:59 CEST
Last Seen                     2013-04-13 14:31:59 CEST
Local ID                      07528517-7bf7-4510-9dbe-4a78e5c7425c

Raw Audit Messages
type=AVC msg=audit(1365856319.736:1950): avc:  denied  { transition } for  pid=13289 comm="rpm" path="/usr/bin/bash" dev="loop0" ino=136535 scontext=unconfined_u:system_r:livecd_t:s0-s0:c0.c1023 tcontext=unconfined_u:system_r:rpm_script_t:s0-s0:c0.c1023 tclass=process


type=SYSCALL msg=audit(1365856319.736:1950): arch=x86_64 syscall=execve per=8 success=yes exit=0 a0=16dc800 a1=16ed6b0 a2=16e7320 a3=20 items=0 ppid=13288 pid=13289 auid=1000 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 ses=2 tty=pts6 comm=sh exe=/usr/bin/bash subj=unconfined_u:system_r:rpm_script_t:s0-s0:c0.c1023 key=(null)

Hash: sh,livecd_t,rpm_script_t,process,transition

audit2allow

#============= livecd_t ==============
allow livecd_t rpm_script_t:process transition;

audit2allow -R
require {
	type livecd_t;
}

#============= livecd_t ==============
rpm_transition_script(livecd_t)


Additional info:
hashmarkername: setroubleshoot
kernel:         3.8.3-201.fc18.x86_64
type:           libreport

Comment 1 Daniel Walsh 2013-04-16 21:21:06 UTC
Miroslav do you think this is a bug in livecd tool, since it is not supposed to be doing SELinux stuff within the build.

Mads, did the live image build correctly?

Comment 2 Mads Kiilerich 2013-04-16 22:15:15 UTC
Yes, it seems like it did build and work correctly.

Hmm ... could it be because I in a %post --nochroot section do a rpm -q ? But I assume read-only operations is ok - everything should be allowed in a %post --nochroot section.

Comment 3 Daniel Walsh 2013-04-17 20:16:52 UTC
Well a post install would cause a rpm_script_transition, but not sure what you mean by this.  

Did you install a special rpm?  into a livecd?

Comment 4 Mads Kiilerich 2013-04-17 20:33:16 UTC
Yes, the .ks will also do something like
  %post --nochroot
  rpm --root $INSTALL_ROOT -i -f --nodeps .../xxx.rpm
to install a RPM without installing all dependencies.

What I had in mind was another useful use of rpm in %post --nochroot:
  rpm -q livecd-tools > $INSTALL_ROOT/versions.txt

Comment 5 Daniel Walsh 2013-04-17 20:56:14 UTC
I guess we should add the transition, since we want the post install scripts to run, but we relabel at the end so it should fix it up.

I wish livecd_tools was like mock and did no SELinux actions.

Comment 6 Mads Kiilerich 2013-04-17 21:20:15 UTC
From my point of view: %post sections are custom shell scripts and the user run them as root. Any kind of limitations of what can be done from them will hit some livecd-tool user - you shouldn't try. This error was just the example I hit. I don't think that allowing that transition would make a significant difference.

You could perhaps lock ordinary %post sections down so they can't escape from the chroot ... but I don't think it is worth it.

Comment 7 Daniel Walsh 2013-04-17 22:44:53 UTC
587e992cd2f55fab53425fe6e8dea58a36fc619c fixes this in git.

Comment 8 Fedora Update System 2013-04-18 12:51:16 UTC
selinux-policy-3.11.1-91.fc18 has been submitted as an update for Fedora 18.
https://admin.fedoraproject.org/updates/selinux-policy-3.11.1-91.fc18

Comment 9 Fedora Update System 2013-04-19 04:48:50 UTC
Package selinux-policy-3.11.1-91.fc18:
* should fix your issue,
* was pushed to the Fedora 18 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing selinux-policy-3.11.1-91.fc18'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2013-6018/selinux-policy-3.11.1-91.fc18
then log in and leave karma (feedback).

Comment 10 Fedora Update System 2013-04-20 01:02:33 UTC
selinux-policy-3.11.1-91.fc18 has been pushed to the Fedora 18 stable repository.  If problems still persist, please make note of it in this bug report.


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