Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
小 白蛋
Vault
Commits
9aa89b5b
Unverified
Commit
9aa89b5b
authored
5 years ago
by
Jim Kalafut
Committed by
GitHub
5 years ago
Browse files
Options
Download
Email Patches
Plain Diff
Add region parameter to AWS agent auto auth (#7632) (#7651)
parent
41ad1d2c
Branches unavailable
v1.2.7
v1.2.6
v1.2.5
v1.2.4
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
command/agent/auth/aws/aws.go
+12
-1
command/agent/auth/aws/aws.go
with
12 additions
and
1 deletion
+12
-1
command/agent/auth/aws/aws.go
+
12
-
1
View file @
9aa89b5b
...
...
@@ -19,6 +19,7 @@ import (
"github.com/hashicorp/vault/api"
awsauth
"github.com/hashicorp/vault/builtin/credential/aws"
"github.com/hashicorp/vault/command/agent/auth"
"github.com/hashicorp/vault/helper/awsutil"
)
const
(
...
...
@@ -45,6 +46,7 @@ type awsMethod struct {
mountPath
string
role
string
headerValue
string
region
string
// These are used to share the latest creds safely across goroutines.
credLock
sync
.
Mutex
...
...
@@ -70,6 +72,7 @@ func NewAWSAuthMethod(conf *auth.AuthConfig) (auth.AuthMethod, error) {
mountPath
:
conf
.
MountPath
,
credsFound
:
make
(
chan
struct
{}),
stopCh
:
make
(
chan
struct
{}),
region
:
awsutil
.
DefaultRegion
,
}
typeRaw
,
ok
:=
conf
.
Config
[
"type"
]
...
...
@@ -142,6 +145,14 @@ func NewAWSAuthMethod(conf *auth.AuthConfig) (auth.AuthMethod, error) {
}
}
regionRaw
,
ok
:=
conf
.
Config
[
"region"
]
if
ok
{
a
.
region
,
ok
=
regionRaw
.
(
string
)
if
!
ok
{
return
nil
,
errors
.
New
(
"could not convert 'region' value into string"
)
}
}
if
a
.
authType
==
typeIAM
{
// Check for an optional custom frequency at which we should poll for creds.
...
...
@@ -246,7 +257,7 @@ func (a *awsMethod) Authenticate(ctx context.Context, client *api.Client) (retTo
defer
a
.
credLock
.
Unlock
()
var
err
error
data
,
err
=
awsauth
.
GenerateLoginData
(
a
.
lastCreds
,
a
.
headerValue
,
""
)
data
,
err
=
awsauth
.
GenerateLoginData
(
a
.
lastCreds
,
a
.
headerValue
,
a
.
region
)
if
err
!=
nil
{
retErr
=
errwrap
.
Wrapf
(
"error creating login value: {{err}}"
,
err
)
return
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment
Menu
Projects
Groups
Snippets
Help