From b824d62449e8e4fbd72e25e9811c086c15fac2d7 Mon Sep 17 00:00:00 2001 From: Steven Brudenell Date: Fri, 6 May 2022 11:06:19 -0800 Subject: [PATCH] btrbk: support multiple gpg recipients --- btrbk | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/btrbk b/btrbk index d49c87d..14d3aa4 100755 --- a/btrbk +++ b/btrbk @@ -124,7 +124,7 @@ my %config_options = ( raw_target_block_size => { default => "128K", accept => [ qr/[0-9]+[kmgKMG]?/ ] }, raw_target_split => { default => undef, accept => [qw( no ), qr/[0-9]+([kmgtpezyKMGTPEZY][bB]?)?/ ] }, gpg_keyring => { default => undef, accept_file => { absolute => 1 } }, - gpg_recipient => { default => undef, accept => [ qr/[0-9a-zA-Z_@\+\-\.]+/ ] }, + gpg_recipient => { default => undef, accept => [ qr/[0-9a-zA-Z_@\+\-\.]+/ ], split => 1 }, openssl_ciphername => { default => "aes-256-cbc", accept => [ qr/[0-9a-zA-Z\-]+/ ] }, openssl_iv_size => { default => undef, accept => [qw( no ), qr/[0-9]+/ ] }, openssl_keyfile => { default => undef, accept_file => { absolute => 1 } }, @@ -1750,7 +1750,9 @@ sub btrfs_send_to_file($$$;$$) my @gpg_options = ( '--batch', '--no-tty', '--no-random-seed-file', '--trust-model', 'always' ); push @gpg_options, ( '--compress-algo', 'none' ) if($compress); # NOTE: if --compress-algo is not set, gpg might still compress according to OpenPGP standard. push(@gpg_options, ( '--no-default-keyring', '--keyring', { unsafe => $encrypt->{keyring} } )) if($encrypt->{keyring}); - push(@gpg_options, ( '--default-recipient', $encrypt->{recipient} )) if($encrypt->{recipient}); + foreach(@$encrypt->{recipient} // []) { + push(@gpg_options, ('--recipient', $_)); + } push @cmd_pipe, { cmd => [ 'gpg', @gpg_options, '--encrypt' ], compressed_ok => ($compress ? 1 : 0),