Skip to content
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 the ability to restrict token usage by IP. Add to token roles. #4412

Merged
merged 1 commit into from
Apr 21, 2018

Conversation

jefferai
Copy link
Member

Fixes #815

@jefferai jefferai added this to the 0.10.1 milestone Apr 20, 2018
break
}
}
if !valid {
Copy link
Member

Choose a reason for hiding this comment

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

Can we add a server log entry here indicating the reason for failure? It otherwise may be hard to find out the cause for the denial. Or, how about a new error to indicate that this is from a CIDR check failure?

Copy link
Member Author

Choose a reason for hiding this comment

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

We don't do that for any other type of authorization denied. If we're going to start naming types (which I'm not convinced we should do) then we should do it throughout.

for _, v := range boundCIDRs {
parsedCIDR, err := sockaddr.NewSockAddr(v)
if err != nil {
return logical.ErrorResponse(errwrap.Wrapf(fmt.Sprintf("invalid value %q when parsing bound cidrs: {{err}}", v), err).Error()), nil
Copy link
Member

Choose a reason for hiding this comment

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

Can we remove the usage of errwrap here? It may not serve anything since we are converting the error into a string argument.

Copy link
Member Author

Choose a reason for hiding this comment

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

Formats it in a sanitized way though

Copy link
Member

@vishalnayak vishalnayak left a comment

Choose a reason for hiding this comment

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

Minor comments, otherwise LGTM!

@jefferai jefferai merged commit bc0918a into master Apr 21, 2018
@jefferai jefferai deleted the issue-815 branch April 21, 2018 14:49
@atheiman
Copy link
Contributor

I found this issue looking for a way to restrict a vault token to only be used from an ec2 instance with a given instance profile. The ec2 instance logs in using the aws auth, but we dont see a way in the docs to restrict the token usage to the given instance profile. If I can only restrict token usage by IP address thats fine, but I dont see how to do that in the docs either. Can you help me out @jefferai or @vishalnayak ?

@atheiman
Copy link
Contributor

Looks like @tyrannosaurus-becks is the hero I need to add bound_cidrs to the aws auth method #4662

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants