berke/wipe — pull request #2 by tyll (2013-10-15 09:07:58+00:00)
Title: Properly overwrite filenames

This patch is based on the source of shred from coreutils by Colin Plumb.
While shred is now licensed under GPLv3, the parts of this patch that were
derived from shred could easily be changed to a version of shred
(git commit cad884a) that was licensed under GPLv2 or later.

Note that this patch only keeps the filename from being readable in the
filesystem structure. For journaling fileystems, such as ext{3,4}, the
filename is still retained in the journal.

Testcase:
$ dd if=/dev/zero bs=1M count=256 of=wipeimagefile-ext2.bin;
$ losetup /dev/loop2 wipeimagefile-ext2.bin;
$ mkfs.ext2 /dev/loop2;
$ mkdir /mnt/wipetest;
$ mount /dev/loop2 /mnt/wipetest;
$ echo "very secret data that should be deleted after use" > /mnt/wipetest/secretfile.txt;
$ wipe -fc /mnt/wipetest/secretfile.txt;
$ umount /mnt/wipetest;
$ losetup -d /dev/loop2;
$ rmdir /mnt/wipetest;
$ fls wipeimagefile-ext2.bin
wipeimagefile-ext2.bin
d/d 11: lost+found
r/- * 0: secretfile.txt
r/- * 0: 4hv06IB9SyTgVt
d/d 2561: $OrphanFiles