Gentoo Archives: gentoo-amd64

From: Jason Booth <jbooth@××××××××××××××××.net>
To: gentoo-amd64@l.g.o
Subject: Re: [gentoo-amd64] Re: Using encrypted swap via cryptsetup-luks on amd64
Date: Sun, 22 Oct 2006 05:24:40
Message-Id: 200610212324.11244.jbooth@hyperintelligent.net
In Reply to: Re: [gentoo-amd64] Re: Using encrypted swap via cryptsetup-luks on amd64 by Jason Booth
1 On Saturday 21 October 2006 23:16, Jason Booth wrote:
2 > On Saturday 21 October 2006 21:26, Richard Freeman wrote:
3 > > Duncan wrote:
4 > > > I'm not running encrypted swap tho I've always thought it'd be nice to
5 > > > setup /someday/, so I can't help directly.
6 > >
7 > > I just run the following script from local.start. I forget where I
8 > > found it online. Obviously change the swapdevice variable!
9 > >
10 > > Honestly, my guess is that it is overly paranoid. You could probably
11 > > eliminate most of the steps this script takes, but it runs in only a
12 > > second or two so it isn't a big deal. I would leave in the bit that
13 > > zeros the start of the encrypted swap partition - it probably helps to
14 > > keep mkswap from getting confused.
15 > >
16 > > Not sure what the fancy scripts that are being discussed do, but this is
17 > > plenty good for me, and I'm sure Duncan could get this running in about
18 > > 15 seconds...
19 >
20 > Yeah this script has worked fine for me for like 5 years except for one
21 > thing:
22 >
23 > I can't find which gentoo package contains uuencode(installed
24 > uucp,uulib,uudeview and googled to no avail).
25 Nevermind I just found it: sharutils
26
27 >
28 > > #!/bin/sh
29 > > # Run this script somewhere in your startup scripts _after_ random
30 > > # number generator has been initialized and /usr has been mounted.
31 > > # (md5sum, uuencode, tail and head programs usually reside in /usr/bin/)
32 > >
33 > > # encrypted swap partition
34 > > SWAPDEVICE=/dev/hda3
35 > >
36 > > # loop device name
37 > > LOOPDEV=/dev/loop6
38 > >
39 > > MD=`dd if=${SWAPDEVICE} bs=4k count=10 2>/dev/null | md5sum`
40 > > for X in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 ; do
41 > > dd if=/dev/zero of=${SWAPDEVICE} bs=4k count=10 conv=notrunc
42 > > 2>/dev/null sync
43 > > done
44 > > UR=`dd if=/dev/urandom bs=18 count=1 2>/dev/null \
45 > >
46 > > | uuencode -m - | head -n 2 | tail -n 1`
47 > >
48 > > echo ${MD}${UR} | losetup -p 0 -e aes-cbc-256 ${LOOPDEV} ${SWAPDEVICE}
49 > > MD=
50 > > UR=
51 > > dd if=/dev/zero of=${LOOPDEV} bs=4k count=10 conv=notrunc 2>/dev/null
52 > > sync
53 > > mkswap ${LOOPDEV}
54 > > sync
55 > > swapon ${LOOPDEV}
56 >
57 > Thanks,
58 > Jason
59 >
60 > --
61 > gpg public key:
62 > http://lazybird.hyperintelligent.net/~jbooth/jbooth_key.asc
63
64 --
65 gpg public key: http://lazybird.hyperintelligent.net/~jbooth/jbooth_key.asc
66 --
67 gentoo-amd64@g.o mailing list