public inbox for gentoo-hardened@lists.gentoo.org
 help / color / mirror / Atom feed
From: Sven Vermeulen <sven.vermeulen@siphos.be>
To: gentoo-hardened@lists.gentoo.org
Subject: Re: [gentoo-hardened] SELinux policy and openrc
Date: Sun, 15 May 2011 00:25:32 +0200	[thread overview]
Message-ID: <20110514222532.GA27770@siphos.be> (raw)
In-Reply-To: <4DCEB50A.8080707@giz-works.com>

On Sat, May 14, 2011 at 11:59:54AM -0500, Chris Richards wrote:
> Just posting this so that others will know about it.  We determined that 
> /lib64/rc/init.d needs to be relabled to initrc_state_t on the file 
> system using the same relabel that we do for /dev.  I believe the manual 
> is being updated to add this information.  In addition, a rule has to be 
> added to init.fc and init.te to relabel this directory ( 
> /lib64/rc/init\.d((/.*)? gen_context(system_u:object_r:initrc_state_t, 
> s0) (or something similar), as well as add the mounton privilege using 
> files_mountpoint(initrc_state_t).  Once that is done, there is no longer 
> a need for the fstab stuff.

I just pushed selinux-base-policy-2.20101213-r15 to hardened-dev.git
overlay. It does not resolve all problems, but at least Gentoo Hardened with
SELinux now boots up properly with OpenRC (and the Gentoo SELinux handbook
has been updated with that what Chris R. said).

But there is still some work ahead.
- rc-update currently *does* *not* *work*. Not good. I know. 
  The problem is that rc-update (bin_t) calls /sbin/rc (initrc_exec_t) so
  transitions to run_init_t which does not have the rights to write in
  /etc/runlevels (etc_t). Calling rc-update with run_init doesn't help
  either (transitions to initrc_t which also has no rights to write to
  etc_t)
- rc-service works
- rc-status works if you use "run_init rc-status". Allowing rc-status to
  work without run_init is possible as well (-r15 offers the
  gentoo_init_manage_script_status_files interface for this which we can
  apply to run_init_t, but you'll also need to add in a
  term_use_unallocated_ttys(run_init_t)) but I left it out as I find it to
  be an ugly situation then
- rc works if you use "run_init rc". 

Now, this mixed usage of "with run_init" and "without run_init" is a pain,
especially as Gentoo tried hard not to require run_init in the first place
(well, it uses it, but in the background). This can be fixed by using
run_init in the wrappers where needed, but that requires an update on
openrc. Yet this still looks to me like the sanest approach. 

Some methods can be used to work around this, like labelling the wrappers so
that they transition before /sbin/rc is called, but that looks like an ugly
situation too to me.

To fix the rc-update issue, we need to be able to run /sbin/rc without
transitioning. I'm thinking about having a copy of /sbin/rc to
/lib64/rc/sbin and have the rc-update wrapper point to that one. I can then
also do the same for rc-status (no need for run_init then, sysadm_t has the
same privileges). It seems to work fairly well on my systems, but that's
again another change just for SELinux-enabled Gentoo systems :-(

Chris R.: in https://bugs.gentoo.org/351712 the use of the wrappers was
suggested instead of symlinks (which would've caused the same problems here
I think) just for the reason that I'm writing out now. How did you resolve
the problem on your system?

Wkr,
	Sven Vermeulen



  parent reply	other threads:[~2011-05-14 23:02 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-13 20:06 [gentoo-hardened] SELinux policy and openrc Sven Vermeulen
2011-05-14 16:59 ` Chris Richards
2011-05-14 21:41   ` Sven Vermeulen
2011-05-14 22:25   ` Sven Vermeulen [this message]
2011-05-15 13:16     ` Sven Vermeulen

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=20110514222532.GA27770@siphos.be \
    --to=sven.vermeulen@siphos.be \
    --cc=gentoo-hardened@lists.gentoo.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox