Skip to content
This repository has been archived by the owner on Jan 25, 2023. It is now read-only.

Improve docs for vault iam auth #104

Merged
merged 2 commits into from
Oct 19, 2018
Merged

Improve docs for vault iam auth #104

merged 2 commits into from
Oct 19, 2018

Conversation

Etiene
Copy link
Contributor

@Etiene Etiene commented Oct 17, 2018

No description provided.

Copy link
Collaborator

@brikis98 brikis98 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice improvements 👍

# AWS credentials.
# AWS credentials. It was modified from the python 2.x example published by
# J. Thompson, the author of the Vault IAM auth method, at the vault support
# mailing list.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Link?

@@ -57,28 +50,48 @@ of the Vault nodes.

### Vault Authentication using IAM user or role

To read more about Vault IAM auth, refer to [Vault AWS Auth documentation][aws_auth].
IAM auth is a process in which Vault leverages on AWS STS (Security Token Service) to
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need for the word "on"

[`ec2` auth method example][ec2_example].

The workflow is that the client trying to authenticate will create a request to
the method `GetCallerIdentity` of the AWS STS API. This method basically answers
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

create a request (but not send!)

the STS request without actually knowing the contents of the signed part. It then
receives a response from STS identifying who signed it, which the Vault Server then
can check against the ARN of the IAM principal bounded to a previously created Vault
Role and decide if it should be allowed to authenticate or not.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe because it's not my first time reading it, but I find your explanation clearer than the Vault docs 👍

#### With an HTTP request

The [vault-consul-ami][vault_consul_ami] includes a [python script][py_sign] called
`sign-request.py`. We use python here instead of bash so we take advantage of the
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/so we take/to take/


The [vault-consul-ami][vault_consul_ami] includes a [python script][py_sign] called
`sign-request.py`. We use python here instead of bash so we take advantage of the
`boto3` AWS SDK library. This script is a modified version of the Python 2.x example
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(the same pattern should work with the AWS SDK in any other supported language such as Go, Java, Ruby, ...)

creds=$(curl http://169.254.169.254/latest/meta-data/iam/security-credentials/<AWS-IAM-ROLE-NAME>)
export AWS_ACCESS_KEY_ID=$(echo $creds | jq -r .AccessKeyId)
export AWS_SECRET_ACCESS_KEY=$(echo $creds | jq -r .SecretAccessKey)
export AWS_SESSION_TOKEN=$(echo $creds | jq -r .Token)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm, are you sure you have to extract AWS creds from EC2 metadata here? All the AWS SDK tools I've ever used (which includes Vault) know to look for these creds automatically, with you having to set those env vars.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried without this and I didn't succeed, maybe the fault was on me or something I did and it should have worked? Hm... Maybe I'll try again

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

duh, I was passing the iam role name instead of the vault role name 🤦‍♀️

@Etiene
Copy link
Contributor Author

Etiene commented Oct 19, 2018

Notify
@infosecgithub
@bgt101

@Etiene Etiene merged commit 141f576 into master Oct 19, 2018
@Etiene Etiene deleted the docs/iam-auth branch October 19, 2018 13:22
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants