View Single Post
Posts: 1 | Thanked: 10 times | Joined on Sep 2010
#36
Hello,
I have managed to somehow set up encrypted /home/user using truecrypt, using the internal flash partition /dev/mmcblk0p1, which is normally mounted as /home/user/MyDocs.

First step is to back up /home/user/MyDocs contents, as they will be overwritten!

Second step was to unmount the partition, and encrypting it using truecrypt, with ext3 filesystem. After that, mount it some place as /mnt, set the correct ownership and permisions (owner user.users), and copy the contents of /home/user (including the hidden folders) to the new truecrypt encrypted partition.

Now, a tricky part comes in. Somehow, the N900 will not be able to browse the /home/user/MyDocs folder, unless it is mounted directly. The only workaround i could find, is to create an image under the new /home/user folder (which will be encrypted) , and mount it separate under /home/user/MyDocs , as a loop device. It does not matter which type of filesystem you use , as the N900 can accept both fat32 and ext3 fs under MyDocs folder.

The interesting part is that you get somehow plausible deniability, as when you first start the phone, it will not show the contacts, pictures, user accounts, documents, until you use the following script to mount the encrypted partition:
(after encryption, at start-up you will get a message stating "unsupported filesystem" and the /dev/mmcblk0p1 will not be mounted)

#!/bin/bash
truecrypt --filesystem=none /dev/mmcblk0p1
mount /dev/loop0 /home/user
#if i don't mount it like this, it takes too long to mount
losetup /dev/loop5 /home/user/docs.img
mount /dev/loop5 /home/user/MyDocs
#workaround to be able to "see" the MyDocs folder using the #filemanager.
truecrypt -l
sleep 2
killall signond
#restart the daemon that manages IM user accounts (and maybe #e-mail accounts?)
sleep 2
killall mission-control rtcom-messaging-ui rtcom-call-ui rtcom-accounts-ui
#restart the messaging services, to re-read messaging accounts
sleep 2
killall hildon-desktop hildon-home hildon-status-menu
#restart the better part of hildon, to re-read desktop, calendar, #shortcuts, etc from the new /home/user encrypted partition.

Script has to run as root.

This actually works, by replacing /home/user folder with an encrypted one, and the /home/user/MyDocs with a loop image (you can choose the size). There is no significant performance decrease, and does not affect the battery. Also, you do not need to modify the kernel.
Works perfect on the N900 with last version of firmware and kernel,
and last version of tryuecrypt ported on N900 Maemo 5.

Now, there is also a method of encrypting the swap partition, using truecrypt with one-time key files. Here is the script:
(has to be ran after mounting the encrypted /home/user partition)

#!/bin/bash
swapoff -a
#disable swap
cd /home/user
dd if=/dev/urandom of=key1.txt bs=1024K count=1
dd if=/dev/urandom of=key2.txt bs=1024K count=1
dd if=/dev/urandom of=key3.txt bs=1024K count=1
dd if=/dev/urandom of=key4.txt bs=1024K count=1
dd if=/dev/urandom of=key5.txt bs=1024K count=1
#create 5 one time use key-files under the encrypted /home/user
truecrypt -t -c --random-source=/dev/urandom --quick --encryption=AES --hash=SHA-512 --volume-type=normal --filesystem=none -k key1.txt,key2.txt,key3.txt,key4.txt,key5.txt -p="" /dev/mmcblk0p3
truecrypt -t -p="" -k key1.txt,key2.txt,key3.txt,key4.txt,key5.txt --protect-hidden=no --filesystem=none /dev/mmcblk0p3
rm -f key*.txt
#create a truecrypt partition on the /dev/mmcblk0p3 and remove #the temporary key files
mkswap /dev/loop1
swapon /dev/loop1
#format and activate the swap

However, this has not been tested.

Once again, this method works by replacing the entire /home/user folder, along with all its contents, including calendar entries, email and IM accounts, emails and conversations. If you decide to try it, make sure you back up the important stuff first.

I could not find a reliable way to encrypt the swap, the /tmp and the /var/tmp folders, yet. Maybe someone else will.

Cheers,
J
 

The Following 10 Users Say Thank You to jsweiss For This Useful Post: