feat: Support Vault AppRole authentication method#190
Conversation
Pull Request Test Coverage Report for Build 22356474081Warning: This coverage report may be inaccurate.This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.
Details
💛 - Coveralls |
There was a problem hiding this comment.
Pull request overview
Adds Vault AppRole authentication support for the SSH CA Vault integration, along with config schema/validation updates to allow either a static token, AppRole credentials, or implicit VAULT_TOKEN usage.
Changes:
- Add Vault AppRole login support when
ssh.ca.vault.auth.appRoleis configured. - Add config types + validation for
ssh.ca.vault.authandssh.ca.vault.auth.appRole. - Add
go.mod/go.sumdependency forgithub.com/hashicorp/vault/api/auth/approle.
Reviewed changes
Copilot reviewed 4 out of 5 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| internal/sshhandler/ca.go | Adds AppRole authentication flow during Vault client initialization. |
| internal/config/config.go | Extends Vault auth config schema and adds validation for token vs AppRole. |
| internal/config/config_test.go | Adds unit tests for new auth config validation and AppRole mount defaulting. |
| go.mod | Adds AppRole auth submodule dependency. |
| go.sum | Adds checksums for the new dependency. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
62f4c22 to
b47a3a0
Compare
9e0ad29 to
2361dc4
Compare
2361dc4 to
eaf3b25
Compare
| return nil, fmt.Errorf("failed to create vault client: %w", err) | ||
| } | ||
|
|
||
| client.SetNamespace(vaultConfig.Namespace) |
There was a problem hiding this comment.
We should set the namespace before auth to ensure the login request and all subsequent vault requests hit the same namespace.
~⚠️ Branched off from #190~ ## Changes - Create a new `VaultClient` type that wraps the Vault API client with token lifecycle management that watches token expiry, re-authenticates on failure, and retries login. - Start Vault client token renewal loop in `SSHProxy.Start()`, so we can gracefully shut down the token lifecycle loop as SSHProxy terminates.
Changes
newVaultAuthMethodto return the appropriate authMethod based on the gateway configAppRoleauthentication methodnewVaultClientto return authenticated Vault clientssh.vault.auth.approleconfiguration and validationNotes
Support for token renewal will be added on a separate PR.