Gentoo Archives: gentoo-hardened

From: "Radosław Smogura" <mail@×××××××.eu>
To: gentoo-hardened@l.g.o
Cc: Sven Vermeulen <swift@g.o>
Subject: Re: [gentoo-hardened] SELinux base policy r2 in hardened-dev overlay
Date: Sun, 21 Aug 2011 12:03:33
Message-Id: 201108211339.15280.mail@smogura.eu
In Reply to: Re: [gentoo-hardened] SELinux base policy r2 in hardened-dev overlay by Sven Vermeulen
1 Sven Vermeulen <swift@g.o> Sunday 21 of August 2011 12:06:46
2 > On Sat, Aug 20, 2011 at 08:08:41PM -0500, Chris Richards wrote:
3 > > > Yet we will eventually need to support this, because otherwise we need
4 > > > to "open" the privileges on initrc_t towards all potential services.
5 > > > Not only does that require lots of work, it also brings in patches in
6 > > > our policy that
7 > > > upstream will never accept (and they're right not to accept it).
8 > >
9 > > Ok, I buy the argument. Is this a shortcoming in the old bash init, or
10 > > is this a shortcoming in OpenRC?
11 > >
12 > > I'm starting to see a little more free time from my job and might be able
13 > > to tackle some things starting in a couple of weeks.
14 >
15 > I'm not sure. A quick check reveals that there is no such thing as
16 > domain-specific initrc_t subdomains. It seems that the subdomains are there
17 > to allow roles within SELinux to handle init scripts of one daemon but not
18 > the other (for instance, create an ldapadm_r which has ldap_admin() and as
19 > such is allowed to execute it properly, but doesn't have the same rights
20 > for postfix).
21 >
22 > Within Gentoo, we mark everything as initrc_exec_t, so the user needs just
23 > "one" privilege to handle services for all domains. I'd like to "fix" that,
24 > but still keep the integrated run_init support in-place. That'll require
25 > some more investigation here (since I don't understand how the integrated
26 > run_init is done).
27 >
28 > However, my initial assessment that we "otherwise" need to "open" up
29 > initrc_t stays in place (we just don't have a choice here). That initrc_t
30 > is a highly privileged domain is obvious from a first look at its .te file.
31 > So it looks as if we just need to add the proper optional_policy statements
32 > here.
33 >
34 > BTW, glad to hear you're seeing some free time in the near future ;-)
35 >
36 > Wkr,
37 > Sven Vermeulen
38
39 I'm not SeLinux guroo, but at eye glance it looks like init (runint) script
40 1. reads contexts/run_init_type (but I think this is done to password
41 authentication)
42 2. then it reads and changes to contexts/initrc_context domain.
43
44 This is made in policycoreutils-extras/runscript_selinux.c. There are some
45 comments about initrc_devpts_t.
46
47 Maybe changin 2. will be solution, instead of read contexts/initrc_context
48 take context from target script?
49
50 Regards,
51 Radek.

Replies