News stories announcing that some big institution lost backup tapes containing private data for millions of identities became pretty common nowadays. And it is hardly surprising considering that there is always room for mistake when number of tapes shuffled back and forth is large enough and performed frequently. What is surprising that the the take-up of encrypting the data before it is stored on tape is has not been very rapid at all -- it seems like the majority of tapes floating out there still have all the data on them in easily readable formats. Even though there is really a lot at stake each time you loose a tape (which with todays capacities can contain millions of records easily), the storage and archiving practices are historically slow and conservative in respect to reacting or embracing change. Even though on the scape of an enterprise-wide backup system the switch to encrypting data on tape is not a trivial exercise, on a smaller scale though encrypting the data before it hits the tape is very simple. On Solaris 10 for instance you already have all the tools you need to achieve this. Solaris 10 now ships with a wonderful crypto framework out of the box, which makes most of the encryption/decryption activities pretty much trivial.
In this case lets assume we want to encrypt all data produced by ufsdump while we backup some particular filesystem on our machine. For these purposes we will rely on arcfour algorithm supported by Solaris crypto framework. Arcfour is particularly well suited for this sort of task due to its comparative lightness in respect to CPU consumption needed to perform the encryption process. And in case of system backups this is particularly relevant -- you need the lightest encryption algo possible that is capable of doing the job when backing up gigabytes of data. Long story short, on Solaris you can be running secure encrypted back in almost no time flat without relying on any additional equipment or software. So here is how you can do it:
1. Create a 128 byte key to be used to encrypt and decrypt the data. You can create the key manually picking a sequence of bytes that makes sense to you, but otherwise a quick and more efficient way to do it is to generate a random key:
# dd=/dev/random bs=128 count=1 of=/etc/mykeys/backup.k
It goes without saying that after generating the key you should keep it secure.
2. After the key is generated you can immediately start using it to encrypt the backups going to tape:
# ufsdump 0f - /var | encrypt -a arcfour \
-k /etc/mykeys/backup.k | dd of=/dev/rmt/0
That's it, the data stored on tape will be secure from prying eyes, unless of course someone has your key. And you don't have to worry as much if the tape gets lost.
3. In order to decrypt and restore the data on tape you will have to use the same key:
# decrypt -a arcfour -k /etc/mykeys/backup.k \
-i /dev/rmt/0 | ufsrestore xvf -
Very easy and best of all it won't cost you a penny to implement this feature.