Bug 506076

Summary: Upgrading from F-10 to F-11 missed installing the unconfineduser module
Product: [Fedora] Fedora Reporter: Nils Philippsen <nphilipp>
Component: selinux-policy-targetedAssignee: Miroslav Grepl <mgrepl>
Status: CLOSED CURRENTRELEASE QA Contact: Ben Levenson <benl>
Severity: high Docs Contact:
Priority: low    
Version: 11CC: cje
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2010-04-27 15:17:49 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Nils Philippsen 2009-06-15 13:42:30 UTC
Description of problem:
I used preupgrade to upgrade from F-10 + updates to F-11. Afterwards, several services didn't start up properly and I found that my user's security context had sysadm_t, not unconfined_t.

Version-Release number of selected component (if applicable):
selinux-policy-targeted-3.6.12-39.fc11

How reproducible:
Not very (the machine is F-11 now, I've upgraded other machines without such problems).

Steps to Reproduce:
1. Have machine with F-10 + updates, SELinux targeted active & enforcing
2. Use preupgrade to upgrade to F-11
  
Actual results:
- Several services don't start properly, users can't login, etc.
- "semodule -l" lists the "unconfined", but not the "unconfineduser" module

Expected results:
All the above works, "semodule -l" lists both "unconfined" and "unconfineduser" modules.

Additional info:
After running "semodule -i /usr/share/selinux/targeted/unconfineduser.pp.bz2" everything worked again. Took me a while to find out what the problem was, though ;-).

Comment 1 Daniel Walsh 2009-06-15 19:28:34 UTC
I am not sure what the "preupgrade" is.

selinux-policy package attempts to see if an old version of selinux-policy is installed if it is old, it installs both unconfineduser and unconfined otherwise it will only upgrade if a previous version is installed.

So if an admin remove unconfined.pp or unconfineduser.pp we don't add them back.

On F10 we did not have unconfineduser.pp so the upgrade was supposed to figure this out and add it.

Comment 2 Nils Philippsen 2009-06-16 08:23:37 UTC
(In reply to comment #1)
> I am not sure what the "preupgrade" is.

With the preupgrade package/program one can download the e.g. F-11 packages needed for upgrading while still working in F-10, when the download is ready one is prompted to reboot the system, subsequently anaconda is started which upgrades the system with the downloaded packages.

> selinux-policy package attempts to see if an old version of selinux-policy is
> installed if it is old, it installs both unconfineduser and unconfined
> otherwise it will only upgrade if a previous version is installed.
> 
> So if an admin remove unconfined.pp or unconfineduser.pp we don't add them
> back.
>
> On F10 we did not have unconfineduser.pp so the upgrade was supposed to figure
> this out and add it. 

Somehow this failed for me, but don't ask me why on that machine and not on others. If you want, I'll attach the current "semodule -l" list which differs from the one after the upgrade in that I added unconfineduser and removed two temporary modules which enabled some peculiarities on my system w.r.t. PPP and UUCP/Postfix (which you fixed in targeted policy a while ago already but I forgot to remove).

Comment 3 Daniel Walsh 2009-06-16 13:58:19 UTC
function get_unconfined() {
# We only want to upgrade unconfined.pp and unconfineduser if they are 
# currently installed.  If you have a version 3.0.0 or less of unconfined 
# installed, you will need to install both, since unconfineduser did not exist 
# prior to this.
eval `semodule -l | while read package version; do
	case $package in
	"unconfineduser")
	        echo "unconfineduser=$version"
		;;
	"unconfined")
	 	echo "unconfined=$version"
		;;
	esac
done`

if [ -z "$unconfineduser" -a -n "$unconfined" ]; then
    f1=`echo $unconfined | cut -d. -f 1`
    if [ $f1 -lt 3 ]; then
	unconfineduser="1"
    else
        if [ $f1 -eq  3 ]; then
	    f2=`echo $unconfined | cut -s -d. -f2`
	    f3=`echo $unconfined | cut -s -d. -f3`
	    if [ \( -z "$f2" \) -o \( \( "$f2" -eq 0 \)  -a \( -z "f3" -o "$f3" -eq 0 \) \) ]; then 
	        unconfineduser="1"
	    fi
	fi
    fi
fi
echo ${unconfined:+unconfined.pp.bz2} ${unconfineduser:+unconfineduser.pp.bz2}
}

This is the "hacky" code that was trying to figure out whether you needed the unconfineuser.pp file installed.

Basically it attempts to see if you have an unconfined.pp that is versioned less then 3.0.1, if it is then we install both packages.

Comment 4 Nils Philippsen 2009-06-17 08:39:05 UTC
I just reviewed my upgrade.log (should have done this before):

--- 8< ---
Upgrading selinux-policy-targeted-3.6.12-39.fc11.noarch
libsepol.scope_copy_callback: audioentropy: Duplicate declaration in module: type/attribute entropyd_var_run_t
libsemanage.semanage_link_sandbox: Link packages failed
semodule:  Failed!
--- >8 ---

to me, this looks like a problem which prevented the scriptlet to run and install unconfineduser properly. What do you think?

Comment 5 Daniel Walsh 2009-06-17 14:25:50 UTC
Yes that would do it.

I have not seen this one before.  Updates are working ok for you now?

Comment 6 Nils Philippsen 2009-06-17 15:56:18 UTC
Yes, I've just updated from 3.6.12-45 to -50 and still both unconfined/user modules are installed and unconfined_t exists (checked with "id").

Comment 7 cje 2009-07-27 21:33:33 UTC
i just hit this bug today - very grateful to see the workaround in the description!

not sure why it's hitting my clean-installed F11 system.  i did a packagekit update yesterday which claimed to have 294(!) updates to install and then appeared to hang on 'installing packages' but the yum log says it completed okay and 'yum update' now says all is up to date.

Comment 8 Daniel Walsh 2009-08-21 21:34:58 UTC
Miroslav, I think we should remove the logic that prevents unconfineduser from being installed, and install it always.  Hopefully we will get a new version of semodule to handle this better.

Comment 9 Miroslav Grepl 2009-09-02 14:08:43 UTC
Fixed in selinux-policy-3.6.12-81.fc11 by Dan

Comment 10 Bug Zapper 2010-04-27 14:56:35 UTC
This message is a reminder that Fedora 11 is nearing its end of life.
Approximately 30 (thirty) days from now Fedora will stop maintaining
and issuing updates for Fedora 11.  It is Fedora's policy to close all
bug reports from releases that are no longer maintained.  At that time
this bug will be closed as WONTFIX if it remains open with a Fedora 
'version' of '11'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version prior to Fedora 11's end of life.

Bug Reporter: Thank you for reporting this issue and we are sorry that 
we may not be able to fix it before Fedora 11 is end of life.  If you 
would still like to see this bug fixed and are able to reproduce it 
against a later version of Fedora please change the 'version' of this 
bug to the applicable version.  If you are unable to change the version, 
please add a comment here and someone will do it for you.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events.  Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

The process we are following is described here: 
http://fedoraproject.org/wiki/BugZappers/HouseKeeping