1#!/bin/ksh -p 2# 3# CDDL HEADER START 4# 5# This file and its contents are supplied under the terms of the 6# Common Development and Distribution License ("CDDL"), version 1.0. 7# You may only use this file in accordance with the terms of version 8# 1.0 of the CDDL. 9# 10# A full copy of the text of the CDDL should have accompanied this 11# source. A copy of the CDDL is also available via the Internet at 12# http://www.illumos.org/license/CDDL. 13# 14# CDDL HEADER END 15# 16 17# 18# Copyright (c) 2017, Datto, Inc. All rights reserved. 19# 20 21. $STF_SUITE/include/libtest.shlib 22 23# 24# DESCRIPTION: 25# ZFS should perform unencrypted sends of encrypted datasets, unless the '-p' 26# or '-R' options are specified. 27# 28# STRATEGY: 29# 1. Create an encrypted dataset 30# 6. Create a child encryption root 31# 2. Snapshot the dataset 32# 3. Attempt a send 33# 4. Attempt a send with properties 34# 5. Attempt a replication send 35# 7. Unmount the parent and unload its key 36# 8. Attempt a send of the parent dataset 37# 9. Attempt a send of the child encryption root 38# 39 40verify_runnable "both" 41 42function cleanup 43{ 44 datasetexists $TESTPOOL/$TESTFS1 && \ 45 log_must zfs destroy -r $TESTPOOL/$TESTFS1 46} 47 48log_onexit cleanup 49 50log_assert "ZFS should perform unencrypted sends of encrypted datasets, " \ 51 "unless the '-p' or '-R' options are specified" 52 53typeset passphrase="password" 54typeset passphrase1="password1" 55typeset snap="$TESTPOOL/$TESTFS1@snap" 56 57log_must eval "echo $passphrase | zfs create -o encryption=on" \ 58 "-o keyformat=passphrase $TESTPOOL/$TESTFS1" 59 60log_must eval "echo $passphrase1 | zfs create -o encryption=on" \ 61 "-o keyformat=passphrase $TESTPOOL/$TESTFS1/child" 62 63log_must zfs snapshot -r $snap 64 65log_must eval "zfs send $snap > /dev/null" 66log_mustnot eval "zfs send -p $snap > /dev/null" 67log_mustnot eval "zfs send -R $snap > /dev/null" 68 69log_must zfs unmount $TESTPOOL/$TESTFS1 70log_must zfs unload-key $TESTPOOL/$TESTFS1 71 72log_mustnot eval "zfs send $snap > /dev/null" 73log_must eval "zfs send $TESTPOOL/$TESTFS1/child@snap > /dev/null" 74 75log_pass "ZFS performs unencrypted sends of encrypted datasets, unless the" \ 76 "'-p' or '-R' options are specified" 77