<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-3050029677375999718</id><updated>2011-09-15T12:02:10.209+01:00</updated><category term='2.6.31'/><category term='hardened gentoo'/><category term='gcc-4.3'/><category term='glibc-2.10'/><category term='aircrack-ng'/><category term='gcc-4.4.3'/><category term='installation'/><category term='bug'/><category term='gentoo'/><category term='layman'/><category term='nss'/><category term='mpi'/><category term='PIE'/><category term='KDE 4.3.1'/><category term='mplayer'/><category term='firefox'/><category term='cracking'/><category term='amd64'/><category term='lilo'/><category term='32-bit'/><category term='intel 3945'/><category term='mprotect'/><category term='paxtest'/><category term='injection'/><category term='kvm'/><category term='openmpi'/><category term='gcc-4.4'/><category term='X11'/><category term='executable stack'/><category term='2.6.30.4'/><category term='gcc-4.4.1'/><category term='KDE'/><category term='64-bit'/><category term='howto'/><category term='PAX'/><category term='graphite'/><category term='overlay'/><category term='john the ripper'/><category term='nouveau'/><category term='wireshark'/><category term='networking'/><category term='pentoo'/><category term='gcc-4.3.4'/><category term='wireless'/><category term='KMS'/><category term='kernel'/><category term='LUKS'/><category term='KDE 4.3'/><category term='grsecurity'/><category term='nvidia'/><category term='encrypted root'/><title type='text'>Hardened Gentoo Adventures by radegand</title><subtitle type='html'>...on a mission for free, secure and geek friendly OS...
&lt;br&gt;&lt;br&gt;
"I'd rather be compiling" ;]</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://hardenedgentoo.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3050029677375999718/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://hardenedgentoo.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>radegand</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>32</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-3050029677375999718.post-5773612972886451826</id><published>2011-06-25T22:37:00.004+01:00</published><updated>2011-06-26T00:04:01.312+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='PAX'/><category scheme='http://www.blogger.com/atom/ns#' term='mprotect'/><category scheme='http://www.blogger.com/atom/ns#' term='firefox'/><title type='text'>Firefox 5 with MPROTECT on...of course!</title><content type='html'>While the Firefox 4 ebuild is still warm, here comes Firefox 5! And yes - we want MPROTECT enabled on it too of course...! ;)&lt;br /&gt;&lt;br /&gt;BTW, if you've ever wondered why I'm so preoccupied about the whole mrprotect story, I recommend reading my year old research on the topic which can be found &lt;a href="http://labs.mwrinfosecurity.com/projectdetail.php?project=13&amp;view=news"&gt;here&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;Well, it turns out to be, that with the release of the new Firefox things got much easier actually! There is no need to patch the source anymore, we just need to disable the 'jit' during source configuration. Not only this allows us to actually compile Firefox 5 on Gentoo hardened (sic!) but actually allows to run it with mprotect enabled too! But first things first...&lt;br /&gt;&lt;br /&gt;An attempt to install Firefox 5 on Gentoo Hardened system is likely to end up with emerge failing and entry in kern.log similar to this:&lt;br /&gt;&lt;code class="prettyprint"&gt;&lt;br /&gt;grsec: denied RWX mmap of &lt;anonymous mapping&gt; by /var/tmp/portage/www-client/firefox-5.0/work/mozilla-release/obj-x86_64-unknown-linux-gnu/dist/bin/xpcshell[xpcshell:10891] uid/euid:0/0 gid/egid:0/0, parent /bin/bash[sh:10882] uid/euid:0/0 gid/egid:0/0                                                                                                            &lt;br /&gt;xpcshell[10891]: segfault at 41ea0ddc ip 00006b9475051ed4 sp 000078b37e81b6f0 error 4 in libxul.so[6b9474031000+1823000]&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;While &lt;span style="font-weight:bold;"&gt;jit&lt;/span&gt; seems to like RWX memory pages a lot, Gentoo hardened users do not...;)&lt;br /&gt;&lt;br /&gt;But fear not! The trustworthy hack for Firefox 4 works here too, and we don't need to hack the source, it's just enough to add &lt;span style="font-style:italic;"&gt;--disable-methodjit&lt;/span&gt; the configure script. (For more information on how to create your local overlay have a look at my previous &lt;a href="http://hardenedgentoo.blogspot.com/2011/06/enabling-mprotect-on-firefox-4.html"&gt;post&lt;/a&gt; or refer to your favourite search engine ;) . So basically you could add this to the ebuild, somewhere in the &lt;span style="font-style:italic;"&gt;src_configure()&lt;/span&gt; section:&lt;br /&gt;&lt;code class="prettyprint"&gt;&lt;br /&gt;        if ! use jit ; then&lt;br /&gt;                mozconfig_annotate '' --disable-methodjit&lt;br /&gt;        fi&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;..recompile...and off you go! At the moment the firefox binary (/usr/lib/firefox/firefox-bin) is quite likely to have mprotect automatically disabled  so you might need to enable it by hand by running: &lt;br /&gt;&lt;code class="prettyprint"&gt;&lt;br /&gt;paxctl -M /usr/lib/firefox/firefox-bin&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;Bear in mind that Firefox now runs plugins in a separate process - &lt;span style="font-style:italic;"&gt;plugin-container&lt;/span&gt;. It can also be mprotect enabled or disabled, so you might want to check it too...it's worth noting that enabling mprotect on plugin-container will make Firefox crash probably on every use of Flash or Java, but hey, it's secure then, is it not...? ;)&lt;br /&gt;&lt;br /&gt;Gentoo bug tracking all this can be found &lt;a href="https://bugs.gentoo.org/show_bug.cgi?id=373029"&gt;here&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3050029677375999718-5773612972886451826?l=hardenedgentoo.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://hardenedgentoo.blogspot.com/feeds/5773612972886451826/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://hardenedgentoo.blogspot.com/2011/06/firefox-5-with-mprotect-onof-course.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3050029677375999718/posts/default/5773612972886451826'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3050029677375999718/posts/default/5773612972886451826'/><link rel='alternate' type='text/html' href='http://hardenedgentoo.blogspot.com/2011/06/firefox-5-with-mprotect-onof-course.html' title='Firefox 5 with MPROTECT on...of course!'/><author><name>radegand</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3050029677375999718.post-5913220935724717008</id><published>2011-06-13T20:11:00.006+01:00</published><updated>2011-06-16T18:51:39.543+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='mprotect'/><category scheme='http://www.blogger.com/atom/ns#' term='firefox'/><category scheme='http://www.blogger.com/atom/ns#' term='grsecurity'/><category scheme='http://www.blogger.com/atom/ns#' term='hardened gentoo'/><title type='text'>Enabling MPROTECT on Firefox 4</title><content type='html'>...so after nearly a year (sic!), here's the solution to get MPROTECT working with Firefox - browsing the Interwebs can be secure again! ;) Thanks to &lt;span style="font-weight:bold;"&gt;zakalwe&lt;/span&gt; on #grsecurity@OFTC for the patch and help! :)&lt;br /&gt;&lt;br&gt;&lt;br /&gt;So the problem of course is JIT - we need to disable it at all cost! (You'll be probably losing some JS performance, ya've been warned!). Well, it's not the most elegant solution, but it does work...The elegant solution would be of course to have an compilation option available to completely disable JIT...&lt;br /&gt;&lt;br&gt;&lt;br /&gt;Anyway - let's get our hands dirty, shall we?&lt;br /&gt;&lt;br&gt;&lt;br /&gt;The easiest way to do it, would be to create your local overlay (unless you've already got one). Assuming that you don't here's what needs to be done. Choose a folder where you will store you local ebuild - say &lt;span style="font-style:italic;"&gt;/usr/local/portage&lt;/span&gt;. Next create there required folder structure:&lt;br /&gt;&lt;code class="prettyprint"&gt;&lt;br /&gt;mkdir /usr/local/portage&lt;br /&gt;mkdir -p /usr/local/portage/net-libs/xulrunner&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;Yes, we actually need to amend the xulrunner ebuild and not the firefox one.&lt;br /&gt;&lt;br&gt;&lt;br /&gt;Now we need to copy the "original" ebuild along with the patches which will serve as a baseline:&lt;br /&gt;&lt;code class="prettyprint"&gt;&lt;br /&gt;cp /usr/portage/net-libs/xulrunner/xulrunner-2.0.1-r1.ebuild /usr/local/portage/net-libs/xulrunner/&lt;br /&gt;cp -r /usr/portage/net-libs/xulrunner/files/ /usr/local/portage/net-libs/xulrunner/&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;Now open the copied ebuild in your favourite editor and locate the following code:&lt;br /&gt;&lt;code class="prettyprint"&gt;&lt;br /&gt;    mozconfig_annotate '' --with-default-mozilla-five-home="${MOZLIBDIR}"&lt;br /&gt;    mozconfig_annotate '' --enable-extensions="${MEXTENSIONS}"&lt;br /&gt;    mozconfig_annotate '' --disable-mailnews&lt;br /&gt;    mozconfig_annotate '' --enable-canvas&lt;br /&gt;    mozconfig_annotate '' --enable-safe-browsing&lt;br /&gt;    mozconfig_annotate '' --with-system-png&lt;br /&gt;    mozconfig_annotate '' --enable-system-ffi&lt;br /&gt;    mozconfig_use_enable system-sqlite&lt;br /&gt;    mozconfig_use_enable gconf&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;Add after the last &lt;span style="font-weight:bold;"&gt;mozconfig_annotate&lt;/span&gt; line the following code:&lt;br /&gt;&lt;code class="prettyprint"&gt;&lt;br /&gt;mozconfig_annotate '' --disable-jit&lt;br /&gt;mozconfig_annotate '' --disable-methodjit&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;...so the whole chunk looks like this:&lt;br /&gt;&lt;code class="prettyprint"&gt;&lt;br /&gt;    mozconfig_annotate '' --with-default-mozilla-five-home="${MOZLIBDIR}"&lt;br /&gt;    mozconfig_annotate '' --enable-extensions="${MEXTENSIONS}"&lt;br /&gt;    mozconfig_annotate '' --disable-mailnews&lt;br /&gt;    mozconfig_annotate '' --enable-canvas&lt;br /&gt;    mozconfig_annotate '' --enable-safe-browsing&lt;br /&gt;    mozconfig_annotate '' --with-system-png&lt;br /&gt;    mozconfig_annotate '' --enable-system-ffi&lt;br /&gt;    mozconfig_annotate '' --disable-jit&lt;br /&gt;    mozconfig_annotate '' --disable-methodjit&lt;br /&gt;    mozconfig_use_enable system-sqlite&lt;br /&gt;    mozconfig_use_enable gconf&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;Halfway through! Now, unfortunately that is not enough - we'll have to patch xulrunners source too...so here we go!&lt;br /&gt;&lt;br&gt;&lt;br /&gt;First, create folder where we can save our patch to be automatically picked up during compilation. It could be added explicitly to the ebuild but this way is just easier and less scary for some perhaps ;)&lt;br /&gt;&lt;code class="prettyprint"&gt;&lt;br /&gt;mkdir -p /etc/portage/patches/net-libs/xulrunner&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;...and save in that folder file (under whatever name) with the content below:&lt;br /&gt;&lt;code class="prettyprint"&gt;&lt;br /&gt;diff -Nurp ./mozilla-2.0/js/src/assembler/wtf/Platform.h &lt;br /&gt;./mozilla-2.0.new/js/src/assembler/wtf/Platform.h&lt;br /&gt;--- ./mozilla-2.0/js/src/assembler/wtf/Platform.h       2011-05-12 &lt;br /&gt;22:06:56.000000000 +0100&lt;br /&gt;+++ ./mozilla-2.0.new/js/src/assembler/wtf/Platform.h   2011-05-12 &lt;br /&gt;22:12:35.000000000 +0100&lt;br /&gt;@@ -918,15 +918,7 @@ on MinGW. See https://bugs.webkit.org/sh&lt;br /&gt;&amp;nbsp#if !defined(ENABLE_YARR_JIT)&lt;br /&gt; &lt;br /&gt;&amp;nbsp/* YARR supports x86 &amp; x86-64, and has been tested on Mac and Windows. */&lt;br /&gt;-#if (WTF_CPU_X86 \&lt;br /&gt;- || WTF_CPU_X86_64 \&lt;br /&gt;- || WTF_CPU_ARM_TRADITIONAL \&lt;br /&gt;- || WTF_CPU_ARM_THUMB2 \&lt;br /&gt;- || WTF_CPU_X86)&lt;br /&gt;-#define ENABLE_YARR_JIT 1&lt;br /&gt;-#else&lt;br /&gt;&amp;nbsp#define ENABLE_YARR_JIT 0&lt;br /&gt;-#endif&lt;br /&gt; &lt;br /&gt;&amp;nbsp#endif /* !defined(ENABLE_YARR_JIT) */&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;Nearly there! Now, we need to create digest for our newly created ebuild,so:&lt;br /&gt;&lt;code class="prettyprint"&gt;&lt;br /&gt;# ebuild /usr/local/portage/net-libs/xulrunner/xulrunner-2.0.1-r1.ebuild digest&lt;br /&gt;&gt;&gt;&gt; Creating Manifest for /usr/local/portage/net-libs/xulrunner&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;...and tell portage to use our local ebuild:&lt;br /&gt;&lt;code class="prettyprint"&gt;&lt;br /&gt;echo PORTDIR_OVERLAY="/usr/local/portage" &gt;&gt; /etc/make.conf&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;Ready to compile! Emerging xulrunner should give you output similar to this:&lt;br /&gt;&lt;code class="prettyprint"&gt;&lt;br /&gt;# emerge -av xulrunner&lt;br /&gt;&lt;br /&gt;These are the packages that would be merged, in order:&lt;br /&gt;&lt;br /&gt;Calculating dependencies... done!&lt;br /&gt;[ebuild   R   ~] net-libs/xulrunner-2.0.1-r1  USE="alsa crashreporter dbus ipc webm wifi -custom-optimization -debug -gconf -libnotify -startup-notification -system-sqlite" 0 kB [0=&gt;1]&lt;br /&gt;&lt;br /&gt;Total: 1 package (1 reinstall), Size of downloads: 0 kB&lt;br /&gt;Portage tree and overlays:&lt;br /&gt; [0] /usr/portage&lt;br /&gt; [1] /usr/local/portage&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;As can be seen, our new ebuild is just about to be emerged!&lt;br /&gt;&lt;br&gt;&lt;br /&gt;Make sure that you see the code being patched (I named the patch jit.patch)&lt;br /&gt;&lt;code class="prettyprint"&gt;&lt;br /&gt;...&lt;br /&gt; *   5009_use_system_libffi.patch ...                                                                                                                                        [ ok ]&lt;br /&gt; * Done with patching&lt;br /&gt; * Applying mozilla-2.0_support_64bit_big_endian.patch ...                                                                                                                   [ ok ]&lt;br /&gt;&lt;span style="font-weight:bold;"&gt; * Applying user patches from /etc/portage/patches//net-libs/xulrunner ...&lt;br /&gt; *   jit.patch ...                                                                                                                                                         [ ok ]&lt;/span&gt;  &lt;br /&gt; * Done with patching&lt;br /&gt;...&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;...and then when the summary of config options is displayed (seconds later), you will see this:&lt;br /&gt;&lt;code class="prettyprint"&gt;&lt;br /&gt;    --with-system-png               mozilla.org default&lt;br /&gt;    --enable-system-ffi             mozilla.org default&lt;br /&gt;    &lt;span style="font-weight:bold;"&gt;--disable-jit                   mozilla.org default&lt;br /&gt;    --disable-methodjit             mozilla.org default&lt;/span&gt;&lt;br /&gt;    --disable-system-sqlite         -system-sqlite&lt;br /&gt;    --disable-gconf                 -gconf&lt;br /&gt;==========================================================&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;Looks good! So after short while...perfect for a cup of coffee or a pint of your favourite lager, xulrunner is ready! Now we need to recompile firefox itself against it...&lt;br /&gt;&lt;code class="prettyprint"&gt;&lt;br /&gt;emerge firefox&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;The ebuild will still disable mprotect on Firefox as we haven't touched it. Just before we enable it using paxutils, we need to disable all the JIT options in Firefox itself. So start it up, type "&lt;span style="font-style:italic;"&gt;about:config&lt;/span&gt;" in the address bar and hit enter. Don't be worry about loosing warranty ;) Type jit in the filter and disable any option that is set to 'true' (click twice on it to change its value). Close Firefox and we can enable mprotect now!&lt;br /&gt;&lt;code class="prettyprint"&gt;&lt;br /&gt;# paxctl -v /usr/lib/firefox/firefox &lt;br /&gt;PaX control v0.5&lt;br /&gt;Copyright 2004,2005,2006,2007 PaX Team &lt;pageexec@freemail.hu&gt;&lt;br /&gt;&lt;br /&gt;- PaX flags: -----m-x-e-- [/usr/lib/firefox/firefox]&lt;br /&gt;        MPROTECT is disabled&lt;br /&gt;        RANDEXEC is disabled&lt;br /&gt;        EMUTRAMP is disabled&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;But that's not what we want! So:&lt;br /&gt;&lt;code class="prettyprint"&gt;&lt;br /&gt;# paxctl -M /usr/lib/firefox/firefox &lt;br /&gt;# paxctl -v /usr/lib/firefox/firefox &lt;br /&gt;PaX control v0.5&lt;br /&gt;Copyright 2004,2005,2006,2007 PaX Team &lt;pageexec@freemail.hu&gt;&lt;br /&gt;&lt;br /&gt;- PaX flags: ----M--x-e-- [/usr/lib/firefox/firefox]&lt;br /&gt;        MPROTECT is enabled&lt;br /&gt;        RANDEXEC is disabled&lt;br /&gt;        EMUTRAMP is disabled&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;Start Firefox and...voila - it works! :)&lt;br /&gt;&lt;br /&gt;It is worth noting, that plugins now run in a separate process: &lt;span style="font-style:italic;"&gt;plugin-container&lt;/span&gt; which is normally located in &lt;span style="font-style:italic;"&gt;/usr/lib/xulrunner-2.0/&lt;/span&gt;. To achieve best security, it should have the mprotect flag enabled as well. (Un)fortunatelly - flash will not work! So if you don't care about youtube and alike:&lt;br /&gt;&lt;code class="prettyprint"&gt;&lt;br /&gt;paxctl -M /usr/lib64/xulrunner-2.0/plugin-container&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;To verify that it is actually working you can find the PID of firefox running the &lt;span style="font-style:italic;"&gt;ps&lt;/span&gt; command and then cat &lt;span style="font-style:italic;"&gt;/proc/&lt;span style="font-style:italic;"&gt;&lt;span style="font-weight:bold;"&gt;PID&lt;/span&gt;&lt;/span&gt;/status&lt;/span&gt; and at the bottom there will be something like this:&lt;br /&gt;&lt;code class="prettyprint"&gt;&lt;br /&gt;Cpus_allowed:   f&lt;br /&gt;Cpus_allowed_list: 0-3&lt;br /&gt;Mems_allowed:   00000000,00000001&lt;br /&gt;Mems_allowed_list: 0&lt;br /&gt;voluntary_ctxt_switches:     21023&lt;br /&gt;nonvoluntary_ctxt_switches:  1664&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;PaX:  PeMRs&lt;/span&gt;&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;...where the capital '&lt;span style="font-weight:bold;"&gt;M&lt;/span&gt;' stands for enabled MPROTECT. How cool is that? ;) Enjoy!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3050029677375999718-5913220935724717008?l=hardenedgentoo.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://hardenedgentoo.blogspot.com/feeds/5913220935724717008/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://hardenedgentoo.blogspot.com/2011/06/enabling-mprotect-on-firefox-4.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3050029677375999718/posts/default/5913220935724717008'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3050029677375999718/posts/default/5913220935724717008'/><link rel='alternate' type='text/html' href='http://hardenedgentoo.blogspot.com/2011/06/enabling-mprotect-on-firefox-4.html' title='Enabling MPROTECT on Firefox 4'/><author><name>radegand</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3050029677375999718.post-2713728206841496375</id><published>2010-07-28T20:45:00.003+01:00</published><updated>2010-07-28T21:40:06.546+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='mprotect'/><category scheme='http://www.blogger.com/atom/ns#' term='firefox'/><category scheme='http://www.blogger.com/atom/ns#' term='grsecurity'/><category scheme='http://www.blogger.com/atom/ns#' term='hardened gentoo'/><title type='text'>Grsecurity, Firefox, MPROTECT and You!</title><content type='html'>Firefox is definitely one of this pieces of software where you want to have all of the available security options enabled :) And one of those features that you might REALLY want is MPROTECT (brought to you by the &lt;a href="http://grsecurity.net"&gt;grsecurity&lt;/a&gt; ;)). Making long story short, it works by restricting the mprotect() system call which makes life of an attacker much more difficult because they cannot simply change protection of a specific memory region (mark it as executable if it wasn't originally executable) or create a new writeable&amp;executable memory mapping using the mmap() call. Without this feature, all the 'non-executable memory regions' hype in your system is more or less useless, as the permission could be simply changed by the attacker. So far so good :)&lt;br /&gt;&lt;br /&gt;However, you can notice that Gentoo by default disables this protection (without really telling user why!) as it usually wreaks havoc with flash and java plugins and sometimes the browser itself...but what if you don't really care about these and you do want to have this on? Well, it gets more interesting...historically, Firefox had issues with MROTECT every now and then, so how does it look like with the latest 3.6.8 release?&lt;br /&gt;&lt;br /&gt;During the emerge process you can see this:&lt;br /&gt;&lt;code class="prettyprint"&gt;&lt;br /&gt; * Legacy EI PaX marking -m&lt;br /&gt; *      /var/tmp/portage/www-client/firefox-3.6.8/image///usr/lib64/mozilla-firefox/firefox&lt;br /&gt; * PT PaX marking -m&lt;br /&gt; *      /var/tmp/portage/www-client/firefox-3.6.8/image///usr/lib64/mozilla-firefox/firefox&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;Which can be also confirmed by using the paxctl tool:&lt;br /&gt;&lt;code class="prettyprint"&gt;&lt;br /&gt;# paxctl -v /usr/lib64/mozilla-firefox/firefox &lt;br /&gt;PaX control v0.5&lt;br /&gt;Copyright 2004,2005,2006,2007 PaX Team &lt;pageexec@freemail.hu&gt;&lt;br /&gt;&lt;br /&gt;- PaX flags: -----m-x-e-- [/usr/lib64/mozilla-firefox/firefox]&lt;br /&gt;        MPROTECT is disabled&lt;br /&gt;        RANDEXEC is disabled&lt;br /&gt;        EMUTRAMP is disabled&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;Not really what we wanted...let's reset it! (you need to run this command as root)&lt;br /&gt;&lt;code class="prettyprint"&gt;&lt;br /&gt;# paxctl -z /usr/lib64/mozilla-firefox/firefox &lt;br /&gt;# paxctl -v /usr/lib64/mozilla-firefox/firefox &lt;br /&gt;PaX control v0.5&lt;br /&gt;Copyright 2004,2005,2006,2007 PaX Team &lt;pageexec@freemail.hu&gt;&lt;br /&gt;&lt;br /&gt;- PaX flags: ------------ [/usr/lib64/mozilla-firefox/firefox]&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;That's better! Ok, but does it actually work?&lt;br /&gt;&lt;code class="prettyprint"&gt;&lt;br /&gt;$ firefox&lt;br /&gt;Segmentation fault&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;Ooops...not good! So what's the problem? Last few lines of strace output show the answer:&lt;br /&gt;&lt;code class="prettyprint"&gt;&lt;br /&gt;mmap(NULL, 65536, &lt;span style="font-weight:bold;"&gt;PROT_READ|PROT_WRITE|PROT_EXEC&lt;/span&gt;, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = -1 EPERM (&lt;span style="font-weight:bold;"&gt;Operation not permitted&lt;/span&gt;)&lt;br /&gt;mprotect(0xfffffffffffff000, 69632, &lt;span style="font-weight:bold;"&gt;PROT_READ|PROT_WRITE|PROT_EXEC&lt;/span&gt;) = -1 ENOMEM (&lt;span style="font-weight:bold;"&gt;Cannot allocate memory&lt;/span&gt;)&lt;br /&gt;--- SIGSEGV (Segmentation fault) @ 0 (0) ---&lt;br /&gt;unlink("/home/radegand/.mozilla/firefox/ekyjebvs.default/lock") = 0&lt;br /&gt;rt_sigaction(SIGSEGV, {SIG_DFL, [], SA_RESTORER, 0x3434af56120}, NULL, 8) = 0&lt;br /&gt;rt_sigprocmask(SIG_UNBLOCK, [SEGV], NULL, 8) = 0&lt;br /&gt;tgkill(26608, 26608, SIGSEGV)           = 0&lt;br /&gt;--- SIGSEGV (Segmentation fault) @ 0 (0) ---&lt;br /&gt;+++ killed by SIGSEGV +++&lt;br /&gt;Segmentation fault&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;The mmap() call above tries to create a writeable and executable memory mapping (which is not permitted by Grsecurity) which is followed by a call to mprotect() to set the same permission ('rwx'), which is also not permitted...so then it segfaults...:)&lt;br /&gt;&lt;br /&gt;Luckily, there's a workaround! From information gathered on IRC, the following two options would allow Firefox to run with the MPROTECT feature on:&lt;br /&gt;&lt;code class="prettyprint"&gt;&lt;br /&gt;user_pref("javascript.options.jit.chrome", false); &lt;br /&gt;user_pref("javascript.options.jit.content", false);&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;They should be added in the &lt;span style="font-style:italic;"&gt;prefs.js&lt;/span&gt; file located in the Firefox profile folder:&lt;br /&gt;&lt;code class="prettyprint"&gt;&lt;br /&gt;/home/&lt;span style="font-style:italic;"&gt;[your_user]&lt;/span&gt;/.mozilla/firefox/&lt;span style="font-style:italic;"&gt;[random_string]&lt;/span&gt;.default/&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;...and then Firefox will run happily ever after...or so one would hope... ;)&lt;br /&gt;&lt;br /&gt;Of course you could disable MPROTECT, start Firefox, go to &lt;span style="font-style:italic;"&gt;about:config&lt;/span&gt; and add the options above. But do you really want to run your browser without this protection, even just for few seconds? ;) Well, if JIT really needs 'rwx' pages, given for instance &lt;a href="http://blog.mozilla.com/security/2009/07/14/critical-javascript-vulnerability-in-firefox-35/"&gt;this&lt;/a&gt; issue, I'm not sure if I would... ;P&lt;br /&gt;&lt;br /&gt;Ok, but what is the real cause of the problem? Let's see...unpack the source code and have a poke around - Gentoo ebuild system comes handy here:&lt;br /&gt;&lt;code class="prettyprint"&gt;&lt;br /&gt;# ebuild /usr/portage/www-client/firefox/firefox-3.6.8.ebuild unpack&lt;br /&gt;# cd /var/tmp/portage/www-client/firefox-3.6.8/work/&lt;br /&gt;work # grep -R -i PROT_EXEC *&lt;br /&gt;mozilla-1.9.2/js/ctypes/libffi/src/closures.c:   don't attempt PROT_EXEC|PROT_WRITE mapping at all, as that&lt;br /&gt;mozilla-1.9.2/js/ctypes/libffi/src/closures.c:  ptr = mmap (NULL, length, (prot &amp; ~PROT_WRITE) | PROT_EXEC,&lt;br /&gt;mozilla-1.9.2/js/ctypes/libffi/src/closures.c:      ptr = mmap (start, length, prot | PROT_EXEC, flags, fd, offset);&lt;br /&gt;mozilla-1.9.2/js/ctypes/libffi/src/closures.c:   with ((prot &amp; ~PROT_WRITE) | PROT_EXEC) and mremap with&lt;br /&gt;mozilla-1.9.2/js/ctypes/libffi/testsuite/libffi.call/ffitest.h:  page = mmap (NULL, size, PROT_READ | PROT_WRITE | PROT_EXEC,&lt;br /&gt;mozilla-1.9.2/js/ctypes/libffi/testsuite/libffi.call/ffitest.h:  page = mmap (NULL, size, PROT_READ | PROT_WRITE | PROT_EXEC,&lt;br /&gt;mozilla-1.9.2/js/ctypes/libffi/testsuite/libffi.special/ffitestcxx.h:  page = mmap (NULL, size, PROT_READ | PROT_WRITE | PROT_EXEC,&lt;br /&gt;mozilla-1.9.2/js/ctypes/libffi/testsuite/libffi.special/ffitestcxx.h:  page = mmap (NULL, size, PROT_READ | PROT_WRITE | PROT_EXEC,&lt;br /&gt;mozilla-1.9.2/js/src/nanojit/avmplus.cpp:    flags |= PROT_EXEC;&lt;br /&gt;mozilla-1.9.2/js/src/nanojit/avmplus.cpp:                PROT_READ | PROT_WRITE | PROT_EXEC,&lt;br /&gt;mozilla-1.9.2/layout/base/tests/TestPoisonArea.cpp:  return mprotect((caddr_t)page, PAGESIZE, PROT_READ|PROT_WRITE|PROT_EXEC);&lt;br /&gt;mozilla-1.9.2/layout/base/tests/TestPoisonArea.cpp:  // (mmap(PROT_EXEC) may fail when applied to anonymous memory.)&lt;br /&gt;mozilla-1.9.2/nsprpub/lib/msgc/src/unixgc.c:    addr = mmap(lastaddr, size, PROT_READ|PROT_WRITE|PROT_EXEC,&lt;br /&gt;mozilla-1.9.2/nsprpub/lib/msgc/src/unixgc.c:    addr = mmap(base + oldSize, allocSize, PROT_READ|PROT_WRITE|PROT_EXEC,&lt;br /&gt;mozilla-1.9.2/nsprpub/pr/src/md/unix/nextstep.c:                case PROT_EXEC:         mach_prot = VM_PROT_EXECUTE;    break;&lt;br /&gt;mozilla-1.9.2/nsprpub/pr/src/md/unix/unix.c:    prot |= PROT_EXEC;&lt;br /&gt;mozilla-1.9.2/toolkit/crashreporter/google-breakpad/src/google_breakpad/common/minidump_exception_mac.h:  /* EXC_I386_EXTOVRFLT =  9: mapped to EXC_BAD_ACCESS/(PROT_READ|PROT_EXEC) */&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;So here are your potential offenders...The next step would be to investigate the code further and try to remove the PROT_EXEC flag where it does not seem necessary, compile and test...believe it or not, it's sometimes much &lt;a href="http://bugs.gentoo.org/show_bug.cgi?id=329499"&gt;easier&lt;/a&gt; than it sounds!&lt;br /&gt;&lt;br /&gt;...but more about it next time...&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3050029677375999718-2713728206841496375?l=hardenedgentoo.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://hardenedgentoo.blogspot.com/feeds/2713728206841496375/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://hardenedgentoo.blogspot.com/2010/07/grsecurity-firefox-mprotect-and-you.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3050029677375999718/posts/default/2713728206841496375'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3050029677375999718/posts/default/2713728206841496375'/><link rel='alternate' type='text/html' href='http://hardenedgentoo.blogspot.com/2010/07/grsecurity-firefox-mprotect-and-you.html' title='Grsecurity, Firefox, MPROTECT and You!'/><author><name>radegand</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3050029677375999718.post-6024412505059894223</id><published>2010-04-28T20:24:00.003+01:00</published><updated>2010-04-28T20:53:58.558+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='hardened gentoo'/><category scheme='http://www.blogger.com/atom/ns#' term='amd64'/><category scheme='http://www.blogger.com/atom/ns#' term='PIE'/><category scheme='http://www.blogger.com/atom/ns#' term='mplayer'/><title type='text'>mplayer PIE on amd64 :)</title><content type='html'>For ages it was not possible to compile mplayer as Position Independent Executable (at least not on amd64) - until today! To my greatest surprise it compiled fine using the default gentoo hardened gcc spec, including PIE support.&lt;br /&gt;&lt;br /&gt;So simply sync your portage tree, emerge &lt;span style="font-weight:bold;"&gt;mplayer-1.0_rc4_p20100427&lt;/span&gt; and enjoy! Watching your favourite movie has never felt so safe before! ;]&lt;br /&gt;&lt;br /&gt;&lt;code class="prettyprint"&gt;&lt;br /&gt;./checksec.sh --file /usr/bin/mplayer&lt;br /&gt;RELRO           STACK CANARY      NX            PIE                     FILE&lt;br /&gt;Full RELRO      Canary found      NX enabled    &lt;span style="font-weight:bold;"&gt;PIE enabled&lt;/span&gt;             /usr/bin/mplayer&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;...or alternatively:&lt;br /&gt;&lt;code class="prettyprint"&gt;&lt;br /&gt;readelf -h /usr/bin/mplayer&lt;br /&gt;ELF Header:&lt;br /&gt;  Magic:   7f 45 4c 46 02 01 01 00 00 00 00 00 00 00 00 00 &lt;br /&gt;  Class:                             ELF64&lt;br /&gt;  Data:                              2's complement, little endian&lt;br /&gt;  Version:                           1 (current)&lt;br /&gt;  OS/ABI:                            UNIX - System V&lt;br /&gt;  ABI Version:                       0&lt;br /&gt;  &lt;span style="font-weight:bold;"&gt;Type:                              DYN (Shared object file)&lt;/span&gt;&lt;br /&gt;  Machine:                           Advanced Micro Devices X86-64&lt;br /&gt;  Version:                           0x1&lt;br /&gt;  Entry point address:               0xcae48&lt;br /&gt;  Start of program headers:          64 (bytes into file)&lt;br /&gt;  Start of section headers:          9064016 (bytes into file)&lt;br /&gt;  Flags:                             0x0&lt;br /&gt;  Size of this header:               64 (bytes)&lt;br /&gt;  Size of program headers:           56 (bytes)&lt;br /&gt;  Number of program headers:         10&lt;br /&gt;  Size of section headers:           64 (bytes)&lt;br /&gt;  Number of section headers:         27&lt;br /&gt;  Section header string table index: 26&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;Enjoy the PIE! ;]&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3050029677375999718-6024412505059894223?l=hardenedgentoo.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://hardenedgentoo.blogspot.com/feeds/6024412505059894223/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://hardenedgentoo.blogspot.com/2010/04/mplayer-pie-on-amd64.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3050029677375999718/posts/default/6024412505059894223'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3050029677375999718/posts/default/6024412505059894223'/><link rel='alternate' type='text/html' href='http://hardenedgentoo.blogspot.com/2010/04/mplayer-pie-on-amd64.html' title='mplayer PIE on amd64 :)'/><author><name>radegand</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3050029677375999718.post-2562115471490822053</id><published>2010-04-15T18:45:00.009+01:00</published><updated>2010-04-15T22:48:03.927+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='gentoo'/><category scheme='http://www.blogger.com/atom/ns#' term='howto'/><category scheme='http://www.blogger.com/atom/ns#' term='kvm'/><category scheme='http://www.blogger.com/atom/ns#' term='networking'/><title type='text'>KVM setup with bridged networking</title><content type='html'>The other day I hat to run my virtual machines on the same network as the host system itself and as I found information on the net to be a bit confusing I thought I could share how I came to terms with it :)&lt;br /&gt;&lt;br /&gt;As usual I've used the &lt;a href=http://en.gentoo-wiki.com/wiki/KVM&gt;following&lt;/a&gt; &lt;a href=http://en.gentoo-wiki.com/wiki/QEmu&gt;information&lt;/a&gt; resources - both of which have different view on the networking setup... ;) They do, however, mention all the prerequisites which have to met in order for the networking to work. So I assume that you have emerged &lt;span style="font-style:italic;"&gt;bridge-utils&lt;/span&gt; and that kernel support for &lt;span style="font-weight:bold;"&gt;TUN/TAP device driver&lt;/span&gt;, &lt;span style="font-weight:bold;"&gt;"802.1d Ethernet Bridging"&lt;/span&gt; and &lt;span style="font-weight:bold;"&gt;"802.1Q VLAN Support"&lt;/span&gt; is enabled. &lt;br /&gt;&lt;br /&gt;If you've been using NATed networking before, you need to remove vde from your start-up script:&lt;br /&gt;&lt;code class="prettyprint"&gt;&lt;br /&gt;rc-update vde del default&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;In my case my host and my VMs were getting addresses via DHCP. You could use static addresses as well - just specify the addresses for each interface manually and remember to add line for default route (see the links above for some examples on this). So below is my &lt;span style="font-style:italic;"&gt;/etc/conf.d/net&lt;/span&gt; file. &lt;br /&gt;&lt;code class="prettyprint"&gt;&lt;br /&gt;bridge_br0="eth0 tap0 tap1"                                                                                           config_eth0=( "null" )&lt;br /&gt;config_br0=( "dhcp" )&lt;br /&gt;brctl_br0=( "setfd 0" "sethello 0" "stp off" )&lt;br /&gt;rc_need_br0=( "net.tap0" "net.tap1" "net.eth0" )&lt;br /&gt;&lt;br /&gt;config_tap0=( "null ")&lt;br /&gt;tuntap_tap0="tap"&lt;br /&gt;tunctl_tap0="-u radegand"&lt;br /&gt;mac_tap0="00:a0:b0:c0:d0:f0"                                                                                                                                &lt;br /&gt;config_tap1=( "null ") &lt;br /&gt;tuntap_tap1="tap"                                                                                &lt;br /&gt;tunctl_tap1="-u radegand"&lt;br /&gt;mac_tap1="00:a1:b1:c1:d1:f1"&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;Ok, section by section...&lt;br /&gt;The first section defines the bridge to be comprised of three interfaces: one physical (&lt;span style="font-weight:bold;"&gt;eth0&lt;/span&gt;) and two virtual (&lt;span style="font-weight:bold;"&gt;tap0&lt;/span&gt; and &lt;span style="font-weight:bold;"&gt;tap1&lt;/span&gt;). It then specifies that no ip address is required for eth0, instead it specifies that interface &lt;span style="font-weight:bold;"&gt;br0&lt;/span&gt; will obtain it ip settings via DHCP. It also specifies some bridge options and sets dependencies for the br0 so when the &lt;span style="font-style:italic;"&gt;init.d&lt;/span&gt; script is executed it can handle these properly. &lt;br /&gt;&lt;br /&gt;The next two sections define tap0 and tap1 interfaces. It specifies that no IP address is needed for each of them (VM will get the IP instead - more on it later), the device type, the user who will have access to that device - this should be the same user who would run the VM itself. Finally - a specific mac address (you can be creative here! ;)) needs to be assigned to each tap device. You need such a section for each VM that will use the bridged network and each of such virtual interface can be used by one VM only.&lt;br /&gt;&lt;br /&gt;Ok, time two start the new shiny interfaces! ;) Make sure that you have all the required links to start them:&lt;br /&gt;&lt;code class="prettyprint"&gt;&lt;br /&gt;ln -s /etc/init.d/net.lo /etc/init.d/net.tap0&lt;br /&gt;ln -s /etc/init.d/net.lo /etc/init.d/net.tap1&lt;br /&gt;ln -s /etc/init.d/net.lo /etc/init.d/net.br0&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;...and start them of course!:&lt;br /&gt;&lt;code class="prettyprint"&gt;&lt;br /&gt;/etc/init.d/net.tap0 start&lt;br /&gt;/etc/init.d/net.tap1 start&lt;br /&gt;/etc/init.d/net.br0 start&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;Remember to add them to a relevant boot level using &lt;span style="font-style:italic;"&gt;rc-update&lt;/span&gt; when everything is tested and working fine...&lt;br /&gt;&lt;br /&gt;Rite, now the interfaces should be up and ready to test! Let's see...&lt;br /&gt;&lt;code class="prettyprint"&gt;&lt;br /&gt;# ifconfig&lt;br /&gt;br0       Link encap:Ethernet  HWaddr 00:aa:bb:cc:dd:ee  &lt;br /&gt;          inet addr:192.168.0.10  Bcast:192.168.0.255  Mask:255.255.255.0&lt;br /&gt;          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1&lt;br /&gt;          RX packets:201 errors:0 dropped:0 overruns:0 frame:0&lt;br /&gt;          TX packets:150 errors:0 dropped:0 overruns:0 carrier:0&lt;br /&gt;          collisions:0 txqueuelen:0 &lt;br /&gt;          RX bytes:16269 (15.8 KiB)  TX bytes:38080 (37.1 KiB)&lt;br /&gt;&lt;br /&gt;eth0      Link encap:Ethernet  HWaddr 00:aa:bb:cc:dd:ee  &lt;br /&gt;          UP BROADCAST RUNNING PROMISC MULTICAST  MTU:1500  Metric:1&lt;br /&gt;          RX packets:202 errors:0 dropped:0 overruns:0 frame:0&lt;br /&gt;          TX packets:157 errors:0 dropped:0 overruns:0 carrier:0&lt;br /&gt;          collisions:0 txqueuelen:1000 &lt;br /&gt;          RX bytes:20135 (19.6 KiB)  TX bytes:39152 (38.2 KiB)&lt;br /&gt;          Interrupt:17 &lt;br /&gt;&lt;br /&gt;tap0      Link encap:Ethernet  HWaddr 00:a0:b0:c0:d0:f0  &lt;br /&gt;          UP BROADCAST RUNNING PROMISC MULTICAST  MTU:1500  Metric:1&lt;br /&gt;          RX packets:0 errors:0 dropped:0 overruns:0 frame:0&lt;br /&gt;          TX packets:0 errors:0 dropped:21 overruns:0 carrier:0&lt;br /&gt;          collisions:0 txqueuelen:500 &lt;br /&gt;          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)&lt;br /&gt;&lt;br /&gt;tap1      Link encap:Ethernet  HWaddr 00:a1:b1:c1:d1:f1  &lt;br /&gt;          UP BROADCAST RUNNING PROMISC MULTICAST  MTU:1500  Metric:1&lt;br /&gt;          RX packets:0 errors:0 dropped:0 overruns:0 frame:0&lt;br /&gt;          TX packets:0 errors:0 dropped:21 overruns:0 carrier:0&lt;br /&gt;          collisions:0 txqueuelen:500 &lt;br /&gt;          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;Note that the mac address of the br0 is the same as eth0 (yes, I did amended them a bit here, they're not my real mac addresses but they DO match nevertheless...)&lt;br /&gt;&lt;br /&gt;Time to start VMs! So the magic command that needs to be added to the qemu/kvm command line which will get you bridged network is...:&lt;br /&gt;&lt;code class="prettyprint"&gt;&lt;br /&gt;-net tap,ifname=&lt;span style="font-weight:bold;"&gt;tap0&lt;/span&gt;,script=no,downscript=no -net nic,macaddr=00:a0:b0:c0:d0:&lt;span style="font-weight:bold;"&gt;f1&lt;/span&gt;&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;Now, the important bits are highlighted - for each of your VMs you need to use separate tap interface. Moreover, you need to specify mac address for the VM and it has to be different that the one specified for given tap interface in &lt;span style="font-style:italic;"&gt;/etc/conf.d/net&lt;/span&gt; file. Of course it can be entirely different, not only by last byte - I just keep it this way to keep track of my VMs...But don't take my world for that - try using the same mac address for your VM as you set for the tap interface...and then when your VM is up and running &lt;span style="font-style:italic;"&gt;grep&lt;/span&gt; the &lt;span style="font-style:italic;"&gt;/var/log/kern.log&lt;/span&gt; file on your host system for:&lt;br /&gt;&lt;code class="prettyprint"&gt;&lt;br /&gt;tap0: received packet with own address as source address&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;So for each VM you run use different tap interface and remember to set different mac address than the tap device itself...&lt;br /&gt;&lt;br /&gt;Ok, now you should have KVM setup up with bridged networking...no additional setup is need - no need for specific iptables rules and you don't even need to have the ip forwarding (&lt;span style="font-style:italic;"&gt;/proc/sys/net/ipv4/ip_forward&lt;/span&gt;) enabled for it to work! Now - how cool is that? ;)&lt;br /&gt;&lt;br /&gt;PS. No - it won't work with wireless, only with ethernet...if you need a wireless bridge - have a look &lt;a href="http://www.faqs.org/docs/Linux-mini/Proxy-ARP-Subnet.html"&gt;here&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3050029677375999718-2562115471490822053?l=hardenedgentoo.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://hardenedgentoo.blogspot.com/feeds/2562115471490822053/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://hardenedgentoo.blogspot.com/2010/04/kvm-setup-with-bridged-networking.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3050029677375999718/posts/default/2562115471490822053'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3050029677375999718/posts/default/2562115471490822053'/><link rel='alternate' type='text/html' href='http://hardenedgentoo.blogspot.com/2010/04/kvm-setup-with-bridged-networking.html' title='KVM setup with bridged networking'/><author><name>radegand</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3050029677375999718.post-4976650399536451479</id><published>2010-03-13T13:26:00.005Z</published><updated>2010-03-13T15:10:10.184Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='paxtest'/><category scheme='http://www.blogger.com/atom/ns#' term='grsecurity'/><category scheme='http://www.blogger.com/atom/ns#' term='kernel'/><title type='text'>New paxtest 0.9.9</title><content type='html'>New &lt;span style="font-weight:bold;"&gt;paxtest&lt;/span&gt; has been recently released! ...along with the new &lt;span style="font-weight:bold;"&gt;hardened-sources-2.6.33&lt;/span&gt; ebuild (testing from the hardened-development overlay). This had to be tested! ;]&lt;br /&gt;&lt;br /&gt;Although paxtest ebuild itself has not been updated yet, you can compile it from &lt;a href="http://grsecurity.net/~spender/paxtest-0.9.9.tgz"&gt;source&lt;/a&gt; or update ebuild in your local repository..&lt;br /&gt;&lt;br /&gt;Anyway - results below:&lt;br /&gt;&lt;code class="prettyprint"&gt;&lt;br /&gt;# paxtest blackhat&lt;br /&gt;PaXtest - Copyright(c) 2003,2004 by Peter Busser &lt;peter@adamantix.org&gt;&lt;br /&gt;Released under the GNU Public Licence version 2 or later&lt;br /&gt;&lt;br /&gt;Writing output to paxtest.log&lt;br /&gt;It may take a while for the tests to complete&lt;br /&gt;Test results:&lt;br /&gt;PaXtest - Copyright(c) 2003,2004 by Peter Busser &lt;peter@adamantix.org&gt;&lt;br /&gt;Released under the GNU Public Licence version 2 or later&lt;br /&gt;&lt;br /&gt;Mode: blackhat&lt;br /&gt;Linux quad 2.6.33-hardened #1 SMP Sat Mar 13 10:00:54 GMT 2010 x86_64 Intel(R) Core(TM)2 Quad CPU Q6600 @ 2.40GHz GenuineIntel GNU/Linux&lt;br /&gt;&lt;br /&gt;Executable anonymous mapping             : Killed&lt;br /&gt;Executable bss                           : Killed&lt;br /&gt;Executable data                          : Killed&lt;br /&gt;Executable heap                          : Killed&lt;br /&gt;Executable stack                         : Killed&lt;br /&gt;Executable shared library bss            : Killed&lt;br /&gt;Executable shared library data           : Killed&lt;br /&gt;Executable anonymous mapping (mprotect)  : Killed&lt;br /&gt;Executable bss (mprotect)                : Killed&lt;br /&gt;Executable data (mprotect)               : Killed&lt;br /&gt;Executable heap (mprotect)               : Killed&lt;br /&gt;Executable stack (mprotect)              : Killed&lt;br /&gt;Executable shared library bss (mprotect) : Killed&lt;br /&gt;Executable shared library data (mprotect): Killed&lt;br /&gt;Writable text segments                   : Killed&lt;br /&gt;Anonymous mapping randomisation test     : 33 bits (guessed)&lt;br /&gt;Heap randomisation test (ET_EXEC)        : 40 bits (guessed)&lt;br /&gt;Heap randomisation test (PIE)            : 40 bits (guessed)&lt;br /&gt;Main executable randomisation (ET_EXEC)  : 32 bits (guessed)&lt;br /&gt;Main executable randomisation (PIE)      : 32 bits (guessed)&lt;br /&gt;Shared library randomisation test        : 33 bits (guessed)&lt;br /&gt;Stack randomisation test (SEGMEXEC)      : 40 bits (guessed)&lt;br /&gt;Stack randomisation test (PAGEEXEC)      : 40 bits (guessed)&lt;br /&gt;Return to function (strcpy)              : paxtest: return address contains a NULL byte.&lt;br /&gt;Return to function (memcpy)              : Vulnerable&lt;br /&gt;Return to function (strcpy, PIE)         : paxtest: return address contains a NULL byte.&lt;br /&gt;Return to function (memcpy, PIE)         : Vulnerable&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;Return to function is the key! ;]&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3050029677375999718-4976650399536451479?l=hardenedgentoo.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://hardenedgentoo.blogspot.com/feeds/4976650399536451479/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://hardenedgentoo.blogspot.com/2010/03/new-paxtest-099.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3050029677375999718/posts/default/4976650399536451479'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3050029677375999718/posts/default/4976650399536451479'/><link rel='alternate' type='text/html' href='http://hardenedgentoo.blogspot.com/2010/03/new-paxtest-099.html' title='New paxtest 0.9.9'/><author><name>radegand</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3050029677375999718.post-3062031221085386440</id><published>2010-02-14T10:47:00.001Z</published><updated>2010-02-14T10:52:20.453Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='overlay'/><category scheme='http://www.blogger.com/atom/ns#' term='gentoo'/><category scheme='http://www.blogger.com/atom/ns#' term='hardened gentoo'/><category scheme='http://www.blogger.com/atom/ns#' term='gcc-4.4.3'/><title type='text'>Gcc-4.4.3 on Gentoo Hardened</title><content type='html'>Freshly released version of gcc-4.4.3 is now available on gentoo hardened! ;] As usually, it is available via the &lt;span style="font-style:italic;"&gt;hardened-development&lt;/span&gt; overlay. Thanks guys!&lt;br /&gt;&lt;code class="prettyprint"&gt; &lt;br /&gt;# gcc-config -l&lt;br /&gt; [1] x86_64-pc-linux-gnu-3.4.6&lt;br /&gt; [2] x86_64-pc-linux-gnu-3.4.6-hardenednopie&lt;br /&gt; [3] x86_64-pc-linux-gnu-3.4.6-hardenednopiessp&lt;br /&gt; [4] x86_64-pc-linux-gnu-3.4.6-hardenednossp&lt;br /&gt; [5] x86_64-pc-linux-gnu-3.4.6-vanilla&lt;br /&gt; [6] x86_64-pc-linux-gnu-4.4.3 *&lt;br /&gt; [7] x86_64-pc-linux-gnu-4.4.3-hardenednopie&lt;br /&gt; [8] x86_64-pc-linux-gnu-4.4.3-hardenednossp&lt;br /&gt; [9] x86_64-pc-linux-gnu-4.4.3-vanilla&lt;br /&gt;&lt;/code&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3050029677375999718-3062031221085386440?l=hardenedgentoo.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://hardenedgentoo.blogspot.com/feeds/3062031221085386440/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://hardenedgentoo.blogspot.com/2010/02/gcc-443-on-gentoo-hardened.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3050029677375999718/posts/default/3062031221085386440'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3050029677375999718/posts/default/3062031221085386440'/><link rel='alternate' type='text/html' href='http://hardenedgentoo.blogspot.com/2010/02/gcc-443-on-gentoo-hardened.html' title='Gcc-4.4.3 on Gentoo Hardened'/><author><name>radegand</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3050029677375999718.post-4544525038248931416</id><published>2010-02-09T21:31:00.003Z</published><updated>2010-02-09T22:38:53.396Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='installation'/><category scheme='http://www.blogger.com/atom/ns#' term='howto'/><category scheme='http://www.blogger.com/atom/ns#' term='pentoo'/><title type='text'>Installing Pentoo on Hard Drive with LUKS encryption</title><content type='html'>Pentoo is a great Linux distro created with security testing in mind - be it a penetration testing or wireless testing. I know - Backtrack 4 is out there and is cool too ;P however, being a Gentoo user you simply cannot resist Pentoo... ;) It might be just me but I find it so much easier to customise as well! And how many times you had to install something from source? And then getting all the header files and tricky dependencies right can be cumbersome...with Pentoo - you have the full Gentoo portage tree plus lots of security tools available as ebuilds at hand. If something's not there - it's so god damn easy to...compile it! ;]&lt;br /&gt;&lt;br /&gt;Anyway - here's a quick howto how to get Pentoo installed on your hard drive with LUKS encrypted root partition and encrypted swap, too... LiveCD is great, but you might want to have something more permanent and faster...so here it goes!&lt;br /&gt;&lt;br /&gt;Installation guides that I've used for reference:&lt;br /&gt;&lt;a href="http://www.netsc.ch/IMG/pdf/pentoo.pdf"&gt;http://www.netsc.ch/IMG/pdf/pentoo.pdf&lt;/a&gt;&lt;br /&gt;and here:&lt;br /&gt;&lt;a href="http://trac.pentoo.ch/wiki/Livecd/Installation"&gt;http://trac.pentoo.ch/wiki/Livecd/Installation&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Boot the LiveCD and check that networking is fine and that sshd is running (you don't necessarily need networking at this stage but I prefer to do the installation remotely). Also change root password:&lt;br /&gt;&lt;code class="prettyprint"&gt; &lt;br /&gt;dhcpcd eth0&lt;br /&gt;/etc/init.d/sshd start&lt;br /&gt;passwd&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;Create installation partitions. You'll at least need /boot, / (root), and swap. My setup was as follows:&lt;br /&gt;&lt;code class="prettyprint"&gt;&lt;br /&gt;pentoo ~ # fdisk -l&lt;br /&gt;&lt;br /&gt;Disk /dev/sda: 60.0 GB, 60011642880 bytes&lt;br /&gt;16 heads, 63 sectors/track, 116280 cylinders&lt;br /&gt;Units = cylinders of 1008 * 512 = 516096 bytes&lt;br /&gt;Disk identifier: 0x6ce2c029&lt;br /&gt;&lt;br /&gt;   Device Boot      Start         End      Blocks   Id  System&lt;br /&gt;/dev/sda1               1         195       98248+  83  Linux&lt;br /&gt;/dev/sda2             196        4071     1953504   83  Linux&lt;br /&gt;/dev/sda3            4072      116280    56553336   83  Linux&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;sda1&lt;/span&gt; - boot&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;sda2&lt;/span&gt; - swap&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;sda3&lt;/span&gt; - root&lt;br /&gt;&lt;br /&gt;Onto encrypted partition creation... ;) You can of course tune the encryption options (see the &lt;span style="font-style:italic;"&gt;cryptsetup&lt;/span&gt; manpage)&lt;br /&gt;&lt;code class="prettyprint"&gt; &lt;br /&gt;pentoo ~ # cryptsetup --verbose --cipher "aes-cbc-essiv:sha256" --key-size 256 --verify-passphrase luksFormat /dev/sda3&lt;br /&gt;&lt;br /&gt;WARNING!&lt;br /&gt;========&lt;br /&gt;This will overwrite data on /dev/sda3 irrevocably.&lt;br /&gt;&lt;br /&gt;Are you sure? (Type uppercase yes): YES&lt;br /&gt;Enter LUKS passphrase:&lt;br /&gt;Verify passphrase:&lt;br /&gt;Command successful.&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;Now open the encrypted partition and create the mapping needed for installation:&lt;br /&gt;&lt;code class="prettyprint"&gt;&lt;br /&gt;pentoo ~ # cryptsetup luksOpen /dev/sda3 root&lt;br /&gt;Enter passphrase for /dev/sda3:&lt;br /&gt;Key slot 0 unlocked.&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;Create filesystems on newly created partitions. Feel free to use your favourite filesystem - just beware with &lt;span style="font-style:italic;"&gt;/boot&lt;/span&gt; partition as, for instance, grub doesn't really work with ext4...&lt;br /&gt;&lt;code class="prettyprint"&gt;&lt;br /&gt;pentoo ~ # mkfs.ext3 /dev/sda1&lt;br /&gt;mke2fs 1.41.9 (22-Aug-2009)&lt;br /&gt;Filesystem label=&lt;br /&gt;OS type: Linux&lt;br /&gt;Block size=1024 (log=0)&lt;br /&gt;Fragment size=1024 (log=0)&lt;br /&gt;24576 inodes, 98248 blocks&lt;br /&gt;4912 blocks (5.00%) reserved for the super user&lt;br /&gt;First data block=1&lt;br /&gt;Maximum filesystem blocks=67371008&lt;br /&gt;12 block groups&lt;br /&gt;8192 blocks per group, 8192 fragments per group&lt;br /&gt;2048 inodes per group&lt;br /&gt;Superblock backups stored on blocks:&lt;br /&gt;        8193, 24577, 40961, 57345, 73729&lt;br /&gt;&lt;br /&gt;Writing inode tables: done&lt;br /&gt;Creating journal (4096 blocks): done&lt;br /&gt;Writing superblocks and filesystem accounting information: done&lt;br /&gt;&lt;br /&gt;This filesystem will be automatically checked every 33 mounts or&lt;br /&gt;180 days, whichever comes first.  Use tune2fs -c or -i to override.&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;And the root partition to follow:&lt;br /&gt;&lt;code class="prettyprint"&gt;&lt;br /&gt;pentoo ~ # mkfs.ext3 /dev/mapper/root&lt;br /&gt;mke2fs 1.41.9 (22-Aug-2009)&lt;br /&gt;Filesystem label=&lt;br /&gt;OS type: Linux&lt;br /&gt;Block size=4096 (log=2)&lt;br /&gt;Fragment size=4096 (log=2)&lt;br /&gt;3538944 inodes, 14138077 blocks&lt;br /&gt;706903 blocks (5.00%) reserved for the super user&lt;br /&gt;First data block=0&lt;br /&gt;Maximum filesystem blocks=0&lt;br /&gt;432 block groups&lt;br /&gt;32768 blocks per group, 32768 fragments per group&lt;br /&gt;8192 inodes per group&lt;br /&gt;Superblock backups stored on blocks:&lt;br /&gt;        32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,&lt;br /&gt;        4096000, 7962624, 11239424&lt;br /&gt;&lt;br /&gt;Writing inode tables: done&lt;br /&gt;Creating journal (32768 blocks): done&lt;br /&gt;Writing superblocks and filesystem accounting information: done&lt;br /&gt;&lt;br /&gt;This filesystem will be automatically checked every 37 mounts or&lt;br /&gt;180 days, whichever comes first.  Use tune2fs -c or -i to override.&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;Mount partitions...&lt;br /&gt;&lt;code class="prettyprint"&gt;&lt;br /&gt;pentoo ~ # mount /dev/mapper/root /mnt/gentoo/&lt;br /&gt;pentoo ~ # mkdir /mnt/gentoo/boot&lt;br /&gt;pentoo ~ # mount /dev/sda1 /mnt/gentoo/boot/&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;Don't worry about swap partition - we'll encrypt it later.&lt;br /&gt;&lt;br /&gt;Now we need to copy files form LiveCD onto the hard drive. As there will be some overwriting happening, it's useful to unalias the &lt;span style="font-style:italic;"&gt;cp&lt;/span&gt; command first:&lt;br /&gt;&lt;code class="prettyprint"&gt;&lt;br /&gt;pentoo ~ # alias&lt;br /&gt;alias aemerge='ACCEPT_KEYWORDS="~x86" emerge'&lt;br /&gt;alias cp='cp -i'&lt;br /&gt;alias grep='grep --color=auto'&lt;br /&gt;alias ll='ls -l'&lt;br /&gt;alias ls='ls --color'&lt;br /&gt;alias mv='mv -i'&lt;br /&gt;alias rm='rm -i'&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;Unalias then!&lt;br /&gt;&lt;code class="prettyprint"&gt;&lt;br /&gt;unalias cp&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;...and then start copying the files:&lt;br /&gt;&lt;code class="prettyprint"&gt;&lt;br /&gt;cp -avf /mnt/livecd/* /mnt/gentoo&lt;br /&gt;cp -avf /etc /root /mnt/gentoo&lt;br /&gt;cp -avf /usr/portage /mnt/gentoo/usr&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;From there on it's pretty much a straight forward Gentoo installation - all tweaks allowed! ;]&lt;br /&gt;&lt;code class="prettyprint"&gt;&lt;br /&gt;pentoo ~ # mount -t proc none /mnt/gentoo/proc&lt;br /&gt;pentoo ~ # mount -o bind /dev /mnt/gentoo/dev&lt;br /&gt;pentoo ~ # chroot /mnt/gentoo /bin/bash&lt;br /&gt;pentoo / # env-update&lt;br /&gt;&gt;&gt;&gt; Regenerating /etc/ld.so.cache...&lt;br /&gt;pentoo / # source /etc/profile&lt;br /&gt;pentoo / # export PS1="(chroot) $PS1"&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;Just out of curiosity:&lt;br /&gt;&lt;code class="prettyprint"&gt;&lt;br /&gt;(chroot) pentoo src # gcc-config -l&lt;br /&gt; [1] i686-pc-linux-gnu-4.3.4 *&lt;br /&gt;(chroot) pentoo src # eselect profile list&lt;br /&gt;Available profile symlink targets:&lt;br /&gt;  [1]   default/linux/x86/10.0 *&lt;br /&gt;  [2]   default/linux/x86/10.0/desktop&lt;br /&gt;  [3]   default/linux/x86/10.0/developer&lt;br /&gt;  [4]   default/linux/x86/10.0/server&lt;br /&gt;  [5]   hardened/linux/x86/10.0&lt;br /&gt;  [6]   selinux/2007.0/x86&lt;br /&gt;  [7]   selinux/2007.0/x86/hardened&lt;br /&gt;  [8]   selinux/v2refpolicy/x86&lt;br /&gt;  [9]   selinux/v2refpolicy/x86/desktop&lt;br /&gt;  [10]  selinux/v2refpolicy/x86/developer&lt;br /&gt;  [11]  selinux/v2refpolicy/x86/hardened&lt;br /&gt;  [12]  selinux/v2refpolicy/x86/server&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;Not bad! You could always switch to the hardened profile, enable the &lt;a href="http://hardenedgentoo.blogspot.com/2009/10/64-bit-hardened-gentoo-with-luks-on.html"&gt;graphite&lt;/a&gt; extension and recompile world... ;)&lt;br /&gt;&lt;br /&gt;Anyway - kernel compilation! I'd use a &lt;a href="http://packages.gentoo.org/package/sys-kernel/hardened-sources"&gt;hardened-sources&lt;/a&gt; from the hardened-development overlay (you'll need to emerge &lt;span style="font-style:italic;"&gt;git&lt;/span&gt; for that) but you can as well just stay with the stock kernel...&lt;br /&gt;&lt;code class="prettyprint"&gt;&lt;br /&gt;(chroot) pentoo src # ls -la&lt;br /&gt;total 20&lt;br /&gt;drwxr-xr-x  5 root root 4096 Jan 22 13:55 .&lt;br /&gt;drwxr-xr-x 16 root root 4096 Dec  3 23:31 ..&lt;br /&gt;lrwxrwxrwx  1 root root   31 Dec  3 23:30 linux -&gt; /usr/src/linux-2.6.31-pentoo-r3&lt;br /&gt;drwxr-xr-x 24 root root 4096 Dec  3 23:30 linux-2.6.31-pentoo-r3&lt;br /&gt;drwxr-xr-x 24 root root 4096 Jan 22 13:56 linux-2.6.32-hardened-r2&lt;br /&gt;drwxr-xr-x 12 root root 4096 Dec  3 21:39 mosref-2.0_beta3&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;The easiest way to get the kernel config file:&lt;br /&gt;&lt;code class="prettyprint"&gt;&lt;br /&gt;(chroot) pentoo src # zcat /proc/config.gz &gt; /usr/src/linux/.config&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;And then you can modify it or leave it alone... :)&lt;br /&gt;&lt;br /&gt;Edit &lt;span style="font-style:italic;"&gt;/etc/genkernel.conf&lt;/span&gt;. Not really required but I like to disable clean and mrproper and add LUKS line:&lt;br /&gt;&lt;code class="prettyprint"&gt;&lt;br /&gt;CLEAN="no"&lt;br /&gt;LUKS="yes"&lt;br /&gt;# Run 'make mrproper' before configuration/compilation?&lt;br /&gt;MRPROPER="no"&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;For multicore you could also add there (number of cores+1):&lt;br /&gt;&lt;code class="prettyprint"&gt;&lt;br /&gt;MAKEOPTS="-j3"&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;Compile! Well, not yet...if you run &lt;span style="font-style:italic;"&gt;genkernel&lt;/span&gt; now it will fail with:&lt;br /&gt;&lt;code class="prettyprint"&gt;&lt;br /&gt;ld: cannot find -lcrypt&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;rebuilding &lt;span style="font-style:italic;"&gt;genkernel&lt;/span&gt; did not help but...how about rebuilding &lt;span style="font-style:italic;"&gt;glibc&lt;/span&gt;?&lt;br /&gt;&lt;code class="prettyprint"&gt;&lt;br /&gt;(chroot) pentoo linux # emerge -av glibc&lt;br /&gt; * IMPORTANT: 2 news items need reading for repository 'gentoo'.&lt;br /&gt; * Use eselect news to read news items.&lt;br /&gt;These are the packages that would be merged, in order:&lt;br /&gt;&lt;br /&gt;Calculating dependencies... done!&lt;br /&gt;[ebuild     U ] sys-libs/glibc-2.10.1-r1 [2.9_p20081201-r2] USE="-debug -gd -glibc-omitfp (-hardened) (-multilib) -nls -profile (-selinux) -vanilla" 16,511 kB&lt;br /&gt;&lt;br /&gt;Total: 1 package (1 upgrade), Size of downloads: 16,511 kB&lt;br /&gt;Would you like to merge these packages? [Yes/No]&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;Once it's done (few cups of chai later...)&lt;br /&gt;&lt;code class="prettyprint"&gt;&lt;br /&gt;(chroot) pentoo linux # genkernel --luks all&lt;br /&gt;* Gentoo Linux Genkernel; Version 3.4.10&lt;br /&gt;* Running with options: --luks all&lt;br /&gt;&lt;br /&gt;* Linux Kernel 2.6.31-pentoo-r3 for x86...&lt;br /&gt;*         &gt;&gt; Running oldconfig...&lt;br /&gt;* config: --no-clean is enabled; leaving the .config alone.&lt;br /&gt;*         &gt;&gt; Compiling 2.6.31-pentoo-r3 bzImage...&lt;br /&gt;*         &gt;&gt; Compiling 2.6.31-pentoo-r3 modules...&lt;br /&gt;* Copying config for successful build to /etc/kernels/kernel-config-x86-2.6.31-pentoo-r3&lt;br /&gt;* busybox: &gt;&gt; Applying patches...&lt;br /&gt;* busybox: &gt;&gt; Configuring...&lt;br /&gt;* busybox: &gt;&gt; Compiling...&lt;br /&gt;* busybox: &gt;&gt; Copying to cache...&lt;br /&gt;* initramfs: &gt;&gt; Initializing...&lt;br /&gt;*         &gt;&gt; Appending base_layout cpio data...&lt;br /&gt;*         &gt;&gt; Appending auxilary cpio data...&lt;br /&gt;* Including LUKS support&lt;br /&gt;*         &gt;&gt; Appending busybox cpio data...&lt;br /&gt;*         &gt;&gt; Appending e2fsprogs cpio data...&lt;br /&gt;* E2FSPROGS: Adding support (compiling binaries)...&lt;br /&gt;* e2fsprogs: &gt;&gt; Configuring...&lt;br /&gt;* e2fsprogs: &gt;&gt; Compiling libs...&lt;br /&gt;* e2fsprogs: &gt;&gt; Compiling e2fsck...&lt;br /&gt;* e2fsprogs: &gt;&gt; Compiling mke2fs...&lt;br /&gt;* e2fsprogs: &gt;&gt; Copying to cache...&lt;br /&gt;*       &gt;&gt; Copying to bincache...&lt;br /&gt;*         &gt;&gt; Appending modules cpio data...&lt;br /&gt;*&lt;br /&gt;* Kernel compiled successfully!&lt;br /&gt;*&lt;br /&gt;* Required Kernel Parameters:&lt;br /&gt;*     real_root=/dev/$ROOT&lt;br /&gt;*&lt;br /&gt;*     Where $ROOT is the device node for your root partition as the&lt;br /&gt;*     one specified in /etc/fstab&lt;br /&gt;*&lt;br /&gt;* If you require Genkernel's hardware detection features; you MUST&lt;br /&gt;* tell your bootloader to use the provided INITRAMFS file. Otherwise;&lt;br /&gt;* substitute the root argument for the real_root argument if you are&lt;br /&gt;* not planning to use the initrd...&lt;br /&gt;&lt;br /&gt;* WARNING... WARNING... WARNING...&lt;br /&gt;* Additional kernel cmdline arguments that *may* be required to boot properly...&lt;br /&gt;&lt;br /&gt;* Do NOT report kernel bugs as genkernel bugs unless your bug&lt;br /&gt;* is about the default genkernel configuration...&lt;br /&gt;*&lt;br /&gt;* Make sure you have the latest genkernel before reporting bugs.&lt;br /&gt;(chroot) pentoo linux #&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;Yuppie!!&lt;br /&gt;&lt;br /&gt;Edit the &lt;span style="font-style:italic;"&gt;/etc/fstab&lt;/span&gt; file:&lt;br /&gt;&lt;code class="prettyprint"&gt;&lt;br /&gt;/dev/sda1               /boot           ext3            noauto,noatime  1 2&lt;br /&gt;/dev/mapper/root        /               ext3            noatime         0 1&lt;br /&gt;/dev/mapper/crypt-swap  none            swap            sw              0 0&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;Ok, time to create LUKS mappings:&lt;br /&gt;&lt;code class="prettyprint"&gt;&lt;br /&gt;vi /etc/conf.d/dmcrypt&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;...and add your swap partition:&lt;br /&gt;&lt;code class="prettyprint"&gt;&lt;br /&gt;swap=crypt-swap&lt;br /&gt;source='/dev/sda2'&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;Now the bootloader:&lt;br /&gt;&lt;code class="prettyprint"&gt;&lt;br /&gt;nano /boot/grub/menu.lst&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;If you've installed the stock kernel that's how it should look like:&lt;br /&gt;&lt;code class="prettyprint"&gt;&lt;br /&gt;title Pentoo Linux 2.6.31-r3&lt;br /&gt;root (hd0,0)&lt;br /&gt;kernel /boot/kernel-genkernel-x86-2.6.31-pentoo-r3 crypt_root=/dev/sda3 real_root=/dev/mapper/root&lt;br /&gt;initrd /boot/initramfs-genkernel-x86-2.6.31-pentoo-r3&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;Rite - unfortunately we now need to install new config file manually - run &lt;span style="font-style:italic;"&gt;grub&lt;/span&gt;:&lt;br /&gt;&lt;code class="prettyprint"&gt;&lt;br /&gt;&lt;br /&gt;    GNU GRUB  version 0.97  (640K lower / 3072K upper memory)&lt;br /&gt;&lt;br /&gt; [ Minimal BASH-like line editing is supported.  For the first word, TAB&lt;br /&gt;   lists possible command completions.  Anywhere else TAB lists the possible&lt;br /&gt;   completions of a device/filename. ]&lt;br /&gt;&lt;br /&gt;grub&gt; &lt;span style="font-weight:bold;"&gt;root (hd0)&lt;/span&gt;&lt;br /&gt; Filesystem type unknown, using whole disk&lt;br /&gt;&lt;br /&gt;grub&gt; &lt;span style="font-weight:bold;"&gt;root (hd0,0)&lt;/span&gt;&lt;br /&gt; Filesystem type is ext2fs, partition type 0x83&lt;br /&gt;&lt;br /&gt;grub&gt; &lt;span style="font-weight:bold;"&gt;setup (hd0)&lt;/span&gt;&lt;br /&gt; Checking if "/boot/grub/stage1" exists... yes&lt;br /&gt; Checking if "/boot/grub/stage2" exists... yes&lt;br /&gt; Checking if "/boot/grub/e2fs_stage1_5" exists... yes&lt;br /&gt; Running "embed /boot/grub/e2fs_stage1_5 (hd0)"...  17 sectors are embedded.&lt;br /&gt;succeeded&lt;br /&gt; Running "install /boot/grub/stage1 (hd0) (hd0)1+17 p (hd0,0)/boot/grub/stage2 /boot/grub/menu.lst"... s&lt;br /&gt;ucceeded&lt;br /&gt;Done.&lt;br /&gt;&lt;br /&gt;grub&gt;&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;Voila! Few boot script tweaks...&lt;br /&gt;&lt;code class="prettyprint"&gt;&lt;br /&gt;(chroot) pentoo linux # rc-update del autoconfig default&lt;br /&gt;* service autoconfig removed from runlevel default&lt;br /&gt;(chroot) pentoo linux # rc-update add keymaps default&lt;br /&gt;* service keymaps added to runlevel default&lt;br /&gt;(chroot) pentoo linux #rc-update add dmcrypt boot&lt;br /&gt;* service dmcrypt added to runlevel default&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;Edit the keymap file if you wish...&lt;br /&gt;&lt;code class="prettyprint"&gt;&lt;br /&gt;nano /etc/conf.d/keymaps&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;Done...reboot &amp; enjoy! ;]&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3050029677375999718-4544525038248931416?l=hardenedgentoo.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://hardenedgentoo.blogspot.com/feeds/4544525038248931416/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://hardenedgentoo.blogspot.com/2010/02/installing-pentoo-on-hard-drive-with.html#comment-form' title='6 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3050029677375999718/posts/default/4544525038248931416'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3050029677375999718/posts/default/4544525038248931416'/><link rel='alternate' type='text/html' href='http://hardenedgentoo.blogspot.com/2010/02/installing-pentoo-on-hard-drive-with.html' title='Installing Pentoo on Hard Drive with LUKS encryption'/><author><name>radegand</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>6</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3050029677375999718.post-8764097429786225033</id><published>2010-01-23T17:02:00.004Z</published><updated>2010-01-23T17:30:09.427Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='nouveau'/><category scheme='http://www.blogger.com/atom/ns#' term='KMS'/><category scheme='http://www.blogger.com/atom/ns#' term='nvidia'/><category scheme='http://www.blogger.com/atom/ns#' term='X11'/><title type='text'>Nouveau driver with KMS support on Hardened</title><content type='html'>I got annoyed recently with the &lt;span style="font-style:italic;"&gt;nv&lt;/span&gt; driver and still not being able to use the proprietary nvidia driver I decided to try &lt;span style="font-style:italic;"&gt;nouveau&lt;/span&gt; driver...and it worked! :) Additional bonus was - &lt;span style="font-style:italic;"&gt;KMS&lt;/span&gt; - fast switching between X and console...finally!&lt;br /&gt;&lt;br /&gt;Ok, here we go. A recent kernel will be needed, I'm using the 2.6.32 hardened sources, but anything &gt;= 2.6.31 should do. xorg-server-1.7 will be required though. So before you try, make sure that you have it up and running and that everything works as it should - I had some non obvious dependencies to solve...anyway!&lt;br /&gt;&lt;br /&gt;There's a &lt;a href="http://nouveau.freedesktop.org/wiki/GentooEbuilds"&gt;installation guide&lt;/a&gt; provided which helps a lot ;]&lt;br /&gt;&lt;br /&gt;Make sure that your kernel have debugfs support compiled (in "Kernel Hacking" enable "Debug Filesystem") and I also had to enable UVESA option ( "Device drivers" -&gt; "Graphics support" -&gt; "Support for framebuffer devices" -&gt; "Userspace VESA VGA support"). Recompile and reboot to your new kernel.&lt;br /&gt;&lt;br /&gt;Disable the proprietary module if you were using it (unlikely on hardened! ;P). As per guide switch &lt;span style="font-style:italic;"&gt;opengl&lt;/span&gt; to X11:&lt;br /&gt;&lt;code class="prettyprint"&gt;&lt;br /&gt;# eselect opengl set xorg-x11&lt;br /&gt;Switching to xorg-x11 OpenGL interface... done&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;Make sure you have &lt;span style="font-weight:bold;"&gt;USE="dri"&lt;/span&gt; and &lt;span style="font-weight:bold;"&gt;VIDEO_CARDS="nouveau"&lt;/span&gt; set in make.conf. Try emerging this (You'll probably need to keyword and unmask these ebuilds):&lt;br /&gt;&lt;code class="prettyprint"&gt;&lt;br /&gt;# emerge -va nouveau-drm libdrm xorg-server xf86-video-nouveau&lt;br /&gt;&lt;br /&gt;These are the packages that would be merged, in order:&lt;br /&gt;&lt;br /&gt;Calculating dependencies... done!&lt;br /&gt;[ebuild  N    ] x11-drivers/nouveau-firmware-20091212  0 kB [1]&lt;br /&gt;[ebuild  N    ] x11-libs/libdrm-9999  USE="-static-libs" 0 kB [1]&lt;br /&gt;[ebuild  N    ] x11-base/nouveau-drm-99999999  0 kB [1]&lt;br /&gt;[ebuild   R   ] x11-base/xorg-server-1.7.4  USE="hal ipv6 nptl sdl xorg -debug -dmx -kdrive -minimal -tslib" 0 kB [0]&lt;br /&gt;[ebuild  N    ] x11-drivers/xf86-video-nouveau-9999  USE="-static-libs" 0 kB [1]&lt;br /&gt;&lt;br /&gt;Total: 5 packages (4 new, 1 reinstall), Size of downloads: 0 kB&lt;br /&gt;Portage tree and overlays:&lt;br /&gt; [0] /usr/portage&lt;br /&gt; [1] /usr/local/portage/layman/x11&lt;br /&gt;&lt;br /&gt;Would you like to merge these packages? [Yes/No]&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;This should look similar to this above. Pay attention to packages that need to be pulled from the x11 overlay rather than portage tree.&lt;br /&gt;&lt;br /&gt;Once everything is compiled, change the xorg.conf to use new driver - replace:&lt;br /&gt;&lt;code class="prettyprint"&gt;&lt;br /&gt;Driver         "nv"&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;with:&lt;br /&gt;&lt;code class="prettyprint"&gt;&lt;br /&gt;Driver         "nouveau"&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;Enable relevant modules to be loaded during boot. The &lt;span style="font-style:italic;"&gt;/etc/conf.d/modules&lt;/span&gt; should something like this:&lt;br /&gt;&lt;code class="prettyprint"&gt;&lt;br /&gt;modules_2_6="dri nouveau"&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;Do not modprobe the nouveau driver from within X! It will kill it... ;] Stop X, modprobe and start X again...or simply reboot...end enjoy the new driver and KMS!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3050029677375999718-8764097429786225033?l=hardenedgentoo.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://hardenedgentoo.blogspot.com/feeds/8764097429786225033/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://hardenedgentoo.blogspot.com/2010/01/nouveau-driver-with-kms-support-on.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3050029677375999718/posts/default/8764097429786225033'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3050029677375999718/posts/default/8764097429786225033'/><link rel='alternate' type='text/html' href='http://hardenedgentoo.blogspot.com/2010/01/nouveau-driver-with-kms-support-on.html' title='Nouveau driver with KMS support on Hardened'/><author><name>radegand</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3050029677375999718.post-7669640237120439934</id><published>2009-10-29T21:52:00.003Z</published><updated>2009-10-29T22:14:28.773Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='hardened gentoo'/><category scheme='http://www.blogger.com/atom/ns#' term='bug'/><category scheme='http://www.blogger.com/atom/ns#' term='wireshark'/><title type='text'>Wireshark on Gentoo hardened</title><content type='html'>If compiling wireshark bails out with the following error:&lt;br /&gt;&lt;code class="prettyprint"&gt;&lt;br /&gt;checking for GTK+ - version &gt;= 2.4.0... no&lt;br /&gt;*** Could not run GTK+ test program, checking why...&lt;br /&gt;*** The test program failed to compile or link. See the file config.log for the&lt;br /&gt;*** exact error that occured. This usually means GTK+ is incorrectly installed.&lt;br /&gt;configure: error: GTK+ 2.4 or later isn't available, so Wireshark can't be compiled&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;Disable the 'profile' flag as per &lt;a href="http://bugs.gentoo.org/215806"&gt;this&lt;/a&gt; bug. So the magic command is:&lt;br /&gt;&lt;code class="prettyprint"&gt;&lt;br /&gt;USE="-profile" emerge wireshark&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;Happy sniffing! ;]&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3050029677375999718-7669640237120439934?l=hardenedgentoo.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://hardenedgentoo.blogspot.com/feeds/7669640237120439934/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://hardenedgentoo.blogspot.com/2009/10/wireshark-on-gentoo-hardened.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3050029677375999718/posts/default/7669640237120439934'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3050029677375999718/posts/default/7669640237120439934'/><link rel='alternate' type='text/html' href='http://hardenedgentoo.blogspot.com/2009/10/wireshark-on-gentoo-hardened.html' title='Wireshark on Gentoo hardened'/><author><name>radegand</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3050029677375999718.post-2626998755957764746</id><published>2009-10-23T18:59:00.004+01:00</published><updated>2010-04-15T16:16:07.506+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='intel 3945'/><category scheme='http://www.blogger.com/atom/ns#' term='injection'/><category scheme='http://www.blogger.com/atom/ns#' term='wireless'/><category scheme='http://www.blogger.com/atom/ns#' term='aircrack-ng'/><title type='text'>Injection support with Intel 3945 A/B/G card</title><content type='html'>I've used this chipset for quite a while now and since some time it very stable, well supported and built in antenna provides decent reception. It's not N capable but it does A band! Getting it to work on a decent kernel is trivial and Gentoo hardened is no exception. ;]&lt;br /&gt;&lt;br /&gt;First, make sure that you have it enabled in your kernel config - in Wireless LAN section enable "Intel PRO/Wireless 3945ABG/BG Network Connection" - I tend to compile it as a module so I can load it only when necessary - just in case, I prefer to have it disabled... ;] If needed, recompile and boot your new kernel, then continue.&lt;br /&gt;&lt;br /&gt;You probably want to emerge aircrack suite if not already done so. Aircrack has a cool feature to test injection support and can do sooo much more than that! You need to make sure that you will emerge aircrack from the 'hardened-development' overlay because otherwise it won't compile on hardened. It has some inline assembly which unfortunately does not like to be compiled as PIE, at least at the time being ;( Anyway:&lt;br /&gt;&lt;code class="prettyprint"&gt;&lt;br /&gt;~ # emerge -av aircrack-ng&lt;br /&gt;&lt;br /&gt;These are the packages that would be merged, in order:&lt;br /&gt;&lt;br /&gt;Calculating dependencies ... done!&lt;br /&gt;[ebuild  N    ] net-wireless/aircrack-ng-1.0  USE="sqlite" 1,472 kB [1]&lt;br /&gt;&lt;br /&gt;Total: 1 package (1 new), Size of downloads: 1,472 kB&lt;br /&gt;Portage tree and overlays:&lt;br /&gt; [0] /usr/portage&lt;br /&gt; [1] /usr/local/portage/layman/hardened-development&lt;br /&gt;&lt;br /&gt;Would you like to merge these packages? [Yes/No]&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;Cool, once it's done it's time to load the module:&lt;br /&gt;&lt;code class="prettyprint"&gt;&lt;br /&gt;host ~ # modprobe iwl3945&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;Which should result in the following output via the &lt;span style="font-style:italic;"&gt;dmesg&lt;/span&gt; command:&lt;br /&gt;&lt;code class="prettyprint"&gt;&lt;br /&gt;iwl3945 0000:0c:00.0: PCI INT A disabled&lt;br /&gt;iwl3945: Intel(R) PRO/Wireless 3945ABG/BG Network Connection driver for Linux, 1.2.26ks&lt;br /&gt;iwl3945: Copyright(c) 2003-2009 Intel Corporation&lt;br /&gt;iwl3945 0000:0c:00.0: PCI INT A -&gt; GSI 17 (level, low) -&gt; IRQ 17&lt;br /&gt;iwl3945 0000:0c:00.0: setting latency timer to 64&lt;br /&gt;iwl3945 0000:0c:00.0: Tunable channels: 13 802.11bg, 23 802.11a channels&lt;br /&gt;iwl3945 0000:0c:00.0: Detected Intel Wireless WiFi Link 3945ABG&lt;br /&gt;iwl3945 0000:0c:00.0: irq 24 for MSI/MSI-X&lt;br /&gt;phy2: Selected rate control algorithm 'iwl-3945-rs'&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;Sweet! Let's enable monitor mode then, shall we? Command &lt;span style="font-style:italic;"&gt;airmon-ng&lt;/span&gt; when run without any parameters will show list of wireless cards recognised by the system along with their respective drivers - quite useful!&lt;br /&gt;&lt;code class="prettyprint"&gt;&lt;br /&gt;~ # airmon-ng&lt;br /&gt;Interface       Chipset         Driver&lt;br /&gt;wlan1           Atheros         ath5k - [phy1]&lt;br /&gt;mon0            Atheros         ath5k - [phy1]&lt;br /&gt;wlan0           Intel 3945ABG   iwl3945 - [phy2]&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;Right, so the card is there, now the monitor mode itself:&lt;br /&gt;&lt;code class="prettyprint"&gt;&lt;br /&gt;~ # airmon-ng start wlan0&lt;br /&gt;Interface       Chipset         Driver&lt;br /&gt;&lt;br /&gt;wlan1           Atheros         ath5k - [phy1]&lt;br /&gt;mon0            Atheros         ath5k - [phy1]&lt;br /&gt;wlan0           Intel 3945ABG   iwl3945 - [phy2]SIOCSIFFLAGS: No such file or directory&lt;br /&gt;                                (monitor mode enabled on mon1)&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;Hmm...that didn't look good, let's see what has happened...that's what I got from dmesg again:&lt;br /&gt;&lt;code class="prettyprint"&gt;&lt;br /&gt;iwl3945 0000:0c:00.0: firmware: requesting iwlwifi-3945-2.ucode&lt;br /&gt;iwl3945 0000:0c:00.0: iwlwifi-3945-2.ucode firmware file req failed: -2&lt;br /&gt;iwl3945 0000:0c:00.0: firmware: requesting iwlwifi-3945-1.ucode&lt;br /&gt;iwl3945 0000:0c:00.0: iwlwifi-3945-1.ucode firmware file req failed: -2&lt;br /&gt;iwl3945 0000:0c:00.0: Could not read microcode: -2&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;Oppsie! Right, so required firmware file is missing but there's a trustworthy Gentoo repository! ;] So:&lt;br /&gt;&lt;code class="prettyprint"&gt;&lt;br /&gt;~ # emerge -av iwl3945-ucode&lt;br /&gt;&lt;br /&gt;These are the packages that would be merged, in order:&lt;br /&gt;&lt;br /&gt;Calculating dependencies... done!&lt;br /&gt;[ebuild  N    ] net-wireless/iwl3945-ucode-15.32.2.9  66 kB&lt;br /&gt;&lt;br /&gt;Total: 1 package (1 new), Size of downloads: 66 kB&lt;br /&gt;&lt;br /&gt;Would you like to merge these packages? [Yes/No]&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;Yesss! When it's installed we need to reload the module and then start the monitor mode again:&lt;br /&gt;&lt;code class="prettyprint"&gt;&lt;br /&gt;~ # rmmod iwl3945&lt;br /&gt;~ # modprobe iwl3945&lt;br /&gt;~ # airmon-ng start wlan0&lt;br /&gt;Interface       Chipset         Driver&lt;br /&gt;&lt;br /&gt;wlan1           Atheros         ath5k - [phy1]&lt;br /&gt;mon0            Atheros         ath5k - [phy1]&lt;br /&gt;wlan0           Intel 3945ABG   iwl3945 - [phy3]&lt;br /&gt;                                (&lt;span style="font-weight:bold;"&gt;monitor mode enabled on mon1&lt;/span&gt;)&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;Which resulted in the following in the &lt;span style="font-style:italic;"&gt;dmesg&lt;/span&gt;:&lt;br /&gt;&lt;code class="prettyprint"&gt;&lt;br /&gt;iwl3945 0000:0c:00.0: firmware: requesting iwlwifi-3945-2.ucode&lt;br /&gt;iwl3945 0000:0c:00.0: loaded firmware version 15.32.2.9&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;Yuppie! Now run aircrack as a final test:&lt;br /&gt;&lt;code class="prettyprint"&gt;&lt;br /&gt;~ # aireplay-ng -9 mon1&lt;br /&gt;20:38:16  Trying broadcast probe requests...&lt;br /&gt;20:38:16  Injection is working!&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Bakgat!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3050029677375999718-2626998755957764746?l=hardenedgentoo.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://hardenedgentoo.blogspot.com/feeds/2626998755957764746/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://hardenedgentoo.blogspot.com/2009/10/injection-support-with-intel-3945-abg.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3050029677375999718/posts/default/2626998755957764746'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3050029677375999718/posts/default/2626998755957764746'/><link rel='alternate' type='text/html' href='http://hardenedgentoo.blogspot.com/2009/10/injection-support-with-intel-3945-abg.html' title='Injection support with Intel 3945 A/B/G card'/><author><name>radegand</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3050029677375999718.post-5001850195493298913</id><published>2009-10-19T21:47:00.002+01:00</published><updated>2009-10-19T22:12:47.828+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='howto'/><category scheme='http://www.blogger.com/atom/ns#' term='hardened gentoo'/><title type='text'>HowTo update</title><content type='html'>I've just setup another box according to my earlier &lt;a href="http://hardenedgentoo.blogspot.com/2009/10/64-bit-hardened-gentoo-with-luks-on.html"&gt;HowTo&lt;/a&gt; - just to test it accuracy ;). I've spotted few mistakes which should be now fixed. In the meantime kernel got updated to 2.6.31.4 and KDE to 4.3.2 ;] It also seems that &lt;span style="font-weight:bold;"&gt;nepomuk&lt;/span&gt; is now fine with &lt;span style="font-weight:bold;"&gt;grsec&lt;/span&gt; kernels - it compiles and runs without segfaulting! ;]&lt;br /&gt;Happy Compiling!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3050029677375999718-5001850195493298913?l=hardenedgentoo.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://hardenedgentoo.blogspot.com/feeds/5001850195493298913/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://hardenedgentoo.blogspot.com/2009/10/howto-update.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3050029677375999718/posts/default/5001850195493298913'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3050029677375999718/posts/default/5001850195493298913'/><link rel='alternate' type='text/html' href='http://hardenedgentoo.blogspot.com/2009/10/howto-update.html' title='HowTo update'/><author><name>radegand</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3050029677375999718.post-7347737725660547670</id><published>2009-10-03T12:46:00.011+01:00</published><updated>2009-10-23T19:52:15.614+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='gcc-4.4.1'/><category scheme='http://www.blogger.com/atom/ns#' term='grsecurity'/><category scheme='http://www.blogger.com/atom/ns#' term='hardened gentoo'/><category scheme='http://www.blogger.com/atom/ns#' term='KDE 4.3.1'/><category scheme='http://www.blogger.com/atom/ns#' term='glibc-2.10'/><title type='text'>64-bit Hardened Gentoo with LUKS on 2.6.31.1-grsec, glibc-2.10 and gcc-4.4.1. With KDE-4.3.1. From scratch.</title><content type='html'>UPDATED 23/10 - Added info about &lt;span style="font-weight:bold;"&gt;repos.conf&lt;/span&gt; which I've missed previously!&lt;br /&gt;&lt;br /&gt;Recenty I had to setup a new box with the specs above so I decided to share my installation notes in an attempt to spread the Gentoo virus ;] Apologies if they're not always as detailed as they could be but nevertheless should be helpful for anyone setting up a new Gentoo box. Ok, off we go!&lt;br /&gt;&lt;br /&gt;I've mostly used as a reference the following links:&lt;br /&gt;&lt;br /&gt;&lt;a href="http://forums.gentoo.org/viewtopic-t-705939.html"&gt;The Hardened GCC4 Toolchain Overlay Guide&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.saout.de/tikiwiki/tiki-index.php?page=LUKSOnGentoo"&gt;LUKS on Gentoo&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;I used &lt;a href="http://distfiles.gentoo.org/releases/amd64/autobuilds/current-iso/"&gt;this&lt;/a&gt; live CD and &lt;a href="http://distfiles.gentoo.org/releases/amd64/autobuilds/current-iso/hardened/stage3-amd64-hardened+nomultilib-20090903.tar.bz2"&gt;this&lt;/a&gt; stage3 tarball because I wanted to give a go for the weekly hardened ones just out of curiosity :). Also, as soon as it was possible I've ssh'ed to the new box to make command pasting (and saving!) much easier.&lt;br /&gt;&lt;br /&gt;Follow the &lt;a href="http://www.gentoo.org/doc/en/handbook/handbook-amd64.xml"&gt;Gentoo Installation handbook&lt;/a&gt; up to chapter 4. Ok, disk preparation - below I have created a 100MB boot partition (will have to stay unencrypted), 2G of SWAP space and root partition  on the remaining disk space for rest of the system. &lt;br /&gt;&lt;code class=prettyprint&gt;&lt;br /&gt;livecd ~ # fdisk /dev/sda                                                                                                           &lt;br /&gt;Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel                                                  &lt;br /&gt;Building a new DOS disklabel with disk identifier 0x24c78168.                                                                       &lt;br /&gt;Changes will remain in memory only, until you decide to write them.                                                                 &lt;br /&gt;After that, of course, the previous content won't be recoverable.                                                                   &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;The number of cylinders for this disk is set to 10011.&lt;br /&gt;There is nothing wrong with that, but this is larger than 1024,&lt;br /&gt;and could in certain setups cause problems with:               &lt;br /&gt;1) software that runs at boot time (e.g., old versions of LILO)&lt;br /&gt;2) booting and partitioning software from other OSs            &lt;br /&gt;   (e.g., DOS FDISK, OS/2 FDISK)                               &lt;br /&gt;Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)&lt;br /&gt;&lt;br /&gt;Command (m for help): n&lt;br /&gt;Command action         &lt;br /&gt;   e   extended        &lt;br /&gt;   p   primary partition (1-4)&lt;br /&gt;p                             &lt;br /&gt;Partition number (1-4): 1     &lt;br /&gt;First cylinder (1-10011, default 1): &lt;br /&gt;Using default value 1                &lt;br /&gt;Last cylinder, +cylinders or +size{K,M,G} (1-10011, default 10011): +100M      &lt;br /&gt;&lt;br /&gt;Command (m for help): p&lt;br /&gt;&lt;br /&gt;Disk /dev/sda: 82.3 GB, 82348277760 bytes&lt;br /&gt;255 heads, 63 sectors/track, 10011 cylinders&lt;br /&gt;Units = cylinders of 16065 * 512 = 8225280 bytes&lt;br /&gt;Disk identifier: 0x24c78168&lt;br /&gt;&lt;br /&gt;   Device Boot      Start         End      Blocks   Id  System&lt;br /&gt;/dev/sda1               1          14      112423+  83  Linux&lt;br /&gt;&lt;br /&gt;Command (m for help): n&lt;br /&gt;Command action&lt;br /&gt;   e   extended&lt;br /&gt;   p   primary partition (1-4)&lt;br /&gt;p&lt;br /&gt;Partition number (1-4): 2&lt;br /&gt;First cylinder (15-10011, default 15):&lt;br /&gt;Using default value 15&lt;br /&gt;Last cylinder, +cylinders or +size{K,M,G} (15-10011, default 10011): +2G&lt;br /&gt;&lt;br /&gt;Command (m for help): n&lt;br /&gt;Command action&lt;br /&gt;   e   extended&lt;br /&gt;   p   primary partition (1-4)&lt;br /&gt;p&lt;br /&gt;Partition number (1-4): p&lt;br /&gt;Partition number (1-4): 3&lt;br /&gt;First cylinder (277-10011, default 277):&lt;br /&gt;Using default value 277&lt;br /&gt;Last cylinder, +cylinders or +size{K,M,G} (277-10011, default 10011):&lt;br /&gt;Using default value 10011&lt;br /&gt;&lt;br /&gt;Command (m for help): w&lt;br /&gt;The partition table has been altered!&lt;br /&gt;&lt;br /&gt;Calling ioctl() to re-read partition table.&lt;br /&gt;Syncing disks.&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Now the encrypted partition creation. You can use different options, just check cryptsetup man page. The option below uses AES 256 bit encryption with SHA256 key hashing in cbc-essiv mode.&lt;br /&gt;&lt;code class=prettyprint&gt;&lt;br /&gt;livecd ~ # cryptsetup --verbose --cipher "aes-cbc-essiv:sha256" --key-size 256 --verify-passphrase luksFormat /dev/sda3&lt;br /&gt;&lt;br /&gt;WARNING!&lt;br /&gt;========&lt;br /&gt;This will overwrite data on /dev/sda3 irrevocably.&lt;br /&gt;&lt;br /&gt;Are you sure? (Type uppercase yes): YES&lt;br /&gt;Enter LUKS passphrase:&lt;br /&gt;Verify passphrase:&lt;br /&gt;Command successful.&lt;br /&gt;livecd ~ #&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Ahh - you'd better remember this passphrase! Ya've been warned... ;]&lt;br /&gt;Ok, now we need to to 'map' the encrypted partition so it will be visible to the system:&lt;br /&gt;&lt;code class=prettyprint&gt;&lt;br /&gt;livecd ~ # cryptsetup luksOpen /dev/sda3 root&lt;br /&gt;Enter LUKS passphrase:&lt;br /&gt;key slot 0 unlocked.&lt;br /&gt;Command successful.&lt;br /&gt;livecd ~ #&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;Onto fortmatting! For main partition choose whatever filesystem you want. For the boot partition I'd go with soomething stable like ext2 or ext3 so it will be well supported by bootloader. Speed doesn't really matter here - your kernel is loaded only once during the booting ;)&lt;br /&gt;&lt;code class=prettyprint&gt;&lt;br /&gt;livecd ~ # mkfs.ext3 /dev/sda1&lt;br /&gt;mke2fs 1.41.3 (12-Oct-2008)&lt;br /&gt;Filesystem label=&lt;br /&gt;OS type: Linux&lt;br /&gt;Block size=1024 (log=0)&lt;br /&gt;Fragment size=1024 (log=0)&lt;br /&gt;28112 inodes, 112420 blocks&lt;br /&gt;5621 blocks (5.00%) reserved for the super user&lt;br /&gt;First data block=1&lt;br /&gt;Maximum filesystem blocks=67371008&lt;br /&gt;14 block groups&lt;br /&gt;8192 blocks per group, 8192 fragments per group&lt;br /&gt;2008 inodes per group&lt;br /&gt;Superblock backups stored on blocks:&lt;br /&gt;        8193, 24577, 40961, 57345, 73729&lt;br /&gt;&lt;br /&gt;Writing inode tables: done&lt;br /&gt;Creating journal (4096 blocks): done&lt;br /&gt;Writing superblocks and filesystem accounting information: done&lt;br /&gt;&lt;br /&gt;This filesystem will be automatically checked every 31 mounts or&lt;br /&gt;180 days, whichever comes first.  Use tune2fs -c or -i to override.&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;Being a curious person, I've chosen the ext4 filesystem for root partition ;] Pay attention to the &lt;span style="font-style:italic;"&gt;/dev/mapper/root&lt;/span&gt; here instead of &lt;span style="font-style:italic;"&gt;/dev/sda3&lt;/span&gt;!&lt;br /&gt;&lt;code class=prettyprint&gt;&lt;br /&gt;livecd ~ # mkfs.ext4 /dev/mapper/root&lt;br /&gt;mke2fs 1.41.3 (12-Oct-2008)&lt;br /&gt;Filesystem label=&lt;br /&gt;OS type: Linux&lt;br /&gt;Block size=4096 (log=2)&lt;br /&gt;Fragment size=4096 (log=2)&lt;br /&gt;4890624 inodes, 19548839 blocks&lt;br /&gt;977441 blocks (5.00%) reserved for the super user&lt;br /&gt;First data block=0&lt;br /&gt;Maximum filesystem blocks=4294967296&lt;br /&gt;597 block groups&lt;br /&gt;32768 blocks per group, 32768 fragments per group&lt;br /&gt;8192 inodes per group&lt;br /&gt;Superblock backups stored on blocks:&lt;br /&gt;        32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,&lt;br /&gt;        4096000, 7962624, 11239424&lt;br /&gt;&lt;br /&gt;Writing inode tables: done&lt;br /&gt;Creating journal (32768 blocks): done&lt;br /&gt;Writing superblocks and filesystem accounting information: done&lt;br /&gt;&lt;br /&gt;This filesystem will be automatically checked every 33 mounts or&lt;br /&gt;180 days, whichever comes first.  Use tune2fs -c or -i to override.&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;Now the newly created partition need to be mounted as per the handbook:&lt;br /&gt;&lt;code class=prettyprint&gt;&lt;br /&gt;livecd ~ # mount /dev/mapper/root /mnt/gentoo/&lt;br /&gt;livecd ~ # mkdir /mnt/gentoo/boot&lt;br /&gt;livecd ~ # mount /dev/sda1 /mnt/gentoo/boot/&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;Adjust date if necessary:&lt;br /&gt;&lt;code class=prettyprint&gt;&lt;br /&gt;livecd ~ # date&lt;br /&gt;Fri Sep 11 13:37:52 UTC 2009&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;And from there it's more or less standard Gentoo installation...get and unpack the stage3 file and latest portage tree:&lt;br /&gt;&lt;code class=prettyprint&gt;&lt;br /&gt;livecd ~ # cd /mnt/gentoo/&lt;br /&gt;livecd gentoo # wget http://mirrors.kernel.org/gentoo/releases/amd64/autobuilds/current-iso/hardened/stage3-amd64-hardened+nomultilib-20090903.tar.bz2&lt;br /&gt;&lt;br /&gt;livecd gentoo # tar xjpf stage3-*.tar.bz2&lt;br /&gt;&lt;br /&gt;livecd gentoo # cd /mnt/gentoo&lt;br /&gt;livecd gentoo # wget http://mirror.datapipe.net/gentoo/snapshots/portage-latest.tar.bz2&lt;br /&gt;livecd gentoo # tar xjpf portage* -C usr/&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Before any compilation will be done on the system, adjust make.conf to suit your needs (CC and USE flags, etc.). Again - handbook and multiple online resources are available for more details.&lt;br /&gt;&lt;code class=prettyprint&gt;&lt;br /&gt;livecd ~ # nano /mnt/gentoo/etc/make.conf&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;adjust as needed...&lt;br /&gt;&lt;br /&gt;Chrooting!&lt;br /&gt;&lt;code class=prettyprint&gt;&lt;br /&gt;livecd ~ # mount -t proc none /mnt/gentoo/proc&lt;br /&gt;livecd ~ # mount -o bind /dev /mnt/gentoo/dev&lt;br /&gt;livecd ~ # cp -Lv /etc/resolv.conf /mnt/gentoo/etc/resolv.conf&lt;br /&gt;`/etc/resolv.conf' -&gt; `/mnt/gentoo/etc/resolv.conf'&lt;br /&gt;livecd ~ # chroot /mnt/gentoo /bin/bash&lt;br /&gt;livecd / # env-update &amp;&amp; source /etc/profile&lt;br /&gt;&gt;&gt;&gt; Regenerating /etc/ld.so.cache...&lt;br /&gt;livecd / # export PS1="(chroot) $PS1"&lt;br /&gt;(chroot) livecd / #&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;Nice, now update the portage tree:&lt;br /&gt;&lt;code class=prettyprint&gt;&lt;br /&gt;(chroot) livecd / # emerge --sync --quiet&lt;br /&gt;&lt;br /&gt;Performing Global Updates: /usr/portage/profiles/updates/3Q-2009&lt;br /&gt;(Could take a couple of minutes if you have a lot of binary packages.)&lt;br /&gt;  .='update pass'  *='binary update'  #='/var/db update'  @='/var/db move'&lt;br /&gt;  s='/var/db SLOT move'  %='binary move'  S='binary SLOT move'&lt;br /&gt;  p='update /etc/portage/package.*'&lt;br /&gt;...............................................&lt;br /&gt;(chroot) livecd / #&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;Localisation bits below...speeds up compilation of glibc as it doesn't need to generate 400+ locales! ;]&lt;br /&gt;&lt;code class=prettyprint&gt;&lt;br /&gt;(chroot) livecd / #  nano -w /etc/locale.gen&lt;br /&gt;(chroot) livecd / # locale-gen&lt;br /&gt; * Generating 2 locales (this might take a while) with 1 jobs&lt;br /&gt; *  (1/2) Generating en_US.ISO-8859-1 ...                                                                                                                                     [ ok ]&lt;br /&gt; *  (2/2) Generating en_US.UTF-8 ...                                                                                                                                          [ ok ]&lt;br /&gt; * Generation complete&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;We'll have to use &lt;span style="font-weight:bold;"&gt;layman&lt;/span&gt; tool so let's emerge it now:&lt;br /&gt;&lt;code class=prettyprint&gt;&lt;br /&gt;(chroot) livecd / # emerge -av layman&lt;br /&gt;&lt;br /&gt;!!! Your current profile is deprecated and not supported anymore.&lt;br /&gt;!!! Please upgrade to the following profile if possible:&lt;br /&gt;        hardened/linux/amd64/10.0/no-multilib&lt;br /&gt;To upgrade do the following steps:&lt;br /&gt;# Use eselect profile to switch into 10.0 profile.&lt;br /&gt;&lt;br /&gt;These are the packages that would be merged, in order:&lt;br /&gt;&lt;br /&gt;Calculating dependencies... done!&lt;br /&gt;[ebuild  N    ] dev-python/pyxml-0.8.4-r2  USE="-doc -examples" 718 kB&lt;br /&gt;[ebuild  N    ] app-portage/layman-1.2.3  USE="-git -subversion -test" 46 kB&lt;br /&gt;&lt;br /&gt;Total: 2 packages (2 new), Size of downloads: 764 kB&lt;br /&gt;&lt;br /&gt;Would you like to merge these packages? [Yes/No]&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Oppsie! Ok, so Gentoo profile needs to be changed first. Let's see what we've got:&lt;br /&gt;&lt;code class=prettyprint&gt;&lt;br /&gt;(chroot) livecd / # eselect profile list&lt;br /&gt;Available profile symlink targets:&lt;br /&gt;  [1]   default/linux/amd64/2008.0&lt;br /&gt;  [2]   default/linux/amd64/2008.0/desktop&lt;br /&gt;  [3]   default/linux/amd64/2008.0/developer&lt;br /&gt;  [4]   default/linux/amd64/2008.0/no-multilib&lt;br /&gt;  [5]   default/linux/amd64/2008.0/server&lt;br /&gt;  [6]   default/linux/amd64/10.0&lt;br /&gt;  [7]   default/linux/amd64/10.0/desktop&lt;br /&gt;  [8]   default/linux/amd64/10.0/developer&lt;br /&gt;  [9]   default/linux/amd64/10.0/no-multilib&lt;br /&gt;  [10]  default/linux/amd64/10.0/server&lt;br /&gt;  [11]  hardened/amd64&lt;br /&gt;  [12]  hardened/amd64/multilib&lt;br /&gt;  [13]  selinux/2007.0/amd64&lt;br /&gt;  [14]  selinux/2007.0/amd64/hardened&lt;br /&gt;  [15]  selinux/v2refpolicy/amd64&lt;br /&gt;  [16]  selinux/v2refpolicy/amd64/desktop&lt;br /&gt;  [17]  selinux/v2refpolicy/amd64/developer&lt;br /&gt;  [18]  selinux/v2refpolicy/amd64/hardened&lt;br /&gt;  [19]  selinux/v2refpolicy/amd64/server&lt;br /&gt;  [20]  hardened/linux/amd64/10.0&lt;br /&gt;  [21]  hardened/linux/amd64/10.0/no-multilib&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;That's a no brainer really... ;] Hardened no-multilib is the way to go! ;)&lt;br /&gt;&lt;code class=prettyprint&gt;&lt;br /&gt;(chroot) livecd / # eselect profile set 21&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;Now emerge layman. Note that you're most likely currently using &lt;span style="font-weight:bold;"&gt;gcc-3.4.6&lt;/span&gt; which does not support the &lt;span style="font-style:italic;"&gt;-march=native&lt;/span&gt; option. I was to quick to adjust my CC flags so I had to change it to &lt;span style="font-style:italic;"&gt;-march=K8&lt;/span&gt; for my AMD64x2 CPU.&lt;br /&gt;Adding hardened overlay:&lt;br /&gt;&lt;code class=prettyprint&gt;&lt;br /&gt;(chroot) livecd / # layman -a hardened-development&lt;br /&gt;* Failed to add overlay "hardened-development".&lt;br /&gt;* Error was: Binary /usr/bin/git seems to be missing! Overlay type "git" not supported. Did you emerge dev-util/git?&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;I did forgot about git indeed! ;] Because I had plenty of USE flags enabled at this stage, I did not want to emerge too much dependencies at this point, hence I disabled some of the flags:&lt;br /&gt;&lt;code class=prettyprint&gt;&lt;br /&gt;(chroot) livecd / # USE="-gnome -perl -gtk" emerge -av dev-util/git&lt;br /&gt;These are the packages that would be merged, in order:&lt;br /&gt;&lt;br /&gt;Calculating dependencies... done!&lt;br /&gt;[ebuild  N    ] virtual/libintl-0  0 kB&lt;br /&gt;[ebuild  N    ] dev-libs/libgpg-error-1.7  USE="nls" 395 kB&lt;br /&gt;[ebuild  N    ] dev-libs/libtasn1-2.3  USE="-doc" 1,449 kB&lt;br /&gt;[ebuild  N    ] dev-libs/libgcrypt-1.4.4  1,117 kB&lt;br /&gt;[ebuild  N    ] net-libs/gnutls-2.6.6  USE="cxx nls zlib -bindist -doc -guile -lzo" 4,997 kB&lt;br /&gt;[ebuild  N    ] net-misc/curl-7.19.6  USE="gnutls ipv6 ssl -ares -idn -kerberos -ldap -libssh2 -nss -test" 2,293 kB&lt;br /&gt;[ebuild  N    ] dev-util/git-1.6.3.3  USE="bash-completion curl iconv threads xinetd -cgi -cvs -doc -emacs -gtk -mozsha1 -perl (-ppcsha1) -subversion -tk -webdav" 2,252 kB&lt;br /&gt;&lt;br /&gt;Total: 7 packages (7 new), Size of downloads: 12,501 kB&lt;br /&gt;&lt;br /&gt;Would you like to merge these packages? [Yes/No]&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;Oh yes, I would! When &lt;span style="font-weight:bold;"&gt;layman&lt;/span&gt; is ready we can proceed with adding the overlay:&lt;br /&gt;&lt;code class=prettyprint&gt;&lt;br /&gt;(chroot) livecd / # layman -a hardened-development&lt;br /&gt;* Running command "/usr/bin/git clone "git://git.overlays.gentoo.org/proj/hardened-development.git" "/usr/local/portage/layman/hardened-development""...&lt;br /&gt;Initialized empty Git repository in /usr/local/portage/layman/hardened-development/.git/&lt;br /&gt;remote: Counting objects: 2266, done.&lt;br /&gt;remote: Compressing objects: 100% (1144/1144), done.&lt;br /&gt;remote: Total 2266 (delta 1026), reused 2154 (delta 961)&lt;br /&gt;Receiving objects: 100% (2266/2266), 2.13 MiB | 657 KiB/s, done.&lt;br /&gt;Resolving deltas: 100% (1026/1026), done.&lt;br /&gt;* Successfully added overlay "hardened-development".&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;Now change /etc/make.conf to include layman overlays. Adding this line should do:&lt;br /&gt;&lt;code class=prettyprint&gt;&lt;br /&gt;source /usr/portage/local/layman/make.conf&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;Ina  true Gentoo fashion there will be some keywording/unmasking needed. I went for using folders with files beneath but you could with one file for each task if you wish.&lt;br /&gt;&lt;code class=prettyprint&gt;&lt;br /&gt;(chroot) livecd ~ # cd /etc/&lt;br /&gt;(chroot) livecd etc # mkdir portage &amp;&amp; cd portage&lt;br /&gt;(chroot) livecd etc # mkdir package.keywords&lt;br /&gt;(chroot) livecd etc # mkdir package.unmask&lt;br /&gt;(chroot) livecd portage # echo "=sys-devel/gcc-4.4*" &gt;&gt;/etc/portage/package.keywords/toolchain&lt;br /&gt;(chroot) livecd portage # echo "=sys-devel/gcc-4.4*" &gt;&gt;/etc/portage/package.unmask/toolchain&lt;br /&gt;(chroot) livecd portage # echo "=sys-libs/glibc-2.10*" &gt;&gt;/etc/portage/package.keywords/toolchain&lt;br /&gt;(chroot) livecd portage # echo "=sys-libs/glibc-2.10*" &gt;&gt;/etc/portage/package.unmask/toolchain&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;We need repos.conf file to use eclasses from the overlay. This file goes into /etc/portage and should contain the following:&lt;br /&gt;&lt;code class="prettyprint"&gt;&lt;br /&gt;# cat /etc/portage/repos.conf&lt;br /&gt;[gentoo]&lt;br /&gt;eclass-overrides = hardened-dev&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;Also, in order to compile glibc you need to disable the &lt;span style="font-weight:bold;"&gt;profile&lt;/span&gt; flag for it in &lt;span style="font-style:italic;"&gt;package.use&lt;/span&gt; file:&lt;br /&gt;&lt;code class=prettyprint&gt;&lt;br /&gt;echo "sys-libs/glibc -profile" &gt;&gt; /etc/portage/package.use&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;Let's see what will happen now...&lt;br /&gt;&lt;code class=prettyprint&gt;&lt;br /&gt;(chroot) livecd layman # emerge -av gcc-config linux-headers glibc binutils gcc portage -1&lt;br /&gt;&lt;br /&gt;These are the packages that would be merged, in order:&lt;br /&gt;Calculating dependencies... done!&lt;br /&gt;!!! All ebuilds that could satisfy "&gt;=dev-libs/ppl-0.10" have been masked.&lt;br /&gt;!!! One of the following masked packages is required to complete your request:&lt;br /&gt;- dev-libs/ppl-0.10.2 (masked by: ~amd64 keyword)&lt;br /&gt;For more information, see the MASKED PACKAGES section in the emerge&lt;br /&gt;man page or refer to the Gentoo Handbook.&lt;br /&gt;(dependency required by "sys-devel/gcc-4.4.1-r2" [ebuild])&lt;br /&gt;(dependency required by "gcc" [argument])&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;Obvious! I've enabled the &lt;a href="http://hardenedgentoo.blogspot.com/2009/07/gcc-441-with-graphite-framework.html"&gt;graphite&lt;/a&gt; extensions and forgot about their dependencies. More keywording then.&lt;br /&gt;&lt;code class=prettyprint&gt;&lt;br /&gt;(chroot) livecd layman # echo "&gt;=dev-libs/ppl-0.10" &gt;&gt; /etc/portage/package.keywords/toolchain&lt;br /&gt;(chroot) livecd package.keywords # echo "&gt;=dev-libs/cloog-ppl-0.15" &gt;&gt; /etc/portage/package.keywords/toolchain&lt;br /&gt;(chroot) livecd package.keywords # emerge -av gcc-config linux-headers glibc binutils gcc portage -1&lt;br /&gt;&lt;br /&gt;These are the packages that would be merged, in order:&lt;br /&gt;&lt;br /&gt;Calculating dependencies... done!&lt;br /&gt;[ebuild   R   ] sys-apps/portage-2.1.6.13  USE="-build -doc -epydoc (-selinux)" LINGUAS="pl*" 733 kB [0]&lt;br /&gt;[ebuild  N    ] dev-libs/gmp-4.2.4  USE="-nocxx" 1,671 kB [0]&lt;br /&gt;[ebuild   R   ] sys-devel/gcc-config-1.4.1  0 kB [0]&lt;br /&gt;[ebuild   R   ] sys-devel/binutils-2.18-r3  USE="nls* (-gold) -multislot -multitarget -test -vanilla" 14,629 kB [0]&lt;br /&gt;[ebuild  N    ] dev-libs/ppl-0.10.2  USE="-doc (-pch) -prolog -test -watchdog" 9,590 kB [0]&lt;br /&gt;[ebuild   R   ] sys-kernel/linux-headers-2.6.27-r2  3,509 kB [0]&lt;br /&gt;[ebuild  N    ] dev-libs/mpfr-2.4.1_p1  883 kB [0]&lt;br /&gt;[ebuild  N    ] dev-libs/cloog-ppl-0.15.7  750 kB [0]&lt;br /&gt;[ebuild  NS   ] sys-devel/gcc-4.4.1-r2 [3.4.6-r2] USE="graphite gtk hardened mudflap nls nptl (-altivec) -bootstrap -build -doc (-fixed-point) -fortran -gcj -ip28 -ip32r10k -libffi (-multilib) -multislot (-n32) (-n64) -nocxx -objc -objc++ -objc-gc -openmp -test -vanilla" 61,426 kB [1]&lt;br /&gt;[ebuild     U ] sys-libs/glibc-2.10.1 [2.9_p20081201-r2] USE="gd* hardened nls* profile* -debug -glibc-omitfp (-multilib) (-selinux) -vanilla" 15,909 kB [0=&gt;1]&lt;br /&gt;&lt;br /&gt;Total: 10 packages (1 upgrade, 4 new, 1 in new slot, 4 reinstalls), Size of downloads: 109,097 kB&lt;br /&gt;Portage tree and overlays:&lt;br /&gt; [0] /usr/portage&lt;br /&gt; [1] /usr/local/portage/layman/hardened-development&lt;br /&gt;&lt;br /&gt;Would you like to merge these packages? [Yes/No]&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;Ok, nearly there, but I wanted newer &lt;span style="font-style:italic;"&gt;linux-headers&lt;/span&gt;! ;] So:&lt;br /&gt;&lt;code class=prettyprint&gt;&lt;br /&gt;(chroot) livecd package.keywords # echo sys-kernel/linux-headers &gt;&gt; /etc/portage/package.keywords/system&lt;br /&gt;(chroot) livecd package.keywords # emerge -av gcc-config linux-headers glibc binutils gcc portage -1&lt;br /&gt;&lt;br /&gt;These are the packages that would be merged, in order:&lt;br /&gt;Calculating dependencies... done!&lt;br /&gt;[ebuild   R   ] sys-apps/portage-2.1.6.13  USE="-build -doc -epydoc (-selinux)" LINGUAS="pl*" 733 kB [0]&lt;br /&gt;[ebuild  N    ] dev-libs/gmp-4.2.4  USE="-nocxx" 1,671 kB [0]&lt;br /&gt;[ebuild   R   ] sys-devel/gcc-config-1.4.1  0 kB [0]&lt;br /&gt;[ebuild   R   ] sys-devel/binutils-2.18-r3  USE="nls* (-gold) -multislot -multitarget -test -vanilla" 14,629 kB [0]&lt;br /&gt;[ebuild  N    ] dev-libs/ppl-0.10.2  USE="-doc (-pch) -prolog -test -watchdog" 9,590 kB [0]&lt;br /&gt;[ebuild     U ] sys-kernel/linux-headers-2.6.30-r1 [2.6.27-r2] 3,780 kB [0]&lt;br /&gt;[ebuild  N    ] dev-libs/mpfr-2.4.1_p1  883 kB [0]&lt;br /&gt;[ebuild  N    ] dev-libs/cloog-ppl-0.15.7  750 kB [0]&lt;br /&gt;[ebuild  NS   ] sys-devel/gcc-4.4.1-r2 [3.4.6-r2] USE="graphite gtk hardened mudflap nls nptl (-altivec) -bootstrap -build -doc (-fixed-point) -fortran -gcj -ip28 -ip32r10k -libffi (-multilib) -multislot (-n32) (-n64) -nocxx -objc -objc++ -objc-gc -openmp -test -vanilla" 61,426 kB [1]&lt;br /&gt;[ebuild     U ] sys-libs/glibc-2.10.1 [2.9_p20081201-r2] USE="gd* hardened nls* profile* -debug -glibc-omitfp (-multilib) (-selinux) -vanilla" 15,909 kB [0=&gt;1]&lt;br /&gt;&lt;br /&gt;Total: 10 packages (2 upgrades, 4 new, 1 in new slot, 3 reinstalls), Size of downloads: 109,368 kB&lt;br /&gt;Portage tree and overlays:&lt;br /&gt; [0] /usr/portage&lt;br /&gt; [1] /usr/local/portage/layman/hardened-development&lt;br /&gt;&lt;br /&gt;Would you like to merge these packages? [Yes/No]&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;Oh yes! So the last final check before we go to ensure that everything is set to build our new shiny hardened toolchain:&lt;br /&gt;&lt;code class=prettyprint&gt;&lt;br /&gt;(chroot) livecd package.keywords # eselect profile list&lt;br /&gt;Available profile symlink targets:&lt;br /&gt;  [1]   default/linux/amd64/2008.0&lt;br /&gt;  [2]   default/linux/amd64/2008.0/desktop&lt;br /&gt;  [3]   default/linux/amd64/2008.0/developer&lt;br /&gt;  [4]   default/linux/amd64/2008.0/no-multilib&lt;br /&gt;  [5]   default/linux/amd64/2008.0/server&lt;br /&gt;  [6]   default/linux/amd64/10.0&lt;br /&gt;  [7]   default/linux/amd64/10.0/desktop&lt;br /&gt;  [8]   default/linux/amd64/10.0/developer&lt;br /&gt;  [9]   default/linux/amd64/10.0/no-multilib&lt;br /&gt;  [10]  default/linux/amd64/10.0/server&lt;br /&gt;  [11]  hardened/amd64&lt;br /&gt;  [12]  hardened/amd64/multilib&lt;br /&gt;  [13]  selinux/2007.0/amd64&lt;br /&gt;  [14]  selinux/2007.0/amd64/hardened&lt;br /&gt;  [15]  selinux/v2refpolicy/amd64&lt;br /&gt;  [16]  selinux/v2refpolicy/amd64/desktop&lt;br /&gt;  [17]  selinux/v2refpolicy/amd64/developer&lt;br /&gt;  [18]  selinux/v2refpolicy/amd64/hardened&lt;br /&gt;  [19]  selinux/v2refpolicy/amd64/server&lt;br /&gt;  [20]  hardened/linux/amd64/10.0&lt;br /&gt;  [21]  hardened/linux/amd64/10.0/no-multilib *&lt;br /&gt;(chroot) livecd package.keywords # gcc-config -l&lt;br /&gt; [1] x86_64-pc-linux-gnu-3.4.6 *&lt;br /&gt; [2] x86_64-pc-linux-gnu-3.4.6-hardenednopie&lt;br /&gt; [3] x86_64-pc-linux-gnu-3.4.6-hardenednopiessp&lt;br /&gt; [4] x86_64-pc-linux-gnu-3.4.6-hardenednossp&lt;br /&gt; [5] x86_64-pc-linux-gnu-3.4.6-vanilla&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;All set! So let's emerge the toolchain (last emerge command above).&lt;br /&gt;&lt;br /&gt;Hmm...that didn't work, did it?&lt;br /&gt;&lt;code class=prettyprint&gt;&lt;br /&gt;&gt;&gt;&gt; Failed to emerge dev-libs/ppl-0.10.2, Log file:&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;Let's temporarily disable the &lt;span style="font-style:italic;"&gt;graphite&lt;/span&gt; USE flag then:&lt;br /&gt;&lt;code class=prettyprint&gt;&lt;br /&gt;(chroot) livecd package.keywords # USE="-graphite" emerge -av linux-headers glibc gcc -1&lt;br /&gt;These are the packages that would be merged, in order:&lt;br /&gt;Calculating dependencies... done!&lt;br /&gt;[ebuild     U ] sys-kernel/linux-headers-2.6.30-r1 [2.6.27-r2] 0 kB [0]&lt;br /&gt;[ebuild  N    ] dev-libs/mpfr-2.4.1_p1  0 kB [0]&lt;br /&gt;[ebuild  NS   ] sys-devel/gcc-4.4.1-r2 [3.4.6-r2] USE="gtk hardened mudflap nls nptl (-altivec) -bootstrap -build -doc (-fixed-point) -fortran -gcj -graphite -ip28 -ip32r10k -libffi (-multilib) -multislot (-n32) (-n64) -nocxx -objc -objc++ -objc-gc -openmp -test -vanilla" 0 kB [1]&lt;br /&gt;[ebuild     U ] sys-libs/glibc-2.10.1 [2.9_p20081201-r2] USE="gd* hardened nls* profile* -debug -glibc-omitfp (-multilib) (-selinux) -vanilla" 0 kB [0=&gt;1]&lt;br /&gt;&lt;br /&gt;Total: 4 packages (2 upgrades, 1 new, 1 in new slot), Size of downloads: 0 kB&lt;br /&gt;Portage tree and overlays:&lt;br /&gt; [0] /usr/portage&lt;br /&gt; [1] /usr/local/portage/layman/hardened-development&lt;br /&gt;&lt;br /&gt;Would you like to merge these packages? [Yes/No]&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;Yuppie - this worked!:&lt;br /&gt;&lt;code class=prettyprint&gt;&lt;br /&gt;(chroot) livecd package.keywords # gcc-config -l&lt;br /&gt; [1] x86_64-pc-linux-gnu-3.4.6 *&lt;br /&gt; [2] x86_64-pc-linux-gnu-3.4.6-hardenednopie&lt;br /&gt; [3] x86_64-pc-linux-gnu-3.4.6-hardenednopiessp&lt;br /&gt; [4] x86_64-pc-linux-gnu-3.4.6-hardenednossp&lt;br /&gt; [5] x86_64-pc-linux-gnu-3.4.6-vanilla&lt;br /&gt; [6] x86_64-pc-linux-gnu-4.4.1&lt;br /&gt; [7] x86_64-pc-linux-gnu-4.4.1-hardenednopie&lt;br /&gt; [8] x86_64-pc-linux-gnu-4.4.1-hardenednossp&lt;br /&gt; [9] x86_64-pc-linux-gnu-4.4.1-vanilla&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;So let's switch to our new compiler and try to rebuild it with graphite extensions enabled (you'll need to enable &lt;span style="font-weight:bold;"&gt;graphite&lt;/span&gt; use flag in &lt;span style="font-style:italic;"&gt;/etc/make.conf&lt;/span&gt;):&lt;br /&gt;&lt;code class=prettyprint&gt;&lt;br /&gt;(chroot) livecd package.keywords # gcc-config 6&lt;br /&gt; * Switching native-compiler to x86_64-pc-linux-gnu-4.4.1 ...&lt;br /&gt;&gt;&gt;&gt; Regenerating /etc/ld.so.cache...                                                                                                                                          [ ok ]&lt;br /&gt;&lt;br /&gt; * If you intend to use the gcc from the new profile in an already&lt;br /&gt; * running shell, please remember to do:&lt;br /&gt;&lt;br /&gt; *   # source /etc/profile&lt;br /&gt;&lt;br /&gt;(chroot) livecd package.keywords # source /etc/profile&lt;br /&gt;(chroot) livecd package.keywords # emerge -av gcc&lt;br /&gt;&lt;br /&gt;These are the packages that would be merged, in order:&lt;br /&gt;&lt;br /&gt;Calculating dependencies... done!&lt;br /&gt;[ebuild  N    ] dev-libs/ppl-0.10.2  USE="-doc (-pch) -prolog -test -watchdog" 0 kB [0]&lt;br /&gt;[ebuild  N    ] dev-libs/cloog-ppl-0.15.7  0 kB [0]&lt;br /&gt;[ebuild   R   ] sys-devel/gcc-4.4.1-r2  USE="graphite* gtk hardened mudflap nls nptl (-altivec) -bootstrap -build -doc (-fixed-point) -fortran -gcj -ip28 -ip32r10k -libffi (-multilib) -multislot (-n32) (-n64) -nocxx -objc -objc++ -objc-gc -openmp -test -vanilla" 0 kB [1]&lt;br /&gt;&lt;br /&gt;Total: 3 packages (2 new, 1 reinstall), Size of downloads: 0 kB&lt;br /&gt;Portage tree and overlays:&lt;br /&gt; [0] /usr/portage&lt;br /&gt; [1] /usr/local/portage/layman/hardened-development&lt;br /&gt;&lt;br /&gt;Would you like to merge these packages? [Yes/No] y&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;Ppl failed again ;( I've tried rebuilding binutils and glibc with the new compiler first but that didn't work too. As it is usually the case - solution was simple and even given on the screen!&lt;br /&gt;&lt;code class=prettyprint&gt;&lt;br /&gt;livecd package.keywords # fix_libtool_files.sh 3.4.6&lt;br /&gt; * Scanning libtool files for hardcoded gcc library paths...&lt;br /&gt; *   [1/7] Scanning /lib ...&lt;br /&gt; *   [2/7] Scanning /usr/lib ...&lt;br /&gt; *   [3/7] Scanning /lib64 ...&lt;br /&gt; *   [4/7] Scanning /usr/lib64 ...&lt;br /&gt; *     FIXING: /usr/lib64/gcc/x86_64-pc-linux-gnu/3.4.6/libsupc++.la ...[]&lt;br /&gt; *     FIXING: /usr/lib64/gcc/x86_64-pc-linux-gnu/3.4.6/libstdc++.la ...[]&lt;br /&gt; *   [5/7] Scanning /usr/local/lib ...&lt;br /&gt; *   [6/7] Scanning /usr/local/lib64 ...&lt;br /&gt; *   [7/7] Scanning /usr/x86_64-pc-linux-gnu/lib ...&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;Rite, we're on track...emerge gcc with graphite enabled and it should work this time. To take the full advantage of the graphite framework you'll need to change your CCFLAGS (see bottom of &lt;a href="http://hardenedgentoo.blogspot.com/2009/07/gcc-441-with-graphite-framework.html"&gt;this&lt;/a&gt; page). I also wanted to enable ccache to speed up all the recompilations ;]&lt;br /&gt;&lt;code class=prettyprint&gt;&lt;br /&gt;livecd # emerge -av ccache&lt;br /&gt;These are the packages that would be merged, in order:&lt;br /&gt;Calculating dependencies... done!&lt;br /&gt;[ebuild  N    ] dev-util/ccache-2.4-r7  85 kB&lt;br /&gt;Total: 1 package (1 new), Size of downloads: 85 kB&lt;br /&gt;Would you like to merge these packages? [Yes/No]&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;This would require the following changes in make.confg (choose whatever size for your cache tou want):&lt;br /&gt;&lt;code class=prettyprint&gt;&lt;br /&gt;livecd package.keywords # nano /etc/make.conf&lt;br /&gt;&lt;br /&gt;FEATURES="ccache"&lt;br /&gt;CCACHE_SIZE="5G"&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;At last! New gcc has arrived:&lt;br /&gt;&lt;code class=prettyprint&gt;&lt;br /&gt;livecd package.keywords # gcc -v&lt;br /&gt;Using built-in specs.&lt;br /&gt;Target: x86_64-pc-linux-gnu&lt;br /&gt;Configured with: /var/tmp/portage/sys-devel/gcc-4.4.1-r2/work/gcc-4.4.1/configure --prefix=/usr --bindir=/usr/x86_64-pc-linux-gnu/gcc-bin/4.4.1 --includedir=/usr/lib/gcc/x86_64-pc-linux-gnu/4.4.1/include --datadir=/usr/share/gcc-data/x86_64-pc-linux-gnu/4.4.1 --mandir=/usr/share/gcc-data/x86_64-pc-linux-gnu/4.4.1/man --infodir=/usr/share/gcc-data/x86_64-pc-linux-gnu/4.4.1/info --with-gxx-include-dir=/usr/lib/gcc/x86_64-pc-linux-gnu/4.4.1/include/g++-v4 --host=x86_64-pc-linux-gnu --build=x86_64-pc-linux-gnu --disable-altivec --disable-fixed-point --with-ppl --with-cloog --enable-nls --without-included-gettext --with-system-zlib --disable-checking --disable-werror --enable-secureplt --disable-multilib --enable-libmudflap --disable-libssp --enable-espf --disable-libgomp --enable-cld --with-python-dir=/share/gcc-data/x86_64-pc-linux-gnu/4.4.1/python --disable-libgcj --enable-languages=c,c++ --enable-shared --enable-threads=posix --enable-__cxa_atexit --enable-clocale=gnu --with-bugurl=http://bugs.gentoo.org/ --with-pkgversion='Gentoo Hardened 4.4.1-r2 p1.0, espf-0.3.3'&lt;br /&gt;Thread model: posix&lt;br /&gt;gcc version 4.4.1 (Gentoo Hardened 4.4.1-r2 p1.0, espf-0.3.3)&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;Ok, nice and sweet. Now we need to recompile world. Again due to some circular dependencies I disabled the &lt;span style="font-style:italic;"&gt;gnome&lt;/span&gt; flag which I've already enabled in &lt;span style="font-style:italic;"&gt;make.conf&lt;/span&gt; ;) :&lt;br /&gt;&lt;code class=prettyprint&gt;&lt;br /&gt;time USE="-gnome" emerge -ev world --keep-going&lt;br /&gt;failed to compile:&lt;br /&gt;* The following 34 packages have failed to build or install:&lt;br /&gt; *                                                           &lt;br /&gt; *      ('ebuild', '/', 'sys-fs/cryptsetup-1.0.6-r2', 'merge')&lt;br /&gt; *      ('ebuild', '/', 'gnome-base/libgnomeprint-2.18.5', 'merge')&lt;br /&gt; *      ('ebuild', '/', 'dev-python/libgnomecanvas-python-2.22.3', 'merge')&lt;br /&gt; *      ('ebuild', '/', 'net-print/libgnomecups-0.2.3', 'merge')           &lt;br /&gt; *      ('ebuild', '/', 'app-misc/hal-info-20090414', 'merge')             &lt;br /&gt; *      ('ebuild', '/', 'x11-base/xorg-server-1.5.3-r6', 'merge')          &lt;br /&gt; *      ('ebuild', '/', 'sys-apps/hal-0.5.11-r9', 'merge')                 &lt;br /&gt; *      ('ebuild', '/', 'dev-python/pygtk-2.14.1-r1', 'merge')             &lt;br /&gt; *      ('ebuild', '/', 'x11-libs/gtksourceview-1.8.5-r1', 'merge')        &lt;br /&gt; *      ('ebuild', '/', 'dev-python/gnome-python-base-2.22.3', 'merge')    &lt;br /&gt; *      ('ebuild', '/', 'gnome-base/libgnomecanvas-2.20.1.1', 'merge')     &lt;br /&gt; *      ('ebuild', '/', 'dev-python/gnome-python-desktop-base-2.24.1', 'merge')&lt;br /&gt; *      ('ebuild', '/', 'net-print/cups-1.3.10-r2', 'merge')&lt;br /&gt; *      ('ebuild', '/', 'x11-drivers/xf86-video-openchrome-0.2.903', 'merge')&lt;br /&gt; *      ('ebuild', '/', 'net-fs/samba-3.0.33', 'merge')&lt;br /&gt; *      ('ebuild', '/', 'gnome-base/gail-1000', 'merge')&lt;br /&gt; *      ('ebuild', '/', 'x11-drivers/xf86-input-mouse-1.4.0', 'merge')&lt;br /&gt; *      ('ebuild', '/', 'dev-python/libgnomeprint-python-2.24.1', 'merge')&lt;br /&gt; *      ('ebuild', '/', 'app-text/ghostscript-gpl-8.64-r3', 'merge')&lt;br /&gt; *      ('ebuild', '/', 'gnome-base/libglade-2.6.4', 'merge')&lt;br /&gt; *      ('ebuild', '/', 'gnome-base/libgnomeprintui-2.18.3', 'merge')&lt;br /&gt; *      ('ebuild', '/', 'x11-drivers/xf86-input-keyboard-1.3.2', 'merge')&lt;br /&gt; *      ('ebuild', '/', 'dev-python/gtksourceview-python-2.24.1', 'merge')&lt;br /&gt; *      ('ebuild', '/', 'virtual/ghostscript-0', 'merge')&lt;br /&gt; *      ('ebuild', '/', 'dev-util/git-1.6.3.3', 'merge')&lt;br /&gt; *      ('ebuild', '/', 'x11-libs/gtk+-2.14.7-r2', 'merge')&lt;br /&gt; *      ('ebuild', '/', 'dev-python/pygobject-2.18.0', 'merge')&lt;br /&gt; *      ('ebuild', '/', 'x11-libs/libXaw-1.0.5', 'merge')&lt;br /&gt; *      ('ebuild', '/', 'x11-terms/xterm-242', 'merge')&lt;br /&gt; *      ('ebuild', '/', 'x11-apps/xinit-1.0.8-r4', 'merge')&lt;br /&gt; *      ('ebuild', '/', 'sys-apps/groff-1.20.1-r1', 'merge')&lt;br /&gt; *      ('ebuild', '/', 'x11-apps/xmessage-1.0.2-r1', 'merge')&lt;br /&gt; *      ('ebuild', '/', 'x11-apps/xsm-1.0.1-r1', 'merge')&lt;br /&gt; *      ('ebuild', '/', 'x11-apps/xclock-1.0.3-r1', 'merge')&lt;br /&gt; *&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;Nothing critical ;D Well...&lt;span style="font-style:italic;"&gt;cryptsetup&lt;/span&gt; maybe. I don't remember why it failed but as it was already installed, it worked fine and I think that it needed to be keyworded with ~amd64 and then it compiled fine. Further system adjustments:&lt;br /&gt;&lt;code class=prettyprint&gt;&lt;br /&gt;livecd # sed -i 's/once/once,--hash-style=gnu/' /etc/make.conf&lt;br /&gt;livecd # etc-update&lt;br /&gt;livecd # emerge syslog-ng ntp lilo vixie-cron sysfsutils dhcpcd eix gentoolkit portage-utils genlop&lt;br /&gt;livecd # cp /usr/share/zoneinfo/GMT /etc/localtime&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Kernel time - I've used 2.6.31 which since then has been upgraded to 2.6.31.1 and is running perfectly fine. I do strongly recommend to use the 2.6.31.1! Also - the &lt;span style="font-weight:bold;"&gt;patch&lt;/span&gt; utility is also needed!&lt;br /&gt;&lt;code class=prettyprint&gt;&lt;br /&gt;livecd src # wget http://grsecurity.net/test/grsecurity-2.1.14-2.6.31-200909121839.patch&lt;br /&gt;livecd src #emerge patch&lt;br /&gt;livecd src # tar jxf linux-2.6.31.tar.bz2&lt;br /&gt;livecd src # patch -p0 &lt; grsecurity-2.1.14-2.6.31-200909121839.patch&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;The easiest way to go about kernel configuration is to use the one from livecd - once it's working we can start stripping it down of unnecessary stuff.&lt;br /&gt;Outside chroot:&lt;br /&gt;&lt;code class=prettyprint&gt;&lt;br /&gt;zcat /proc/config.gz &gt; /mnt/gentoo/usr/src/linux-2.6.31/.config&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;Back to chroot (forgot about the &lt;span style="font-weight:bold;"&gt;genkernel&lt;/span&gt;! ;) ):&lt;br /&gt;&lt;code class=prettyprint&gt;&lt;br /&gt;livecd src # ln -s linux-2.6.31 linux&lt;br /&gt;livecd src # emerge genkernel&lt;br /&gt;livecd src # emerge -av cryptsetup&lt;br /&gt;livecd src # rc-update add dmcrypt boot&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;Also, /etc/genkernel.conf needs LUKS="yes" set (default is no). You could also tweak other options.&lt;br /&gt;&lt;code class=prettyprint&gt;&lt;br /&gt;CLEAN="no"&lt;br /&gt;MRPROPER="no"&lt;br /&gt;LUKS="yes"&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;Compile! Remember to add the &lt;span style="font-style:italic;"&gt;--luks&lt;/span&gt; option so a LUKS-aware initrd will be created.&lt;br /&gt;&lt;code class=prettyprint&gt;&lt;br /&gt;livecd linux-2.6.31 # genkernel --luks all&lt;br /&gt;* Gentoo Linux Genkernel; Version 3.4.10.904&lt;br /&gt;* Running with options: --luks all&lt;br /&gt;&lt;br /&gt;* Linux Kernel 2.6.31 for x86_64...&lt;br /&gt;*         &gt;&gt; Running oldconfig...&lt;br /&gt;* config: --no-clean is enabled; leaving the .config alone.&lt;br /&gt;*         &gt;&gt; Compiling 2.6.31-grsec bzImage...&lt;br /&gt;*         &gt;&gt; Compiling 2.6.31-grsec modules...&lt;br /&gt;* Copying config for successful build to /etc/kernels/kernel-config-x86_64-2.6.31-grsec&lt;br /&gt;* busybox: &gt;&gt; Applying patches...&lt;br /&gt;* busybox: &gt;&gt; Configuring...&lt;br /&gt;* busybox: &gt;&gt; Compiling...&lt;br /&gt;* busybox: &gt;&gt; Copying to cache...&lt;br /&gt;* initramfs: &gt;&gt; Initializing...&lt;br /&gt;*         &gt;&gt; Appending base_layout cpio data...&lt;br /&gt;*         &gt;&gt; Appending auxilary cpio data...&lt;br /&gt;*         &gt;&gt; Appending busybox cpio data...&lt;br /&gt;*         &gt;&gt; Appending luks cpio data...&lt;br /&gt;* Including LUKS support&lt;br /&gt;*         &gt;&gt; Appending modules cpio data...&lt;br /&gt;*&lt;br /&gt;* Kernel compiled successfully!&lt;br /&gt;*&lt;br /&gt;* Required Kernel Parameters:&lt;br /&gt;*     real_root=/dev/$ROOT&lt;br /&gt;*&lt;br /&gt;*     Where $ROOT is the device node for your root partition as the&lt;br /&gt;*     one specified in /etc/fstab&lt;br /&gt;*&lt;br /&gt;* If you require Genkernel's hardware detection features; you MUST&lt;br /&gt;* tell your bootloader to use the provided INITRAMFS file. Otherwise;&lt;br /&gt;* substitute the root argument for the real_root argument if you are&lt;br /&gt;* not planning to use the initramfs...&lt;br /&gt;&lt;br /&gt;* WARNING... WARNING... WARNING...&lt;br /&gt;* Additional kernel cmdline arguments that *may* be required to boot properly...&lt;br /&gt;&lt;br /&gt;* Do NOT report kernel bugs as genkernel bugs unless your bug&lt;br /&gt;* is about the default genkernel configuration...&lt;br /&gt;*&lt;br /&gt;* Make sure you have the latest genkernel before reporting bugs.&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;Nearly there. /etc/fstab needs to be adjusted so our new system will boot properly. If you've used the same partitioning scheme, here's how it needs to look like:&lt;br /&gt;&lt;code class=prettyprint&gt;&lt;br /&gt;/dev/sda1               /boot           ext3            noauto,noatime  1 2&lt;br /&gt;/dev/mapper/root        /               ext4            noatime         0 1&lt;br /&gt;/dev/crypt-swap         none            swap            sw              0 0&lt;br /&gt;/dev/cdrom              /mnt/cdrom      auto            noauto,ro       0 0&lt;br /&gt;#/dev/fd0               /mnt/floppy     auto            noauto          0 0&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;To get encrypted swap partition working you need to add this to /etc/conf.d/dmcrypt :&lt;br /&gt;&lt;code class=prettyprint&gt;&lt;br /&gt;swap=crypt-swap&lt;br /&gt;source='/dev/sda2'&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;Almost ready for reboot! Edit hostname and clock settings (/etc/hostname and /etc/conf.d/clock) and proceed to boot loader config. Due to neverending issues with grub on amd64 we're (for now at least) doomed with lilo ;]. In order to get it to work with LUKS the append line should look like this:&lt;br /&gt;&lt;code class=prettyprint&gt;&lt;br /&gt;  &lt;br /&gt;  append="init=/linuxrc ramdisk=8192 crypt_root=/dev/sda3 real_root=/dev/mapper/root"&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;And I still leave root=/dev/sda3 option in as well. Before you reboot also make sure that you've changed root password. Reboot!&lt;br /&gt;Let's test it then, shall we? Emerge and run &lt;span style="font-weight:bold;"&gt;paxtest&lt;/span&gt;:&lt;br /&gt;&lt;code class=prettyprint&gt;&lt;br /&gt;host ~ # echo "app-admin/paxtest ~amd64" &gt;&gt; /etc/portage/package.keywords/system&lt;br /&gt;host ~ # emerge paxtest&lt;br /&gt;host ~ # paxtest blackhat&lt;br /&gt;PaXtest - Copyright(c) 2003,2004 by Peter Busser &lt;peter@adamantix.org&gt;&lt;br /&gt;Released under the GNU Public Licence version 2 or later              &lt;br /&gt;Writing output to paxtest.log&lt;br /&gt;It may take a while for the tests to complete&lt;br /&gt;Test results:                                &lt;br /&gt;PaXtest - Copyright(c) 2003,2004 by Peter Busser &lt;peter@adamantix.org&gt;&lt;br /&gt;Released under the GNU Public Licence version 2 or later              &lt;br /&gt;Mode: blackhat&lt;br /&gt;Linux host 2.6.31-grsec #3 SMP Tue Sep 15 10:51:44 GMT 2009 x86_64 AMD Athlon(tm) 64 X2 Dual Core Processor 3800+ AuthenticAMD GNU/Linux&lt;br /&gt;&lt;br /&gt;Executable anonymous mapping             : Killed&lt;br /&gt;Executable bss                           : Killed&lt;br /&gt;Executable data                          : Killed&lt;br /&gt;Executable heap                          : Killed&lt;br /&gt;Executable stack                         : Killed&lt;br /&gt;Executable anonymous mapping (mprotect)  : Killed&lt;br /&gt;Executable bss (mprotect)                : Killed&lt;br /&gt;Executable data (mprotect)               : Killed&lt;br /&gt;Executable heap (mprotect)               : Killed&lt;br /&gt;Executable stack (mprotect)              : Killed&lt;br /&gt;Executable shared library bss (mprotect) : Killed&lt;br /&gt;Executable shared library data (mprotect): Killed&lt;br /&gt;Writable text segments                   : Killed&lt;br /&gt;Anonymous mapping randomisation test     : 33 bits (guessed)&lt;br /&gt;Heap randomisation test (ET_EXEC)        : 40 bits (guessed)&lt;br /&gt;Heap randomisation test (ET_DYN)         : 40 bits (guessed)&lt;br /&gt;Main executable randomisation (ET_EXEC)  : 32 bits (guessed)&lt;br /&gt;Main executable randomisation (ET_DYN)   : 32 bits (guessed)&lt;br /&gt;Shared library randomisation test        : 33 bits (guessed)&lt;br /&gt;Stack randomisation test (SEGMEXEC)      : No randomisation&lt;br /&gt;Stack randomisation test (PAGEEXEC)      : 40 bits (guessed)&lt;br /&gt;Return to function (strcpy)              : *** buffer overflow detected ***: rettofunc1 - terminated&lt;br /&gt;rettofunc1: buffer overflow attack in function &lt;unknown&gt; - terminated&lt;br /&gt;Report to http://bugs.gentoo.org/&lt;br /&gt;Killed&lt;br /&gt;Return to function (memcpy)              : *** buffer overflow detected ***: rettofunc2 - terminated&lt;br /&gt;rettofunc2: buffer overflow attack in function &lt;unknown&gt; - terminated&lt;br /&gt;Report to http://bugs.gentoo.org/&lt;br /&gt;Killed&lt;br /&gt;Return to function (strcpy, RANDEXEC)    : *** buffer overflow detected ***: rettofunc1x - terminated&lt;br /&gt;rettofunc1x: buffer overflow attack in function &lt;unknown&gt; - terminated&lt;br /&gt;Report to http://bugs.gentoo.org/&lt;br /&gt;Killed&lt;br /&gt;Return to function (memcpy, RANDEXEC)    : *** buffer overflow detected ***: rettofunc2x - terminated&lt;br /&gt;rettofunc2x: buffer overflow attack in function &lt;unknown&gt; - terminated&lt;br /&gt;Report to http://bugs.gentoo.org/&lt;br /&gt;Killed&lt;br /&gt;Executable shared library bss            : Killed&lt;br /&gt;Executable shared library data           : Killed&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;Sweet! You could update baselayout and switch to openrc:&lt;br /&gt;&lt;code class=prettyprint&gt;&lt;br /&gt;host ~ # echo "sys-apps/baselayout ~amd64" &gt;&gt; /etc/portage/package.keywords/system&lt;br /&gt;host ~ # echo "sys-apps/openrc ~amd64" &gt;&gt; /etc/portage/package.keywords/system&lt;br /&gt;host ~ # echo "sys-apps/sysvinit ~amd64" &gt;&gt; /etc/portage/package.keywords/system&lt;br /&gt;host ~ # emerge -av baselayout&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;KDE time! The &lt;a href="http://www.gentoo.org/proj/en/desktop/kde/kde4-guide.xml#kde_portage"&gt;Gentoo KDE Guide&lt;/a&gt; will be useful here, especially to get the keywording/unmasking files. To keep it nice and clean:&lt;br /&gt;&lt;code class=prettyprint&gt;&lt;br /&gt;host ~ # cd /etc/portage/package.keywords/&lt;br /&gt;host package.keywords # touch kde-4.3&lt;br /&gt;host package.keywords # nano kde-4.3&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;Update the files as per guide. Also some packages have to be compiled with specific flags set, this is what worked for me at the time being:&lt;br /&gt;&lt;code class=prettyprint&gt;&lt;br /&gt;host portage # echo "dev-python/PyQt4 sql webkit" &gt;&gt; /etc/portage/package.use&lt;br /&gt;host portage # echo "sys-auth/pambase consolekit" &gt;&gt; /etc/portage/package.use&lt;br /&gt;host portage # echo "x11-libs/qt-gui mng" &gt;&gt; /etc/portage/package.use&lt;br /&gt;host portage # echo "sys-libs/ncurses unicode" &gt;&gt; /etc/portage/package.use&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;Now is the biggie ;] Better run it over night or even better over weekend...The &lt;span style="font-style:italic;"&gt;--keep-going&lt;/span&gt; command will prevent you from checking every 10 minutes if the compilation hasn't stopped due to some errors ;) :&lt;br /&gt;&lt;code class="prettyprint"&gt;&lt;br /&gt;emerge --keep-going -av kde-meta&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;...few hours later I got this:&lt;br /&gt;&lt;code class="prettyprint"&gt;&lt;br /&gt; *&lt;br /&gt; * The following 12 packages have failed to build or install:&lt;br /&gt; *&lt;br /&gt; *      ('ebuild', '/', 'kde-base/nepomuk-4.3.1', 'merge')&lt;br /&gt; *      ('ebuild', '/', 'kde-base/kdebase-meta-4.3.1', 'merge')&lt;br /&gt; *      ('ebuild', '/', 'kde-base/kde-meta-4.3.1', 'merge')&lt;br /&gt; *      ('ebuild', '/', 'kde-base/gwenview-4.3.1', 'merge')&lt;br /&gt; *      ('ebuild', '/', 'kde-base/kdegraphics-meta-4.3.1', 'merge')&lt;br /&gt; *      ('ebuild', '/', 'kde-base/kdenetwork-meta-4.3.1', 'merge')&lt;br /&gt; *      ('ebuild', '/', 'kde-base/mplayerthumbs-4.3.1', 'merge')&lt;br /&gt; *      ('ebuild', '/', 'kde-base/kdemultimedia-meta-4.3.1', 'merge')&lt;br /&gt; *      ('ebuild', '/', 'kde-base/kmail-4.3.1', 'merge')&lt;br /&gt; *      ('ebuild', '/', 'kde-base/dolphin-4.3.1', 'merge')&lt;br /&gt; *      ('ebuild', '/', 'kde-base/kdepim-meta-4.3.1', 'merge')&lt;br /&gt; *      ('ebuild', '/', 'kde-base/kget-4.3.1', 'merge')&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;Well, &lt;span style="font-weight:bold;"&gt;nepomuk&lt;/span&gt; did not like the grsec kernel, so I had to reboot into vanilla and re-emerge the &lt;span style="font-weight:bold;"&gt;kde-meta&lt;/span&gt; package. It (nepomuk) compiled fine but still segfaults on grsec kernels - I don't really use it so I'm not bothered but that probably is a bug that would require some patching. Nevertheless - finish of the installation as per Gentoo guide, remove unnecessary files and update config files:&lt;br /&gt;&lt;code class="prettyprint"&gt;&lt;br /&gt;host / # rm portage-latest.tar.bz2&lt;br /&gt;host / # rm stage3-amd64-hardened+nomultilib-20090903.tar.bz2&lt;br /&gt;host / # etc-update&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;...configure X (Gentoo guides will be helpful again!) and start your new shiny KDE environment! ;] Remember to add &lt;span style="font-weight:bold;"&gt;dbus&lt;/span&gt; to startup or KDM will not work; you'll probably need &lt;span style="font-weight:bold;"&gt;hald&lt;/span&gt; as well:&lt;br /&gt;&lt;code class="prettyprint"&gt;&lt;br /&gt;host ~ # rc-update add dbus default&lt;br /&gt;* service dbus added to runlevel default&lt;br /&gt;host ~ # /etc/init.d/dbus start&lt;br /&gt;dbus            |* Starting D-BUS system messagebus...                                                  &lt;br /&gt;[ ok ]          |&lt;br /&gt;host ~ # /etc/init.d/hald start&lt;br /&gt;hald            |* Starting Hardware Abstraction Layer daemon...                                        &lt;br /&gt;[ ok ]          |&lt;br /&gt;host ~ # rc-update add hald default&lt;br /&gt;* service hald added to runlevel default&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;Enjoy!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3050029677375999718-7347737725660547670?l=hardenedgentoo.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://hardenedgentoo.blogspot.com/feeds/7347737725660547670/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://hardenedgentoo.blogspot.com/2009/10/64-bit-hardened-gentoo-with-luks-on.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3050029677375999718/posts/default/7347737725660547670'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3050029677375999718/posts/default/7347737725660547670'/><link rel='alternate' type='text/html' href='http://hardenedgentoo.blogspot.com/2009/10/64-bit-hardened-gentoo-with-luks-on.html' title='64-bit Hardened Gentoo with LUKS on 2.6.31.1-grsec, glibc-2.10 and gcc-4.4.1. With KDE-4.3.1. From scratch.'/><author><name>radegand</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3050029677375999718.post-6264585900790686029</id><published>2009-10-03T12:39:00.003+01:00</published><updated>2009-10-03T12:45:49.131+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='hardened gentoo'/><category scheme='http://www.blogger.com/atom/ns#' term='gcc-4.4'/><category scheme='http://www.blogger.com/atom/ns#' term='glibc-2.10'/><title type='text'>Compiling glibc-2.10 with GCC-4.4 on gentoo hardened</title><content type='html'>It does not compile with the profile flag set, at least at the time of writing. In order to get it compiled unset the flag:&lt;br /&gt;&lt;code class=prettyprint&gt;&lt;br /&gt;# USE="-profile" emerge -av glibc&lt;br /&gt;&lt;br /&gt;These are the packages that would be merged, in order:&lt;br /&gt;&lt;br /&gt;Calculating dependencies ... done!&lt;br /&gt;[ebuild   R   ] sys-libs/glibc-2.10.1  USE="gd hardened nls -debug -glibc-omitfp (-multilib) -profile (-selinux) -vanilla" 16,492 kB&lt;br /&gt;&lt;/code&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3050029677375999718-6264585900790686029?l=hardenedgentoo.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://hardenedgentoo.blogspot.com/feeds/6264585900790686029/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://hardenedgentoo.blogspot.com/2009/10/compiling-glibc-210-with-gcc-44-on.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3050029677375999718/posts/default/6264585900790686029'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3050029677375999718/posts/default/6264585900790686029'/><link rel='alternate' type='text/html' href='http://hardenedgentoo.blogspot.com/2009/10/compiling-glibc-210-with-gcc-44-on.html' title='Compiling glibc-2.10 with GCC-4.4 on gentoo hardened'/><author><name>radegand</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3050029677375999718.post-723427808161860938</id><published>2009-09-22T18:34:00.003+01:00</published><updated>2009-09-22T18:40:24.986+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='grsecurity'/><category scheme='http://www.blogger.com/atom/ns#' term='kernel'/><category scheme='http://www.blogger.com/atom/ns#' term='2.6.31'/><title type='text'>2.6.31-grsec</title><content type='html'>Latest testing grsecurity patch is available &lt;a href="http://grsecurity.net/test/grsecurity-2.1.14-2.6.31-200909201605.patch"&gt;here&lt;/a&gt;. Although there &lt;a href="http://forums.grsecurity.net/viewtopic.php?f=3&amp;t=2193"&gt;were&lt;/a&gt; some issues with linking for users with older binutils (2.18), they should be now resolved. I've been using this kernel for quite a few days now without any issues at all...&lt;br /&gt;&lt;br /&gt;So just follow &lt;a href="http://hardenedgentoo.blogspot.com/2009/08/kernel-26304-with-grsecurity-patch.html"&gt;this&lt;/a&gt; with the latest patch...compile and enjoy! ;]&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3050029677375999718-723427808161860938?l=hardenedgentoo.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://hardenedgentoo.blogspot.com/feeds/723427808161860938/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://hardenedgentoo.blogspot.com/2009/09/2631-grsec.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3050029677375999718/posts/default/723427808161860938'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3050029677375999718/posts/default/723427808161860938'/><link rel='alternate' type='text/html' href='http://hardenedgentoo.blogspot.com/2009/09/2631-grsec.html' title='2.6.31-grsec'/><author><name>radegand</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3050029677375999718.post-7123170843766288963</id><published>2009-09-11T22:33:00.003+01:00</published><updated>2009-09-11T22:46:56.561+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='KDE'/><category scheme='http://www.blogger.com/atom/ns#' term='KDE 4.3'/><category scheme='http://www.blogger.com/atom/ns#' term='gentoo'/><title type='text'>KDE 4.3.1 on Gentoo...hardened!</title><content type='html'>Yes! It works fine with &lt;span style="font-weight:bold;"&gt;gcc-4.4.1&lt;/span&gt; and &lt;span style="font-weight:bold;"&gt;glibc-2.10.1&lt;/span&gt;...just follow the &lt;a href="http://www.gentoo.org/proj/en/desktop/kde/kde4-guide.xml"&gt;guide&lt;/a&gt;. It compiled without any issues apart from the nepomuk ebuild requiring non-grsec kernel to compile - and yes, it does crash when running with grsecurity but hey - nepomuk is not critical a part of the &lt;span style="font-weight:bold;"&gt;KDE&lt;/span&gt; environment, is it? ;)&lt;br /&gt;&lt;br /&gt;Of course, getting X to work with decent drivers is always a mission (at least with nvidia based cards), so I'm currently using the opensource '&lt;span style="font-weight:bold;"&gt;nv&lt;/span&gt;' drivers, as neither '&lt;span style="font-weight:bold;"&gt;nouveau&lt;/span&gt;' nor binary drivers work for me...KMS works fine - hopefully the &lt;span style="font-weight:bold;"&gt;2.6.31&lt;/span&gt; brings less patching...&lt;br /&gt;&lt;br /&gt;Nevertheless - if you're not after fancy 3D stuff (maybe owners of non-nvidia cards are more lucky?) - &lt;span style="font-weight:bold;"&gt;KDE 4.3&lt;/span&gt; is out there an it looks much better than previous 4.x release - less vista-ish too - that's for sure! ;]&lt;br /&gt;&lt;br /&gt;Emerge! ;)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3050029677375999718-7123170843766288963?l=hardenedgentoo.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://hardenedgentoo.blogspot.com/feeds/7123170843766288963/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://hardenedgentoo.blogspot.com/2009/09/kde-431-on-gentoohardened.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3050029677375999718/posts/default/7123170843766288963'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3050029677375999718/posts/default/7123170843766288963'/><link rel='alternate' type='text/html' href='http://hardenedgentoo.blogspot.com/2009/09/kde-431-on-gentoohardened.html' title='KDE 4.3.1 on Gentoo...hardened!'/><author><name>radegand</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3050029677375999718.post-6859923569516610718</id><published>2009-08-21T20:41:00.002+01:00</published><updated>2009-08-21T20:52:32.804+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='overlay'/><category scheme='http://www.blogger.com/atom/ns#' term='layman'/><category scheme='http://www.blogger.com/atom/ns#' term='hardened gentoo'/><title type='text'>Gentoo hardened overlay update - once again :)</title><content type='html'>The &lt;span style="font-style: italic;"&gt;&lt;a href="http://github.com/Xake/toolchain-overlay/tree/master"&gt;xake-toolchain&lt;/a&gt;&lt;/span&gt; overlay has been moved to overlays.gentoo.org and renamed to &lt;span style="font-style: italic;"&gt;hardened-overlay&lt;/span&gt; and is available now directly using layman! So if you were using layman to track xake-toolchain it's time to update...&lt;br /&gt;&lt;br /&gt;&lt;code class="prettyprint"&gt;&lt;br /&gt;# layman -d xake-toolchain&lt;br /&gt;* Successfully deleted overlay "xake-toolchain".&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;And add:&lt;br /&gt;&lt;code class="prettyprint"&gt;&lt;br /&gt;# layman -a hardened-development&lt;br /&gt;* Running command "/usr/bin/git clone "git://git.overlays.gentoo.org/proj/hardened-development.git" "/usr/local/portage/layman/hardened-development""...&lt;br /&gt;Initialized empty Git repository in /usr/local/portage/layman/hardened-development/.git/&lt;br /&gt;remote: Counting objects: 2180, done.&lt;br /&gt;remote: Compressing objects: 100% (1090/1090), done.&lt;br /&gt;remote: Total 2180 (delta 992), reused 2089 (delta 935)&lt;br /&gt;Receiving objects: 100% (2180/2180), 2.11 MiB | 618 KiB/s, done.&lt;br /&gt;Resolving deltas: 100% (992/992), done.&lt;br /&gt;* Successfully added overlay "hardened-development".&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;Test case: ;)&lt;br /&gt;&lt;code class="prettyprint"&gt;&lt;br /&gt;# layman -l&lt;br /&gt;* hardened-development      [Git       ] (git://git.overlays.gentoo.org/proj/hardened-development.git)&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;Happy compiling! ;]&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3050029677375999718-6859923569516610718?l=hardenedgentoo.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://hardenedgentoo.blogspot.com/feeds/6859923569516610718/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://hardenedgentoo.blogspot.com/2009/08/gentoo-hardened-overlay-update-once.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3050029677375999718/posts/default/6859923569516610718'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3050029677375999718/posts/default/6859923569516610718'/><link rel='alternate' type='text/html' href='http://hardenedgentoo.blogspot.com/2009/08/gentoo-hardened-overlay-update-once.html' title='Gentoo hardened overlay update - once again :)'/><author><name>radegand</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3050029677375999718.post-80903983215896371</id><published>2009-08-14T15:40:00.003+01:00</published><updated>2009-08-14T15:45:29.033+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='gcc-4.4.1'/><category scheme='http://www.blogger.com/atom/ns#' term='overlay'/><category scheme='http://www.blogger.com/atom/ns#' term='layman'/><category scheme='http://www.blogger.com/atom/ns#' term='hardened gentoo'/><category scheme='http://www.blogger.com/atom/ns#' term='gcc-4.3.4'/><title type='text'>Gentoo hardened overlay update</title><content type='html'>Gcc-4.4.1 and gcc-4.3.4 are now in master branch of the &lt;span style="font-style:italic;"&gt;xake-toolchain&lt;/span&gt; overlay. :) Therefore if you've been using the testing branch you can now switch to master:&lt;br /&gt;&lt;code class=prettyprint&gt;&lt;br /&gt;~ # cd "/usr/local/portage/layman/xake-toolchain"&lt;br /&gt;x86 xake-toolchain # git checkout master&lt;br /&gt;Switched to branch 'master'&lt;br /&gt;Your branch is behind 'origin/master' by 6 commits, and can be fast-forwarded.&lt;br /&gt;xake-toolchain # layman -S&lt;br /&gt;* Running command "cd "/usr/local/portage/layman/xake-toolchain" &amp;&amp; /usr/bin/git pull"...&lt;br /&gt;Updating 7ac8e25..659a4cc&lt;br /&gt;Fast forward&lt;br /&gt; README                                             |   11 +-&lt;br /&gt; eclass/flag-o-matic.eclass                         |  137 +++-&lt;br /&gt; eclass/hardened-funcs.eclass                       |  812 -----------------&lt;br /&gt; eclass/toolchain-funcs.eclass                      |  463 ----------&lt;br /&gt; eclass/toolchain.eclass                            |  911 ++++++++++++++++++--&lt;br /&gt; sys-boot/grub/Manifest                             |    2 +-&lt;br /&gt; sys-boot/grub/grub-0.97-r10.ebuild                 |   17 +-&lt;br /&gt; sys-devel/gcc/Manifest                             |   25 +-&lt;br /&gt; sys-devel/gcc/gcc-4.3.3-r1.ebuild                  |   85 --&lt;br /&gt; .../{gcc-4.3.3-r3.ebuild =&gt; gcc-4.3.4-r1.ebuild}   |   25 +-&lt;br /&gt; .../{gcc-4.3.3-r2.ebuild =&gt; gcc-4.4.1-r2.ebuild}   |   33 +-&lt;br /&gt; sys-libs/glibc/Manifest                            |    3 +-&lt;br /&gt; .../2.10/glibc-2.10-hardened-ssp-compat.patch      |  168 ++++&lt;br /&gt; sys-libs/glibc/glibc-2.10.1.ebuild                 |    3 +&lt;br /&gt; sys-libs/libstdc++-v3/ChangeLog                    |  235 -----&lt;br /&gt; sys-libs/libstdc++-v3/Manifest                     |    6 -&lt;br /&gt; .../libstdc++-v3/files/compile_with_no-SSP.patch   |   11 -&lt;br /&gt; sys-libs/libstdc++-v3/libstdc++-v3-3.3.6-r1.ebuild |  179 ----&lt;br /&gt; sys-libs/libstdc++-v3/metadata.xml                 |    5 -&lt;br /&gt; 19 files changed, 1205 insertions(+), 1926 deletions(-)&lt;br /&gt; delete mode 100644 eclass/hardened-funcs.eclass&lt;br /&gt; delete mode 100644 eclass/toolchain-funcs.eclass&lt;br /&gt; delete mode 100644 sys-devel/gcc/gcc-4.3.3-r1.ebuild&lt;br /&gt; rename sys-devel/gcc/{gcc-4.3.3-r3.ebuild =&gt; gcc-4.3.4-r1.ebuild} (75%)&lt;br /&gt; rename sys-devel/gcc/{gcc-4.3.3-r2.ebuild =&gt; gcc-4.4.1-r2.ebuild} (72%)&lt;br /&gt; create mode 100644 sys-libs/glibc/files/2.10/glibc-2.10-hardened-ssp-compat.patch&lt;br /&gt; delete mode 100644 sys-libs/libstdc++-v3/ChangeLog&lt;br /&gt; delete mode 100644 sys-libs/libstdc++-v3/Manifest&lt;br /&gt; delete mode 100644 sys-libs/libstdc++-v3/files/compile_with_no-SSP.patch&lt;br /&gt; delete mode 100644 sys-libs/libstdc++-v3/libstdc++-v3-3.3.6-r1.ebuild&lt;br /&gt; delete mode 100644 sys-libs/libstdc++-v3/metadata.xml&lt;br /&gt;*&lt;br /&gt;* Success:&lt;br /&gt;* ------&lt;br /&gt;*&lt;br /&gt;* Successfully synchronized overlay "xake-toolchain".&lt;br /&gt;xake-toolchain #&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Thanks guys! :)))&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3050029677375999718-80903983215896371?l=hardenedgentoo.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://hardenedgentoo.blogspot.com/feeds/80903983215896371/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://hardenedgentoo.blogspot.com/2009/08/gentoo-hardened-overlay-update.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3050029677375999718/posts/default/80903983215896371'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3050029677375999718/posts/default/80903983215896371'/><link rel='alternate' type='text/html' href='http://hardenedgentoo.blogspot.com/2009/08/gentoo-hardened-overlay-update.html' title='Gentoo hardened overlay update'/><author><name>radegand</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3050029677375999718.post-1864587764468734246</id><published>2009-08-11T13:05:00.002+01:00</published><updated>2009-08-11T13:10:38.485+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='gcc-4.4.1'/><category scheme='http://www.blogger.com/atom/ns#' term='overlay'/><category scheme='http://www.blogger.com/atom/ns#' term='hardened gentoo'/><category scheme='http://www.blogger.com/atom/ns#' term='gcc-4.3.4'/><category scheme='http://www.blogger.com/atom/ns#' term='gcc-4.4'/><title type='text'>gcc-4.4.1-r2 is out!</title><content type='html'>The hardened overlay has just been updated - with ebuilds for gcc-4.3.4 and gcc-4.4.1-r2. The new ebuild for 4.4.1 includes new espf-0.3.2 patches.&lt;br /&gt;&lt;code class="prettyprint"&gt;&lt;br /&gt;# gcc -v&lt;br /&gt;Using built-in specs.&lt;br /&gt;Target: i686-pc-linux-gnu&lt;br /&gt;Configured with: /var/tmp/portage/sys-devel/gcc-4.4.1-r2/work/gcc-4.4.1/configure --prefix=/usr --bindir=/usr/i686-pc-linux-gnu/gcc-bin/4.4.1 --includedir=/usr/lib/gcc/i686-pc-linux-gnu/4.4.1/include --datadir=/usr/share/gcc-data/i686-pc-linux-gnu/4.4.1 --mandir=/usr/share/gcc-data/i686-pc-linux-gnu/4.4.1/man --infodir=/usr/share/gcc-data/i686-pc-linux-gnu/4.4.1/info --with-gxx-include-dir=/usr/lib/gcc/i686-pc-linux-gnu/4.4.1/include/g++-v4 --host=i686-pc-linux-gnu --build=i686-pc-linux-gnu --disable-altivec --disable-fixed-point --with-ppl --with-cloog --enable-nls --without-included-gettext --with-system-zlib --disable-checking --disable-werror --enable-secureplt --disable-multilib --enable-libmudflap --disable-libssp --enable-espf --disable-libgomp --enable-cld --disable-libgcj --with-arch=i686 --enable-languages=c,c++ --enable-shared --enable-threads=posix --enable-__cxa_atexit --enable-clocale=gnu --with-bugurl=http://bugs.gentoo.org/ --with-pkgversion='Gentoo Hardened 4.4.1-r2 p1.0, espf-0.3.2'&lt;br /&gt;Thread model: posix&lt;br /&gt;gcc version 4.4.1 (&lt;span style="font-weight:bold;"&gt;Gentoo Hardened 4.4.1-r2 p1.0, espf-0.3.2&lt;/span&gt;)&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;Thanks to everyone involved in making this happen! :)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3050029677375999718-1864587764468734246?l=hardenedgentoo.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://hardenedgentoo.blogspot.com/feeds/1864587764468734246/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://hardenedgentoo.blogspot.com/2009/08/gcc-441-r2-is-out.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3050029677375999718/posts/default/1864587764468734246'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3050029677375999718/posts/default/1864587764468734246'/><link rel='alternate' type='text/html' href='http://hardenedgentoo.blogspot.com/2009/08/gcc-441-r2-is-out.html' title='gcc-4.4.1-r2 is out!'/><author><name>radegand</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3050029677375999718.post-7177216271857091019</id><published>2009-08-11T11:40:00.003+01:00</published><updated>2009-08-11T11:48:36.123+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='PAX'/><category scheme='http://www.blogger.com/atom/ns#' term='grsecurity'/><category scheme='http://www.blogger.com/atom/ns#' term='2.6.30.4'/><category scheme='http://www.blogger.com/atom/ns#' term='kernel'/><title type='text'>New grsecurity test patch for 2.6.30.4</title><content type='html'>Available &lt;a href="http://grsecurity.net/test.php"&gt;here&lt;/a&gt;. It fixes a signal handling error which seemed to prevent firefox from running on x86 machine. &lt;br /&gt;&lt;br /&gt;Get it now while it's fresh! ;]&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3050029677375999718-7177216271857091019?l=hardenedgentoo.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://hardenedgentoo.blogspot.com/feeds/7177216271857091019/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://hardenedgentoo.blogspot.com/2009/08/new-grsecurity-test-patch-for-26304.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3050029677375999718/posts/default/7177216271857091019'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3050029677375999718/posts/default/7177216271857091019'/><link rel='alternate' type='text/html' href='http://hardenedgentoo.blogspot.com/2009/08/new-grsecurity-test-patch-for-26304.html' title='New grsecurity test patch for 2.6.30.4'/><author><name>radegand</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3050029677375999718.post-8516124499063496068</id><published>2009-08-07T09:31:00.002+01:00</published><updated>2009-08-07T09:38:39.678+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='PAX'/><category scheme='http://www.blogger.com/atom/ns#' term='grsecurity'/><category scheme='http://www.blogger.com/atom/ns#' term='2.6.30.4'/><category scheme='http://www.blogger.com/atom/ns#' term='64-bit'/><category scheme='http://www.blogger.com/atom/ns#' term='kernel'/><title type='text'>64-bit 2.6.30.4-grsec</title><content type='html'>It seems that bug that stopped latest grsecurity patch to work on 64-bit kernels has been resolved. The latest &lt;a href="http://www.grsecurity.net/test/grsecurity-2.1.14-2.6.30.4-200908051916.patch"&gt;grsecurity-2.1.14-2.6.30.4-200908051916.patch&lt;/a&gt; is working fine for over a day of a standard desktop use - stable enough for me! ;)&lt;br /&gt;&lt;code class=prettyprint&gt;&lt;br /&gt;# paxtest blackhat&lt;br /&gt;PaXtest - Copyright(c) 2003,2004 by Peter Busser &lt;peter@adamantix.org&gt;&lt;br /&gt;Released under the GNU Public Licence version 2 or later              &lt;br /&gt;&lt;br /&gt;Mode: blackhat&lt;br /&gt;Linux 2.6.30.4-grsec #4 SMP Thu Aug 6 09:57:40 BST 2009 x86_64 Intel(R) Core(TM)2 Quad CPU Q6600 @ 2.40GHz GenuineIntel GNU/Linux&lt;br /&gt;&lt;br /&gt;Executable anonymous mapping             : Killed&lt;br /&gt;Executable bss                           : Killed&lt;br /&gt;Executable data                          : Killed&lt;br /&gt;Executable heap                          : Killed&lt;br /&gt;Executable stack                         : Killed&lt;br /&gt;Executable anonymous mapping (mprotect)  : Killed&lt;br /&gt;Executable bss (mprotect)                : Killed&lt;br /&gt;Executable data (mprotect)               : Killed&lt;br /&gt;Executable heap (mprotect)               : Killed&lt;br /&gt;Executable stack (mprotect)              : Killed&lt;br /&gt;Executable shared library bss (mprotect) : Killed&lt;br /&gt;Executable shared library data (mprotect): Killed&lt;br /&gt;Writable text segments                   : Killed&lt;br /&gt;Anonymous mapping randomisation test     : 33 bits (guessed)&lt;br /&gt;Heap randomisation test (ET_EXEC)        : 40 bits (guessed)&lt;br /&gt;Heap randomisation test (ET_DYN)         : 40 bits (guessed)&lt;br /&gt;Main executable randomisation (ET_EXEC)  : 32 bits (guessed)&lt;br /&gt;Main executable randomisation (ET_DYN)   : 32 bits (guessed)&lt;br /&gt;Shared library randomisation test        : 33 bits (guessed)&lt;br /&gt;Stack randomisation test (SEGMEXEC)      : No randomisation&lt;br /&gt;Stack randomisation test (PAGEEXEC)      : 40 bits (guessed)&lt;br /&gt;Return to function (strcpy)              : *** buffer overflow detected ***: rettofunc1 - terminated&lt;br /&gt;rettofunc1: buffer overflow attack in function &lt;unknown&gt; - terminated&lt;br /&gt;Report to http://bugs.gentoo.org/&lt;br /&gt;Killed&lt;br /&gt;Return to function (memcpy)              : *** buffer overflow detected ***: rettofunc2 - terminated&lt;br /&gt;rettofunc2: buffer overflow attack in function &lt;unknown&gt; - terminated&lt;br /&gt;Report to http://bugs.gentoo.org/&lt;br /&gt;Killed&lt;br /&gt;Return to function (strcpy, RANDEXEC)    : *** buffer overflow detected ***: rettofunc1x - terminated&lt;br /&gt;rettofunc1x: buffer overflow attack in function &lt;unknown&gt; - terminated&lt;br /&gt;Report to http://bugs.gentoo.org/&lt;br /&gt;Killed&lt;br /&gt;Return to function (memcpy, RANDEXEC)    : *** buffer overflow detected ***: rettofunc2x - terminated&lt;br /&gt;rettofunc2x: buffer overflow attack in function &lt;unknown&gt; - terminated&lt;br /&gt;Report to http://bugs.gentoo.org/&lt;br /&gt;Killed&lt;br /&gt;Executable shared library bss            : Killed&lt;br /&gt;Executable shared library data           : Killed&lt;br /&gt;&lt;/code&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3050029677375999718-8516124499063496068?l=hardenedgentoo.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://hardenedgentoo.blogspot.com/feeds/8516124499063496068/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://hardenedgentoo.blogspot.com/2009/08/64-bit-26304-grsec.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3050029677375999718/posts/default/8516124499063496068'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3050029677375999718/posts/default/8516124499063496068'/><link rel='alternate' type='text/html' href='http://hardenedgentoo.blogspot.com/2009/08/64-bit-26304-grsec.html' title='64-bit 2.6.30.4-grsec'/><author><name>radegand</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3050029677375999718.post-3148058506426272428</id><published>2009-08-05T16:34:00.007+01:00</published><updated>2009-08-11T13:13:54.936+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='PAX'/><category scheme='http://www.blogger.com/atom/ns#' term='gentoo'/><category scheme='http://www.blogger.com/atom/ns#' term='howto'/><category scheme='http://www.blogger.com/atom/ns#' term='grsecurity'/><category scheme='http://www.blogger.com/atom/ns#' term='2.6.30.4'/><category scheme='http://www.blogger.com/atom/ns#' term='kernel'/><title type='text'>Kernel 2.6.30.4 with Grsecurity patch</title><content type='html'>The latest stable patch for the 2.6 branch on the &lt;a href="grsecurity.net"&gt;grsecurity.net&lt;/a&gt; website is for 2.6.27 kernel and the latest available gentoo hardened-sources ebuild that includes grsecurity is for 2.6.29 but the latest kernel is 2.6.30.4 so... ;)&lt;br /&gt;&lt;br /&gt;NOTE: This info applies to a testing version of the grsecurity patch and is very likely to harm your system and eat your hamster (possibly). I wouldn't use it on a production system at all...Also it does not seem to work properly on amd64 architecture at &lt;a href="http://forums.grsecurity.net/viewtopic.php?f=3&amp;t=2170"&gt;the&lt;/a&gt; &lt;a href="http://forums.grsecurity.net/viewtopic.php?f=3&amp;t=2168"&gt;moment&lt;/a&gt;. It didn't work for me on x86_64 but it seems fine on x86. Ya've been warned!&lt;br /&gt;&lt;br /&gt;NOTE2: I mainly followed this &lt;a href="http://en.wikibooks.org/wiki/Grsecurity#Installation"&gt;information&lt;/a&gt; which includes much more details about the installation process and Grsecurity and PAX itself. Definitely a recommended reading!&lt;br /&gt;&lt;br /&gt;Ok, here we go...first, the kernel sources:&lt;br /&gt;&lt;code class="prettyprint"&gt;&lt;br /&gt;# cd /usr/src&lt;br /&gt;# wget http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.30.4.tar.bz2&lt;br /&gt;# http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.30.4.tar.bz2.sign&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;As recommended on the aforementioned guide, it's always good idea to verify your sources. It doesn't really matter that much if you have downloaded the archive from the main kernel website (unless you don't trust your ISP ;)). Of course someone could plant a backdoor in the source tree before it got packaged, but...anyway! Latest information about kernel signature (and key) can be found &lt;a href="http://www.kernel.org/signature.html"&gt;here&lt;/a&gt;. Verification time! But first the actual key is needed:&lt;br /&gt;&lt;code class="prettyprint"&gt;&lt;br /&gt;# gpg --keyserver wwwkeys.pgp.net --recv-keys 0x517D0F0E&lt;br /&gt;gpg: requesting key 517D0F0E from hkp server wwwkeys.pgp.net&lt;br /&gt;gpg: key 517D0F0E: public key "Linux Kernel Archives Verification Key &lt;ftpadmin@kernel.org&gt;" imported&lt;br /&gt;gpg: no ultimately trusted keys found&lt;br /&gt;gpg: Total number processed: 1&lt;br /&gt;gpg:               imported: 1&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;...and verification follows...:&lt;br /&gt;&lt;code class="prettyprint"&gt;&lt;br /&gt;# gpg --verify linux-2.6.30.4.tar.bz2.sign&lt;br /&gt;gpg: Signature made Fri Jul 31 00:13:44 2009 BST using DSA key ID 517D0F0E&lt;br /&gt;gpg: Good signature from "Linux Kernel Archives Verification Key &lt;ftpadmin@kernel.org&gt;"&lt;br /&gt;gpg: WARNING: This key is not certified with a trusted signature!&lt;br /&gt;gpg:          There is no indication that the signature belongs to the owner.&lt;br /&gt;Primary key fingerprint: C75D C40A 11D7 AF88 9981  ED5B C86B A06A 517D 0F0E&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;Looks good...unpack the sources:&lt;br /&gt;&lt;code class="prettyprint"&gt;&lt;br /&gt;# tar jxf linux-2.6.30.4.tar.bz2&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;And time for patch - including key to verify it of course! ;]&lt;br /&gt;&lt;code class="prettyprint"&gt;&lt;br /&gt;# wget http://grsecurity.net/spender-gpg-key.asc&lt;br /&gt;# wget http://grsecurity.net/test/grsecurity-2.1.14-2.6.30.4-200908041752.patch&lt;br /&gt;# wget http://grsecurity.net/test/grsecurity-2.1.14-2.6.30.4-200908041752.patch.sig&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;Again - import the key and verify the patch:&lt;br /&gt;&lt;code class="prettyprint"&gt;&lt;br /&gt;# gpg --import spender-gpg-key.asc&lt;br /&gt;gpg: key 4245D46A: public key "Bradley Spengler (spender) &lt;spender@grsecurity.net&gt;" imported&lt;br /&gt;gpg: Total number processed: 1&lt;br /&gt;gpg:               imported: 1&lt;br /&gt;&lt;br /&gt;# gpg --verify grsecurity-2.1.14-2.6.30.4-200908041752.patch.sig&lt;br /&gt;gpg: Signature made Tue Aug  4 22:56:17 2009 BST using DSA key ID 4245D46A&lt;br /&gt;gpg: Good signature from "Bradley Spengler (spender) &lt;spender@grsecurity.net&gt;"&lt;br /&gt;gpg: WARNING: This key is not certified with a trusted signature!&lt;br /&gt;gpg:          There is no indication that the signature belongs to the owner.&lt;br /&gt;Primary key fingerprint: 9F74 393D 7E7F FF3C 6500  E778 9879 B649 4245 D46A&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;If you already have symlink to linux you need to update it to point to new kernel tree. Or create new one if it doesn't exist:&lt;br /&gt;&lt;code class="prettyprint"&gt;&lt;br /&gt;# ln -s linux-2.6.30.4 linux&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;Patch the sources and get ready for kernel configuration! ;)&lt;br /&gt;&lt;code class="prettyprint"&gt;&lt;br /&gt;# patch -p0 &lt; ./grsecurity-2.1.14-2.6.30.4-200908041752.patch&lt;br /&gt;# cd linux&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;You can use your current kernel configuration by copying relevant file that is corresponding with your kernel version from &lt;span style="font-style:italic;"&gt;/boot/config-X.X.X&lt;/span&gt; to &lt;br /&gt;&lt;span style="font-style:italic;"&gt;/usr/src/linux/.config&lt;/span&gt;. Alternatively:&lt;br /&gt;&lt;code class="prettyprint"&gt;&lt;br /&gt;# zcat /proc/config.gz &gt; /usr/src/linux/.config&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;Now the beast itself. Run your favourite kernel configuration variant (make oldconfig ;)) and enable grsecurity along with PAX. Use one of the predefined security levels or just choose custom and read &lt;a href="http://en.wikibooks.org/wiki/Grsecurity/Configuring_and_Installing_grsecurity#Configuring_the_Kernel"&gt;this&lt;/a&gt;.&lt;br /&gt;&lt;code class="prettyprint"&gt;&lt;br /&gt;# make menuconfig&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;I use genkernel wrapper - it creates initramfs automatically that will work with my LUKS encrypted partition:&lt;br /&gt;&lt;code class="prettyprint"&gt;&lt;br /&gt;# genkernel --luks all&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;Update bootloader to use the new kernel and rewrite MBR -reboot, choose your new kernel and pray! If it have worked:&lt;br /&gt;&lt;code class="prettyprint"&gt;&lt;br /&gt;# uname -srv&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Linux 2.6.30.4-grsec&lt;/span&gt; #1 SMP Wed Aug 5 15:29:37 BST 2009&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;And just to be on a safe side:&lt;br /&gt;&lt;code class="prettyprint"&gt;&lt;br /&gt;# paxtest blackhat                               &lt;br /&gt;PaXtest - Copyright(c) 2003,2004 by Peter Busser &lt;peter@adamantix.org&gt;&lt;br /&gt;Released under the GNU Public Licence version 2 or later              &lt;br /&gt;&lt;br /&gt;Writing output to paxtest.log&lt;br /&gt;It may take a while for the tests to complete&lt;br /&gt;Test results:                                &lt;br /&gt;PaXtest - Copyright(c) 2003,2004 by Peter Busser &lt;peter@adamantix.org&gt;&lt;br /&gt;Released under the GNU Public Licence version 2 or later              &lt;br /&gt;&lt;br /&gt;Mode: blackhat&lt;br /&gt;Linux 2.6.30.4-grsec #1 SMP Wed Aug 5 15:29:37 BST 2009 i686 GNU/Linux&lt;br /&gt;&lt;br /&gt;Executable anonymous mapping             : Killed&lt;br /&gt;Executable bss                           : Killed&lt;br /&gt;Executable data                          : Killed&lt;br /&gt;Executable heap                          : Killed&lt;br /&gt;Executable stack                         : Killed&lt;br /&gt;Executable anonymous mapping (mprotect)  : Killed&lt;br /&gt;Executable bss (mprotect)                : Killed&lt;br /&gt;Executable data (mprotect)               : Killed&lt;br /&gt;Executable heap (mprotect)               : Killed&lt;br /&gt;Executable stack (mprotect)              : Killed&lt;br /&gt;Executable shared library bss (mprotect) : Killed&lt;br /&gt;Executable shared library data (mprotect): Killed&lt;br /&gt;Writable text segments                   : Killed&lt;br /&gt;Anonymous mapping randomisation test     : 17 bits (guessed)&lt;br /&gt;Heap randomisation test (ET_EXEC)        : 23 bits (guessed)&lt;br /&gt;Heap randomisation test (ET_DYN)         : 23 bits (guessed)&lt;br /&gt;Main executable randomisation (ET_EXEC)  : 15 bits (guessed)&lt;br /&gt;Main executable randomisation (ET_DYN)   : 15 bits (guessed)&lt;br /&gt;Shared library randomisation test        : 17 bits (guessed)&lt;br /&gt;Stack randomisation test (SEGMEXEC)      : 23 bits (guessed)&lt;br /&gt;Stack randomisation test (PAGEEXEC)      : 24 bits (guessed)&lt;br /&gt;Return to function (strcpy)              : *** buffer overflow detected ***: rettofunc1 - terminated&lt;br /&gt;rettofunc1: buffer overflow attack in function &lt;unknown&gt; - terminated&lt;br /&gt;Report to http://bugs.gentoo.org/&lt;br /&gt;Killed&lt;br /&gt;Return to function (memcpy)              : *** buffer overflow detected ***: rettofunc2 - terminated&lt;br /&gt;rettofunc2: buffer overflow attack in function &lt;unknown&gt; - terminated&lt;br /&gt;Report to http://bugs.gentoo.org/&lt;br /&gt;Killed&lt;br /&gt;Return to function (strcpy, RANDEXEC)    : *** buffer overflow detected ***: rettofunc1x - terminated&lt;br /&gt;rettofunc1x: buffer overflow attack in function &lt;unknown&gt; - terminated&lt;br /&gt;Report to http://bugs.gentoo.org/&lt;br /&gt;Killed&lt;br /&gt;Return to function (memcpy, RANDEXEC)    : *** buffer overflow detected ***: rettofunc2x - terminated&lt;br /&gt;rettofunc2x: buffer overflow attack in function &lt;unknown&gt; - terminated&lt;br /&gt;Report to http://bugs.gentoo.org/&lt;br /&gt;Killed&lt;br /&gt;Executable shared library bss            : Killed&lt;br /&gt;Executable shared library data           : Killed&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Yuppie! ;]&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3050029677375999718-3148058506426272428?l=hardenedgentoo.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://hardenedgentoo.blogspot.com/feeds/3148058506426272428/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://hardenedgentoo.blogspot.com/2009/08/kernel-26304-with-grsecurity-patch.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3050029677375999718/posts/default/3148058506426272428'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3050029677375999718/posts/default/3148058506426272428'/><link rel='alternate' type='text/html' href='http://hardenedgentoo.blogspot.com/2009/08/kernel-26304-with-grsecurity-patch.html' title='Kernel 2.6.30.4 with Grsecurity patch'/><author><name>radegand</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3050029677375999718.post-5933237818593483595</id><published>2009-08-04T17:18:00.007+01:00</published><updated>2009-08-04T18:13:44.025+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='overlay'/><category scheme='http://www.blogger.com/atom/ns#' term='layman'/><category scheme='http://www.blogger.com/atom/ns#' term='howto'/><title type='text'>Using layman to track the hardened overlay</title><content type='html'>Ok, so manually updating an overlay is boring and cumbersome ;) Well, I mean, instead of doing:&lt;br /&gt;&lt;code class="prettyprint"&gt;&lt;br /&gt;cd /usr/local/toolchain-overlay &amp;&amp; git update&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;You could simply run:&lt;br /&gt;&lt;code class="prettyprint"&gt;&lt;br /&gt;layman -S&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;Efficiency! &lt;br /&gt;&lt;br /&gt;So if you haven't used layman before here's quick step-by-step. First - quite obviously - we need to emerge layman itself:&lt;br /&gt;&lt;code class="prettyprint"&gt;&lt;br /&gt;# emerge -av layman&lt;br /&gt;&lt;br /&gt;These are the packages that would be merged, in order:&lt;br /&gt;&lt;br /&gt;Calculating dependencies... done!&lt;br /&gt;[ebuild  N    ] dev-python/pyxml-0.8.4-r2  USE="-doc -examples" 718 kB&lt;br /&gt;[ebuild  N    ] app-portage/layman-1.2.3  USE="-git -subversion -test" 46 kB&lt;br /&gt;&lt;br /&gt;Total: 2 packages (2 new), Size of downloads: 764 kB&lt;br /&gt;&lt;br /&gt;Would you like to merge these packages? [Yes/No]&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;...after few minutes portage kindly informs us what to do next:&lt;br /&gt;&lt;code class="prettyprint"&gt;&lt;br /&gt; * Select an overlay and add it using&lt;br /&gt; * layman -a overlay-name&lt;br /&gt; * If this is the very first overlay you add with layman,&lt;br /&gt; * you need to append the following statement to your&lt;br /&gt; * /etc/make.conf file:&lt;br /&gt; *&lt;br /&gt; * source /usr/local/portage/layman/make.conf&lt;br /&gt; *&lt;br /&gt; * If you modify the 'storage' parameter in the layman&lt;br /&gt; * configuration file (/etc/layman/layman.cfg) you will&lt;br /&gt; * need to adapt the path given above to the new storage&lt;br /&gt; * directory.&lt;br /&gt; * Please add the 'source' statement to make.conf only AFTER&lt;br /&gt; * you added your first overlay. Otherwise portage will fail.&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;Nice and easy. Here we go:&lt;br /&gt;&lt;code class="prettyprint"&gt;&lt;br /&gt;# layman -o http://github.com/Xake/toolchain-overlay.git/xake-toolchain.xml -fa xake-toolchain&lt;br /&gt;* Running command "/usr/bin/git clone "git://github.com/Xake/toolchain-overlay.git" "/usr/local/portage/layman/xake-toolchain""...&lt;br /&gt;Initialized empty Git repository in /usr/local/portage/layman/xake-toolchain/.git/&lt;br /&gt;remote: Counting objects: 2083, done.&lt;br /&gt;remote: Compressing objects: 100% (1306/1306), done.&lt;br /&gt;remote: Total 2083 (delta 953), reused 1492 (delta 633)&lt;br /&gt;Receiving objects: 100% (2083/2083), 2.08 MiB | 284 KiB/s, done.&lt;br /&gt;Resolving deltas: 100% (953/953), done.&lt;br /&gt;* Successfully added overlay "xake-toolchain".&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;Confirm that it is there and that it's up to date:&lt;br /&gt;&lt;code class="prettyprint"&gt;&lt;br /&gt;# layman -l&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;* xake-toolchain            [Git       ] (git://github.com/Xake/toolchain-overlay.git &lt;/span&gt;&lt;br /&gt;# layman -S&lt;br /&gt;                                                                                                                                                            * Running command "cd "/usr/local/portage/layman/xake-toolchain" &amp;&amp; /usr/bin/git pull"...&lt;br /&gt;Already up-to-date.&lt;br /&gt;*&lt;br /&gt;* Success:&lt;br /&gt;* ------&lt;br /&gt;*&lt;br /&gt;* Successfully synchronized overlay "xake-toolchain".&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;Time to change the repository to use &lt;span style="font-style:italic;"&gt;testing&lt;/span&gt; branch which is required for gcc-4.4. If you want to stay with gcc-4.3 skip this step and proceed to editing &lt;span style="font-style:italic;"&gt;/etc/make.conf&lt;/span&gt;. For gcc-4.4 run this:&lt;br /&gt;&lt;code class="prettyprint"&gt;&lt;br /&gt;# cd /usr/local/portage/layman/xake-toolchain&lt;br /&gt;# git branch testing origin/testing&lt;br /&gt;Branch testing set up to track remote branch testing from origin.&lt;br /&gt;# git checkout testing &amp;&amp; git pull &amp;&amp; cd $OLDPWD&lt;br /&gt;Switched to branch 'testing'&lt;br /&gt;Already up-to-date.&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;Now portage has to know that it needs to look somewhere else for ebuilds. This requires change in &lt;span style="font-style:italic;"&gt;/etc/make.conf&lt;/span&gt;. We need to comment out previous location (&lt;span style="font-style:italic;"&gt;/usr/local/toolchain-overlay&lt;/span&gt;) and add the new one. Open &lt;span style="font-style:italic;"&gt;/etc/make.conf&lt;/span&gt; in your favourite editor:&lt;br /&gt;&lt;code class="prettyprint"&gt;&lt;br /&gt;#PORTDIR_OVERLAY="/usr/local/toolchain-overlay"&lt;br /&gt;source /usr/local/portage/layman/make.conf&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;That should be it. To confirm that portage works as it should try emerging &lt;span style="font-style:italic;"&gt;gcc&lt;/span&gt; and &lt;span style="font-style:italic;"&gt;glibc&lt;/span&gt;. For gcc-4.4 you should see:&lt;br /&gt;&lt;code class="prettyprint"&gt;&lt;br /&gt;# emerge -av glibc gcc&lt;br /&gt;&lt;br /&gt;These are the packages that would be merged, in order:&lt;br /&gt;&lt;br /&gt;Calculating dependencies... done!&lt;br /&gt;[ebuild   R   ] sys-devel/gcc-4.4.1-r1  USE="graphite gtk hardened mudflap nls nptl (-altivec) -bootstrap -build -doc (-fixed-point) -fortran -gcj -ip28 -ip32r10k -libffi (-multilib) -multislot (-n32) (-n64) -nocxx -objc -objc++ -objc-gc -openmp -test -vanilla" 0 kB [1]&lt;br /&gt;[ebuild   R   ] sys-libs/glibc-2.10.1  USE="gd hardened nls profile -debug -glibc-omitfp (-multilib) (-selinux) -vanilla" 0 kB [1]&lt;br /&gt;&lt;br /&gt;Total: 2 packages (2 reinstalls), Size of downloads: 0 kB&lt;br /&gt;Portage tree and overlays:&lt;br /&gt; [0] /usr/portage&lt;br /&gt;&lt;span style="font-weight:bold;"&gt; [1] /usr/local/portage/layman/xake-toolchain&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Would you like to merge these packages? [Yes/No] n&lt;br /&gt;&lt;br /&gt;Quitting.&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;All set! You can safely delete the &lt;span style="font-style:italic;"&gt;/usr/local/toolchain-overlay&lt;/span&gt; folder. Now whenever you want to update the overlay, simply run:&lt;br /&gt;&lt;code class="prettyprint"&gt;&lt;br /&gt;# layman -S&lt;br /&gt;&lt;/code&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3050029677375999718-5933237818593483595?l=hardenedgentoo.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://hardenedgentoo.blogspot.com/feeds/5933237818593483595/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://hardenedgentoo.blogspot.com/2009/08/using-layman-to-track-hardened-overlay.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3050029677375999718/posts/default/5933237818593483595'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3050029677375999718/posts/default/5933237818593483595'/><link rel='alternate' type='text/html' href='http://hardenedgentoo.blogspot.com/2009/08/using-layman-to-track-hardened-overlay.html' title='Using layman to track the hardened overlay'/><author><name>radegand</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3050029677375999718.post-5940227274218833110</id><published>2009-08-01T08:26:00.009+01:00</published><updated>2009-08-01T18:55:59.189+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='openmpi'/><category scheme='http://www.blogger.com/atom/ns#' term='mpi'/><category scheme='http://www.blogger.com/atom/ns#' term='cracking'/><category scheme='http://www.blogger.com/atom/ns#' term='howto'/><category scheme='http://www.blogger.com/atom/ns#' term='john the ripper'/><title type='text'>John the ripper on mpi steroids or how to crack YOUR passwords faster</title><content type='html'>Ok, so everybody knows john. John is the ripper. He rips passwords. But he's not always fast enough. However, thanks to &lt;a href="http://www.bindshell.net/tools/johntheripper"&gt;this&lt;/a&gt; patch he can now take an advantage of your multicore system! Here's the quick &amp; dirty howto.&lt;br /&gt;&lt;br /&gt;All required goodies are there in Gentoo portage tree so in a true Gentooer fashion:&lt;br /&gt;&lt;code class="prettyprint"&gt;&lt;br /&gt;# emerge -av openmpi johntheripper&lt;br /&gt;&lt;br /&gt;These are the packages that would be merged, in order:&lt;br /&gt;&lt;br /&gt;Calculating dependencies... done!&lt;br /&gt;[ebuild  N    ] sys-cluster/openmpi-1.3.2  USE="cxx ipv6 threads -debug -fortran -heterogeneous -mpi-threads -pbs -romio" 0 kB&lt;br /&gt;[ebuild  N    ] app-crypt/johntheripper-1.7.3.1  USE="mmx &lt;span style="font-weight:bold;"&gt;mpi&lt;/span&gt; sse2 (-altivec) -custom-cflags -minimal" 0 kB&lt;br /&gt;&lt;br /&gt;Total: 2 packages (2 new), Size of downloads: 0 kB&lt;br /&gt;&lt;br /&gt;Would you like to merge these packages? [Yes/No]&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;Make sure that the &lt;span style="font-weight:bold;"&gt;mpi&lt;/span&gt; flag is enabled. After it's done, quick test to confirm it's working:&lt;br /&gt;&lt;code  class="prettyprint"&gt;&lt;br /&gt;# mpirun -np 2 uname -rsv&lt;br /&gt;Linux 2.6.29-hardened #13 SMP Fri Jul 24 15:26:08 BST 2009&lt;br /&gt;Linux 2.6.29-hardened #13 SMP Fri Jul 24 15:26:08 BST 2009&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;Where 2 is number of processors (or cores) available. Ok, ready to go - first benchmarking without multicore:&lt;br /&gt;&lt;code class="prettyprint"&gt;&lt;br /&gt;# john --test&lt;br /&gt;mca: base: component_find: unable to open /usr/lib/openmpi/mca_osc_pt2pt: file not found (ignored)&lt;br /&gt;mca: base: component_find: unable to open /usr/lib/openmpi/mca_osc_rdma: file not found (ignored)&lt;br /&gt;Benchmarking: Traditional DES [128/128 BS SSE2]... DONE&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Many salts:     1529K c/s real, 1698K c/s virtual&lt;br /&gt;Only one salt:  1253K c/s real, 1392K c/s virtual&lt;/span&gt;&lt;br /&gt;Benchmarking: BSDI DES (x725) [128/128 BS SSE2]... DONE&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Many salts:     49920 c/s real, 56089 c/s virtual&lt;br /&gt;Only one salt:  48512 c/s real, 53902 c/s virtual&lt;/span&gt;&lt;br /&gt;Benchmarking: FreeBSD MD5 [32/32]... DONE&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Raw:    4933 c/s real, 5542 c/s virtual&lt;br /&gt;&lt;/span&gt;Benchmarking: OpenBSD Blowfish (x32) [32/32]... DONE&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Raw:    305 c/s real, 342 c/s virtual&lt;/span&gt;&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;There is not much info about the error reported but it does not seem to be critical. Now run with through the mpi:&lt;br /&gt;&lt;code class="prettyprint"&gt;&lt;br /&gt;# mpirun -np 2 john --test                             &lt;br /&gt;mca: base: component_find: unable to open /usr/lib/openmpi/mca_osc_pt2pt: file not found (ignored)&lt;br /&gt;mca: base: component_find: unable to open /usr/lib/openmpi/mca_osc_rdma: file not found (ignored) &lt;br /&gt;mca: base: component_find: unable to open /usr/lib/openmpi/mca_osc_pt2pt: file not found (ignored)&lt;br /&gt;mca: base: component_find: unable to open /usr/lib/openmpi/mca_osc_rdma: file not found (ignored) &lt;br /&gt;Benchmarking: Traditional DES [128/128 BS SSE2]... DONE&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Many salts:     3178K c/s real, 6754K c/s virtual&lt;br /&gt;Only one salt:  2622K c/s real, 5651K c/s virtual&lt;/span&gt;&lt;br /&gt;Benchmarking: BSDI DES (x725) [128/128 BS SSE2]... DONE&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Many salts:     102846 c/s real, 222092 c/s virtual&lt;br /&gt;Only one salt:  99703 c/s real, 215022 c/s virtual&lt;/span&gt;&lt;br /&gt;Benchmarking: FreeBSD MD5 [32/32]... DONE&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Raw:    9869 c/s real, 21833 c/s virtual&lt;/span&gt;&lt;br /&gt;Benchmarking: OpenBSD Blowfish (x32) [32/32]... DONE&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Raw:    616 c/s real, 1353 c/s virtual&lt;/span&gt;&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;Whooaa! That's a bit faster...And &lt;a href="http://www.milw0rm.com/papers/337"&gt;here's&lt;/a&gt; a more comprehensive guide too. Off course using rainbow tables will be always faster, but: good (big) rainbow tables are needed and if the password is salted than you're out of luck. Anyway - happy cracking! ;]&lt;br /&gt;&lt;br /&gt;BTW: Oh and do use loong and complex passwords...also - if you compare full benchmark output, just look how fast is cracking md5 as compared to sha-1 or blowfish...and although john does not support cracking sha512 passwords as of yet, your system probably supports this algorithm for password hashing so...but that's a totally different story!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3050029677375999718-5940227274218833110?l=hardenedgentoo.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://hardenedgentoo.blogspot.com/feeds/5940227274218833110/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://hardenedgentoo.blogspot.com/2009/08/john-ripper-on-mpi-steroids-or-how-to.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3050029677375999718/posts/default/5940227274218833110'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3050029677375999718/posts/default/5940227274218833110'/><link rel='alternate' type='text/html' href='http://hardenedgentoo.blogspot.com/2009/08/john-ripper-on-mpi-steroids-or-how-to.html' title='John the ripper on mpi steroids or how to crack YOUR passwords faster'/><author><name>radegand</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3050029677375999718.post-2203951789720525248</id><published>2009-07-30T10:02:00.008+01:00</published><updated>2009-07-30T17:06:40.592+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='gcc-4.4.1'/><category scheme='http://www.blogger.com/atom/ns#' term='gentoo'/><category scheme='http://www.blogger.com/atom/ns#' term='graphite'/><category scheme='http://www.blogger.com/atom/ns#' term='gcc-4.4'/><title type='text'>gcc-4.4.1 with graphite framework</title><content type='html'>Ok, so the recent release of the beloved (?) gcc compiler provides not only usual bug fixes and enhancements but also some exciting features such as the &lt;a href="http://gcc.gnu.org/wiki/Graphite"&gt;graphite&lt;/a&gt; framework which aims to provide better optimization of a compiled code (loops to be precise) thus resulting in faster binaries. There's some interesting &lt;a href="http://en.wikipedia.org/wiki/Polyhedron"&gt;theory&lt;/a&gt; behind it too! And &lt;a href="http://forums.gentoo.org/viewtopic-t-713532-start-350-postdays-0-postorder-asc-highlight-.html"&gt;here&lt;/a&gt; is a forum discussion just in case something goes wrong ;)&lt;br /&gt;&lt;br /&gt;Is it faster? I dunno...feels like it ;) Is it bleeding edge? Oh yeah! ;] So make some backup, etc., ya've been warned!&lt;br /&gt;&lt;br /&gt;First, enable the &lt;span style="font-weight:bold;"&gt;graphite&lt;/span&gt; USE flag in &lt;span style="font-style:italic;"&gt;/etc/make.conf&lt;/span&gt;. Next, keyword two required libraries - for a x86_64 box this is needed:&lt;br /&gt;&lt;code class="prettyprint"&gt;&lt;br /&gt;echo 'dev-libs/ppl ~amd64' &gt;&gt; /etc/portage/package.keywords&lt;br /&gt;echo 'dev-libs/cloog-ppl ~amd64' &gt;&gt; /etc/portage/package.keywords&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;Ready to emerge!&lt;br /&gt;&lt;code class="prettyprint"&gt;&lt;br /&gt;# emerge -av gcc&lt;br /&gt;&lt;br /&gt;These are the packages that would be merged, in order:&lt;br /&gt;&lt;br /&gt;Calculating dependencies... done!&lt;br /&gt;[ebuild  N    ] dev-libs/ppl-0.10.2  USE="-doc (-pch) -prolog -test -watchdog" 9,590 kB [0]&lt;br /&gt;[ebuild  N    ] dev-libs/cloog-ppl-0.15.3  788 kB [0]&lt;br /&gt;[ebuild   R   ] sys-devel/gcc-4.4.1-r1  USE="graphite* gtk hardened mudflap nls nptl (-altivec) -bootstrap -build -doc (-fixed-point) -fortran -gcj -ip28 -ip32r10k -libffi (-multilib) -multislot (-n32) (-n64) -nocxx -objc -objc++ -objc-gc -openmp -test -vanilla" 0 kB [1]&lt;br /&gt;&lt;br /&gt;Total: 3 packages (2 new, 1 reinstall), Size of downloads: 10,378 kB&lt;br /&gt;Portage tree and overlays:&lt;br /&gt; [0] /usr/portage&lt;br /&gt; [1] /usr/local/toolchain-overlay&lt;br /&gt;&lt;br /&gt;Would you like to merge these packages? [Yes/No]&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;few minutes later... ;)&lt;br /&gt;&lt;code class="prettyprint"&gt;&lt;br /&gt;# gcc -v&lt;br /&gt;Using built-in specs.&lt;br /&gt;Target: x86_64-pc-linux-gnu&lt;br /&gt;Configured with: /var/tmp/portage/sys-devel/gcc-4.4.1-r1/work/gcc-4.4.1/configure --prefix=/usr --bindir=/usr/x86_64-pc-linux-gnu/gcc-bin/4.4.1 --includedir=/usr/lib/gcc/x86_64-pc-linux-gnu/4.4.1/include --datadir=/usr/share/gcc-data/x86_64-pc-linux-gnu/4.4.1 --mandir=/usr/share/gcc-data/x86_64-pc-linux-gnu/4.4.1/man --infodir=/usr/share/gcc-data/x86_64-pc-linux-gnu/4.4.1/info --with-gxx-include-dir=/usr/lib/gcc/x86_64-pc-linux-gnu/4.4.1/include/g++-v4 --host=x86_64-pc-linux-gnu --build=x86_64-pc-linux-gnu --disable-altivec --disable-fixed-point &lt;span style="font-weight:bold;"&gt;--with-ppl --with-cloog&lt;/span&gt; --enable-nls --without-included-gettext --with-system-zlib --disable-checking --disable-werror --enable-secureplt --disable-multilib --enable-libmudflap --disable-libssp --enable-espf --disable-libgomp --enable-cld --disable-libgcj --enable-languages=c,c++ --enable-shared --enable-threads=posix --enable-__cxa_atexit --enable-clocale=gnu --with-bugurl=http://bugs.gentoo.org/ --with-pkgversion='Gentoo Hardened 4.4.1-r1 p1.0, espf-0.3.1'&lt;br /&gt;Thread model: posix&lt;br /&gt;gcc version 4.4.1 (Gentoo Hardened 4.4.1-r1 p1.0, espf-0.3.1)&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Ok, now it's time to adjust &lt;span style="font-weight:bold;"&gt;CCFLAGS&lt;/span&gt;. They should look similar to this (the last three options are important here):&lt;br /&gt;&lt;code class="prettyprint"&gt;&lt;br /&gt;CFLAGS="-O2 -march=native -pipe -floop-interchange -floop-strip-mine -floop-block"&lt;br /&gt;CXXFLAGS="${CFLAGS}"&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Rite...all set! Now the classics:&lt;br /&gt;&lt;code class="prettyprint"&gt;&lt;br /&gt;emerge binutils gcc glibc linux-headers &amp;&amp; emerge -eav world&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;...is it faster then? ;]&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3050029677375999718-2203951789720525248?l=hardenedgentoo.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://hardenedgentoo.blogspot.com/feeds/2203951789720525248/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://hardenedgentoo.blogspot.com/2009/07/gcc-441-with-graphite-framework.html#comment-form' title='5 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3050029677375999718/posts/default/2203951789720525248'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3050029677375999718/posts/default/2203951789720525248'/><link rel='alternate' type='text/html' href='http://hardenedgentoo.blogspot.com/2009/07/gcc-441-with-graphite-framework.html' title='gcc-4.4.1 with graphite framework'/><author><name>radegand</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>5</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3050029677375999718.post-6117123532640195635</id><published>2009-07-29T11:15:00.006+01:00</published><updated>2009-07-30T16:38:35.458+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='gentoo'/><category scheme='http://www.blogger.com/atom/ns#' term='64-bit'/><category scheme='http://www.blogger.com/atom/ns#' term='32-bit'/><title type='text'>How to (too)quickly remove 32-bit packages from your 64-bit system</title><content type='html'>I have recently migrated my system from multilib to non-multilib. After rebuilding kernel, world and making sure that my &lt;span style="font-style:italic;"&gt;/lib&lt;/span&gt; folder pointed to &lt;span style="font-style:italic;"&gt;/lib64&lt;/span&gt;, there were still some files left under &lt;span style="font-style:italic;"&gt;/lib32&lt;/span&gt;. That was against the principles! ;) &lt;br /&gt;&lt;code class="prettyprint"&gt;&lt;br /&gt;# qfile /lib32&lt;br /&gt;app-emulation/emul-linux-x86-baselibs (/lib32)&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;Ok, so here' the guilty one...let's see why it got pulled in:&lt;br /&gt;&lt;code class="prettyprint"&gt;&lt;br /&gt;# equery depends app-emulation/emul-linux-x86-baselibs&lt;br /&gt;[ Searching for packages depending on app-emulation/emul-linux-x86-baselibs... ]&lt;br /&gt;app-emulation/emul-linux-x86-gtklibs-20071214 (&gt;=app-emulation/emul-linux-x86-baselibs-20071114)&lt;br /&gt;app-emulation/emul-linux-x86-medialibs-20071114 (&gt;=app-emulation/emul-linux-x86-baselibs-20071114)&lt;br /&gt;app-emulation/emul-linux-x86-sdl-20080316 (&gt;=app-emulation/emul-linux-x86-baselibs-20071114)&lt;br /&gt;app-emulation/emul-linux-x86-soundlibs-20080418 (&gt;=app-emulation/emul-linux-x86-baselibs-20071114)&lt;br /&gt;app-emulation/emul-linux-x86-xlibs-20080810 (&gt;=app-emulation/emul-linux-x86-baselibs-20071114)&lt;br /&gt;net-im/skype-2.0.0.72 (amd64? &gt;=app-emulation/emul-linux-x86-baselibs-2.1.1)&lt;br /&gt;www-plugins/adobe-flash-10.0.22.87 (amd64 &amp; multilib &amp; 32bit? app-emulation/emul-linux-x86-baselibs)&lt;br /&gt;x11-misc/googleearth-5.0.11733.9347 (amd64? app-emulation/emul-linux-x86-baselibs)&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;Oh well, say bye bye to skype, flash and googleearth...who'd need this anyway? ;)&lt;br /&gt;&lt;code class="prettyprint"&gt;&lt;br /&gt;# equery depends app-emulation/emul-linux-x86-baselibs | awk {'print $1'} | xargs emerge -Cpv&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;Final step: to ensure that system is not spoiled (ever! ;)) with 32-bit nonsense some masking is needed:&lt;br /&gt;&lt;code class="prettyprint"&gt;&lt;br /&gt;echo "app-emulation/emul-linux-x86-baselibs" &gt;&gt; /etc/portage/package.mask&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;Job done!&lt;br /&gt;&lt;br /&gt;Update: bear in mind that there some dependencies might still exist thus run this:&lt;br /&gt;&lt;code class="prettyprint"&gt;&lt;br /&gt;emerge -uavND world&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;If you see the '&lt;span style="font-style:italic;"&gt;emul-*&lt;/span&gt;' packages being pulled in - check your use flag and run multiple '&lt;span style="font-style:italic;"&gt;equery depends [package]&lt;/span&gt;' to identify the offenders and remove them!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3050029677375999718-6117123532640195635?l=hardenedgentoo.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://hardenedgentoo.blogspot.com/feeds/6117123532640195635/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://hardenedgentoo.blogspot.com/2009/07/how-to-tooquickly-remove-32-bit.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3050029677375999718/posts/default/6117123532640195635'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3050029677375999718/posts/default/6117123532640195635'/><link rel='alternate' type='text/html' href='http://hardenedgentoo.blogspot.com/2009/07/how-to-tooquickly-remove-32-bit.html' title='How to (too)quickly remove 32-bit packages from your 64-bit system'/><author><name>radegand</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3050029677375999718.post-6379149034318354280</id><published>2009-07-28T10:09:00.011+01:00</published><updated>2009-07-28T14:12:15.757+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='gcc-4.4.1'/><category scheme='http://www.blogger.com/atom/ns#' term='overlay'/><category scheme='http://www.blogger.com/atom/ns#' term='hardened gentoo'/><category scheme='http://www.blogger.com/atom/ns#' term='gcc-4.4'/><title type='text'>gcc-4.4.1 is out!</title><content type='html'>Hot&amp;&lt;a href="http://forums.gentoo.org/viewtopic-t-668885-postdays-0-postorder-asc-start-700.html"&gt;fresh&lt;/a&gt;! ;] Unfortunately I haven't saved the output while updating my systems but this is very straightforward. &lt;a href="http://www.gentoo.org/doc/en/gcc-upgrading.xml"&gt;This&lt;/a&gt; guide will also be helpful as well as this &lt;a href="http://forums.gentoo.org/viewtopic-p-3548628.html"&gt;post&lt;/a&gt; that might describe different approach to updating your whole system ;]. &lt;br /&gt;&lt;br /&gt;If you are already using the testing branch of the overlay your default compiler should be gcc-4.4.0. Simply update the git repository by running 'git pull' in your overlay folder (/usr/local/toolchain-overlay). If you're not using the overlay yet - read &lt;a href="http://hardenedgentoo.blogspot.com/2009/07/hardened-gentoo-running-glibc-210-and.html"&gt;here&lt;/a&gt; ;) Anyway...running 'emerge -av gcc' should show gcc-4.4.1-r1 being pulled in from overlay - go for it! ;]&lt;br /&gt;&lt;br /&gt;Once your gcc is updated, at the end of installation process, you will probably get something like this:&lt;br /&gt;&lt;br /&gt;&lt;code class="prettyprint"&gt;* gcc-config: Active gcc profile is invalid! &lt;br /&gt;&lt;/code&gt;&lt;br /&gt;You'll have to tell your system which compiler it needs to use:&lt;br /&gt;&lt;code class="prettyprint"&gt;&lt;br /&gt;# gcc-config -l&lt;br /&gt; [1] x86_64-pc-linux-gnu-4.3.3&lt;br /&gt; [2] x86_64-pc-linux-gnu-4.3.3-nofortify&lt;br /&gt; [3] x86_64-pc-linux-gnu-4.3.3-nopie&lt;br /&gt; [4] x86_64-pc-linux-gnu-4.3.3-nossp_all&lt;br /&gt; [5] x86_64-pc-linux-gnu-4.3.3-vanilla&lt;br /&gt; [6] x86_64-pc-linux-gnu-4.4.1 &lt;br /&gt; [7] x86_64-pc-linux-gnu-4.4.1-hardenednopie&lt;br /&gt; [8] x86_64-pc-linux-gnu-4.4.1-hardenednossp&lt;br /&gt; [9] x86_64-pc-linux-gnu-4.4.1-vanilla&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;Therefore:&lt;br /&gt;&lt;code class="prettyprint"&gt;&lt;br /&gt;# gcc-config 6&lt;br /&gt;# env-update &amp;&amp; source /etc/profile&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;So Ladies &amp; Gentlemen- here it is!&lt;br /&gt;&lt;code class="prettyprint"&gt;&lt;br /&gt;# gcc -v&lt;br /&gt;Using built-in specs.&lt;br /&gt;Target: x86_64-pc-linux-gnu&lt;br /&gt;Configured with: /var/tmp/portage/sys-devel/gcc-4.4.1-r1/work/gcc-4.4.1/configure --prefix=/usr --bindir=/usr/x86_64-pc-linux-gnu/gcc-bin/4.4.1 --includedir=/usr/lib/gcc/x86_64-pc-linux-gnu/4.4.1/include --datadir=/usr/share/gcc-data/x86_64-pc-linux-gnu/4.4.1 --mandir=/usr/share/gcc-data/x86_64-pc-linux-gnu/4.4.1/man --infodir=/usr/share/gcc-data/x86_64-pc-linux-gnu/4.4.1/info --with-gxx-include-dir=/usr/lib/gcc/x86_64-pc-linux-gnu/4.4.1/include/g++-v4 --host=x86_64-pc-linux-gnu --build=x86_64-pc-linux-gnu --disable-altivec --disable-fixed-point --without-ppl --without-cloog --enable-nls --without-included-gettext --with-system-zlib --disable-checking --disable-werror --enable-secureplt --disable-multilib --enable-libmudflap --disable-libssp --enable-espf --disable-libgomp --enable-cld --disable-libgcj --enable-languages=c,c++ --enable-shared --enable-threads=posix --enable-__cxa_atexit --enable-clocale=gnu --with-bugurl=http://bugs.gentoo.org/ --with-pkgversion='Gentoo Hardened 4.4.1-r1 p1.0, espf-0.3.1'&lt;br /&gt;Thread model: posix&lt;br /&gt;gcc version 4.4.1 (Gentoo Hardened 4.4.1-r1 p1.0, espf-0.3.1)&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;You can run 'fix_libtool_files.sh' just in case: ;)&lt;br /&gt;&lt;code class="prettyprint"&gt;&lt;br /&gt;# fix_libtool_files.sh 4.4.0&lt;br /&gt;* Scanning libtool files for hardcoded gcc library paths...&lt;br /&gt; *   [1/7] Scanning /lib ...&lt;br /&gt; *   [2/7] Scanning /usr/lib ...&lt;br /&gt; *   [3/7] Scanning /lib64 ...&lt;br /&gt; *   [4/7] Scanning /usr/lib64 ...&lt;br /&gt; *   [5/7] Scanning /usr/local/lib ...&lt;br /&gt; *   [6/7] Scanning /usr/local/lib64 ...&lt;br /&gt; *   [7/7] Scanning /usr/x86_64-pc-linux-gnu/lib ...&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;And then - recompile rest of your toolchain - apparently it should be enough to simply compile binutils with glibc and then re-emerge the world:&lt;br /&gt;&lt;code class="prettyprint"&gt;&lt;br /&gt;# emerge -av binutils glibc &amp;&amp; emerge -eav world&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;...but I like to keep my cpu busy:&lt;br /&gt;&lt;code class="prettyprint"&gt;&lt;br /&gt;# emerge -av binutils gcc glibc&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;...and it's an easy one from there:&lt;br /&gt;&lt;code class="prettyprint"&gt;&lt;br /&gt;# emerge -eav system &amp;&amp; emerge -eav world&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;Regardless of approach chosen - it's a tea time...! ;) Enjoy!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3050029677375999718-6379149034318354280?l=hardenedgentoo.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://hardenedgentoo.blogspot.com/feeds/6379149034318354280/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://hardenedgentoo.blogspot.com/2009/07/gcc-441-is-out.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3050029677375999718/posts/default/6379149034318354280'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3050029677375999718/posts/default/6379149034318354280'/><link rel='alternate' type='text/html' href='http://hardenedgentoo.blogspot.com/2009/07/gcc-441-is-out.html' title='gcc-4.4.1 is out!'/><author><name>radegand</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3050029677375999718.post-2257134190307138063</id><published>2009-07-27T12:24:00.010+01:00</published><updated>2009-10-05T20:05:21.209+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='PAX'/><category scheme='http://www.blogger.com/atom/ns#' term='howto'/><category scheme='http://www.blogger.com/atom/ns#' term='hardened gentoo'/><category scheme='http://www.blogger.com/atom/ns#' term='64-bit'/><category scheme='http://www.blogger.com/atom/ns#' term='gcc-4.4'/><category scheme='http://www.blogger.com/atom/ns#' term='kvm'/><category scheme='http://www.blogger.com/atom/ns#' term='glibc-2.10'/><title type='text'>64-bit hardened Gentoo with gcc-4.4 and glibc-2.10</title><content type='html'>UPDATED 5.10 - Update installation HowTo (+LUKS) is available &lt;a href="http://hardenedgentoo.blogspot.com/2009/10/64-bit-hardened-gentoo-with-luks-on.html"&gt;here&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;UPDATED 17.08 - It is no longer needed to use the testing branch from overlay, so skip this part. Also the repo name in repos.conf should then read 'secure' rather than 'secure-testing'.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://hardenedgentoo.blogspot.com/2009/07/hardened-gentoo-running-glibc-210-and.html"&gt;One&lt;/a&gt; of my previous posts shown how to create a x86 hardened Gentoo system. Of course there's also a 64-bit version available! There're only few small differences during the installation process needed - so here's what you need to do to get a new shiny 64-bit hardened gentoo. Follow &lt;a href="http://hardenedgentoo.blogspot.com/2009/07/hardened-gentoo-running-glibc-210-and.html"&gt;this&lt;/a&gt; with the following remarks:&lt;br /&gt;- acquire a 64-bit machine - a 64-bit VM will do!;]&lt;br /&gt;- download a weekly 64-bit gentoo minimal installation CD from &lt;a href="http://mirrors.kernel.org/gentoo/releases/amd64/current/"&gt;here&lt;/a&gt;.&lt;br /&gt;- use &lt;a href="http://weaver.gentooenterprise.com/hardened/gcc-4.3/stage3-amd64-hardened-4.3-20090401.tar.bz2"&gt;this&lt;/a&gt; 64-bit stage&lt;br /&gt;- &lt;span style="font-weight:bold;"&gt;before&lt;/span&gt; emerging gcc, glibc and binutils change profile:&lt;br /&gt;&lt;br /&gt;&lt;code class="prettyprint"&gt;(chroot) livecd / # eselect profile list&lt;br /&gt;Available profile symlink targets:&lt;br /&gt;  [1]   default/linux/amd64/2008.0&lt;br /&gt;  [2]   default/linux/amd64/2008.0/desktop&lt;br /&gt;  [3]   default/linux/amd64/2008.0/developer&lt;br /&gt;  [4]   default/linux/amd64/2008.0/no-multilib&lt;br /&gt;  [5]   default/linux/amd64/2008.0/server&lt;br /&gt;  [6]   hardened/amd64&lt;br /&gt;  [7]   hardened/amd64/multilib&lt;br /&gt;  [8]   selinux/2007.0/amd64&lt;br /&gt;  [9]   selinux/2007.0/amd64/hardened&lt;br /&gt;  [10]  hardened/linux/amd64&lt;br /&gt;(chroot) livecd / # eselect profile show&lt;br /&gt;Current make.profile symlink:&lt;br /&gt;  /usr/portage/profiles/hardened/linux/amd64/2008.0&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;Now run:&lt;br /&gt;&lt;code class="prettyprint"&gt;eselect profile set 6&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Note: even if you want multilib, it seems that profile no. 7 is recommended over 10 as per &lt;a href="http://www.mail-archive.com/gentoo-hardened@lists.gentoo.org/msg02383.html"&gt;this&lt;/a&gt; information.&lt;br /&gt;&lt;br /&gt;Continue with the installation guide. During the kernel configuration step, choose your 64-bit cpu in "Processor type and feature" menu. For non-multilib profile (oh yeah! ;)) in "Executable file formats/Emulations" disable the "IA32 Emulation". Continue...&lt;br /&gt;&lt;br /&gt;As a final step, run paxtest - sit back admire/show off/grab a beer:&lt;br /&gt;&lt;br /&gt;&lt;code class="prettyprint"&gt;~ # paxtest blackhat&lt;br /&gt;PaXtest - Copyright(c) 2003,2004 by Peter Busser &lt;peter@adamantix.org&gt;&lt;br /&gt;Released under the GNU Public Licence version 2 or later&lt;br /&gt;&lt;br /&gt;Writing output to paxtest.log&lt;br /&gt;It may take a while for the tests to complete&lt;br /&gt;Test results:&lt;br /&gt;PaXtest - Copyright(c) 2003,2004 by Peter Busser &lt;peter@adamantix.org&gt;&lt;br /&gt;Released under the GNU Public Licence version 2 or later&lt;br /&gt;&lt;br /&gt;Mode: blackhat&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Linux 2.6.29-hardened #7 SMP Thu Jul 23 12:18:52 UTC 2009 x86_64 QEMU Virtual CPU version 0.10.50 GenuineIntel GNU/Linux&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Executable anonymous mapping             : Killed&lt;br /&gt;Executable bss                           : Killed&lt;br /&gt;Executable data                          : Killed&lt;br /&gt;Executable heap                          : Killed&lt;br /&gt;Executable stack                         : Killed&lt;br /&gt;Executable anonymous mapping (mprotect)  : Killed&lt;br /&gt;Executable bss (mprotect)                : Killed&lt;br /&gt;Executable data (mprotect)               : Killed&lt;br /&gt;Executable heap (mprotect)               : Killed&lt;br /&gt;Executable stack (mprotect)              : Killed&lt;br /&gt;Executable shared library bss (mprotect) : Killed&lt;br /&gt;Executable shared library data (mprotect): Killed&lt;br /&gt;Writable text segments                   : Killed&lt;br /&gt;Anonymous mapping randomisation test     : 34 bits (guessed)&lt;br /&gt;Heap randomisation test (ET_EXEC)        : 40 bits (guessed)&lt;br /&gt;Heap randomisation test (ET_DYN)         : 40 bits (guessed)&lt;br /&gt;Main executable randomisation (ET_EXEC)  : 32 bits (guessed)&lt;br /&gt;Main executable randomisation (ET_DYN)   : 32 bits (guessed)&lt;br /&gt;Shared library randomisation test        : 33 bits (guessed)&lt;br /&gt;Stack randomisation test (SEGMEXEC)      : No randomisation&lt;br /&gt;Stack randomisation test (PAGEEXEC)      : 40 bits (guessed)&lt;br /&gt;Return to function (strcpy)              : *** buffer overflow detected ***: rettofunc1 - terminated&lt;br /&gt;rettofunc1: buffer overflow attack in function &lt;unknown&gt; - terminated&lt;br /&gt;Report to http://bugs.gentoo.org/&lt;br /&gt;Killed&lt;br /&gt;Return to function (memcpy)              : *** buffer overflow detected ***: rettofunc2 - terminated&lt;br /&gt;rettofunc2: buffer overflow attack in function &lt;unknown&gt; - terminated&lt;br /&gt;Report to http://bugs.gentoo.org/&lt;br /&gt;Killed&lt;br /&gt;Return to function (strcpy, RANDEXEC)    : *** buffer overflow detected ***: rettofunc1x - terminated&lt;br /&gt;rettofunc1x: buffer overflow attack in function &lt;unknown&gt; - terminated&lt;br /&gt;Report to http://bugs.gentoo.org/&lt;br /&gt;Killed&lt;br /&gt;Return to function (memcpy, RANDEXEC)    : *** buffer overflow detected ***: rettofunc2x - terminated&lt;br /&gt;rettofunc2x: buffer overflow attack in function &lt;unknown&gt; - terminated&lt;br /&gt;Report to http://bugs.gentoo.org/&lt;br /&gt;Killed&lt;br /&gt;Executable shared library bss            : Killed&lt;br /&gt;Executable shared library data           : Killed&lt;br /&gt;&lt;br /&gt;Result? Pretty much same as for x86, but: greater randomisation due to 64-bit architecture and a fully 64-bit OS of course! ;] (if non-multilib). Note that PAX on x86_64 uses PAGEEXEC and not SEGMEXEC hence no randomisation there.&lt;br /&gt;&lt;br /&gt;&lt;/code&gt;&lt;span style="font-weight:bold;"&gt;NOTE&lt;/span&gt;: if using a KVM virtual machine rather than a dedicated system, in order to take advantage of NX-bit in guest, your host OS needs kernel that is &gt;= 2.6.30. I've tested with gentoo-sources-2.6.30-r4 which worked fine. Unfortunately, at the time of this writing there was no hardened kernel available greater than 2.6.29... ;( Not sure, but this might also apply to other VMs like VirtualBox and VMWare too...&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3050029677375999718-2257134190307138063?l=hardenedgentoo.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://hardenedgentoo.blogspot.com/feeds/2257134190307138063/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://hardenedgentoo.blogspot.com/2009/07/64-bit-hardened-gentoo-with-gcc-44-and.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3050029677375999718/posts/default/2257134190307138063'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3050029677375999718/posts/default/2257134190307138063'/><link rel='alternate' type='text/html' href='http://hardenedgentoo.blogspot.com/2009/07/64-bit-hardened-gentoo-with-gcc-44-and.html' title='64-bit hardened Gentoo with gcc-4.4 and glibc-2.10'/><author><name>radegand</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3050029677375999718.post-714037944702110277</id><published>2009-07-24T20:50:00.003+01:00</published><updated>2009-07-24T20:53:56.258+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='gentoo'/><category scheme='http://www.blogger.com/atom/ns#' term='LUKS'/><category scheme='http://www.blogger.com/atom/ns#' term='encrypted root'/><category scheme='http://www.blogger.com/atom/ns#' term='lilo'/><title type='text'>Lilo and root partition encrypted with LUKS on Gentoo</title><content type='html'>When using full 64-bit system (non-multilib), one has to rely on lilo instead of grub as his bootloader. This seemed like a straightforward migration - which it was, after of course I've discovered that lilo needs one additional parameter to find correct root partition. :)&lt;br /&gt;&lt;br /&gt;Therefore if grub was happy with something like this (where ENCRYPTED_ROOT was the encrypted root partition, say hda1):&lt;br /&gt;&lt;code class="prettyprint"&gt;&lt;br /&gt;kernel /kernel-image-2.0.22 ro crypt_root=/dev/ENCRYPTED_ROOT&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;Lilo line translated into this:&lt;br /&gt;&lt;code class="prettyprint"&gt;&lt;br /&gt;append="ramdisk=8192 crypt_root=/dev/ENCRYPTED_ROOT real_root=/dev/mapper/root"&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;That is of course assuming use of the awesome genkernel script.&lt;br /&gt;&lt;br /&gt;Happy days! ;]&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3050029677375999718-714037944702110277?l=hardenedgentoo.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://hardenedgentoo.blogspot.com/feeds/714037944702110277/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://hardenedgentoo.blogspot.com/2009/07/lilo-and-root-partition-encrypted-with.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3050029677375999718/posts/default/714037944702110277'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3050029677375999718/posts/default/714037944702110277'/><link rel='alternate' type='text/html' href='http://hardenedgentoo.blogspot.com/2009/07/lilo-and-root-partition-encrypted-with.html' title='Lilo and root partition encrypted with LUKS on Gentoo'/><author><name>radegand</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3050029677375999718.post-7529002940131254622</id><published>2009-07-23T13:21:00.013+01:00</published><updated>2009-10-05T20:14:33.654+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='PAX'/><category scheme='http://www.blogger.com/atom/ns#' term='howto'/><category scheme='http://www.blogger.com/atom/ns#' term='hardened gentoo'/><category scheme='http://www.blogger.com/atom/ns#' term='gcc-4.4'/><category scheme='http://www.blogger.com/atom/ns#' term='glibc-2.10'/><title type='text'>Hardened Gentoo running glibc-2.10 and gcc-4.4 with PAX in 15 minutes.</title><content type='html'>UPDATED 5.10 - More up-to-date HowTo is available &lt;a href="http://hardenedgentoo.blogspot.com/2009/10/64-bit-hardened-gentoo-with-luks-on.html"&gt;here&lt;/a&gt; Enjoy! :)&lt;br /&gt;&lt;br /&gt;UPDATED 22.09 - Further changes - the overlay can be now tracked directly via layman and is called 'hardened-development'. I hope to post an updated HowTo (with LUKS encryption) soon...&lt;br /&gt;&lt;br /&gt;UPDATED 17.08 - It is no longer needed to use the testing branch from overlay, so skip this part. Also the repo name in repos.conf should then read 'secure' rather than 'secure-testing'.&lt;br /&gt;&lt;br /&gt;...well, not exactly so - but still faster and easier that one could expect! ;) Depending on used hardware, in few hours you could have a state-of-art, up-to-date, secure system...well, let's say - maybe bit more secure than others... ;] But why bother?&lt;br /&gt;&lt;br /&gt;Note for impatient: open &lt;a href="http://forums.gentoo.org/viewtopic-t-705939.html"&gt;this&lt;/a&gt;, then search this page for 'enough of BS' and start from there... ;)&lt;br /&gt;&lt;br /&gt;Health&amp;amp;Safety note: this info might contain some bugs (no influenza though!). You might ruin your system. Your box might explode (especially if adequate cooling is not provided during compilation ;)). Your wife/girlfriend might get mad ("Honey, I just need to compile one more package, I promise!"). Your friends will hate you ("So your system is secure - how is your new printer/camera/other_new_fancy_device working?" - well, it isn't, you fool!). Ya've been warned!&lt;br /&gt;&lt;br /&gt;So what's the motivation? Being security paranoid doesn't leave you much choice anyway, does it...? ;) Well, run the &lt;a href="http://www.grsecurity.net/%7Epaxguy1/paxtest-0.9.7-pre5.tar.gz"&gt;paxtest&lt;/a&gt; tool and the &lt;a href="http://tk-blog.blogspot.com/2009/02/checksec.html"&gt;checksec.sh&lt;/a&gt; script (elfutils package needed!) on your favourite distro, compare and decide by yourself if it's worth the effort :)&lt;br /&gt;&lt;br /&gt;&lt;code class="prettyprint"&gt;~ # ./checksec.sh --proc-all&lt;br /&gt;        COMMAND    PID RELRO             STACK CANARY           NX            PIE                     ASLR&lt;br /&gt;           init      1 Full RELRO        Canary found           NX enabled    PIE enabled             ASLR enabled&lt;br /&gt;         dhcpcd   1437 Full RELRO        Canary found           NX enabled    PIE enabled             ASLR enabled&lt;br /&gt;      syslog-ng   1557 Full RELRO        Canary found           NX enabled    PIE enabled             ASLR enabled&lt;br /&gt;           sshd   1577 Full RELRO        Canary found           NX enabled    PIE enabled             ASLR enabled&lt;br /&gt;           cron   1592 Full RELRO        Canary found           NX enabled    PIE enabled             ASLR enabled&lt;br /&gt;         agetty   1605 Full RELRO        Canary found           NX enabled    PIE enabled             ASLR enabled&lt;br /&gt;         agetty   1608 Full RELRO        Canary found           NX enabled    PIE enabled             ASLR enabled&lt;br /&gt;         agetty   1609 Full RELRO        Canary found           NX enabled    PIE enabled             ASLR enabled&lt;br /&gt;         agetty   1610 Full RELRO        Canary found           NX enabled    PIE enabled             ASLR enabled&lt;br /&gt;         agetty   1611 Full RELRO        Canary found           NX enabled    PIE enabled             ASLR enabled&lt;br /&gt;         agetty   1612 Full RELRO        Canary found           NX enabled    PIE enabled             ASLR enabled&lt;br /&gt;           sshd   1641 Full RELRO        Canary found           NX enabled    PIE enabled             ASLR enabled&lt;br /&gt;           bash   1646 Full RELRO        Canary found           NX enabled    PIE enabled             ASLR enabled&lt;br /&gt;          udevd    519 Full RELRO        Canary found           NX enabled    PIE enabled             ASLR enabled&lt;br /&gt;&lt;br /&gt;~ # paxtest blackhat&lt;br /&gt;PaXtest - Copyright(c) 2003,2004 by Peter Busser &lt;peter@adamantix.org&gt;&lt;br /&gt;Released under the GNU Public Licence version 2 or later&lt;br /&gt;&lt;br /&gt;Mode: blackhat&lt;br /&gt;Linux 2.6.29-hardened #8 SMP Fri Jul 17 13:35:18 GMT 2009 i686 QEMU Virtual CPU version 0.10.50 GenuineIntel GNU/Linux&lt;br /&gt;&lt;br /&gt;Executable anonymous mapping             : Killed&lt;br /&gt;Executable bss                           : Killed&lt;br /&gt;Executable data                          : Killed&lt;br /&gt;Executable heap                          : Killed&lt;br /&gt;Executable stack                         : Killed&lt;br /&gt;Executable anonymous mapping (mprotect)  : Killed&lt;br /&gt;Executable bss (mprotect)                : Killed&lt;br /&gt;Executable data (mprotect)               : Killed&lt;br /&gt;Executable heap (mprotect)               : Killed&lt;br /&gt;Executable stack (mprotect)              : Killed&lt;br /&gt;Executable shared library bss (mprotect) : Killed&lt;br /&gt;Executable shared library data (mprotect): Killed&lt;br /&gt;Writable text segments                   : Killed&lt;br /&gt;Anonymous mapping randomisation test     : 17 bits (guessed)&lt;br /&gt;Heap randomisation test (ET_EXEC)        : 23 bits (guessed)&lt;br /&gt;Heap randomisation test (ET_DYN)         : 23 bits (guessed)&lt;br /&gt;Main executable randomisation (ET_EXEC)  : 15 bits (guessed)&lt;br /&gt;Main executable randomisation (ET_DYN)   : 15 bits (guessed)&lt;br /&gt;Shared library randomisation test        : 17 bits (guessed)&lt;br /&gt;Stack randomisation test (SEGMEXEC)      : 23 bits (guessed)&lt;br /&gt;Stack randomisation test (PAGEEXEC)      : 23 bits (guessed)&lt;br /&gt;Return to function (strcpy)              : *** buffer overflow detected ***: rettofunc1 - terminated&lt;br /&gt;rettofunc1: buffer overflow attack in function &lt;unknown&gt; - terminated&lt;br /&gt;Report to http://bugs.gentoo.org/&lt;br /&gt;Killed&lt;br /&gt;Return to function (memcpy)              : *** buffer overflow detected ***: rettofunc2 - terminated&lt;br /&gt;rettofunc2: buffer overflow attack in function &lt;unknown&gt; - terminated&lt;br /&gt;Report to http://bugs.gentoo.org/&lt;br /&gt;Killed&lt;br /&gt;Return to function (strcpy, RANDEXEC)    : *** buffer overflow detected ***: rettofunc1x - terminated&lt;br /&gt;rettofunc1x: buffer overflow attack in function &lt;unknown&gt; - terminated&lt;br /&gt;Report to http://bugs.gentoo.org/&lt;br /&gt;Killed&lt;br /&gt;Return to function (memcpy, RANDEXEC)    : *** buffer overflow detected ***: rettofunc2x - terminated&lt;br /&gt;rettofunc2x: buffer overflow attack in function &lt;unknown&gt; - terminated&lt;br /&gt;Report to http://bugs.gentoo.org/&lt;br /&gt;Killed&lt;br /&gt;Executable shared library bss            : Killed&lt;br /&gt;Executable shared library data           : Killed&lt;/unknown&gt;&lt;/unknown&gt;&lt;/unknown&gt;&lt;/unknown&gt;&lt;/peter@adamantix.org&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Ready? If you're not faint-hearted read below! Otherwise take the &lt;a href="http://www.microsoft.com/"&gt;blue pill&lt;/a&gt; ;]&lt;br /&gt;&lt;br /&gt;Requirements:&lt;br /&gt;- bit of time and dedication. RTFM skills will be required too... ;]&lt;br /&gt;- new VM or spare machine - nothing fancy but the faster it is the sooner it's done! Base install took approximately 3G of space but if you want to install anything else than just a base system, you'd need more than that. This HowTo assumes a x86 box.&lt;br /&gt;- no prior knowledge about kernel configuration required yet you will have a PAX kernel! ;]&lt;br /&gt;&lt;br /&gt;Two main links are here:&lt;br /&gt;&lt;a href="http://forums.gentoo.org/viewtopic-t-705939.html"&gt;http://forums.gentoo.org/viewtopic-t-705939.html&lt;/a&gt;&lt;br /&gt;&lt;a href="http://www.gentoo.org/doc/en/handbook/handbook-x86.xml"&gt;http://www.gentoo.org/doc/en/handbook/handbook-x86.xml&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;First link is the main one you want to follow and describes everything you need to know and do to complete the installation procedure. I have used stages from &lt;a href="https://weaver.gentooenterprise.com/hardened/gcc-4.3/"&gt;here&lt;/a&gt; and the official gentoo minimal installation CD that can be found &lt;a href="http://distfiles.gentoo.org/releases/x86/current/"&gt;here&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;To make life easier, I ssh to the new box from another box where I have the guid open - copy&amp;amp;paste made easy. To do so run on new system:&lt;br /&gt;&lt;br /&gt;&lt;code class="prettyprint"&gt;/etc/init.d/sshd start&lt;br /&gt;passwd&lt;br /&gt;ifconfig&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Then ssh into the system using IP shown in the ifconfig command:&lt;br /&gt;&lt;br /&gt;&lt;code class="prettyprint"&gt;sshd root@your_ip_here &lt;/code&gt;&lt;br /&gt;&lt;br /&gt;If for whatever reason installation process is interrupted (power outage) or needs to be stopped (shouting girlfriend ;)), and you've already created and partitioned disk, after neutralizing the threat you can continue the installation like this:&lt;br /&gt;1. boot liveCD&lt;br /&gt;2. ssh into the box as mentioned earlier&lt;br /&gt;3. run:&lt;br /&gt;&lt;br /&gt;&lt;code class="prettyprint"&gt;livecd ~ # mount /dev/your_root_partition_here /mnt/gentoo/&lt;br /&gt;livecd ~ # swapon /dev/your_swap_partition_here&lt;br /&gt;mount -t proc none /mnt/gentoo/proc&lt;br /&gt;mount -o bind /dev /mnt/gentoo/dev&lt;br /&gt;chroot /mnt/gentoo /bin/bash&lt;br /&gt;env-update &amp;amp;&amp;amp; source /etc/profile&lt;br /&gt;export PS1="(chroot) $PS1"&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Right, enough of BS - start here:&lt;br /&gt;&lt;br /&gt;Follow the guide until it says about keywording packages - "First we add certain packages that are known to fail from the portage tree." That's not required anymore :) Instead of this:&lt;br /&gt;&lt;br /&gt;&lt;code class="prettyprint"&gt;echo "=sys-devel/gcc-4.3*" &gt;&gt;/etc/portage/package.keywords&lt;br /&gt;echo "=sys-devel/gcc-4.3*" &gt;&gt;/etc/portage/package.unmask&lt;br /&gt;echo "=sys-libs/glibc-2.8*"&gt;&gt;/etc/portage/package.keywords&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;run:&lt;br /&gt;&lt;br /&gt;&lt;code class="prettyprint"&gt;echo "=sys-devel/gcc-4.4*" &gt;&gt;/etc/portage/package.keywords&lt;br /&gt;echo "=sys-devel/gcc-4.4*" &gt;&gt;/etc/portage/package.unmask&lt;br /&gt;echo "=sys-libs/glibc-2.10*"&gt;&gt;/etc/portage/package.keywords&lt;br /&gt;echo "=sys-libs/glibc-2.10*"&gt;&gt;/etc/portage/package.unmask&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;..and then go for the testing branch. When running the initial emerge of key packages:&lt;br /&gt;&lt;br /&gt;&lt;code class="prettyprint"&gt;emerge gcc-config linux-headers glibc binutils gcc portage -1&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;I run into a weird portage error. The issue was resolved by emerging portage manually:&lt;br /&gt;&lt;br /&gt;&lt;code class="prettyprint"&gt;emerge portage&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;and then emerging rest of the packages:&lt;br /&gt;&lt;br /&gt;&lt;code class="prettyprint"&gt;emerge gcc-config linux-headers glibc binutils gcc -1&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Continue...Don't unmask this: sys-apps/openrc-9999 - doesn't seem to be required anymore. At the kernel configuration stage - unmask latest hardened-sources to get the latest kernel source with all security goodies (2.6.29 at the time of this writing)&lt;br /&gt;&lt;br /&gt;&lt;code class="prettyprint"&gt;echo "sys-kernel/hardened-sources ~x86"&gt;&gt;/etc/portage/package.keywords&lt;br /&gt;emerge -av hardened-sources genkernel&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;New kernel tree should be ready for ya:&lt;br /&gt;&lt;br /&gt;&lt;code class="prettyprint"&gt;(chroot) livecd src # ls -la&lt;br /&gt;total 12&lt;br /&gt;drwxr-xr-x  3 root root 4096 Jul 22 13:14 .&lt;br /&gt;drwxr-xr-x 13 root root 4096 Jul 21 14:12 ..&lt;br /&gt;-rw-r--r--  1 root root    0 Apr  1 00:28 .keep&lt;br /&gt;lrwxrwxrwx  1 root root   21 Jul 22 13:14 linux -&gt; linux-2.6.29-hardened&lt;br /&gt;drwxr-xr-x 23 root root 4096 Jul 22 13:14 linux-2.6.29-hardened&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Now config time - the lazy (not-so-secure) way is shown below. The result will be a default Gentoo kernel with PAX and Grsecurity enabled. To use current configuration of currently running kernel (that is: the one that LiveCD is using):&lt;br /&gt;&lt;br /&gt;&lt;code class="prettyprint"&gt;zcat /proc/config.gz &gt; /usr/src/linux/.config&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Alternatively copy it to default genkernel location like this:&lt;br /&gt;&lt;br /&gt;&lt;code class="prettyprint"&gt;zcat /proc/config.gz &gt; /usr/share/genkernel/arch/x86_64/kernel-&lt;br /&gt;config&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;and then:&lt;br /&gt;&lt;br /&gt;&lt;code class="prettyprint"&gt;genkernel --menuconfig all&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Under Security options enable Grsecurity and PAX. Feel free to tune settings but defaults should be just fine. Use 'gentoo-workstation' or 'gentoo-server' pre-set options. Exit and save configuration and let the kernel compile :)&lt;br /&gt;&lt;br /&gt;Follow the handbook until it says...reboot! (..and pray). If anything goes wrong and kernel does not boot - use 'rescue' procedure as described at the beginning of this how-to.&lt;br /&gt;&lt;br /&gt;If you see login prompt - voilà! You've done it! emerge paxtest, run and relax - or show off in front of your friends ;). You might need to keyword it:&lt;br /&gt;&lt;br /&gt;&lt;code class="prettyprint"&gt;echo "app-admin/paxtest ~x86" &gt;&gt; /etc/portage/package.keywords&lt;br /&gt;emerge paxtest&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;And finally:&lt;br /&gt;&lt;br /&gt;&lt;code class="prettyprint"&gt;~ # gcc -v&lt;br /&gt;Using built-in specs.&lt;br /&gt;Target: i686-pc-linux-gnu&lt;br /&gt;Configured with: /var/tmp/portage/sys-devel/gcc-4.4.0-r4/work/gcc-4.4.0/configure --prefix=/usr --bindir=/usr/i686-pc-linux-gnu/gcc-bin/4.4.0 --includedir=/usr/lib/gcc/i686-pc-linux-gnu/4.4.0/include --datadir=/usr/share/gcc-data/i686-pc-linux-gnu/4.4.0 --mandir=/usr/share/gcc-data/i686-pc-linux-gnu/4.4.0/man --infodir=/usr/share/gcc-data/i686-pc-linux-gnu/4.4.0/info --with-gxx-include-dir=/usr/lib/gcc/i686-pc-linux-gnu/4.4.0/include/g++-v4 --host=i686-pc-linux-gnu --build=i686-pc-linux-gnu --disable-altivec --disable-fixed-point --disable-nls --without-ppl --without-cloog --disable-ppl-version-check --disable-cloog-version-check --with-system-zlib --disable-checking --disable-werror --enable-secureplt --disable-multilib --enable-libmudflap --enable-espf --disable-libssp --disable-libgomp --enable-cld --disable-libgcj --with-arch=i686 --enable-languages=c,c++ --enable-shared --enable-threads=posix --enable-__cxa_atexit --enable-clocale=gnu --with-bugurl=http://bugs.gentoo.org/ --with-pkgversion='Gentoo Hardened 4.4.0-r4 p1.1, espf-0.2.9'&lt;br /&gt;Thread model: posix&lt;br /&gt;gcc version 4.4.0 (Gentoo Hardened 4.4.0-r4 p1.1, espf-0.2.9)&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Rite...so now you have a 'secure' system...or as secure as it gets one should say :) What about classics like weak passwords/default accounts left, default configuration and services, design or configuration errors, 0days, &lt;a href="http://www.youtube.com/watch?v=UdkpJ13e6Z0"&gt;kernel exploits&lt;/a&gt; (or DoSes ;))..but hey - at least it's a good start! ;]&lt;br /&gt;&lt;br /&gt;Next good thing to do would be to tune the kernel and remove all the unnecessary functionality, especially when it comes to device drivers - they just tend to be a bit less secure than expected... ;)&lt;br /&gt;&lt;br /&gt;Enjoy! If it worked for you - great! If it didn't - well, I'm sorry...try again ;)&lt;br /&gt;&lt;br /&gt;Hmm...of course your system might now require few more packages but who have ever said that terminal is ugly? Depending on your mood do 'emerge gnome' or 'emerge kde-meta' and go get some beer...&lt;br /&gt;Few days later....&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3050029677375999718-7529002940131254622?l=hardenedgentoo.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://hardenedgentoo.blogspot.com/feeds/7529002940131254622/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://hardenedgentoo.blogspot.com/2009/07/hardened-gentoo-running-glibc-210-and.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3050029677375999718/posts/default/7529002940131254622'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3050029677375999718/posts/default/7529002940131254622'/><link rel='alternate' type='text/html' href='http://hardenedgentoo.blogspot.com/2009/07/hardened-gentoo-running-glibc-210-and.html' title='Hardened Gentoo running glibc-2.10 and gcc-4.4 with PAX in 15 minutes.'/><author><name>radegand</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3050029677375999718.post-1125301575457923</id><published>2009-07-21T10:26:00.007+01:00</published><updated>2009-07-27T16:09:22.224+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='overlay'/><category scheme='http://www.blogger.com/atom/ns#' term='gcc-4.3'/><category scheme='http://www.blogger.com/atom/ns#' term='hardened gentoo'/><category scheme='http://www.blogger.com/atom/ns#' term='gcc-4.4'/><title type='text'>My Gentoo boxes</title><content type='html'>I'm using two hardened Gentoo systems on a daily basis - for business and pleasure ;] One of them is a x86_64 non-multilib desktop and the other one is a x86 laptop - both are build using the gcc-4.x branch. The official hardened Gentoo is currently still using gcc-3.4 unfortunately; however, thanks to awesome work by zorry, xake and many others there's an overlay available that supports glibc-2.10 and gcc-4.3 and gcc-4.4! ;]&lt;br /&gt;&lt;br /&gt;Information about the overlay can be found &lt;a href="https://hardened.gentooexperimental.org/trac/secure/"&gt;here&lt;/a&gt;. It has all the information required to enjoy a fully hardened, modern Linux distro - patience and fast box is still recommended! ;)&lt;br /&gt;&lt;br /&gt;&lt;a href="http://forums.gentoo.org/viewtopic-t-705939.html"&gt;There&lt;/a&gt; is a nice installation howto and forum discussion &lt;a href="http://forums.gentoo.org/viewtopic-t-668885.html"&gt;too&lt;/a&gt;. &lt;br /&gt;&lt;br /&gt;So why not treat yourself with a new shiny Gentoo? I can hear your compiler screaming... ;]&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3050029677375999718-1125301575457923?l=hardenedgentoo.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://hardenedgentoo.blogspot.com/feeds/1125301575457923/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://hardenedgentoo.blogspot.com/2009/07/my-gentoo-boxes.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3050029677375999718/posts/default/1125301575457923'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3050029677375999718/posts/default/1125301575457923'/><link rel='alternate' type='text/html' href='http://hardenedgentoo.blogspot.com/2009/07/my-gentoo-boxes.html' title='My Gentoo boxes'/><author><name>radegand</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3050029677375999718.post-3397672128477372071</id><published>2009-07-21T09:52:00.008+01:00</published><updated>2009-07-23T14:31:30.463+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='PAX'/><category scheme='http://www.blogger.com/atom/ns#' term='executable stack'/><category scheme='http://www.blogger.com/atom/ns#' term='gentoo'/><category scheme='http://www.blogger.com/atom/ns#' term='bug'/><category scheme='http://www.blogger.com/atom/ns#' term='nss'/><title type='text'>dev-libs/nss - executable stack markings</title><content type='html'>Compilation of version 3.12.3 of the nss library (dev-libs/nss) on my amd64 box resulted with executable and writable stack markings - which from security point of view is better if avoided ;) It also did not make some other programs happy that depend on this library when running under PAX system.&lt;br /&gt;&lt;br /&gt;The initial hint was this:&lt;br /&gt;&lt;br /&gt;&lt;code class="prettyprint"&gt; * QA Notice: The following files contain writable and executable sections&lt;br /&gt;*  Files with such sections will not work properly (or at all!) on some&lt;br /&gt;*  architectures/operating systems.  A bug should be filed at&lt;br /&gt;*  http://bugs.gentoo.org/ to make sure the issue is fixed.&lt;br /&gt;*  For more information, see http://hardened.gentoo.org/gnu-stack.xml&lt;br /&gt;*  Please include the following list of files in your report:&lt;br /&gt;*  Note: Bugs should be filed for the respective maintainers&lt;br /&gt;*  of the package in question and not hardened@g.o.&lt;br /&gt;* RWX --- --- usr/lib64/nss/libfreebl3.so.12&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Which was confirmed below - just in case ;)&lt;br /&gt;&lt;br /&gt;&lt;code class="prettyprint"&gt;user@host ~ $ scanelf -qe /usr/lib64/nss/libfreebl3.so&lt;br /&gt;RWX --- ---  /usr/lib64/nss/libfreebl3.so&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;So when I attempted to run firefox I got a segmentation fault :( Good old strace investigation shown:&lt;br /&gt;&lt;br /&gt;&lt;code class="prettyprint"&gt;user@host ~ $ strace firefox&lt;br /&gt;...&lt;br /&gt;open("/usr/lib64/nss/libfreebl3.so", O_RDONLY) = 46&lt;br /&gt;read(46, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0&gt;\0\1\0\0\0\20:\0\0\0\0\0\0@"..., 832) = 832&lt;br /&gt;fstat(46, {st_mode=S_IFREG|0755, st_size=431928, ...}) = 0&lt;br /&gt;mmap(NULL, 2544672, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 46, 0) = 0x6f9ca2b61000&lt;br /&gt;mprotect(0x6f9ca2bc9000, 2093056, PROT_NONE) = 0&lt;br /&gt;mmap(0x6f9ca2dc8000, 12288, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 46, 0x67000) = 0x6f9ca2dc8000&lt;br /&gt;mmap(0x6f9ca2dcb000, 13344, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x6f9ca2dcb000&lt;br /&gt;mprotect(0x6f9cba22b000, 3460, PROT_READ|PROT_WRITE) = -1 EACCES (Permission denied)&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Oppsie!&lt;br /&gt;There was another hint to this riddle though: &lt;a href="http://hardened.gentoo.org/gnu-stack.xml"&gt; http://hardened.gentoo.org/gnu-stack.xml&lt;/a&gt;. It's a very good read, btw! First, the ebuild had to be compiled and ready for further investigation:&lt;br /&gt;&lt;br /&gt;&lt;code class="prettyprint"&gt;ebuild /usr/portage/dev-libs/nss/nss-3.12.3.ebuild clean unpack compile&lt;br /&gt;cd /var/tmp/portage/dev-libs/nss-3.12.3/work/nss-3.12.3/&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Now which file has to be patched?&lt;br /&gt;&lt;br /&gt;&lt;code class="prettyprint"&gt;host nss-3.12.3 # scanelf -qeR .&lt;br /&gt;RWX --- ---  ./work/nss-3.12.3/mozilla/security/dist/Linux2.6_x86_64_x86_64-pc-linux-gnu-gcc_glibc_PTH_64_OPT.OBJ/lib/libfreebl3.so&lt;br /&gt;RWX --- ---  ./work/nss-3.12.3/mozilla/security/dist/Linux2.6_x86_64_x86_64-pc-linux-gnu-gcc_glibc_PTH_64_OPT.OBJ/lib/libfreebl3.so.12&lt;br /&gt;!WX --- ---  ./work/nss-3.12.3/mozilla/security/nss/lib/freebl/Linux2.6_x86_64_x86_64-pc-linux-gnu-gcc_glibc_PTH_64_OPT.OBJ/Linux_SINGLE_SHLIB/intel-aes.o&lt;br /&gt;RWX --- ---  ./work/nss-3.12.3/mozilla/security/nss/lib/freebl/Linux2.6_x86_64_x86_64-pc-linux-gnu-gcc_glibc_PTH_64_OPT.OBJ/Linux_SINGLE_SHLIB/libfreebl3.so.12&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Aha! The intel-aes.o does not have correct markings set. Time for a patch...The actual source file is here:&lt;br /&gt;&lt;br /&gt;&lt;code class="prettyprint"&gt;/var/tmp/portage/dev-libs/nss-3.12.3/work/nss-3.12.3/mozilla/security/nss/lib/freebl/intel-aes.s&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;as suggested in the guide, adding this at the very bottom of the file:&lt;br /&gt;&lt;br /&gt;&lt;code class="prettyprint"&gt;#if defined(__linux__) &amp;amp;&amp;amp; defined(__ELF__)&lt;br /&gt;.section .note.GNU-stack,"",%progbits&lt;br /&gt;#endif&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;And recompilation time...so the correct order would be this:&lt;br /&gt;&lt;code class="prettyprint"&gt;ebuild /usr/portage/dev-libs/nss/nss-3.12.3.ebuild clean unpack&lt;/code&gt;&lt;br /&gt;Now patch the intel-aes.s file and then:&lt;br /&gt;&lt;br /&gt;&lt;code class="prettyprint"&gt;ebuild /usr/portage/dev-libs/nss/nss-3.12.3.ebuild compile install qmerge&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;No QA error reported! Job done! The actual bug was reported here: &lt;a href="http://bugs.gentoo.org/show_bug.cgi?id=266343"&gt;http://bugs.gentoo.org/show_bug.cgi?id=266343&lt;/a&gt;&lt;br /&gt;All in all - that was an easy fix! :) This is now fixed in nss-3.12.3-r1&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3050029677375999718-3397672128477372071?l=hardenedgentoo.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://hardenedgentoo.blogspot.com/feeds/3397672128477372071/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://hardenedgentoo.blogspot.com/2009/07/dev-libsnss-executable-stack-markings.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3050029677375999718/posts/default/3397672128477372071'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3050029677375999718/posts/default/3397672128477372071'/><link rel='alternate' type='text/html' href='http://hardenedgentoo.blogspot.com/2009/07/dev-libsnss-executable-stack-markings.html' title='dev-libs/nss - executable stack markings'/><author><name>radegand</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>
