Repository navigation
Support externally managed Vault/OpenBao token files - #336
Open
christopher-svensson-stegra wants to merge 1 commit into
Open
christopher-svensson-stegra wants to merge 1 commit into
christopher-svensson-stegra wants to merge 1 commit into
Conversation
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
Allow rustguac to consume an already-issued Vault/OpenBao token maintained by an external process, such as Vault Agent or OpenBao Agent. This delegates authentication-method support and token lifecycle to that process rather than adding each auto-auth method to rustguac.
This is backend authentication, not user SSO or target credential forwarding. It does not change KV paths, folder authorization, or credential storage formats.
How it works
X-Vault-Token.Select
token_fileinstead ofrole_idorjwt_auth; conflicting configurations are rejected. No SecretID environment variable is required. rustguac does not log in, renew, revoke, or retain a cached fallback token in this mode. Missing/unreadable/empty/malformed files fail closed. Existing AppRole/JWT behavior is unchanged.Use cases and examples
A VM using certificate-based authentication
Run Vault/OpenBao Agent as a supervised host service. Give the agent a certificate-auth identity and a least-privilege KV policy; configure its file sink at
/run/vault-agent/token. rustguac only needs the sink, not the agent's private key:The integration guide includes a certificate auto-auth HCL example and links to the Vault/OpenBao documentation. Other agent auto-auth methods work without further rustguac changes.
Docker Compose or another container runtime
Run the agent alongside rustguac. Share the sink directory read-write with the agent and read-only with rustguac, using compatible UIDs/GIDs and restrictive permissions. Mount the directory, not the individual file, so an atomic rename is visible. Keep the agent's bootstrap credentials in a separate mount that rustguac cannot read. The same TOML applies; this PR does not prescribe a container image or bundle an agent.
Separate shared/local backends
Each backend can consume a different token, with independently scoped policies and lifecycle managers:
An existing trusted credential manager can also maintain the sink; no agent-specific protocol is required. Write a restricted temporary file in the same directory and rename it over the sink rather than modifying it in place.
Operational boundaries
The token remains a bearer credential readable by rustguac. Use a least-privilege application token, never a root token; protect the directory and consider memory-backed storage, swap and core-dump exposure. The external manager must keep the token valid: a readable file does not establish validity, and expiry/policy are enforced by Vault/OpenBao. If the manager stops, the last valid token may continue working until expiry.
Regression coverage exercises configuration for all three backend sections, conflicting modes, malformed/missing files and the size boundary, atomic replacement, absence of login/renewal requests, namespace forwarding, and bounded 403 retry behavior.