简体   繁体   English

安全地还原ecryptfs加密备份

[英]securely restoring an ecryptfs encrypted backup

I'm using ecryptfs to backup the entire contents of my Ubuntu box to an external hard drive enclosure. 我正在使用ecryptfs将Ubuntu盒子的全部内容备份到外部硬盘驱动器机箱中。 I've followed this guide and have things properly backing-up and encrypted as I want. 我已按照指南进行操作,并根据需要正确备份和加密了内容。

That's all well and good until I have to actually use the encrypted backup, and that's got me wondering. 在我必须实际使用加密备份之前,一切都很好,这让我感到奇怪。 In the event that I lose my entire primary hard drive, what files/info should I readily have access to in order to de-crypt my backup? 如果我丢失了整个主硬盘驱动器,我应该可以访问哪些文件/信息来解密备份? Besides the options used to setup the initial encryption, are these the only two things I need:? 除了用于设置初始加密的选项之外,这些是我唯一需要的两件事吗?

  • passphrase 密码短语
  • sig key 信号键

For a backup, you might just need to remember the passphrase and the options you used to set up the encrypted folder, so everything in the example page you linked: 对于备份,您可能只需要记住密码短语和用于设置加密文件夹的选项,因此链接的示例页面中的所有内容:

To see the files again, just mount the directory with ecryptfs filesystem. 要再次查看文件,只需使用ecryptfs文件系统挂载目录。

 # mount -t ecryptfs /home/sk/unixmen/ /home/sk/unixmen/ Select key type to use for newly created files: 1) tspi 2) passphrase Selection: 2 <---- Type 2 and press enter Passphrase: <---- Enter the passphrase Select cipher: 1) aes: blocksize = 16; min keysize = 16; max keysize = 32 2) blowfish: blocksize = 8; min keysize = 16; max keysize = 56 3) des3_ede: blocksize = 8; min keysize = 24; max keysize = 24 4) twofish: blocksize = 16; min keysize = 16; max keysize = 32 5) cast6: blocksize = 16; min keysize = 16; max keysize = 32 6) cast5: blocksize = 8; min keysize = 5; max keysize = 16 Selection [aes]: <---- Press Enter Select key bytes: 1) 16 2) 32 3) 24 Selection [16]: <---- Press Enter Enable plaintext passthrough (y/n) [n]: <---- Press Enter Enable filename encryption (y/n) [n]: <---- Press Enter Attempting to mount with the following options: ecryptfs_unlink_sigs ecryptfs_key_bytes=16 ecryptfs_cipher=aes ecryptfs_sig=5c116acdf1d0dd89 Mounted eCryptfs 

The ecryptfs_sig is derived from the passphrase, so is really just to verify you've entered the right passphrase, not really essential to the mount command. ecryptfs_sig是从密码短语派生的,因此实际上只是为了验证您是否输入了正确的密码短语,对于mount命令而言,它并不是必不可少的。

I can't say I like the "Add your passphrase in this file" part of the automatic mount section, detracts from the security by having the passphrase in plain text. 我不能说我喜欢自动安装部分的“在此文件中添加密码”部分,因为密码以纯文本形式存在会降低安全性。 Your system can use eCryptFS & PAM to automatically mount encrypted folders on login, using your login passphrase to "wrap"/encrypt the eCryptFS key. 您的系统可以使用eCryptFS&PAM在登录时自动安装加密的文件夹,并使用登录密码“包装” /加密eCryptFS密钥。 See man ecryptfs & the man pages for it's tools, like ecryptfs-setup-private 有关工具,请参见man ecryptfs及其手册页,例如ecryptfs-setup-private

I found a much nicer solution, after struggling with the above for a couple of hours. 经过上述几个小时的努力,我找到了一个更好的解决方案。

sudo ecryptfs-recover-private

It's super simple to use, just run it and it will find your old private directory, then mount it in /tmp for you. 它非常易于使用,只需运行它,它将找到您的旧私有目录,然后为您将其安装在/tmp中。

From the man page: 从手册页:

ecryptfs-recover-private - find and mount any encrypted private directories ecryptfs-recover-private-查找并挂载任何加密的私有目录

This utility is intended to help eCryptfs recover data from their encrypted home or encrypted private partitions. 该实用程序旨在帮助eCryptfs从其加密的主分区或加密的专用分区中恢复数据。 It is useful to run this from a LiveISO or a recovery image. 从LiveISO或恢复映像运行此命令很有用。 It must run under sudo(8) or with root permission, in order to search the filesystem and perform the mounts. 它必须在sudo(8)或具有root权限下运行,以便搜索文件系统并执行挂载。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM