Skip to main content

HashiCorp Vault Integration

GGScout supports integration with HashiCorp Vault to collect and monitor your secrets. This guide will help you set up and configure the integration.

Supported Features

  • KV1 and KV2 secret engines
  • Multiple secret versions collection
  • Path-based filtering
  • Token-based authentication
warning

HashiCorp Vault namespaces are not yet supported

Configuration

To configure GGScout to work with HashiCorp Vault, add the following configuration to your ggscout.toml file:

Token-based Authentication

[sources.vault]
type = "hashicorpvault"
vault_address = "${VAULT_ADDR}"
fetch_all_versions = true
path = "secret/"
mode = "read"

auth.auth_mode = "token"
auth.token = "${VAULT_TOKEN}"

Kubernetes Authentication

[sources.vault]
type = "hashicorpvault"
vault_address = "${VAULT_ADDR}"
fetch_all_versions = true
path = "secret/"
mode = "read"

auth.auth_mode = "k8s"
auth.k8s.service_account = "${KUBERNETES_SERVICE_ACCOUNT}"
auth.k8s.namespace = "${KUBERNETES_NAMESPACE}"
auth.k8s.role = "${KUBERNETES_ROLE}"

Configuration Parameters

ParameterDescriptionRequiredDefault Value
typeMust be set to "hashicorpvault"Yes
vault_addressThe address of your Vault serverYes
fetch_all_versionsWhether to collect all versions of secretsYes
pathOptional path to restrict secret collectionNo
auth.auth_modeAuthentication mode (e.g., "token", "k8s")Yes
modeIntegration mode (one of: "read", "write", "read/write")No"read"

With additional parameters depending on the chosen authentication mode:

For Token-based Authentication:

ParameterDescriptionRequiredDefault Value
auth.tokenThe Vault authentication tokenYes

For Kubernetes Authentication:

ParameterDescriptionRequiredDefault Value
auth.k8s.service_accountThe Kubernetes service accountYes
auth.k8s.namespaceThe Kubernetes namespaceYes
auth.k8s.roleThe Kubernetes roleYes

Environment Variables

  • VAULT_ADDR: The address of your Vault server (e.g., http://localhost:8200)

For Token-based Authentication:

  • VAULT_TOKEN: Your Vault authentication token

For Kubernetes Authentication:

  • KUBERNETES_SERVICE_ACCOUNT: The Kubernetes service account
  • KUBERNETES_NAMESPACE: The Kubernetes namespace
  • KUBERNETES_ROLE: The Kubernetes role

Required Vault Policies

GGScout requires specific permissions in HashiCorp Vault to collect secrets. The token used for authentication must have the following permissions:

For KV2 Secret Engine

path "secret/data/*" {
capabilities = ["read", "list"]
}

path "secret/metadata/*" {
capabilities = ["read", "list"]
}

For KV1 Secret Engine

path "secret/*" {
capabilities = ["read", "list"]
}

These policies allow GGScout to:

  1. List all secrets in the specified path
  2. Read the content of each secret
  3. Access metadata about the secrets (for KV2)
tip

If you're using a different secret engine path than secret/, adjust the policy paths accordingly.

Best Practices

  1. Use environment variables for sensitive values like auth.token
  2. Consider using path restrictions to limit the scope of secret collection
  3. Enable fetch_all_versions to track changes in your secrets over time
  4. Use a dedicated service account with minimal required permissions