Sparks had an interesting post about Thunderbird email security. This reminded me of another technique I like which is to run Thunderbird and Firefox from an encrypted directory. In addition to encrypting the data, Thunderbird and Firefox won’t start without the encrypted directory mounted.
Here is how to set it up on Fedora 12 and beyond (also works on RHEL with EPEL):
1) Install encfs
$ su -c 'yum install encfs'
2) Create an encrypted directory–all files copied here will be encrypted as long as you’ve run encfs and mounted the directory. I’ve made the mistake before copying a bunch of data to what I thought was the encrypted directory only to find out later it was an empty mountpoint. As a result the files were not encrypted and encfs complained the next time I tried to mount the encrypted directory.
$ encfs ~/.cryptdir/ ~/cryptdir/
Answer the questions and accept the defaults. This same command mounts the encrypted directory in the future.
3) Make sure the encrypted directory is mounted
$ mount | grep encfs encfs on /home/bozo/cryptdir type fuse.encfs (rw,nosuid,nodev,default_permissions,user=bozo)
4) Make sure Thunderbird and Firefox are closed and not running. Close them or kill the processes if they are.
$ ps -ef | grep -E 'thunderbird|firefox'
5) Move Thunderbird and Firefox files to the encrypted directory
$ mv ~/.thunderbird ~/cryptdir/thunderbird $ mv ~/.mozilla ~/cryptdir/mozilla
6) Create symlinks (shortcuts to the directory in the encrypted folder)
$ ln -s ~/cryptdir/thunderbird ~/.thunderbird $ ln -s ~/cryptdir/mozilla ~/.mozilla
7) Start up Thunderbird or Firefox and make sure they work
To manually un-mount the encrypted directory
$ fusermount -u ~/cryptdir
You may also want to consider putting other important files in the ~/cryptdir
as well.
February 27, 2010 at 1:28 pm
Nice post, thank you. Why might someone choose encfs instead of, or in addition to, block device encryption (luks)?
February 28, 2010 at 2:46 pm
If you are already using block device encryption it is another layer of security. How good/strong is it compared to other forms? I don’t know 🙂
Without having looked into it very deeply I think of block device encryption requiring a password at boot. I have some machines that I don’t want to wait around to enter the password at boot or that I don’t have physical access to.
There are lots of different ways to encrypt data. I’ve always found encfs to be simple and easy to use.
February 27, 2010 at 5:18 am
FYI, pam_mount[1] supports encfs, so you can unlock your encrypted directory at logon. It makes it super-easy !
[1] http://pam-mount.sourceforge.net/
February 26, 2010 at 7:46 pm
Why not just encrypt the whole disk and not worry about encrypting specific directories. Fedora is one distro that makes it super easy to encrypt a drive. See http://linuxbsdos.com/2010/02/02/how-fedora-protects-your-data-with-full-disk-encryption/
February 26, 2010 at 4:54 pm
What about your swap space? Secret data will inevitably be stored to disk in the form of swap memory. After this happens, an attacker who steals your disk may read this data unless the swap memory location has been overwritten.
To protect against accidentally writing files to a mount point before a filesystem is mounted, just change the permissions of the mount point directory to read only. When you mount a filesystem, the mount point adapts the permissions of the root directory of that filesystem.
February 26, 2010 at 5:29 pm
Thanks for reading and your comment.
I agree. There are a zillion different ways to protect your system, including a fully encrypted LVM volume that all the logical volumes can live on. This was simply intended to be a short article about one way to use encfs.
February 26, 2010 at 5:41 pm
Just don’t use swap 🙂
Alternately, if you’re not on a machine that you hibernate, there’s no downside to an encrypted swap with a per-boot key that’s not persistent.
Personally, I’m not concerned with the super-dedicated, though. If someone is dedicated enough to pull things out of swap, they’ll do the RAM trick or one of the many other things that can get data out of a system even with an encrypted disk.
February 26, 2010 at 4:48 pm
Making it easy to have an encrypted private area in your homedir is one of the things that’s kind of nice in Ubuntu. I played a little with getting their ecryptfs stuff playing nice on Fedora about a year ago, but ran into problems with userspace/kernel matching. I should try to look at that again as it’d be nice to be able to do.
February 26, 2010 at 5:31 pm
Yes, Ubuntu does a lot of nice user-friendly touches like that. That would be cool if you could get it working for Fedora.
February 26, 2010 at 5:42 pm
As of today, I’ve got a good machine for some Fedora work at home again. Which should hopefully help with having a little time for things like that.