mirror of
https://github.com/optim-enterprises-bv/vault.git
synced 2025-11-02 19:47:54 +00:00
Add bound cidr checking at login time for remaining auths (#7046)
This commit is contained in:
@@ -9,6 +9,7 @@ import (
|
||||
"github.com/google/go-github/github"
|
||||
"github.com/hashicorp/errwrap"
|
||||
"github.com/hashicorp/vault/sdk/framework"
|
||||
"github.com/hashicorp/vault/sdk/helper/cidrutil"
|
||||
"github.com/hashicorp/vault/sdk/helper/policyutil"
|
||||
"github.com/hashicorp/vault/sdk/logical"
|
||||
)
|
||||
@@ -148,6 +149,11 @@ func (b *backend) verifyCredentials(ctx context.Context, req *logical.Request, t
|
||||
return nil, logical.ErrorResponse("configuration has not been set"), nil
|
||||
}
|
||||
|
||||
// Check for a CIDR match.
|
||||
if !cidrutil.RemoteAddrIsOk(req.Connection.RemoteAddr, config.TokenBoundCIDRs) {
|
||||
return nil, nil, logical.ErrPermissionDenied
|
||||
}
|
||||
|
||||
if config.Organization == "" {
|
||||
return nil, logical.ErrorResponse(
|
||||
"organization not found in configuration"), nil
|
||||
|
||||
Reference in New Issue
Block a user