安全擦除 tmpfs 上的文件

安全擦除 tmpfs 上的文件

我有一个脚本,可以将一些数据解密到 tmpfs 中,该目录是安全的(权限),机器的交换已加密(启动时的随机密钥),并且当脚本完成时,它会对 tmpfs 上的明文进行 35 次擦除(Peter Gutmann)。

我这样做是因为我知道擦除日志文件系统上的文件是不安全的,数据可能会被恢复。

为了进行讨论,以下是提取的相关内容:

# make the tmpfs
mkdir /mnt/tmpfs
chmod 0700 /mnt/tmpfs
mount -t tmpfs -o size=1M tmpfs /mnt/tmpfs
cd /mnt/tmpfs

# decrypt the data
gpg -o - <crypted_input_file> | \
    tar -xjpf -

# do processing stuff

# wipe contents
find . -type f -exec bcwipe -I {} ';'

# nuke the tmpfs
cd ..
umount -f /mnt/tmpfs
rm -fR /mnt/tmpfs

因此,我的问题是,暂时假设没有人能够在 tmpfs 中读取它存在的明文(我使用 umask 将明文设置为 0600),上面的代码片段完成后,是否有任何方法可以将明文的痕迹保留在内存或磁盘上?

答案1

据我所知,在 tmpfs 上擦除和卸载不会留下任何有用的痕迹。但我对 bcwipe 不熟悉,所以我假设它会对 tmpfs 一视同仁。

相关内容