s3: make --s3-v2-auth flag

This is an alternative to setting the region to "other-v2-signature"
which is inconvenient for multi-region providers.
This commit is contained in:
Nick Craig-Wood 2018-10-09 13:03:37 +01:00
parent 06922674c8
commit 0f02c9540c
2 changed files with 26 additions and 1 deletions

View File

@ -582,6 +582,16 @@ for more info.
Some providers (eg Aliyun OSS or Netease COS) require this set to false.`,
Default: true,
Advanced: true,
}, {
Name: "v2_auth",
Help: `If true use v2 authentication.
If this is false (the default) then rclone will use v4 authentication.
If it is set then rclone will use v2 authentication.
Use this only if v4 signatures don't work, eg pre Jewel/v10 CEPH.`,
Default: false,
Advanced: true,
}},
})
}
@ -616,6 +626,7 @@ type Options struct {
SessionToken string `config:"session_token"`
UploadConcurrency int `config:"upload_concurrency"`
ForcePathStyle bool `config:"force_path_style"`
V2Auth bool `config:"v2_auth"`
}
// Fs represents a remote s3 server
@ -790,7 +801,7 @@ func s3Connection(opt *Options) (*s3.S3, *session.Session, error) {
// awsConfig.WithLogLevel(aws.LogDebugWithSigning)
ses := session.New()
c := s3.New(ses, awsConfig)
if opt.Region == "other-v2-signature" {
if opt.V2Auth || opt.Region == "other-v2-signature" {
fs.Debugf(nil, "Using v2 auth")
signer := func(req *request.Request) {
// Ignore AnonymousCredentials object

View File

@ -894,6 +894,20 @@ Some providers (eg Aliyun OSS or Netease COS) require this set to false.
- Type: bool
- Default: true
#### --s3-v2-auth
If true use v2 authentication.
If this is false (the default) then rclone will use v4 authentication.
If it is set then rclone will use v2 authentication.
Use this only if v4 signatures don't work, eg pre Jewel/v10 CEPH.
- Config: v2_auth
- Env Var: RCLONE_S3_V2_AUTH
- Type: bool
- Default: false
<!--- autogenerated options stop -->
### Anonymous access to public buckets ###