1 |
-----BEGIN PGP SIGNED MESSAGE----- |
2 |
Hash: SHA1 |
3 |
|
4 |
Duncan wrote: |
5 |
> I'm not running encrypted swap tho I've always thought it'd be nice to |
6 |
> setup /someday/, so I can't help directly. |
7 |
|
8 |
I just run the following script from local.start. I forget where I |
9 |
found it online. Obviously change the swapdevice variable! |
10 |
|
11 |
Honestly, my guess is that it is overly paranoid. You could probably |
12 |
eliminate most of the steps this script takes, but it runs in only a |
13 |
second or two so it isn't a big deal. I would leave in the bit that |
14 |
zeros the start of the encrypted swap partition - it probably helps to |
15 |
keep mkswap from getting confused. |
16 |
|
17 |
Not sure what the fancy scripts that are being discussed do, but this is |
18 |
plenty good for me, and I'm sure Duncan could get this running in about |
19 |
15 seconds... |
20 |
|
21 |
#!/bin/sh |
22 |
# Run this script somewhere in your startup scripts _after_ random |
23 |
# number generator has been initialized and /usr has been mounted. |
24 |
# (md5sum, uuencode, tail and head programs usually reside in /usr/bin/) |
25 |
|
26 |
# encrypted swap partition |
27 |
SWAPDEVICE=/dev/hda3 |
28 |
|
29 |
# loop device name |
30 |
LOOPDEV=/dev/loop6 |
31 |
|
32 |
MD=`dd if=${SWAPDEVICE} bs=4k count=10 2>/dev/null | md5sum` |
33 |
for X in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 ; do |
34 |
dd if=/dev/zero of=${SWAPDEVICE} bs=4k count=10 conv=notrunc 2>/dev/null |
35 |
sync |
36 |
done |
37 |
UR=`dd if=/dev/urandom bs=18 count=1 2>/dev/null \ |
38 |
| uuencode -m - | head -n 2 | tail -n 1` |
39 |
echo ${MD}${UR} | losetup -p 0 -e aes-cbc-256 ${LOOPDEV} ${SWAPDEVICE} |
40 |
MD= |
41 |
UR= |
42 |
dd if=/dev/zero of=${LOOPDEV} bs=4k count=10 conv=notrunc 2>/dev/null |
43 |
sync |
44 |
mkswap ${LOOPDEV} |
45 |
sync |
46 |
swapon ${LOOPDEV} |
47 |
-----BEGIN PGP SIGNATURE----- |
48 |
Version: GnuPG v1.4.5 (GNU/Linux) |
49 |
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org |
50 |
|
51 |
iD8DBQFFOuTeG4/rWKZmVWkRAvh/AJ9m/TppQ4w+kFEtjRgqRqBXrW0HSgCffycx |
52 |
v1aYQi+49/PX9GBTi8Z5kxk= |
53 |
=X4Km |
54 |
-----END PGP SIGNATURE----- |