die man ext4 schreibt zu encrypt
encrypt
This ext4 feature provides file-system level encryption of data blocks and file names. The inode metadata (timestamps, file size, user/group ownership, etc.) is not encrypted.
This feature is most useful on file systems with multiple users, or where not all files should be encrypted. In many use cases, especially on single-user systems, encryption at the block device layer using dm-crypt may provide much better security.
Um das alles nutzen zu können, muss der Kernel (ab Version 4.1) mit EXT4 Encryption gebaut sein.
The process of encrypting a directory is quite simple and does not require any particular privilege other than owning the directory:
First ensure the directory is empty.
Open the directory and send an ioctl to assign it an encryption policy.
Insert the master key into the user session keyring. The key must be of logon type.
That's it. Now, every file you write inside that directory will be transparently encrypted on disk.
I wrote a userspace tool to create encrypted ext4 directories. You can download it from github.
To create an encrypted directory, simply do:
$ mkdir vault
$ ext4-crypt create vault
Enter passphrase:
Confirm passphrase:
vault: Encryption policy is now set.
$ ext4-crypt status vault
vault/: Encrypted directory
Policy version: 0
Filename cipher: aes-256-cts
Contents cipher: aes-256-xts
Filename padding: 4
Key descriptor: lkVZDRI6
Key serial: 524153968
You can then check the master key is properly assigned to your keyring and is not readable:
$ keyctl show
Session Keyring
813374732 --alswrv 1000 65534 keyring: _uid_ses.1000
758072319 --alswrv 1000 65534 \_ keyring: _uid.1000
524153968 --alsw-v 1000 1000 \_ logon: ext4:6c6b565a44524936
When the ext4 volume is mounted and no key is provided, filenames will appear as encrypted and reading or writing to files will be denied. You can access the directory contents by inserting the master key again into the keyring:
$ ls vault
,nCGhbNxWfdBfzffulophA 74XmRzli9dITlYBWLbpkTD CdJOUkfjKxzOd+0zYaO0GC
$ ext-crypt attach vault
Enter passphrase:
$ ls vault
Documents Downloads Music
Das alles habe ich
hier gefunden