3 # This file and its contents are supplied under the terms of the
4 # Common Development and Distribution License ("CDDL"), version 1.0.
5 # You may only use this file in accordance with the terms of version
8 # A full copy of the text of the CDDL should have accompanied this
9 # source. A copy of the CDDL is also available via the Internet at
10 # http://www.illumos.org/license/CDDL.
14 # Copyright (c) 2018 by Datto Inc.
15 # All rights reserved.
18 .
$STF_SUITE/include
/libtest.shlib
19 .
$STF_SUITE/tests
/functional
/fault
/fault.cfg
23 # Test that injected decryption errors are handled correctly.
26 # 1. Create an encrypted dataset with a test file
27 # 2. Inject decryption errors on the file 20% of the time
28 # 3. Read the file to confirm that errors are handled correctly
29 # 4. Confirm that the decryption injection was added to the ZED logs
32 log_assert
"Testing that injected decryption errors are handled correctly"
36 log_must zinject
-c all
37 default_cleanup_noexit
42 default_mirror_setup_noexit
$DISK1 $DISK2
43 log_must
eval "echo 'password' | zfs create -o encryption=on \
44 -o keyformat=passphrase -o keylocation=prompt $TESTPOOL/fs"
45 mntpt
=$
(get_prop mountpoint
$TESTPOOL/fs
)
46 log_must mkfile
32M
$mntpt/file1
48 log_must zinject
-a -t data
-e decrypt
-f 20 $mntpt/file1
49 log_must zfs umount
$TESTPOOL/fs
50 log_must zfs mount
$TESTPOOL/fs
52 log_mustnot
eval "cat $mntpt/file1 > /dev/null"
53 log_must
eval "zpool events $TESTPOOL | grep -q 'authentication'"
55 log_pass
"Injected decryption errors are handled correctly"