| 1 |
|
| 2 |
# Set policy_version 1 |
| 3 |
|
| 4 |
# Try to encrypt as root |
| 5 |
[ERROR] fscrypt encrypt: user must be specified when run as root |
| 6 |
|
| 7 |
When running this command as root, you usually still want to provision/remove |
| 8 |
keys for a normal user's keyring and use a normal user's login passphrase as a |
| 9 |
protector (so the corresponding files will be accessible for that user). This |
| 10 |
can be done with --user=USERNAME. To use the root user's keyring or passphrase, |
| 11 |
use --user=root. |
| 12 |
|
| 13 |
# Try to use --user=root as user |
| 14 |
[ERROR] fscrypt encrypt: could not access user keyring for "root": setting uids: |
| 15 |
operation not permitted |
| 16 |
|
| 17 |
You can only use --user=USERNAME to access the user keyring of another user if |
| 18 |
you are running as root. |
| 19 |
|
| 20 |
# Try to encrypt without user keyring in session keyring |
| 21 |
[ERROR] fscrypt encrypt: user keyring for "fscrypt-test-user" is not linked into |
| 22 |
the session keyring |
| 23 |
|
| 24 |
This is usually the result of a bad PAM configuration. Either correct the |
| 25 |
problem in your PAM stack, enable pam_keyinit.so, or run "keyctl link @u @s". |
| 26 |
|
| 27 |
# Encrypt a directory |
| 28 |
|
| 29 |
# Get dir status as user |
| 30 |
"MNT/dir" is encrypted with fscrypt. |
| 31 |
|
| 32 |
Policy: desc1 |
| 33 |
Options: padding:32 contents:AES_256_XTS filenames:AES_256_CTS policy_version:1 |
| 34 |
Unlocked: Yes |
| 35 |
|
| 36 |
Protected with 1 protector: |
| 37 |
PROTECTOR LINKED DESCRIPTION |
| 38 |
desc2 No custom protector "prot" |
| 39 |
|
| 40 |
# Get dir status as root |
| 41 |
"MNT/dir" is encrypted with fscrypt. |
| 42 |
|
| 43 |
Policy: desc1 |
| 44 |
Options: padding:32 contents:AES_256_XTS filenames:AES_256_CTS policy_version:1 |
| 45 |
Unlocked: Partially (incompletely locked, or unlocked by another user) |
| 46 |
|
| 47 |
Protected with 1 protector: |
| 48 |
PROTECTOR LINKED DESCRIPTION |
| 49 |
desc2 No custom protector "prot" |
| 50 |
|
| 51 |
# Create files in v1-encrypted directory |
| 52 |
|
| 53 |
# Try to lock v1-encrypted directory as user |
| 54 |
[ERROR] fscrypt lock: inode cache can only be dropped as root |
| 55 |
|
| 56 |
Either this command should be run as root to properly clear the inode cache, or |
| 57 |
it should be run with --drop-caches=false (this may leave encrypted files and |
| 58 |
directories in an accessible state). |
| 59 |
"MNT/dir" is encrypted with fscrypt. |
| 60 |
|
| 61 |
Policy: desc1 |
| 62 |
Options: padding:32 contents:AES_256_XTS filenames:AES_256_CTS policy_version:1 |
| 63 |
Unlocked: Yes |
| 64 |
|
| 65 |
Protected with 1 protector: |
| 66 |
PROTECTOR LINKED DESCRIPTION |
| 67 |
desc2 No custom protector "prot" |
| 68 |
|
| 69 |
# Try to lock v1-encrypted directory as root without --user |
| 70 |
[ERROR] fscrypt lock: user must be specified when run as root |
| 71 |
|
| 72 |
When running this command as root, you usually still want to provision/remove |
| 73 |
keys for a normal user's keyring and use a normal user's login passphrase as a |
| 74 |
protector (so the corresponding files will be accessible for that user). This |
| 75 |
can be done with --user=USERNAME. To use the root user's keyring or passphrase, |
| 76 |
use --user=root. |
| 77 |
"MNT/dir" is encrypted with fscrypt. |
| 78 |
|
| 79 |
Policy: desc1 |
| 80 |
Options: padding:32 contents:AES_256_XTS filenames:AES_256_CTS policy_version:1 |
| 81 |
Unlocked: Yes |
| 82 |
|
| 83 |
Protected with 1 protector: |
| 84 |
PROTECTOR LINKED DESCRIPTION |
| 85 |
desc2 No custom protector "prot" |
| 86 |
|
| 87 |
# Lock v1-encrypted directory |
| 88 |
Encrypted data removed from filesystem cache. |
| 89 |
"MNT/dir" is now locked. |
| 90 |
"MNT/dir" is encrypted with fscrypt. |
| 91 |
|
| 92 |
Policy: desc1 |
| 93 |
Options: padding:32 contents:AES_256_XTS filenames:AES_256_CTS policy_version:1 |
| 94 |
Unlocked: No |
| 95 |
|
| 96 |
Protected with 1 protector: |
| 97 |
PROTECTOR LINKED DESCRIPTION |
| 98 |
desc2 No custom protector "prot" |
| 99 |
cat: MNT/dir/file: No such file or directory |
| 100 |
|
| 101 |
# Testing incompletely locking v1-encrypted directory |
| 102 |
Enter custom passphrase for protector "prot": "MNT/dir" is now unlocked and ready for use. |
| 103 |
Encrypted data removed from filesystem cache. |
| 104 |
[ERROR] fscrypt lock: Directory was incompletely locked because some files are |
| 105 |
still open. These files remain accessible. |
| 106 |
|
| 107 |
Try killing any processes using files in the directory, for example using: |
| 108 |
|
| 109 |
find "MNT/dir" -print0 | xargs -0 fuser -k |
| 110 |
|
| 111 |
Then re-run: |
| 112 |
|
| 113 |
fscrypt lock "MNT/dir" |
| 114 |
"MNT/dir" is encrypted with fscrypt. |
| 115 |
|
| 116 |
Policy: desc1 |
| 117 |
Options: padding:32 contents:AES_256_XTS filenames:AES_256_CTS policy_version:1 |
| 118 |
Unlocked: Partially (incompletely locked, or unlocked by another user) |
| 119 |
|
| 120 |
Protected with 1 protector: |
| 121 |
PROTECTOR LINKED DESCRIPTION |
| 122 |
desc2 No custom protector "prot" |
| 123 |
ext4 filesystem "MNT" has 1 protector and 1 policy (only including ones owned by fscrypt-test-user or root). |
| 124 |
All users can create fscrypt metadata on this filesystem. |
| 125 |
|
| 126 |
PROTECTOR LINKED DESCRIPTION |
| 127 |
desc2 No custom protector "prot" |
| 128 |
|
| 129 |
POLICY UNLOCKED PROTECTORS |
| 130 |
desc1 No desc2 |
| 131 |
|
| 132 |
# Finishing locking v1-encrypted directory |
| 133 |
Encrypted data removed from filesystem cache. |
| 134 |
"MNT/dir" is now locked. |
| 135 |
"MNT/dir" is encrypted with fscrypt. |
| 136 |
|
| 137 |
Policy: desc1 |
| 138 |
Options: padding:32 contents:AES_256_XTS filenames:AES_256_CTS policy_version:1 |
| 139 |
Unlocked: No |
| 140 |
|
| 141 |
Protected with 1 protector: |
| 142 |
PROTECTOR LINKED DESCRIPTION |
| 143 |
desc2 No custom protector "prot" |
| 144 |
cat: MNT/dir/file: No such file or directory |