Implementing support for ssh_config(5) files
This commit is contained in:
parent
9564454d74
commit
c151703837
10
syncoid
10
syncoid
|
@ -20,9 +20,9 @@ my $pvoptions = "-p -t -e -r -b";
|
||||||
|
|
||||||
# Blank defaults to use ssh client's default
|
# Blank defaults to use ssh client's default
|
||||||
# TODO: Merge into a single "sshflags" option?
|
# TODO: Merge into a single "sshflags" option?
|
||||||
my %args = ('sshkey' => '', 'sshport' => '', 'sshcipher' => '', 'sshoption' => [], 'target-bwlimit' => '', 'source-bwlimit' => '');
|
my %args = ('sshconfig' => '', 'sshkey' => '', 'sshport' => '', 'sshcipher' => '', 'sshoption' => [], 'target-bwlimit' => '', 'source-bwlimit' => '');
|
||||||
GetOptions(\%args, "no-command-checks", "monitor-version", "compress=s", "dumpsnaps", "recursive|r", "sendoptions=s", "recvoptions=s",
|
GetOptions(\%args, "no-command-checks", "monitor-version", "compress=s", "dumpsnaps", "recursive|r", "sendoptions=s", "recvoptions=s",
|
||||||
"source-bwlimit=s", "target-bwlimit=s", "sshkey=s", "sshport=i", "sshcipher|c=s", "sshoption|o=s@",
|
"source-bwlimit=s", "target-bwlimit=s", "sshconfig=s", "sshkey=s", "sshport=i", "sshcipher|c=s", "sshoption|o=s@",
|
||||||
"debug", "quiet", "no-stream", "no-sync-snap", "no-resume", "exclude=s@", "skip-parent", "identifier=s",
|
"debug", "quiet", "no-stream", "no-sync-snap", "no-resume", "exclude=s@", "skip-parent", "identifier=s",
|
||||||
"no-clone-handling", "no-privilege-elevation", "force-delete", "no-clone-rollback", "no-rollback",
|
"no-clone-handling", "no-privilege-elevation", "force-delete", "no-clone-rollback", "no-rollback",
|
||||||
"create-bookmark", "pv-options=s" => \$pvoptions, "keep-sync-snap", "preserve-recordsize",
|
"create-bookmark", "pv-options=s" => \$pvoptions, "keep-sync-snap", "preserve-recordsize",
|
||||||
|
@ -108,6 +108,9 @@ if (length $args{'sshcipher'}) {
|
||||||
if (length $args{'sshport'}) {
|
if (length $args{'sshport'}) {
|
||||||
$args{'sshport'} = "-p $args{'sshport'}";
|
$args{'sshport'} = "-p $args{'sshport'}";
|
||||||
}
|
}
|
||||||
|
if (length $args{'sshconfig'}) {
|
||||||
|
$args{'sshconfig'} = "-F $args{'sshconfig'}";
|
||||||
|
}
|
||||||
if (length $args{'sshkey'}) {
|
if (length $args{'sshkey'}) {
|
||||||
$args{'sshkey'} = "-i $args{'sshkey'}";
|
$args{'sshkey'} = "-i $args{'sshkey'}";
|
||||||
}
|
}
|
||||||
|
@ -125,7 +128,7 @@ if (length $args{'identifier'}) {
|
||||||
}
|
}
|
||||||
|
|
||||||
# figure out if source and/or target are remote.
|
# figure out if source and/or target are remote.
|
||||||
$sshcmd = "$sshcmd $args{'sshcipher'} $sshoptions $args{'sshport'} $args{'sshkey'}";
|
$sshcmd = "$sshcmd $args{'sshconfig'} $args{'sshcipher'} $sshoptions $args{'sshport'} $args{'sshkey'}";
|
||||||
if ($debug) { print "DEBUG: SSHCMD: $sshcmd\n"; }
|
if ($debug) { print "DEBUG: SSHCMD: $sshcmd\n"; }
|
||||||
my ($sourcehost,$sourcefs,$sourceisroot) = getssh($rawsourcefs);
|
my ($sourcehost,$sourcefs,$sourceisroot) = getssh($rawsourcefs);
|
||||||
my ($targethost,$targetfs,$targetisroot) = getssh($rawtargetfs);
|
my ($targethost,$targetfs,$targetisroot) = getssh($rawtargetfs);
|
||||||
|
@ -1978,6 +1981,7 @@ Options:
|
||||||
--exclude=REGEX Exclude specific datasets which match the given regular expression. Can be specified multiple times
|
--exclude=REGEX Exclude specific datasets which match the given regular expression. Can be specified multiple times
|
||||||
--sendoptions=OPTIONS Use advanced options for zfs send (the arguments are filtered as needed), e.g. syncoid --sendoptions="Lc e" sets zfs send -L -c -e ...
|
--sendoptions=OPTIONS Use advanced options for zfs send (the arguments are filtered as needed), e.g. syncoid --sendoptions="Lc e" sets zfs send -L -c -e ...
|
||||||
--recvoptions=OPTIONS Use advanced options for zfs receive (the arguments are filtered as needed), e.g. syncoid --recvoptions="ux recordsize o compression=lz4" sets zfs receive -u -x recordsize -o compression=lz4 ...
|
--recvoptions=OPTIONS Use advanced options for zfs receive (the arguments are filtered as needed), e.g. syncoid --recvoptions="ux recordsize o compression=lz4" sets zfs receive -u -x recordsize -o compression=lz4 ...
|
||||||
|
--sshconfig=FILE Specifies an ssh_config(5) file to be used
|
||||||
--sshkey=FILE Specifies a ssh key to use to connect
|
--sshkey=FILE Specifies a ssh key to use to connect
|
||||||
--sshport=PORT Connects to remote on a particular port
|
--sshport=PORT Connects to remote on a particular port
|
||||||
--sshcipher|c=CIPHER Passes CIPHER to ssh to use a particular cipher set
|
--sshcipher|c=CIPHER Passes CIPHER to ssh to use a particular cipher set
|
||||||
|
|
Loading…
Reference in New Issue