The file system vault reads secrets from files on the Kong Gateway data plane’s local filesystem. This vault type doesn’t require any external services or credentials.

You can set up a file system vault in one of the following ways:

The Vault entity can only be used once the database is initialized. Secrets for values that are used before the database is initialized can’t make use of the Vaults entity.

Cloud Gateway limitations: The file system vault backend is not supported on Dedicated Cloud Gateways or Serverless Gateways. These gateways don’t provide access to the data plane’s local filesystem, so secret files can’t be stored there.

Secrets can be plain text files or JSON files. Set vaults.config.prefix to the directory containing your secret files, then reference secrets relative to that directory:

Format

Example

Reference format

JSON file (multiple secrets)
{
  "client_id": "abc",
  "client_secret": "test123",
  "issuer": "https://your-idp/oauth"
}
{vault://VAULT_PREFIX/filename.json/key}
Plain text file (single secret)
abc
{vault://VAULT_PREFIX/filename.txt}

Create a file system vault

The following example creates an fs Vault entity that looks for secrets in the directory /tmp/kong/secrets:

Vault configuration options

The following table lists the available configuration parameters for a file system vault:

Field name

Parameter format

Description

Prefix
v3.15+
  • Vault entity: vaults.config.prefix
  • kong.conf parameter: vault_fs_prefix
  • Environment variable: KONG_VAULT_FS_PREFIX
Required. The path to the directory containing the secret files. For example, /tmp/kong/secrets. All secrets will be read from this directory.
TTL
v3.15+
  • Vault entity: vaults.config.ttl
  • kong.conf parameter: vault_fs_ttl
  • Environment variable: KONG_VAULT_FS_TTL
The time-to-live (in seconds) for cached secrets. A value of 0 (default) disables rotation. If non-zero, use at least 60 seconds.
Negative TTL
v3.15+
  • Vault entity: vaults.config.neg_ttl
  • kong.conf parameter: vault_fs_neg_ttl
  • Environment variable: KONG_VAULT_FS_NEG_TTL
The TTL (in seconds) for caching failed secret lookups (file not found or unreadable). If not set, uses the ttl value. A value of 0 disables negative caching.
Resurrect TTL
v3.15+
  • Vault entity: vaults.config.resurrect_ttl
  • kong.conf parameter: vault_fs_resurrect_ttl
  • Environment variable: KONG_VAULT_FS_RESURRECT_TTL
The duration (in seconds) for which expired secrets will continue to be used if the file is unreadable or missing. After this time, Kong stops retrying. The default is 1e8 seconds (~3 years).
Base64 Decode
v3.15+
  • Vault entity: vaults.config.base64_decode
  • kong.conf parameter: vault_fs_decode_base64
  • Environment variable: KONG_VAULT_FS_DECODE_BASE64
Decode all secrets in this vault as base64. Useful for binary data. If some of the secrets in the vault are not base64-encoded, an error will occur when using them. We recommend creating a separate vault for base64 secrets.

Help us make these docs great!

Kong Developer docs are open source. If you find these useful and want to make them better, contribute today!