sftp: Add option to disable remote hash check command execution

This commit is contained in:
Jon Fautley 2018-01-05 09:01:35 +00:00 committed by Nick Craig-Wood
parent 0eba37d8f3
commit 36e6d23112
2 changed files with 13 additions and 0 deletions

View File

@ -151,6 +151,10 @@ Modified times are used in syncing and are fully supported.
SFTP supports checksums if the same login has shell access and `md5sum`
or `sha1sum` as well as `echo` are in the remote's PATH.
This remote check can be disabled by setting the configuration option
`disable_hashcheck`. This may be required if you're connecting to SFTP servers
which are not under your control, and to which the execution of remote commands
is prohibited.
The only ssh agent supported under Windows is Putty's pageant.

View File

@ -70,6 +70,10 @@ func init() {
Help: "Enables the use of the aes128-cbc cipher.",
},
},
}, {
Name: "disable_hashcheck",
Help: "Disable the exectution of SSH commands to determine if remote file hashing is available, leave blank unless you know what you are doing.",
Optional: true,
}},
}
fs.Register(fsi)
@ -613,6 +617,11 @@ func (f *Fs) Hashes() fs.HashSet {
return *f.cachedHashes
}
hashcheckDisabled := fs.ConfigFileGetBool(f.name, "disable_hashcheck")
if hashcheckDisabled {
return fs.HashSet(fs.HashNone)
}
c, err := f.getSftpConnection()
if err != nil {
fs.Errorf(f, "Couldn't get SSH connection to figure out Hashes: %v", err)