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