Files
homelabstack/stacks/mcp/vault-policy.hcl
T
ginnoirandClaude Opus 5.5 d51bad2277 feat(mcp): scope the gateway's Vault token (no more root)
The vault MCP now holds an orphan periodic token (720h) with policy
mcp-gateway: read sys/mounts, CRUD under secret/ (kv-v2), PKI issue/read
under pki/. No sys writes, auth, policy or seal management. The policy is
kept at stacks/mcp/vault-policy.hcl. A vault-token-renewer sidecar renews
the token daily and notifies ntfy if a renewal fails (e.g. Vault sealed).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-02 18:13:25 -06:00

52 lines
1.4 KiB
HCL

# Vault ACL policy "mcp-gateway": what the vault MCP in stacks/mcp may do.
# Reference copy only (not mounted anywhere). Apply with a root/admin token:
# vault policy write mcp-gateway stacks/mcp/vault-policy.hcl
#
# Token: orphan, periodic (720h), policies [default, mcp-gateway]. The
# vault-token-renewer service in this stack renews it daily, so it never lapses
# unless Vault stays sealed/unreachable for 30 days. (The default policy grants
# renew-self / lookup-self.)
#
# Deliberately NOT granted: sys/* writes (mount/auth/policy/seal management),
# auth/*, identity/*, the agent-registry mount. Mount creation and other admin
# stays a root-token job, done by hand.
# list_mounts
path "sys/mounts" {
capabilities = ["read"]
}
# KV v2 at secret/ (mount it first: vault secrets enable -path=secret kv-v2)
path "secret/data/*" {
capabilities = ["create", "read", "update", "delete"]
}
path "secret/metadata/*" {
capabilities = ["read", "list", "delete"]
}
path "secret/metadata" {
capabilities = ["list"]
}
path "secret/delete/*" {
capabilities = ["update"]
}
path "secret/undelete/*" {
capabilities = ["update"]
}
# PKI at pki/: read config/issuers/roles and issue certs, no CA or role admin.
path "pki/issue/*" {
capabilities = ["create", "update"]
}
path "pki/roles" {
capabilities = ["list"]
}
path "pki/roles/*" {
capabilities = ["read"]
}
path "pki/issuers" {
capabilities = ["list"]
}
path "pki/issuer/*" {
capabilities = ["read"]
}