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

WIF support for GCP secrets engine #210

Merged
merged 25 commits into from
May 9, 2024
Merged

WIF support for GCP secrets engine #210

merged 25 commits into from
May 9, 2024

Conversation

vinay-gopalan
Copy link
Contributor

@vinay-gopalan vinay-gopalan commented Apr 19, 2024

This PR adds plugin WIF support to the GCP secrets engine. This adds the following new fields to the config endpoint to enable configuring Workload Identity Federation:

  • identity_token_audience
  • identity_token_ttl
  • service_account_email

The PR also adds tests to ensure that these fields can be set/read to the config and that providing mutually exclusive fields results in an error both against CE and Enterprise editions.

The PR also adds the PluginIdentityTokenSupplier Credential Provider that fetches a plugin identity token from Vault and passes it to an external account Token Source for a valid federated credential exchange. The full functionality of this feature is linked to this PR on the go-gcp-common: hashicorp/go-gcp-common#14, and will be available when those updates are merged and pulled into this repository.

@vinay-gopalan vinay-gopalan changed the title WIF support for AWS secrets engine WIF support for GCP secrets engine Apr 19, 2024
@vinay-gopalan vinay-gopalan requested review from a team, Zlaticanin and fairclothjm April 19, 2024 22:28
plugin/backend.go Outdated Show resolved Hide resolved
plugin/backend.go Show resolved Hide resolved
@@ -1,7 +1,7 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0

//go:generate go run internal/generate_resources.go
//go:generate go run github.com/hashicorp/vault-plugin-secrets-gcp/plugin/iamutil/internal/
Copy link
Contributor Author

Choose a reason for hiding this comment

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

It doesn't look like this ever worked 🤔 Upon upgrading to Go 1.21+, the inclusion of the toolchain directive seems to have uncovered this issue. The incorrect path was breaking tests once the Go version was upgraded, and after meeting with @tomhjp, we decided that using the full path to the underlying directory is the better way to generate and import these resources.

@vinay-gopalan
Copy link
Contributor Author

The build failures are expected. make generate is broken for Go1.22, and we have a separate PR to resolve CI. Validated with a local build (by manually removing the broken generate target) that GCP Secrets WIF works as expected both as built in and as an external plugin

Copy link

@Zlaticanin Zlaticanin left a comment

Choose a reason for hiding this comment

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

Great work!

@vinay-gopalan vinay-gopalan merged commit 8195e68 into main May 9, 2024
1 of 2 checks passed
@vinay-gopalan vinay-gopalan deleted the VAULT-25151/gcp-wif branch May 9, 2024 22:26
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.

3 participants