2
2
mirror of https://github.com/octoleo/restic.git synced 2024-11-11 15:51:02 +00:00

Change priority of AWS credential providers to accept AWS_SESSION_TOKEN

This commit is contained in:
denis.uzvik 2018-03-04 19:26:06 +02:00
parent ab7a3a803d
commit 6bb1bcce03
2 changed files with 9 additions and 1 deletions

View File

@ -0,0 +1,8 @@
Enhancement: Change priority of AWS credential providers to accept AWS_SESSION_TOKEN
Before, it was not possible to use s3 backend with AWS temporary security credentials(with AWS_SESSION_TOKEN).
This change gives higher priority to credentials.EnvAWS credentials provider.
https://github.com/restic/restic/issues/1477
https://github.com/restic/restic/pull/1479
https://github.com/restic/restic/pull/1647

View File

@ -48,6 +48,7 @@ func open(cfg Config, rt http.RoundTripper) (*Backend, error) {
// AWS env variables such as AWS_ACCESS_KEY_ID // AWS env variables such as AWS_ACCESS_KEY_ID
// Minio env variables such as MINIO_ACCESS_KEY // Minio env variables such as MINIO_ACCESS_KEY
creds := credentials.NewChainCredentials([]credentials.Provider{ creds := credentials.NewChainCredentials([]credentials.Provider{
&credentials.EnvAWS{},
&credentials.Static{ &credentials.Static{
Value: credentials.Value{ Value: credentials.Value{
AccessKeyID: cfg.KeyID, AccessKeyID: cfg.KeyID,
@ -59,7 +60,6 @@ func open(cfg Config, rt http.RoundTripper) (*Backend, error) {
Transport: http.DefaultTransport, Transport: http.DefaultTransport,
}, },
}, },
&credentials.EnvAWS{},
&credentials.EnvMinio{}, &credentials.EnvMinio{},
}) })
client, err := minio.NewWithCredentials(cfg.Endpoint, creds, !cfg.UseHTTP, "") client, err := minio.NewWithCredentials(cfg.Endpoint, creds, !cfg.UseHTTP, "")