Honeydipper outsources encryption/decryption tasks to drivers. In order for Honeydipper to be able to decrypt the encrypted content in the config files, the proper driver needs to be loaded and configured. By default, the honeydipper-config-essentials repo gcloud bundle comes with a gcloud KMS driver, I will use this as an example to explain how decryption works.
When you include the honeydipper-config-essentials repo from your bootstrap repo like below:
---
repos:
- repo: https://github.com/honeydipper/honeydipper-config-essentials.git
path: /gcloud
The gcloud-kms driver is loaded automatically with following daemon configuration.
---
drivers:
...
daemon:
...
features:
global:
- name: driver:gcloud-kms
required: true
...
drivers:
...
gcloud-kms:
name: gcloud-kms
type: builtin
handlerData:
shortName: gcloud-kms
Note that the above configuration snippet is for your information purpose, you don’t have to manually type them in if you include the gcloud bundle from the honeydipper-config-essential repo.
The gcloud-kms driver assumes that there is a default google credential where the daemon is running. This is usually the case when you run Honeydipper in gcloud either in Compute Engine or in Kubernetes clusters. See GCP documentation on how to configure the Compute Engine instance or Kubernetes clusters with a service account. If you are running this from your workstation, make sure you run gcloud auth login to authenticate with gcloud. The service account or the credential you are using needs to have roles/kms.CryptoKeyDecryptor IAM role. If you are running the Honeydipper in a docker container other than gcloud, you will need to mount a service account key file into the container and set GOOGLE_APPLICATION_CREDENTIALS environment variable.
The gcloud-kms driver expects a configuration item under drivers.gcloud-kms named keyname.
For example:
---
drivers:
...
gcloud-kms:
keyname: projects/<your project>/locations/<region>/keyRings/<keyring name>/cryptoKeys/<key name>
...
Once this is configured in your repo and loaded by the daemon, you can start to use this driver to decrypt content in the configuration files.
Assuming you have gcloud command installed, and authenticated, and you have the roles/kms.CryptoKeyEncryptor role.
echo -n xxxx_your_secret_xxxx |
gcloud --project=<...> kms encrypt --plaintext-file=- --ciphertext-file=- --keyring=<...> --key=<...> --location=<...> |
base64
Fill in the blank for project, keyring, location and key with the same information you configured for the driver. The command will output the base64 encoded cipher text. You can use this in your configuration file with eyaml style syntax. For example:
---
systems:
my_system:
data:
mysecret: ENC[gcloud-kms,---base64 encoded ciphertext---]
See the interpolation guide for more information on eyaml syntax.
In addition to ENC[...] for encrypted values, Honeydipper supports LOOKUP[...] syntax for fetching secrets at runtime from secret stores. This is useful when you want to avoid storing encrypted values in your config files and instead fetch them dynamically.
The syntax is:
LOOKUP[driver,path][:printf_pattern]
For example, using the GCP Secret Manager driver:
systems:
my_system:
data:
api_token: LOOKUP[gcloud-secret,projects/my-project/secrets/my-api-token/versions/latest]
Using the Vault driver:
systems:
my_system:
data:
api_token: LOOKUP[hd-driver-vault,secret/data/myapp/apikey]
The LOOKUP syntax supports an optional ? prefix on the path to make the lookup optional (swallowing errors if the secret is not found):
systems:
my_system:
data:
optional_setting: LOOKUP[gcloud-secret,projects/my-project/secrets/optional?]
See the interpolation guide for more information on LOOKUP syntax.
Honeydipper’s secure-exec feature is a CLI tool built into each secrets driver binary. It allows you to run any program with decrypted secrets injected into its environment, without ever exposing the plaintext secrets in configuration files, command-line arguments, or process listings. It is similar in concept to Google Berglas exec.
This is not a daemon service configuration. The driver binary is invoked directly from the command line or a startup script with exec as the first positional argument (the service name). It does not run as a long-lived process.
The general command format is:
driver-binary exec -- /path/to/program [args...]
exec) tells the driver to operate in “exec mode” instead of connecting to the daemon.-- separator is required and separates driver arguments from the target program command.-- is resolved relative to $PATH if not absolute.For example, using the GCP KMS driver:
gcloud-kms exec -- /usr/bin/python3 /path/to/script.py
Using the GCP Secret Manager driver:
gcloud-secret exec -- /path/to/application
Using the Vault driver:
hd-driver-vault exec -- /path/to/application
When a driver binary is invoked in exec mode:
hd-lookup: or hd-decrypt:).lookup or decrypt) to resolve the secret using the driver’s native API.syscall.Exec, which replaces the current process — the driver process becomes the target process. The target program sees the decrypted secrets as normal environment variables.Because the driver replaces itself with the target program (via exec), there is no intermediate process that holds the decrypted secrets, and no need for cleanup.
secure-exec recognizes two prefixes in environment variable values:
| Prefix | Driver RPC | Value format |
|---|---|---|
hd-lookup:<path> |
lookup |
A secret path recognized by the driver (e.g. GCP Secret Manager resource name, Vault key path) |
hd-decrypt:<base64> |
decrypt |
Base64-encoded ciphertext (e.g. output of gcloud kms encrypt piped through base64) |
If the driver only implements one of the two RPCs, only the corresponding prefix can be used. For example, gcloud-kms only implements decrypt, so only hd-decrypt: is valid with that driver. Drivers that implement both (none currently) prefer lookup.
The primary use case for secure-exec is bootstrapping — starting Honeydipper itself with decrypted secrets that are required during startup but must not be stored in plaintext.
For example, suppose you need a GitHub token for Honeydipper to clone configuration repositories via https://token@github.com/..., and you want to store that token encrypted in your environment. You can write a startup script like this:
#!/bin/bash
# Set the GitHub token as a secret reference, not in plaintext.
# The token is stored in GCP Secret Manager.
export GITHUB_TOKEN="hd-lookup:projects/my-project/secrets/github-deploy-token/versions/latest"
# Use gcloud-secret to decrypt the token and exec honeydipper.
# The honeydipper process will see GITHUB_TOKEN with the real decrypted value.
exec gcloud-secret exec -- /usr/local/bin/honeydipper
When Honeydipper starts and processes its bootstrap repos, it clones:
repos:
- repo: https://github.com/myorg/honeydipper-config.git
Honeydipper automatically uses $GITHUB_TOKEN from the environment for HTTPS authentication, so the repo is cloned successfully — but the token was never stored in any file, config, or process argument.
If your secret is encrypted with GCP KMS instead of stored in Secret Manager, use gcloud-kms with the hd-decrypt: prefix:
#!/bin/bash
# The GitHub token was encrypted with KMS and base64-encoded.
export GITHUB_TOKEN="hd-decrypt:CiQAc92x...long base64 ciphertext...="
exec gcloud-kms exec -- /usr/local/bin/honeydipper
Similarly, with HashiCorp Vault:
#!/bin/bash
export GITHUB_TOKEN="hd-lookup:secret/data/honeydipper/github#token"
exec hd-driver-vault exec -- /usr/local/bin/honeydipper
The following drivers are compiled with secure-exec support and can be used as CLI tools:
| Driver binary | Default service | RPC used | Notes |
|---|---|---|---|
gcloud-kms |
kms |
decrypt |
Use with hd-decrypt:<base64> — decrypts base64-encoded KMS ciphertext |
gcloud-secret |
google-secret |
lookup |
Use with hd-lookup:<path> — looks up GCP Secret Manager secrets by resource name |
hd-driver-vault |
vault |
lookup |
Use with hd-lookup:<path> — looks up Vault secrets by key path |
Any of these binaries can be invoked directly with exec as the first argument to use the secure-exec feature.
Honeydipper supports multiple drivers for encryption and secret lookup:
| Driver | Type | Description |
|---|---|---|
gcloud-kms |
Decrypt | Google Cloud KMS for decrypting ciphertext (implements decrypt RPC) |
gcloud-secret |
Lookup | Google Cloud Secret Manager for runtime secret fetching (implements lookup RPC) |
hd-driver-vault |
Lookup | HashiCorp Vault for runtime secret fetching (implements lookup RPC) |
Any driver that implements the decrypt or lookup RPC can be used with the ENC or LOOKUP syntax respectively. Drivers that implement these RPCs can also be used with the secure-exec feature to run programs with decrypted secrets in their environment.