-
-
Notifications
You must be signed in to change notification settings - Fork 190
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add nonce support #202
Add nonce support #202
Conversation
vault/auth.go
Outdated
@@ -159,13 +160,25 @@ func (v *Vault) UserPassLogin() string { | |||
func (v *Vault) EC2Login() string { | |||
role := env.Getenv("VAULT_AUTH_AWS_ROLE") | |||
mount := env.Getenv("VAULT_AUTH_AWS_MOUNT", "aws") | |||
nonce := env.Getenv("VAULT_AUTH_AWS_NONCE") | |||
output := env.Getenv("VAULT_AUTH_AWS_NONCE_OUTPUT") | |||
perms := env.Getenv("VAULT_AUTH_AWS_NONCE_PERMISSION", "0666") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure I'm a fan of 0666
as a default permission since it'll be group/other read/writable. IMO 0600
is a safer default.
Also is there even a need for this to be configurable? I'm not sure I really see a use-case where someone would need to save a nonce that's world-readable, and can't simply chmod
it after gomplate
runs...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can change the default or make it non-configurable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, I'd rather make it explicitly 0600
lower down, and also remove the option to configure
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
@@ -159,13 +160,25 @@ func (v *Vault) UserPassLogin() string { | |||
func (v *Vault) EC2Login() string { | |||
role := env.Getenv("VAULT_AUTH_AWS_ROLE") | |||
mount := env.Getenv("VAULT_AUTH_AWS_MOUNT", "aws") | |||
nonce := env.Getenv("VAULT_AUTH_AWS_NONCE") | |||
output := env.Getenv("VAULT_AUTH_AWS_NONCE_OUTPUT") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if maybe naming this VAULT_AUTH_AWS_NONCE_FILE
would be better, and making it possible to provide a nonce via a file (the case where the file exists already), or save it to that path if it's nonexistant.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That should already work as it should be using the env lookup with _FILE support
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh! Good point. 🤔
In that case maybe _OUTPUT
is not so bad an idea... let's just leave this as-is for now.
@stuart-c looks like the integration tests are failing in CI:
|
Not sure why the integration test has started failing |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Me neither... I'll chalk it up to something timing-related, as I see it's passing now... Thanks for this PR! |
Great. Any chance of a new release? Thanks |
@stuart-c yup - I'll work on one soon! |
My previous AWS auth PR unfortunately had an omission - it didn't handle nonces. As a result it isn't possible to run gomplate a second time.
This PR fixes this oversight.