Injecting OpenBao secrets as environment variables with process supervisor mode

OpenBao Agent can start an application as its child process and pass secrets in as environment variables, which avoids changing application code. This page explains how the mode works, what its public beta label means for production and when files are the safer choice.

On this page

When OpenBao Agent environment variables fit an application

Process supervisor mode lets OpenBao Agent launch your application with secrets already in its environment. This suits the situation where an application reads its credentials from environment variables and cannot easily be changed to call OpenBao directly. The Agent authenticates to OpenBao, reads the secrets it has been configured to fetch, starts the child process you name, and supervises that process while it runs. The application sees ordinary environment variables and needs no OpenBao client code, which keeps the change on the deployment side rather than in the application source.

The project documents this feature as public beta, so confirm its current status in the OpenBao documentation for the exact release you plan to run before you make it a production dependency. Ask your platform team to check the Agent release notes for changes to supervision, restart behavior and environment handling, and to test those behaviors in a non-production environment that matches your service manager and container runtime. Plan a fallback path, such as rendered files or a direct client call, in case a later release changes the feature.

Before you choose this pattern, list which secrets the application needs, how often they rotate, and whether any of them are leased credentials that must be renewed while the process runs. Environment variables are set once when the child starts, so a rotated or renewed secret does not reach a running process unless the process is restarted. Also consider who can read the child's environment. On many systems, process environment is visible to other processes running as the same user or to anyone with access to process inspection tools, so the risk profile differs from a file with restrictive permissions.

How the Agent, OpenBao and the child process fit together

The flow starts with OpenBao Agent authenticating to the OpenBao server through an auto-auth method and receiving a token. The Agent then reads the secrets named in its configuration and starts the application as a child process with those values placed in its environment. Configuration changes or lifecycle events make the Agent restart or stop that child. Check the last hop closely: anything in the child's environment is readable by the same host users and processes, so the host is part of your trust boundary.

Agent authenticates, reads secrets, and supervises the child process across trust boundaries.

Choosing between environment variables, rendered files and the Proxy

This table compares four ways an application can receive OpenBao secrets: process supervisor environment variables, rendered template files, OpenBao Proxy and direct API calls. Read each row against your application's language, restart behavior and host access model. Confirm the exact Agent behaviors against the current Agent documentation before you commit to a design.

Delivery optionApplication code changeHow updated secrets reach itWhere the value sits on the host
Process supervisor environment variablesUsually none, if the app reads standard environment variablesTypically the child process is restarted when a value changes; confirm the current Agent behaviorIn the child process environment, visible to same-user processes and some diagnostics; confirm exposure details
Rendered template filesNone, if the app reads a config fileTemplate re-renders on change, with an optional command to reload or restart; confirm the exec optionsOn disk at the rendered path; file mode and ownership control who can read it
OpenBao ProxyYes, the app must point its API calls at the local Proxy addressProxy manages the token and serves requests, so the app fetches on demandToken and responses pass through the local listener; the app holds no long-lived credential
Direct API calls from application codeYes, the app authenticates and reads secrets itselfThe app must poll or re-read secrets and handle leases on its ownIn application memory, and wherever the app logs or caches responses
Best fitLegacy apps and twelve-factor services that already read environment variablesConfig-driven apps that reload from files or can be restarted on changeApps already built on the OpenBao or Vault API that need dynamic handling

How the child process receives secrets and what changes when they rotate

Environment variables are copied into a process when it starts, so a secret that OpenBao Agent renews or re-leases does not reach a running application on its own. In process supervisor mode, the new value only arrives when the child is restarted or when the application re-reads its own environment, which most software does not do. The rotation question is therefore a restart question: before go-live, decide how the child is replaced when a secret changes and who owns that behavior, the platform team or the application team.

Short-lived dynamic credentials make this decision urgent. A database or cloud credential with a short lease will expire on a fixed schedule, and an application that keeps using an expired value will fail with authentication errors rather than degrade gracefully. Plan the restart cadence against the lease durations your secrets engines issue, and test the failure path on purpose: revoke a credential in a non-production environment, watch what the application logs, whether it retries, and whether it recovers once the supervisor delivers a new value. Some applications hold a connection pool open for hours, so an expired credential can keep working until the pool recycles, which makes the failure appear later and in a different place.

Confirm in the current OpenBao Agent documentation how the supervisor handles the child when the Agent configuration or a rendered secret changes, including whether it restarts the child, sends a signal, or leaves the process alone. Do not rely on memory of older Vault Agent behavior, and test the exact version you will run in a staging environment that mirrors production lease settings. Record the answer in your runbook, because an operator who changes a template later needs to know whether that change restarts the application.

Why files are often the safer choice for secrets

Environment variables are simple to inject, but they travel further than most teams expect: into other processes, child processes, dumps and logs. Each risk below has a mitigation, and each also marks a point where a file with tight permissions is the better choice.

Exposure through process inspection

On many systems, the environment of a running process can be read by users or processes on the same host, depending on kernel and permission settings. When OpenBao Agent starts your application with secrets in its environment, anyone able to inspect that process may read them. Check the host's process visibility settings, restrict who can run diagnostic tools, and confirm the process runs under a dedicated service account. If the host is shared by several teams, a file readable only by the service account is usually the safer choice.

Inheritance by child processes

Every child process the application starts inherits its full environment, including secrets it never needs. Shell commands, package managers, health-check scripts and third-party helpers all receive the same values. Audit which subprocesses the application spawns and whether any run untrusted code. A file read by the one component that needs it keeps the secret out of processes that have no business seeing it.

Capture in dumps and diagnostics

Crash dumps, core files, debug endpoints and error reporters often record the environment or the full process state. A secret placed in an environment variable can be copied into these artifacts and then stored, shipped to a vendor or attached to a ticket. Disable core dumps for the service, turn off environment-printing debug routes in production, and confirm your error reporter scrubs known variable names. Where dumps cannot be controlled, prefer a file that the application opens and closes.

Logs, error reports and container inspection

Frameworks sometimes log configuration at startup, and container tooling can display environment values to anyone allowed to inspect the container. Check startup logs, error reporting and orchestrator views for printed variables. Restrict who can run container inspect commands on the host. A rendered file with restricted mode, mounted only into the container that uses it, reduces the places where the value can appear in plain view.

Difficulty of rotating without a restart

An environment variable is fixed when the process starts. When OpenBao rotates or reissues a secret, the application keeps the old value until it restarts, and a restart may be needed for every rotation. Agent can restart the process, but that adds downtime planning and coordination. A file rendered by OpenBao Agent templates can be re-read or watched, so teams that rotate often or use short leases should compare the two patterns before committing.

Setting up process supervisor mode in order

This sequence takes a team from an approved OpenBao release to an Agent that starts an application as a child process with secrets passed as environment variables, verified on a non-production cluster and documented for restart and rollback.

  1. Confirm the OpenBao and Agent build

    The platform owner selects the OpenBao release and the matching OpenBao Agent binary from the project's releases page, then records the version, checksum and the operating system build in the change record. Confirm that the Agent version you run supports process supervisor mode and the environment variable mapping you plan to use, since the feature is in public beta and option names can change between releases. Check the release notes for the Agent version before you pin it. The step is done when the version and checksum are recorded and the team lead has approved the pinned build for the non-production environment.

  2. Create the auth method and policy

    The security or platform engineer enables an auth method suited to servers, such as AppRole, which the project recommends for server workloads, and creates a policy that grants read access only to the secret paths the application needs. Do not attach broad policies or administrative capabilities to the Agent identity. Keep the role's token settings short-lived and bound to the intended hosts where the auth method allows it. The step is done when a test login with the Agent's role ID and secret ID succeeds and a read against a path outside the policy returns a permission error.

  3. Write the Agent configuration file

    The platform engineer writes the Agent configuration with an auto-auth block that uses the chosen method, a token sink with restrictive file permissions, and the supervisor environment mapping that names each variable and the secret field it receives. Keep secret identifiers in a file readable only by the service account, and avoid placing secret values in the configuration itself. Validate the file's syntax using the Agent's own validation option and check the file mode with a directory listing. The step is done when the configuration validates cleanly and the file permissions match the team's standard for service credentials.

  4. Run the Agent against a non-production OpenBao

    The operator starts the Agent in a non-production environment with the application as the supervised child process, using a cluster that holds test secrets only. Watch the Agent logs for successful authentication, the lease or renewal events for each secret, and the start of the child process. Confirm that the application starts and that its logs do not echo the secret values. The step is done when the Agent reports healthy authentication, the child process is running under the expected user account, and the application reaches its normal ready state.

  5. Verify variables without printing them

    The operator checks that the child process received each expected variable by testing for presence and length, or by a check inside the application's own health endpoint, rather than dumping the environment to a terminal or log. Avoid commands that print the full environment of the child, because shell history, CI logs and monitoring tools often capture that output. Compare the variable names against the mapping in the configuration. The step is done when every expected name is present, no unexpected names appear, and the test output contains no secret values.

  6. Test a forced restart after a secret change

    The operator changes a test secret in OpenBao, then confirms that the Agent detects the change and restarts the child process with the new value, following the restart behavior described in the Agent documentation for your version. Record how long the application is unavailable during the restart and whether in-flight requests are lost. Repeat the test after a token renewal event if your policy uses short token lifetimes. The step is done when the application shows the new value through its own behavior, the restart is logged, and the observed downtime is recorded for the operations team.

  7. Document restart and rollback steps

    The platform team writes a runbook that covers how to restart the Agent and child process, how to stop the Agent cleanly, how to revert to the previous pinned binary and configuration, and how to revoke the Agent's role or secret ID if the host is compromised. Include the commands, the expected log messages and the owner for each action. Ask your vendor or the project documentation to confirm any behavior that is still in beta before relying on it in production. The step is done when a second operator has followed the runbook on the test host and completed the rollback without help.

What the public beta label means before production use

A public beta label on an Agent feature tells you the interface is still being shaped. Configuration keys, flags and output behavior can change between releases, and the project may not offer the same support expectations it gives to features marked stable. For process supervisor mode, that means the block that launches your application, the way secrets are injected into its environment, and the exit and restart behavior around it could all shift when you move to a newer OpenBao release. Treat the label as a planning input that affects how often you test, how tightly you pin versions and who you can turn to when something breaks.

Before you put the feature in front of production traffic, read the current OpenBao Agent documentation and the release notes for the version you intend to run. Check the feature's status in both places, and look for known issues that touch environment injection, process lifecycle or secret handling. Confirm the exact support statements in the official OpenBao releases notes rather than relying on secondhand summaries. Record the status you found, the date you checked it and the version you chose, because the answer may differ from one minor line to the next.

Pin a specific, tested OpenBao version in your build and deployment tooling, and upgrade only through a planned change. Then write your own acceptance tests: confirm that the child process starts with the expected variables, that a rotated secret reaches the next start, that a failed login or missing secret stops the application rather than starting it with empty values, and that no secret appears in logs or process listings. DeployOpen will confirm the status of the chosen version during scoping, and the acceptance tests will be part of the written scope so the decision to accept beta behavior is made explicitly by your team.

Security controls around the supervised application

The Agent logs in to OpenBao before it can start the application, and the token it holds is the most sensitive credential on the host. Anyone who reads that token can request every secret the Agent's policies allow, so its storage, lifetime and renewal need the same attention as the secrets themselves.

  • Restrict the token sink file: Write the token only to a location readable by the Agent's service account. This prevents other local users from copying the token and reading secrets under its policies.
  • Keep token lifetimes short and renewable: Configure the auth method so tokens expire and renew on a schedule. This limits how long a stolen token stays useful.
  • Bound the login secret: Prefer AppRole or certificate auth for servers, so the credential used to log in is narrow and can be rotated. Confirm which options your version supports in the OpenBao auth methods documentation.
  • Decide what happens on renewal failure: A lapsed token should stop the child process, so the application does not keep running on stale values.

Check the sink file's owner and permissions, and confirm the token's lifetime and renewal behavior in a staging environment before go-live. Run the broader host setup through the OpenBao security hardening guidance.

Questions teams ask before running an application under OpenBao Agent

How much effort does a process supervisor setup take, and what drives it?

The effort depends less on the Agent configuration itself than on how many secrets, applications and restart paths the setup has to cover. A single application with a handful of static values is a small change. Effort grows with each of these factors:

  • The number of secrets and whether any are dynamic, leased credentials that must be renewed or re-rendered while the application runs.
  • The number of applications, each with its own environment variables, policies and auto-auth method.
  • Restart behavior: whether a secret rotation should restart the child process, and how the application handles a restart without losing work.
  • Testing across failure cases, such as Agent restart, expired tokens and unreachable OpenBao.

Ask any partner for a quote built from these four inputs, written out in the scope document.

Can an internal team set this up without outside help?

Yes, if the team already runs OpenBao and understands its auth methods, policies and leases. The OpenBao Agent documentation and the project's own examples cover the configuration keys, so an experienced platform engineer can build a working test. The harder work is proving the setup is safe: confirming that environment variables do not leak into logs, crash dumps, process listings or child processes, and that the failure modes behave as intended. Teams without a security reviewer or a test environment often find that verification takes longer than the build. A partner can supply that review, but the internal team still needs ownership of the result.

What does the work need from our side?

Most of the work depends on four people or decisions from your organization:

  • A test OpenBao cluster, separate from production, where the supervisor setup can be built and broken on purpose.
  • An application owner who knows which variables the process reads, how it handles restarts and whether it writes its environment anywhere.
  • A platform owner who controls the OpenBao policies, auto-auth method and the host where Agent runs.
  • A written decision on acceptable exposure: which secrets may sit in process memory as environment variables, and which must stay in files with tight permissions instead.

Without the last decision, the scope cannot be closed.

Is the public beta status of process supervisor mode a reason to avoid it?

It is a reason to check the current status before committing, and to test the exact version you plan to run. Confirm the feature's maturity in the OpenBao release notes for the version you target, because the status can change between releases. Treat any feature that is still in beta as one that may change its configuration keys or behavior, and build your upgrade plan around that. Your risk review should decide whether a beta feature is acceptable for the secrets involved.

What changes after go-live, and what keeps running?

After go-live, the setup becomes a recurring operational item rather than a one-time build. Expect ongoing work in four areas: upgrading OpenBao and Agent to new releases and retesting the supervisor path each time, reviewing policies when applications change, watching Agent logs and token renewal, and rehearsing what happens when a secret is rotated or revoked while an application is running. Ask your partner or internal team to document who owns each of these tasks and how often they are reviewed.

How is cost structured in a quote for this work?

A quote should show who is paid for what and separate one-time work from recurring work. One-time items usually include scoping, building the test environment, the supervisor configuration, application changes, security testing and documentation. Recurring items usually include upgrades, retesting after releases and support. Ask for each line to name its deliverable, the assumptions it depends on, and what would change the price, such as more applications or additional secret types. DeployOpen does not publish a price list. Each engagement is fixed-scope, and the quote follows from the written scope.

When should we choose files over environment variables instead?

Choose files when the secret is large, rotates often, or must not appear in a process environment that other processes or child tools might read. Environment variables are simple for the application but are visible to anything that can inspect the process and can be copied into logs or subprocesses. Files with restricted permissions, rendered by OpenBao Agent templates, give tighter control over who reads the value and when it is refreshed. Many teams use files for high-sensitivity credentials and environment variables for low-risk settings.

How DeployOpen works on this

DeployOpen plans, builds, documents and supports OpenBao Agent process supervisor setups inside your own infrastructure. We start from the applications that need secrets, the environment variables they read, and the controls your security team must review before any secret reaches a child process.

How we scope

  • We inventory each application that would read secrets from environment variables and record its startup command and restart behavior.
  • We agree in writing which secrets, auth methods and templates are in scope before work starts, as engagements are fixed-scope.
  • We document which workloads stay on file-based delivery because exposure through the process environment is a concern for them.

How we build

  • We configure OpenBao Agent with auto-auth and an env_template or process supervisor setup for each agreed application.
  • We test secret rotation, lease renewal and child process restarts against a non-production copy of your OpenBao cluster.
  • We check that secret values stay out of logs, crash dumps and shell history during startup and reload.

How we hand over

  • We deliver the Agent configuration files, supervisor settings, service unit definitions and secret path inventory as versioned code.
  • We write runbooks covering rotation, failed authentication, Agent restarts and how to roll back to file-based templates.
  • We walk your platform and security teams through the setup and record what was tested and what remains open.

How we support

  • Ongoing support, upgrades and continuous testing are available as a retainer that follows your OpenBao and Agent release plan.
  • When OpenBao or Agent versions change, we retest the supervisor behavior before you move the change into production.
  • Ask any quote to name the support hours, response expectations and which upgrades and retests are included in the retainer.

Sources and further reading

Talk to our team.

Tell us what you're working on, whether it's a deployment, an audit, a security test or a cyber range. You'll speak with an engineer who can help you scope it.

  • 30-minute call: free, with no obligation.
  • NDA on request: we can sign before you share details.
  • Clear next steps: a scope and plan after the call.