Gentoo Archives: gentoo-hardened

From: Sven Vermeulen <swift@g.o>
To: gentoo-hardened@l.g.o
Subject: Re: [gentoo-hardened] SELinux on Desktop Profile
Date: Thu, 06 Mar 2014 15:15:55
Message-Id: 20140306151551.GA2681@gentoo.org
In Reply to: Re: [gentoo-hardened] SELinux on Desktop Profile by wraeth
1 On Thu, Mar 06, 2014 at 12:40:21AM +1100, wraeth wrote:
2 > * Rebuild util-linux *
3 > mount, provided by util-linux, does not have the functionality
4 > required by SELinux when coming from a non-hardened stage. In order to
5 > get this installed (without bricking anything) I had to:
6 >
7 > emerge -1 libselinux (this will also pull in libsepol)
8 > emerge -1O util-linux (-O required to prevent pols being pulled in)
9 >
10 > This should happen just prior to the first reboot (and any initrd's
11 > should be rebuilt to include the new mount binary, i guess).
12
13 Wouldn't the package (util-linux) be rebuild anyway? It uses USE=selinux so
14 the "emerge -uDN world" should rebuild it (with libselinux bindings).
15
16 > * Select policy type *
17 > This is more of a note on the documentation (I know it's out of date,
18 > (or at least so the wiki says) but for reference nonetheless).
19
20 Where on the wiki does it say that? The SELinux handbook is not out of
21 date. It had an issue if you use 'targeted' as you rightly said but that's a
22 bug, not due to potentially being outdated. And not having it registered as
23 a bug on bugs.gentoo.org made it so it took a while before it got properly
24 noticed (I can read mailinglists from work, but when I can do a bit of
25 Gentoo development I check the bug list and forget that there were things
26 mentioned on the mailinglist).
27
28 > I'm
29 > taking the easy road in and have selected the 'targeted' policy type for
30 > now. Because of this, running ``emerge -uDN @world`` prior to setting
31 > the policy type in /etc/selinux/config causes emerge to attempt to set
32 > the wrong policy, and fail the ebuild. This is in reference to code
33 > listings 2.3 and 2.6 of the SELinux handbook.
34
35 Indeed; I've moved the editing of /etc/selinux/config prior to the 'emerge
36 -uDN world' step.
37
38 > Other than that, everything has gone smoothly except for one thing:
39 > during boot, I'm getting:
40 > systemd-remount-fs[733]: mount: /run not mounted or bad option
41 >
42 > That being said, once booted, /run *is* mounted with:
43 > tmpfs on /run type tmpfs (rw,nosuid,nodev,seclabel,mode=755)
44 >
45 > The relevant line in fstab is:
46 > tmpfs /run tmpfs mode=0755,nosuid,nodev,context=system_u:object_r:var_run_t 0 0
47 >
48 > I'm not sure why this is (current thinking is perhaps a symptom of the
49 > docs being outdated) and the system seems stable for the moment.
50
51 Can you check your dmesg or logs? I don't know systemd-remount-fs but
52 perhaps it's because /run is already mounted and thus it cannot mount it
53 (without being smart enough to use "-o remount").
54
55 If you do something like the following, does the context then appear?
56
57 #v+
58 mount -o remount,context=system_u:object_r:var_run_t /run
59 #v-
60
61 My system gives the following:
62
63 #v+
64 $ mount | grep run
65 tmpfs on /run type tmpfs (rw,rootcontext=system_u:object_r:var_run_t,seclabel,nosuid,nodev,noexec,relatime)
66 #v-
67
68 Wkr,
69 Sven Vermeulen

Replies

Subject Author
Re: [gentoo-hardened] SELinux on Desktop Profile wraeth <wraeth@××××××××××××.net>
Re: [gentoo-hardened] SELinux on Desktop Profile wraeth <wraeth@××××××××××××.net>
Re: [gentoo-hardened] SELinux on Desktop Profile wraeth <wraeth@××××××××××××.net>