All of lore.kernel.org
 help / color / mirror / Atom feed
From: Colin Walters <walters@verbum.org>
To: selinux@tycho.nsa.gov
Subject: SELinux policy updates in a post-%post world
Date: Tue, 25 Mar 2014 01:54:08 +0000	[thread overview]
Message-ID: <1395712688.13975.4@mail.messagingengine.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 2614 bytes --]

Hi,

I mentioned OSTree earlier here.  An issue came up with the SELinux 
integration; to understand it, let me describe how OSTree upgrades work:

1) We perform an rsync-like[1] process to a *new* chroot
2) A "basic" configuration merge is done - we take the new /etc 
defaults, and apply any modified files on top

Note that the policy.19 file is in /etc.

Crucially, there is at present no %post/postinst type functionality.  
This is a dramatic increase in reliability over traditional packages.  
No shell script run as root copy/pasted or just copied from elsewhere 
appended to everything.

For things like /usr/lib/ld.so.cache which is just a cache, this works 
fine because it's just referencing things in /usr/lib - it's all 
precomputed on the compose server.

Now, at least the Fedora selinux-policy has a %post that runs "semodule 
-B" which recompiles the policy (if the client machine has modified it 
locally).

Currently with OSTree, what will happen is it will notice the policy.19 
file is a modified file in /etc, and simply carry it forward.  In other 
words, updates to the base policy have no effect once the admin has 
modified it locally.

Administrators *can* rerun "semodule -B" manually after booting into 
the new root to recompile.

Why can't I just add a %post concept to OSTree?  Well, I could.  But 
I'd like to try as hard as conceivably possible to avoid it, and even 
then only do it where all other avenues are exhausted.  For one thing, 
it would break the ability to do completely offline updates (e.g. open 
up a VM guest disk from the host, and update it).  This ability is 
presently used to great effect in the testing system.

The primary alternative to %post is a "dynamic merge".  For example, 
systemd has a design where the default unit files are in 
/usr/lib/system, and then "dropins" can customize them in 
/etc/systemd/system.  On boot, it unions the two.

Similarly, I added /usr/lib/passwd in addition to /etc/passwd:
https://sourceware.org/bugzilla/show_bug.cgi?id=16142

However...I'm uncertain about doing this for SELinux policy.  The 
policy load happens very early in userspace setup and it's a complex 
task.

One option is to recompile the policy if we can (we're doing an upgrade 
from inside a running system, just chroot to new deployment and rerun 
semodule), and throw an error if we can't do it (the offline upgrade 
case).  The latter would only occur when a machine has a modified 
policy, which doesn't happen for my testing system.

Any other ideas?

[1] It doesn't share any code with rsync, but the details are 
irrelevant for this purpose

[-- Attachment #2: Type: text/html, Size: 3093 bytes --]

             reply	other threads:[~2014-03-25  1:58 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-25  1:54 Colin Walters [this message]
2014-03-25 17:13 ` SELinux policy updates in a post-%post world Stephen Smalley
2014-03-25 21:17   ` Colin Walters

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1395712688.13975.4@mail.messagingengine.com \
    --to=walters@verbum.org \
    --cc=selinux@tycho.nsa.gov \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.