Bug 118604 - policy-sources should conflict policy, not require it!
policy-sources should conflict policy, not require it!
Product: Fedora
Classification: Fedora
Component: policy (Show other bugs)
All Linux
medium Severity high
: ---
: ---
Assigned To: Daniel Walsh
Depends On:
Blocks: FC2Blocker
  Show dependency treegraph
Reported: 2004-03-18 00:18 EST by Aleksey Nogin
Modified: 2007-11-30 17:10 EST (History)
3 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2004-04-22 16:03:58 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Aleksey Nogin 2004-03-18 00:18:24 EST
1) I installed policy-sources (which required installing the policy
package as well).
2) I modified /etc/security/selinux/src/policy/users (to include
myself with appropriate staff roles) and started using the locally
augmented policy.
3) After a while, I ran "up2date -u" which picked up that both policy
and policy-sources need to be updated.
4) up2date -u upgraded the policy package.

!!! At this point, the default policy got installed and loaded,
!!! overriding the local changes. All the processes that were running in
!!! context aleksey:staff_r:staff_t became system_u:object_r:unlabeled_t

5) Later in the up2date -u, the policy-source package was upgraded,
the new locally-augmented policy got rebuilt and loaded and things got
back to normal. But the mis-labeled processes stayed mislabeled (which
caused some files to become mislabeled too).

P.S. At a minimum, the policy files in the policy package should be
%config(noreplace). But the best solution would be to _only_ one
package that would include all the source files and would always do
the make-and-install-and-reload on upgrade. 

P.P.S Sticking with just one (source-based) policy package would also
make it easier to implement the RFE in bug 118571.
Comment 1 Daniel Walsh 2004-03-25 00:22:08 EST
Added config switches policy-1.9-16
Comment 2 Aleksey Nogin 2004-04-02 01:40:49 EST
The problem is back - policy-1.9.2-1 loads the default policy even if
policy-sources is installed :-(
Comment 3 Daniel Walsh 2004-04-02 08:56:24 EST
It should only replace it if the policy.16 file has not been updated.
It is treating it as a config file.

Comment 4 Aleksey Nogin 2004-04-02 16:33:49 EST
Right, so on lolicy.15 -> policy.16 upgrade everything "blows up".
What I do not understand, is why does policy-sources require policy
_at all_.  I am not even sure having a separate policy package is such
a good idea - IMHO would should have _just_ the policy-sources package
(which could then be just called policy) - this way we can eventually
chage things like system-config-users to do the right thing w.r.t.
policy-sources users file.
Comment 5 Daniel Walsh 2004-04-02 23:55:33 EST
Yes that is a screw up.  The Makefile should be checking the version
of kernel that is running and then run with or without the -c flag.

Policy includes the /etc/security/default_context and a few other
files that are not in policy-sources.  Policy-sources requires
additional packages like checkpolicy, make, m4 that are not required
for regular policy.  So it was decided that for minimal install we
would have policy and policy-sources.  

I think we will put a requirement in system-config-users for the
policy-sources file.
Comment 6 Aleksey Nogin 2004-04-04 22:28:33 EDT
The problem with the .15->.16 upgrade was that :

- I had a custom policy-sources .15 set up and loaded
- A new policy package got installed (because of this dependency)
- The policy package installed the default .16 (since there was no .16
- The polciy package loaded the default .16 causing a lot of problems...

In short, at the very least, the policy package %post script should
check whether policy-sources is installed and _not_ do anything in
that case.
Comment 7 Gene Czarcinski 2004-04-05 13:54:16 EDT
The more I think about the subject of this report as stated in the
Summary, the more I like the idea.  At install time have the user
select the canned policy or policy+sources and only install one of them.
Comment 8 Fred New 2004-04-06 05:58:04 EDT
Another possibility would be to have policy-sources just install the
source files like kernel-source does.  I haven't noticed if there is a
kernel boot parm that allows you to select which policy to load, but
that might be necessary, too.
Comment 9 Daniel Walsh 2004-04-06 07:00:12 EDT
Not sure what you mean.  The latest policy locks together policy and
policy-sources so you will need to upgrade both once both are
installed.  Also I have modified the Makefile and spec file to build
all versions of the kernel policy file.  This way all kernels will
work with SELinux.

Comment 10 Fred New 2004-04-06 08:08:09 EDT
SELinux newbie alert...  My thinking was that if we used
policy-sources  like we use the kernel-source RPM, there would be no
need for policy-sources to build the policy when it was installed. The
policy-sources package would be optional, just like kernel-source. We
would use policy-sources for building custom policies under different
names, just like we build custom kernels. For example, if the kernel
required a version 16 policy, a custom name could be policy.16.test1.
This means that we would need a method for switching between the
packaged Fedora policy and our custom policies, just like we switch
between kernels using grub/lilo.

Comment 11 Daniel Walsh 2004-04-06 08:19:18 EDT
It is not that simple.  In some ways you analogy is correct, the
difference is that there are two config files included in
policy-sources that allow the user to customize their policy.  users
and tunables.te.  These files will be edited with tools like
system-config-users and system-config-securitylevel.  If a user wants
to install an executable in a different spot he might need to  update
the file_contexts files.

Finally when you upgrade the policy-sources file if you have not
modified  the users or tunable files, you will end up with the same
policy.* file as provided from the policy rpm.  If you have modified
those files the policy-source upgrade will pick up your local

Comment 12 Fred New 2004-04-06 10:10:49 EDT
I see.  Still, it seems strange that two different packages would
update the same file.  I feel like the build should be moved from
policy-sources to policy, but this probably wouldn't improve the
situation or make your life any easier.

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