diff options
| author | Eric Biggers <ebiggers@google.com> | 2021-12-23 11:39:08 -0600 |
|---|---|---|
| committer | Eric Biggers <ebiggers@google.com> | 2021-12-23 11:39:08 -0600 |
| commit | 57be034ce4700fb07c10b771628c1c63d8483d09 (patch) | |
| tree | 2e9bdfeb26f0d7379c6b6b4186125bd348982ee2 /cli-tests/t_encrypt_login.sh | |
| parent | 6ec8ee00398c435aba7cbb68f8246c1772e12908 (diff) | |
cli-tests: add helper functions to get protector descriptors
Diffstat (limited to 'cli-tests/t_encrypt_login.sh')
| -rwxr-xr-x | cli-tests/t_encrypt_login.sh | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/cli-tests/t_encrypt_login.sh b/cli-tests/t_encrypt_login.sh index e03122d..c42fec7 100755 --- a/cli-tests/t_encrypt_login.sh +++ b/cli-tests/t_encrypt_login.sh @@ -27,18 +27,13 @@ show_status() fi } -get_login_protector() -{ - fscrypt status "$dir" | awk '/login protector/{print $1}' -} - begin "Encrypt with login protector" chown "$TEST_USER" "$dir" _user_do "echo TEST_USER_PASS | fscrypt encrypt --quiet --source=pam_passphrase '$dir'" show_status true recovery_passphrase=$(grep -E '^ +[a-z]{20}$' "$dir/fscrypt_recovery_readme.txt" | sed 's/^ +//') -recovery_protector=$(fscrypt status "$dir" | awk '/Recovery passphrase/{print $1}') -login_protector=$(get_login_protector) +recovery_protector=$(_get_protector_descriptor "$MNT" custom 'Recovery passphrase for dir') +login_protector=$(_get_login_descriptor) _print_header "=> Lock, then unlock with login passphrase" _user_do "fscrypt lock '$dir'" # FIXME: should we be able to use $MNT:$login_protector here? @@ -63,7 +58,7 @@ begin "Encrypt with login protector as root" echo TEST_USER_PASS | fscrypt encrypt --quiet --source=pam_passphrase --user="$TEST_USER" "$dir" show_status true # The newly-created login protector should be owned by the user, not root. -login_protector=$(get_login_protector) +login_protector=$(_get_login_descriptor) owner=$(stat -c "%U:%G" "$MNT_ROOT/.fscrypt/protectors/$login_protector") echo -e "\nProtector is owned by $owner" |