Gentoo Archives: gentoo-hardened

From: Mansour Moufid <mansourmoufid@×××××.com>
To: gentoo-hardened@l.g.o
Subject: Re: [gentoo-hardened] Hardened Targets
Date: Tue, 01 Dec 2009 14:13:15
Message-Id: 44a1f4d20912010611x7b762921r4ca6fe1c7c8567f9@mail.gmail.com
In Reply to: [gentoo-hardened] Hardened Targets by Shinkan
1 On Tue, Dec 1, 2009 at 5:40 AM, Shinkan <shinkan@×××××.com> wrote:
2 > The main problem I can see from my rookie level is that I want each target
3 > to be built with its own version of GCC/LIBC/(basethings) and its own
4 > "snapshot" of a portage tree at a T time.
5
6 You can specify versions by masking with Portage. For example, if you
7 don't want gcc 4, then you would do:
8 # echo ">sys-devel/gcc-4" >> /etc/portage/package.mask
9
10 As for Portage "snapshots", you can get those from the Gentoo mirrors
11 by date, similar to how you did during the installation process. Just
12 don't emerge --sync. You probably do want to apply GLSA updates though
13 (see: glsa-check).
14
15 > I want the final target to be
16 > buildtools-less, portage-less,
17 > almost-everything-except-the-kernel-and-bash-less...
18
19 You can start by adding the "minimal" USE flag to make.conf. Then,
20 once you're sure everything you need is installed, unmerge everything
21 you don't need (gcc, etc.). I'm sure there's a trick to get Portage to
22 unmerge everything in the sys-devel category, which others might be
23 able to help with.
24
25 You really shouldn't unmerge Portage, but if you want to, it should be
26 the last step -- coming *after* emerge -uUDN world && emerge
27 --depclean && revdep-rebuild. After which you can safely rm -drf
28 /usr/portage.
29
30 > I would prefer a "2 step" additive way. Step 1 : I would like to build, for
31 > each target, a "build" dir which contains an hardened toolchain with
32 > specified versions of GCC/LIBC/etc, Step 2 : then from this build dir I
33 > would emerge things I need by hand from zero in a target dir, and build a
34 > kernel.
35
36 If you want one kernel per build, then it seems to me you will need to
37 use chroots, similar to how you chrooted to /mnt/gentoo from the
38 Gentoo installation environment. For example, start with mkdir -p
39 /var/target/1 /var/target/2, etc., each of which would be analogous to
40 /mnt/gentoo. In this case, replace the root directories (``/'') I
41 mentioned above with ``/var/target/n'' as needed, e.g.
42 /var/target/1/etc/portage.mask, etc.
43
44 Hope this helps.
45
46 --
47 Mansour Moufid

Replies

Subject Author
Re: [gentoo-hardened] Hardened Targets Shinkan <shinkan@×××××.com>