-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for cross account management of static roles in AWS Secre…
…ts (#29645) * aws-secrets/add-cross-acc-mgmt-static-roles * refactor * add function pointer for tests * delete commented out code * update * update comment * update func name * add flag * remove docs
- Loading branch information
1 parent
64e92ba
commit 6e0c771
Showing
12 changed files
with
177 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// Copyright (c) HashiCorp, Inc. | ||
// SPDX-License-Identifier: BUSL-1.1 | ||
|
||
//go:build !enterprise | ||
|
||
package aws | ||
|
||
import ( | ||
"context" | ||
"fmt" | ||
|
||
"github.com/aws/aws-sdk-go/aws" | ||
"github.com/hashicorp/vault/sdk/logical" | ||
) | ||
|
||
// assumeRoleStatic assumes an AWS role for cross-account static role management. | ||
// It uses the role ARN and session name provided in the staticRoleEntry configuration | ||
// to generate credentials for the assumed role. | ||
func (b *backend) assumeRoleStatic(ctx context.Context, s logical.Storage, entry *staticRoleEntry) (*aws.Config, error) { | ||
return nil, fmt.Errorf("cross-account static roles are only supported in Vault Enterprise") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// Copyright (c) HashiCorp, Inc. | ||
// SPDX-License-Identifier: BUSL-1.1 | ||
|
||
//go:build !enterprise | ||
|
||
package aws | ||
|
||
import ( | ||
"fmt" | ||
|
||
"github.com/hashicorp/vault/sdk/framework" | ||
) | ||
|
||
// AddStaticAssumeRoleFieldsEnt is a no-op for community edition | ||
func AddStaticAssumeRoleFieldsEnt(fields map[string]*framework.FieldSchema) { | ||
// no-op | ||
} | ||
|
||
func validateAssumeRoleFields(data *framework.FieldData, config *staticRoleEntry) error { | ||
_, hasAssumeRoleARN := data.GetOk(paramAssumeRoleARN) | ||
_, hasRoleSessionName := data.GetOk(paramRoleSessionName) | ||
_, hasExternalID := data.GetOk(paramExternalID) | ||
|
||
if hasAssumeRoleARN || hasRoleSessionName || hasExternalID { | ||
return fmt.Errorf("cross-account static roles are only supported in Vault Enterprise") | ||
} | ||
|
||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.