nh2*_*nh2 5 encryption trim hibernate swap 13.10
我想在 Ubuntu 13.10 上设置磁盘加密,以便我有
//home分区正如这些要求所表明的,这是为了保护我免受潜在的笔记本电脑窃贼读取我的个人数据的影响。由于/未加密,它无法防止有人拿走笔记本电脑、安装键盘记录器并将其还给我。
我已经阅读了EnableHibernateWithEncryptedSwap但它是为 Ubuntu 12.04 编写的,我不确定它是否仍然有效或者是推荐的方式。
最新的设置是什么?
我成功地设置了一个加密的家庭和加密的交换与工作休眠。
我使用uswsusp并很大程度上遵循了这篇文章- 仍然适用于 Ubuntu 13.10。
apt-get install uswsusp,Ubuntu 自动切换pm-hibernate为使用 uswsusp,因此所有 GUI 工具也都使用它。我的设置的一些部分:
创建加密分区
# For /home
sudo cryptsetup --cipher aes-xts-plain --key-size 256 --hash sha512 --use-random --verify-passphrase luksFormat /dev/sdb2
# For swap
sudo cryptsetup --cipher aes-xts-plain --key-size 256 --hash sha512 --use-random --verify-passphrase luksFormat /dev/sdb3
Run Code Online (Sandbox Code Playgroud)
我使用aes-xts-plain它是因为它是最快的cryptsetup benchmark(仅适用于 cryptsetup >= 1.6)。许多指南都使用aes-cbc-essiv,但从我到目前为止所读到的内容来看,它xts同样可以防止水印cbc-essiv。如果您使用的分区 >= 2TB,则应aes-xts-plain64使用-plain. 有关这些选项和选择的更多信息可以在此处找到。
创建这些分区后,您当然必须在它们上创建相应的文件系统,例如使用mkswap /dev/mapper/cryptoposwap 和mkfs.ext4 /dev/mapper/cryptohome。
/etc/crypttab
cryptohome /dev/disk/by-uuid/8cef7fd1-cceb-4a4a-9902-cb9a5805643c none luks,discard
cryptoswap /dev/disk/by-uuid/a99c196d-55df-460f-a162-00c4ea6d46e6 none luks,discard
Run Code Online (Sandbox Code Playgroud)
/etc/fstab
UUID=a4a2187d-a2d2-4a4c-9746-be511c151296 / ext4 errors=remount-ro 0 1
/dev/mapper/cryptoswap none swap sw,discard 0 0
/dev/mapper/cryptohome /home ext4 discard 0 2
Run Code Online (Sandbox Code Playgroud)
discard这两个选项crypttab并fstab为我正在使用的 SSD 启用 TRIM。/etc/initramfs-tools/conf.d/resume从旧的交换 UUID 调整为新的,/dev/mapper/cryptoswap以消除 处的警告update-initramfs -u -k all。这仍然与EnableHibernateWithEncryptedSwap/usr/share/initramfs-tools/scripts/local-top/cryptroot非常相似,但看起来我不必编辑/etc/acpi/hibernate.sh(如果您有提示为什么需要它,请发表评论 - 也许区别在于此设置使用uswsusp?)。