• Zeth will be attending PyCon UK on the 12th to 14th September 2008.

Encrypt your /home this Christmas: part one - background

8 December 2007

Laptops can get lost and stolen. Besides the inconvenience and cost of replacing it, there is the potential for your personal data to end up in the hands of an identity thief.

I have not finished everything I need to do so I am taking my new laptop with me over the Christmas holidays. This reminded me that it was about time that I encrypted my /home directory. In this article I will explain how I did it. It took a little trial and error, but the good news it that now I have figured out the theory, the process is surprisingly easy.

Are you using encryption on your laptop? If not, then like me, it is about time you did!

The Plan

  • Firstly, in ths post I will explain the theoretical issues, i.e. the benefits and shortcomings of my approach to encryption.

System Message: WARNING/2 (<string>, line 19)

Bullet list ends without a blank line; unexpected unindent.

> <br > - Secondly, we will setup the encrypted partition at a dummy mount

System Message: ERROR/3 (<string>, line 21)

Unexpected indentation.
point and check that it works.

System Message: WARNING/2 (<string>, line 22)

Block quote ends without a blank line; unexpected unindent.

> <br > - Thirdly, we will copy our files to the encrypted partition, set the

System Message: ERROR/3 (<string>, line 24)

Unexpected indentation.
encrypted partition to be mounted as /home and then shred the old unencrypted copies of our files.

Remember that I am web developer and part-time grad-student not a security expert so corrections and improvements will be heartily accepted, click here to leave a comment. In other words, despite the fact that it is the weekend so I haven't shaved today, it will take me quite a while to get the complete Bruce Schneier beard.

Don't rely on Security through Obscurity

Even before encryption, there was a certain amount of pseudo-security in my previously unencrypted setup. If you turn the laptop on, it boots Linux and then asks for a password.

So the thief has to really care enough about my data to get it. Firstly, all the data is stored on a native Linux filesystem that Windows-based cracking tools are unlikely to support. So they have to go and get a Linux-live CD. My subnotebook does not have legacy optical devices so they need an external CD drive too. Lastly, they need enough Linux knowledge to know how to mount my partitions and know the layout of the Linux filesystem, e.g. how to find the Mozilla password file or whatever.

A few years ago, this would have been such an unlikely scenario that one could have argued that it does not warrant any further security. And still today, in all likelihood a thief would just sell it on a soon as possible, statistically, these kind of petty thieves are often trying to feed a drug habit. However, they may sell the laptop on to criminal gangs who launder laptops by installing unauthorised copies of Windows and then selling them on ebay or wherever, these criminals would have no qualms about profiting from your private data.

Add in the fact that over the last year or two, Linux has become the second- most used Desktop operating system, with at least 2-3 Linux users for every Mac user, so it is good to start thinking about locking down our data as familiarity with Linux is becoming exponentially more commonplace.

No place like /home

There are various ways to go. Firstly, there is whole disk encryption. Do the whole lot. At the other end of the scale is making just a filestore for sensitive documents, and manually move documents into there that you want to be secured.

My priority is to protect myself from potential identity theft in the event of having another laptop stolen. So as my first step forward, I have decided to go for an encrypted /home partition. This will help protect my passwords, email and files with little or no discernible effect on performance.

Caveats to this approach

There are a few theoretical shortcomings with this approach. This only works if the thief steals the laptop while turned off. If the laptop is stolen while turned on, then the partition will be mounted, and the encryption itself can be compromised by reading RAM or swap. Even worse, if the swap is not cleared on shutdown, some data may be left there. However, the downside of encrypted swap is that it might break hibernation.

The second shortcoming is that the encryption keys are stored on the same computer as the encrypted data. One way around this would be to put the keys on a USB stick and not have them on the machine itself.

The problem with having the keys on the machine is that (in theory) the thief could take an image of your hard-disk, upload it to a supercomputer and then perform a dictionary based attack, eventually the supercomputer would guess the right password. It is perhaps unlikely that the thief has access to a supercomputer and the required cryptographic skills to pull this off. However, even if he has, then it still may take several weeks or more to break a strong password, by which time I could have changed all my passwords.

Thirdly, encryption is not a magic bullet, for example, this approach does nothing against attack from the network while your computer is on.

In summary, it won't stop the US National Security Agency, but it should foil an identity thief if my laptop is lost or stolen. So even after these caveats, my simple approach is still far superior to doing nothing.

`Continue at part two - creating an encrypted partition`_.

`Discuss this post - Leave a comment`_

Docutils System Messages

System Message: ERROR/3 (<string>, line 103); backlink

Unknown target name: "continue at part two - creating an encrypted partition".

System Message: ERROR/3 (<string>, line 105); backlink

Unknown target name: "discuss this post - leave a comment".

1 yoblin says...

linux is the second most-used operating system? I really don't think so:

http://itmanagement.earthweb.com/article.php/3704431

Posted at 5:48 p.m. on December 10, 2007


2 Zeth says...

Thinking doesn't matter, web hits on a selection of English corporate sites don't matter. A defensible methodology is what matters.

I have posted before about this and will post again so don't want to go through it here. Apple claims to have 22 million users, Linux has ~30-40 million in the English speaking world and Europe (many of which dual boot), plus an unknown number in the developing world (perhaps the same again).

Posted at 7:38 p.m. on December 10, 2007


What do you have to say?

Show Editing Help


PyCon UK

About

Hello, my name is Zeth, I'll be your host here.

Command Line Warriors is about taking control of your own technology, it looks at our experiences of computing; especially using GNU/Linux, the Python programming language, the command-line and issues such as techno-ethics, best practices and whatever is cool now. If you take control of your technology then you are a Warrior too!

This site is your site too which means that you can contribute and get involved. You can leave comments using the facility provided. For me, the comments and discussions are by far the best part of the site. So please do have your say!

Latest Discussions

deesha

September 8, 2008
hey all, i just wanted to check the other stuf if nay1 can help me what i want is i have to convert the line starting with my function name ...
Email Syntax Check in Python

Daniel Black

September 3, 2008
Hey, sounds good already. There's another Python script for command-line 140-character-messaging (won't call it "tweeting" for obvious reasons), Tweety Py, that's currently languishing. Not, I think, because the developer's disinterested, ...
Using new social networking service Identi.ca from the command line

Antonio Araujo

September 2, 2008
Dear friends, has anyone built debian packages of db xml 2.4.13? Best regards Antonio
Native XML storage with Berkeley DB XML - part one

Zeth

September 1, 2008
Thanks everyone for your different solutions, absolutely fantastic. I have tried them all. The one from Ciaran McCreesh was the one I was subconsciously groping for.
Sisu and typing unicode in GNOME

andylockran

September 1, 2008
In ubuntu, I do ctrl, and the functions to the right of my keyboard for extra characters. Such as: alt gr + ; + e for é I'll post more ...
Sisu and typing unicode in GNOME

Jinks

September 1, 2008
I am from Germany but i use an US-layout keyboard since that's a lot easier for most my programming needs. Now, having to also write the occassional german letter or ...
Sisu and typing unicode in GNOME

Toni

September 1, 2008
Hi, You might want to add an xkb keymap. Make backups before you begin ;) And sorry about formatting. in /usr/share/X11/xkb/symbols/gb, after "intl", add this: partial alphanumeric_keys xkb_symbols "intl_fi" { ...
Sisu and typing unicode in GNOME

Ciaran McCreesh

September 1, 2008
On a UK keyboard you do alt-gr+[ followed by a to get ä. You don't need the control key at all.
Sisu and typing unicode in GNOME

name

September 1, 2008
Hi!,
List files recursively by modified time

name

September 1, 2008
Hello!,
List files recursively by modified time

Leif

September 1, 2008
On my Norwegian keyboard, the diaeresis is easily accessible, like on Jani's Finnish one. It's one of the few keys that doesn't advance the cursor, along with the tilde, circumflex ...
Sisu and typing unicode in GNOME

Lornix

September 1, 2008
ä <= compose, ", a ö <= compose, ", o å <= compose, o, a Ä <= compose, ", A Ö <= compose, ", O Å <= compose, o, A ...
Sisu and typing unicode in GNOME

name

September 1, 2008
Good day!,
List files recursively by modified time