Allow receiver to override encryption properties in case of replication

Currently, the receiver fails to override the encryption
property for the plain replicated dataset with the error:
"cannot receive incremental stream: encryption property
'encryption' cannot be set for incremental streams.". The
problem is resolved by allowing the receiver to override
the encryption property for plain replicated send.

Signed-off-by: Ameer Hamza <ahamza@ixsystems.com>
This commit is contained in:
Ameer Hamza
2022-12-02 01:29:49 +05:00
committed by Brian Behlendorf
parent 2f2d6bece8
commit d0f350c962
2 changed files with 25 additions and 1 deletions
@@ -41,6 +41,9 @@ verify_runnable "both"
function cleanup
{
datasetexists $TESTPOOL/encrypted && \
destroy_dataset $TESTPOOL/encrypted -r
snapexists $snap && destroy_dataset $snap -f
snapexists $snap2 && destroy_dataset $snap2 -f
@@ -97,4 +100,15 @@ log_note "Verifying ZFS will not receive to an encrypted child when the" \
"parent key is unloaded"
log_mustnot eval "zfs send $snap | zfs receive $TESTPOOL/$TESTFS1/c4"
# Verify that replication can override encryption properties
log_note "Verifying replication can override encryption properties for plain dataset"
typeset key_location="/$TESTPOOL/pkey1"
log_must eval "echo $passphrase > $key_location"
log_must eval "zfs send -R $snap2 | zfs recv -s -F -o encryption=on" \
"-o keyformat=passphrase -o keylocation=file://$key_location" \
"-o mountpoint=none $TESTPOOL/encrypted"
log_must test "$(get_prop 'encryption' $TESTPOOL/encrypted)" != "off"
log_must test "$(get_prop 'keyformat' $TESTPOOL/encrypted)" == "passphrase"
log_must test "$(get_prop 'keylocation' $TESTPOOL/encrypted)" == "file://$key_location"
log_pass "ZFS can receive encrypted filesystems into child dataset"