Why teams issue dynamic OpenBao credentials for Valkey
Many Valkey deployments still authenticate applications with one shared password, copied into configuration files, environment variables and deployment pipelines. Nobody can rotate it safely because the list of services that use it is rarely complete, and a change breaks every consumer at once. OpenBao can create a Valkey ACL user for each request, attach that user to a lease, and revoke it when the lease ends, so each workload holds its own short-lived identity. A leaked credential then expires on its own schedule and points back to one service rather than the whole fleet. Teams usually start with the services that handle the most sensitive data or that restart most often, because those gain the most from per-workload identity.
Dynamic roles fit when the application can receive a credential at runtime, reconnect after a lease expires, and renew its lease before it lapses. Static roles fit when an existing Valkey account must keep its name because other systems, ACL entries or monitoring depend on it. In that case OpenBao rotates the password of the existing account on a schedule and does not create new users. Before choosing, list which clients read a password once at startup and which can handle renewal. An illustrative worker that opens a connection pool at boot will need restart or renewal logic before a dynamic user suits it. The static role page covers that path in detail.
This plugin is one engine in the OpenBao secrets engines group, next to the database and cloud engines covered elsewhere, so this page focuses on the Valkey-specific ACL model. Confirm three things before you design around it: that the Valkey plugin ships in the OpenBao release you plan to run (the OpenBao releases page lists each version), that your Valkey version supports the ACL commands the creation statements depend on, and which team owns lease renewal in each application. Also plan for incident response. OpenBao supports bulk revocation, so you should know how a revocation would reach every Valkey user it issued before an incident occurs.
How a Valkey lease flows from OpenBao to an application
The flow starts when the application authenticates to OpenBao with an auth method it is allowed to use, then requests a Valkey role. OpenBao holds a root credential for Valkey and uses it to create a dedicated ACL user for that request. The application receives the generated username, password and lease, then connects to Valkey with them. When the lease expires or is revoked, OpenBao removes the ACL user. Check that the root credential stays inside the OpenBao boundary, and confirm the lease TTL and revocation behavior in your environment before relying on them.
Trust boundary separates OpenBao's root credential from the Valkey ACL user it creates.
Choosing dynamic roles or static roles for Valkey
A dynamic role asks OpenBao to create a new Valkey ACL user every time a client requests credentials. OpenBao returns that username and password with a lease, and when the lease ends OpenBao removes the user. A static role works the other way around. It maps to an ACL user that already exists in Valkey, and OpenBao rotates that user's password on a schedule, so applications read the current password from OpenBao rather than creating accounts of their own.
- Account lifetime: Dynamic users live only as long as their lease. Static users persist in Valkey and are changed in place.
- Who creates accounts: OpenBao creates dynamic users through the ACL rules you define. Static roles require the account to exist before OpenBao manages it.
- Cleanup: Dynamic leases are revoked automatically at expiry. Static roles need no cleanup, but orphaned application accounts can remain if they were created outside OpenBao.
- Rotation control: Static roles rotate on the period you set. Dynamic roles rotate by issuing new leases.
- Plugin support: Confirm in the OpenBao Valkey plugin documentation whether static roles are supported for Valkey before designing around them.
Before you design either role, check the plugin's documented role types for Valkey, since the research supporting this page does not confirm static role support for it.
The choice changes what your application code must do when credentials change. With dynamic roles, every new lease brings a different username, so the application needs to fetch credentials at startup or renew them before expiry, and it must reconnect cleanly when a lease is revoked. With static roles, the username stays the same and only the password changes on rotation, so the application needs to re-read the password and reconnect when it rotates. In both cases, long-lived Valkey connections can outlive the credential that opened them, so connection pools need a plan for reauthentication.
- Reconnection on expiry: Dynamic leases that expire or get revoked close the session tied to that user, so pools must reconnect with fresh credentials.
- Rotation timing: A static password change can break clients that cache the old value, so rotation should be paired with a reconnect path.
- Renewal: Dynamic leases need renewal logic or a safe re-fetch before expiry.
- Connection fan-out: Many dynamic users across many replicas can multiply the number of ACL users Valkey tracks.
- Failure behavior: Confirm what happens to running services if OpenBao is unreachable when a lease or rotation is due.
Test reconnection under forced revocation and rotation in a non-production environment before you choose the role type for a production service.
Dynamic roles give each service instance its own Valkey username, which makes it easier to tie a command or connection back to a single lease. Static roles reuse one username across every client that reads the password, so Valkey logs show the shared account and the audit trail depends more on OpenBao's own audit log to show who read the password and when. Your audit design should cover both the OpenBao audit device and the Valkey side, because the two record different events.
- Per-instance attribution: Dynamic usernames can encode the service or instance, if your naming rules allow it.
- Shared account risk: A static account used by many replicas hides which instance performed an action on the Valkey side.
- Read events: Record who requested the current static password in OpenBao's audit log.
- Revocation evidence: Dynamic lease revocation is a traceable event, which supports incident response.
- Log retention: Confirm how long Valkey and OpenBao logs are kept and where they are forwarded.
Ask your security team which attribution level your access reviews require before you pick the role type, because that requirement often decides the design.
Dynamic roles suit services that can fetch and renew credentials on their own, and where per-instance attribution or automatic cleanup matters most. Static roles suit cases where an existing Valkey account cannot be replaced, such as legacy clients that cannot change usernames or vendor tools that expect a fixed account. Neither role is the right default for every workload, so most teams decide per service rather than adopting one model across the platform.
- Dynamic fit: New services built to read credentials from OpenBao at startup and handle reconnection.
- Static fit: Legacy applications or appliances that require a fixed username but can accept password changes.
- Mixed estates: Many organizations run both, with a register that records the role type for each service.
- Ownership: Name an owner for each role who approves changes to ACL rules and rotation periods.
- Exceptions: Document why a static account exists and set a review date.
Before you commit, confirm the plugin's static role support for Valkey and confirm your application clients can reconnect cleanly under either model.
Valkey plugin options and when each fits
This table compares the Valkey plugin configuration choices you will make when issuing ACL users from OpenBao, with the situations each one suits and its main trade-off. Use it to decide the design first, then confirm every exact key name in the plugin reference for your OpenBao version before writing configuration.
| Option | When it fits | Main trade-off |
|---|---|---|
| Connection URL and TLS settings | Any cluster where OpenBao must reach Valkey over an encrypted channel with a verified server certificate | Certificate trust and hostname checks add setup work, and a wrong CA setting fails at connection time rather than at configuration time |
| Root credential rotation | Rotating the privileged account OpenBao uses to create and delete ACL users, so that the bootstrap password is no longer known to people | Once OpenBao rotates the root credential, only OpenBao holds it, so break-glass recovery depends on your own documented process |
| Role creation statements | Defining the ACL user that each role produces, including which commands and keyspaces it can touch | Broad statements are easy to write and hard to audit later, so each role should be reviewed against the application's real access needs |
| ACL rule strings | Limiting issued users to specific key patterns and command categories for least privilege per service | Rule syntax errors or overly narrow patterns can break applications that were tested only in staging, so confirm rules against the Valkey ACL documentation |
| Default TTL | Short-lived credentials for workloads that can reconnect and fetch a new user without manual steps | Short TTLs increase renewal traffic and reconnect events, and applications that cache a connection may fail when a lease expires |
| Maximum TTL | Setting a hard ceiling so that renewals cannot extend a credential indefinitely | A low ceiling forces periodic re-issuance for long-running jobs, which must be planned into their design |
| Static role rotation period | Existing Valkey accounts that cannot be replaced with per-request users but must have their passwords rotated on a schedule | Rotation changes the password on a timer, so every consumer must read the current value from OpenBao or it will fail on rotation |
| Username customization | Not supported by the plugin, so usernames follow the plugin's generated pattern | Teams that need readable usernames for audit must map generated names to services in their logging and inventory instead |
Writing ACL rule creation statements safely
The creation statement is the only place where a generated Valkey user receives its permissions, so it carries most of the risk in this setup. The cards below cover what each part of the statement controls, how to scope it per service, and how to prove a rule behaves as intended before it reaches production.
Commands define what the user can do
The command rules in a creation statement set which Valkey operations the generated user may run, and they are the first thing an attacker would test after obtaining a credential. Grant read or write command categories only as far as the service needs, and avoid broad administrative or scripting permissions by default. Review each rule with the application team, because a service that only reads cache entries should never be able to run commands that change server configuration. Confirm the exact command syntax against your Valkey version's ACL documentation before you copy any example.
Key patterns limit reach
Key pattern rules decide which keys a generated user can touch. A pattern that is too wide lets one service read or overwrite another service's data, even when its commands are narrow. Use prefixes that match your key naming convention, and test that a key outside the pattern returns a permission error. Ask each team to list the key families it owns, since a pattern that is correct today can become too broad after a new feature adds keys under the same prefix.
Channel access for pub/sub
Pub/sub channel permissions are easy to overlook because they sit apart from key rules. A subscriber with unrestricted channel access can observe messages meant for other components, and a publisher with the same access can inject messages into them. Scope channels by name or pattern for each service, and treat any service that publishes to a shared channel as a separate role with its own statement. Verify both subscribe and publish paths during testing.
One role per service
Least privilege works only when each service gets its own role, its own creation statement and its own lease policy. A shared role lets one compromised workload obtain access that belongs to others, and it makes audit trails show a shared username rather than a single service instance. Map roles to services in a short table that records commands, key patterns, channels and lease duration side by side, so reviewers can see the full permission set in one place.
Templated usernames and passwords
The creation statement uses templates to generate the username and password for each lease. Keep the username template readable enough to trace a credential back to a service instance, while staying inside the length and character limits your Valkey deployment enforces. Confirm that the generated password meets your password policy, and check how the username template behaves when the name includes characters Valkey does not accept. Record the template choice in your design notes, because changing it later affects every consumer that parses usernames.
Revocation statements and test rollout
A revocation statement removes the generated user when its lease expires or is revoked, so a missing or incorrect statement leaves orphaned Valkey users that accumulate over time. Write the revocation step alongside the creation step, then run a full cycle on a non-production Valkey: create a lease, use it, revoke it and confirm the user no longer authenticates. Repeat the test for each role before rollout, and rerun it after every change to the statements or to the Valkey version.
What the Valkey plugin does not let you customize in usernames
The Valkey plugin generates the usernames for dynamic ACL users itself, so you cannot set their format through the plugin. A username that does not name the service or instance it belongs to matters for two reasons. First, the name appears in Valkey's ACL and client listings, so an operator looking at a live connection sees only the generated name. Second, incident response and audit reviews start from that name and need to connect it to a workload. Before you design around this, confirm in the documentation for your plugin version whether any username template or naming option exists, because the available settings can change between releases.
Several workarounds are worth evaluating, and none of them is a complete substitute for naming control. Encoding the service identity in the OpenBao role name often carries into the generated username, so test that with your version and check any length limits. Setting a client name in each application's connection code makes CLIENT LIST show the service and instance, but that name is set by the client and nothing enforces it. Logging the lease ID with each connection and keeping a mapping from lease to service in your logs lets you trace from OpenBao's audit output to the workload. Each option has a cost in naming discipline and in how renaming roles affects existing leases.
Turn this into a decision before go-live. Write down the attribution questions your incident responders and auditors will ask, then test them: create two leases from one role, and check what appears in the Valkey ACL list, the client list and the OpenBao audit log. If the generated names cannot answer those questions, use a separate role per service or confirm the requirement with your auditor before you rely on the plugin for that workload. Keep the test results with your deployment record so the naming behavior is documented for the plugin version you run.
Setting up Valkey dynamic credentials in OpenBao
This sequence takes a Valkey deployment from version confirmation to application access, with OpenBao issuing and revoking Valkey ACL users under a limited root account. Each step ends with a check you can run before moving on.
Confirm Valkey version and ACL support
Confirm the exact Valkey version your environment runs and that its ACL system is enabled and in use, since the dynamic user model depends on creating and deleting ACL users. Ask the Valkey project documentation and your own platform team which version line you are standardizing on, and check that your deployment mode (standalone, replicated or clustered) is the one you intend to test against. Record the version and the ACL configuration in your change record. The step is done when someone on the team can run an ACL listing command against a non-production node and see the default user and its permissions.
Create a dedicated OpenBao root account
Create a separate Valkey account that OpenBao uses only to manage other users. Give it the ACL permissions needed to create, modify and delete users and to set their command and key rules, and nothing beyond that. Do not reuse the default user, an application account or a human administrator account. Store its password where only the OpenBao administrators can read it, and document which permissions you granted and why. The step is done when a login with this account succeeds and the account can create and delete a throwaway test user, but cannot run data commands against application keys.
Enable the database secrets engine
Enable the database secrets engine on the OpenBao cluster at the mount path your team has chosen, and keep the mount path consistent across environments. Use an OpenBao administrator token or policy that limits who can change this mount. Confirm that the Valkey database plugin is available in your OpenBao build, since plugin availability depends on the version and distribution you run, and ask the project which plugin name matches your Valkey version. The step is done when the mount appears in the list of enabled secrets engines and the plugin type is reported without error.
Configure the Valkey connection with TLS
Create a database connection that points to your Valkey endpoints, supplies the dedicated root account from the second step, and requires TLS for every connection. Provide the CA certificate that signs the Valkey server certificate so OpenBao verifies the server rather than trusting any certificate. Store the root password in the connection configuration, which OpenBao encrypts at rest, and keep the configuration under a policy limited to administrators. The step is done when a connection test reports success against your non-production Valkey and a connection attempt with an incorrect CA fails.
Rotate the root credential
Rotate the dedicated root account password through OpenBao so that only OpenBao knows the current value after the rotation completes. Run the rotation, then confirm that the previous password no longer authenticates and that the new one works only for OpenBao's connection. Record the rotation in your audit trail and decide who is allowed to trigger rotations in the future. The step is done when a direct login with the old password fails, the OpenBao connection test still succeeds, and the audit log shows the rotation event.
Define dynamic and static roles
Create dynamic roles that generate a new Valkey user per request, with a creation statement that sets the ACL rules and a revocation statement that deletes the user, plus a time-to-live and a maximum lease. Add a static role only for an existing account that cannot be replaced yet, with a rotation period set by your policy. Keep the ACL rules as narrow as the application needs, and check the exact statement syntax against the Valkey ACL documentation for your version. Ask for a review of the statements before they go to production. The step is done when a role can be read back with its statements and TTL, and the statements contain no wildcard permissions you did not intend.
Test lease issuance and revocation
Request credentials from a dynamic role on the non-production Valkey and authenticate with them using a Valkey client. Confirm that the user can run only the commands and touch only the keys the ACL rules allow, then revoke the lease through OpenBao and confirm the user is removed from Valkey and can no longer authenticate. Repeat for a lease that expires on its own. Note any username format issues, because the plugin does not let you customize usernames, so your monitoring and log parsing must accept the generated names. The step is done when issued credentials work, revoked credentials fail, and the Valkey ACL list no longer contains the test users.
Grant application policies
Write an OpenBao policy that allows each application identity to read only its own dynamic role path, then bind that policy to the authentication method the application uses. Keep one role per application so revocation and audit can be tied to one service, and avoid giving applications permission to read the root connection or to manage roles. Deploy to production only after the test lease cycle passes. The step is done when an application identity can obtain a credential from its own path, is denied on another application's path, and the resulting Valkey session is visible in your audit records.
Securing the OpenBao to Valkey trust path
Dynamic credentials for Valkey are only as safe as the path that creates them. The cards below cover the root credential OpenBao uses to manage ACL users, the network and TLS path between the two systems, how long issued users live, what gets logged, and which OpenBao policies may request each role.
Root credential storage and rotation
OpenBao needs a Valkey account with permission to create and delete ACL users, and that account is the most sensitive credential in the design. Store it in a location only the OpenBao operators can read, and plan a rotation with a named owner, since rotating it is a configuration change on the OpenBao side. Confirm with the plugin documentation whether OpenBao can rotate this root credential itself and which Valkey permissions the account needs. Avoid reusing the Valkey default or application accounts for this role.
Network path and TLS
Connections from OpenBao to Valkey carry the root credential and every issued password, so they should be encrypted and limited to the OpenBao nodes. Restrict the Valkey port to the OpenBao network segment, and confirm that the connection settings you plan to use support TLS and certificate verification. Check how OpenBao reaches Valkey during failover, because an address that points to a single node can break issuance and revocation.
Lease TTL choices
Each dynamic Valkey user is created with a lease, and the lease TTL sets how long a leaked password stays useful. Shorter leases reduce exposure but increase renewal traffic and the chance that a long-running client loses its connection at expiry. Set default and maximum TTLs per role, and test how your clients reconnect when a lease ends. Document the chosen values so application owners know what to expect.
Audit logging of issuance and revocation
Every credential issuance and revocation should appear in an audit trail that ties the Valkey username to the requesting OpenBao identity and role. Enable OpenBao audit devices, decide where the logs go, and confirm that lease revocations are recorded, including those triggered by expiry. Verify that the audit trail can answer which service held a given Valkey user at a given time, and that log storage and retention meet your own policy.
Policies that can request each role
Limit which OpenBao policies can read the credential path for each Valkey role, so a service can only obtain the access it needs. Give each application its own auth role and policy, and avoid wildcard paths that let one team request another team's Valkey user. Review these policies whenever roles are added, and test them with a token from each application to confirm that requests for other roles are denied.
Common questions about OpenBao and Valkey credentials
What does an OpenBao Valkey credentials engagement cost, and who pays for what?
The cost follows from the written scope, and DeployOpen does not publish a price list. DeployOpen's fee covers planning, configuring the OpenBao engine, defining Valkey ACL rules and role mappings, testing, and documentation. Your organization pays for its own infrastructure, including the OpenBao cluster, Valkey servers and network paths, plus staff time from application owners and the platform or database team. One-time costs include design, initial setup and application changes. Recurring costs include upgrades, rotation operations and any support retainer. The main drivers are the number of Valkey deployments, the number of distinct application roles, and whether existing accounts must be mapped to static roles. Ask for a quote that separates these items and states the assumptions behind each.
How long does a typical Valkey credential setup take?
Duration is set during scoping, and no typical figure applies here because it depends on the environment. The main drivers are how many Valkey deployments are in scope, how many applications need their own ACL roles, whether existing Valkey accounts must move to static roles, and how many environments must be built and tested before production. Change windows and approval cycles for rotating the root credential often set the pace more than the engineering does. A narrower first phase covering one Valkey deployment and one application is usually easier to schedule and verify. Ask the proposal to list milestones, dependencies and the client decisions each milestone needs, so the timeline reflects your approval process.
What does our team need to provide for this work?
Plan access and decisions before the build starts. The work typically needs:
- Administrative access to the Valkey deployments, including the ability to create ACL users and change the root credential.
- A running OpenBao cluster, or an agreed place to deploy one, with network paths from OpenBao to Valkey.
- An inventory of the applications that will consume credentials, with their owners and the commands each one runs.
- Approval to rotate the root credential, with a rollback plan and a maintenance window.
- A non-production Valkey environment for testing.
Your team also needs to name who owns the policies and who responds when a credential issue reaches production.
Can an internal team set up OpenBao dynamic credentials for Valkey alone?
Yes, an internal team can do it if it has engineers who understand Valkey ACL rules, OpenBao policies and leases, and the applications that will change. The risky steps are rotating the root credential, writing ACL rules broader than the application needs, and changing connection code so it handles expired credentials. A common approach is to pilot one non-critical service first, then expand. Ask whether someone on the team can review the ACL statements and explain what happens when a lease is revoked. If the answer is no, a fixed-scope engagement can cover design and the first rollout while your team takes over day-to-day operations.
How do lease TTLs affect application reconnects to Valkey?
Lease TTLs decide how often an application must obtain a new Valkey user, so they directly affect reconnects. OpenBao leases expire and are revoked automatically, and a revoked user can no longer authenticate, so connections using it can fail. Applications need to renew the lease before it expires, or fetch a new credential and reconnect, and connection pools must replace connections without dropping in-flight requests. Set the TTL and maximum TTL together with pool behavior, then test expiry in staging by forcing a revocation and watching error rates. Leasing and automatic revocation are described in What is OpenBao.
Can we customize the usernames OpenBao generates for Valkey?
No, the Valkey plugin does not support customizing the usernames OpenBao generates, so plan around the generated format. Teams usually need usernames that show which service or instance used them. You can record the lease ID, role name and requesting service in your own audit trail, and group roles by application so the role name carries the meaning. Confirm the exact username format in the plugin version you deploy, and check whether your Valkey logs show the username at connection time. Test that your monitoring still identifies each service after any plugin or OpenBao upgrade, because naming behavior can change between versions.
What ongoing operations recur after OpenBao issues Valkey credentials?
Routine operations include scheduled root credential rotation, monitoring lease counts and renewal failures, reviewing ACL rules whenever applications change, and keeping OpenBao and the Valkey plugin current. Upgrades need a test pass against the Valkey versions you run, since ACL behavior and plugin compatibility should be confirmed for each pair. Alerting should cover failed issuance, spikes in revocations and rotation errors. Staff time for these tasks recurs for the life of the setup. A support retainer can cover upgrades, continuous checks and incident response, and the quote should state that periodic scope in writing.
When should we ask for an independent security review of this setup?
Ask for an independent review before production, after significant ACL or policy changes, and whenever the setup expands to more sensitive data. DeployOpen runs security testing and can test the OpenBao and Valkey configuration, including credential handling and permissions, then deliver findings with fixes and a retest. DeployOpen does not issue audit reports or certifications. If your compliance program needs an attestation, an independent auditor or certification body provides it, and the review gives that auditor evidence to examine. Scope the review to the ACL statements, role definitions, root rotation procedure and application reconnect behavior.
Operating dynamic Valkey credentials day to day
Day-to-day operation of dynamic Valkey credentials starts with knowing how many leases exist and how quickly you can end them. Every ACL user OpenBao creates is tied to a lease, and leases expire and revoke automatically, so the number of active leases per role is the figure to watch. Track it against the expected count for each consuming service, and alert when it climbs without a matching deployment. For incidents, OpenBao supports bulk revocation as documented in the project overview, but you must confirm how the Valkey plugin removes ACL users on the server side, how long that takes, and whether existing client connections stay open after the user is deleted. Write a runbook that names the revocation command for each role and rehearse it in a non-production cluster.
The root credential that OpenBao uses to create and delete Valkey users is the most sensitive account in this design, so its rotation needs a fixed schedule and a named owner. Confirm with the plugin documentation how root credential rotation works, which account OpenBao rotates to, and whether any consuming system still holds the previous value during the change. OpenBao and the Valkey plugin should be upgraded together. Before each OpenBao upgrade, read the release notes for changes to the secrets engine API or plugin handling, check that the plugin version you run supports the target OpenBao release, and test the upgrade against a copy of production configuration. Record the rotation and upgrade dates in your change log so auditors can trace each change.
Failover testing matters because a Valkey failover changes which server accepts logins while leases remain valid in OpenBao. Run a planned failover while several dynamic leases are active and confirm that every consuming service reconnects with its existing credential or renews it without manual steps. Confirm how ACL users reach replicas in your topology, since a user created on the primary must exist wherever clients can reconnect after promotion. Also test OpenBao itself: stop the active node in your OpenBao high availability cluster and verify that lease renewals and new issuance resume on the standby. Log the results, the lease counts before and after, and any service that needed a restart, and repeat the drill after each Valkey or OpenBao upgrade.
How DeployOpen scopes and delivers Valkey credential work
DeployOpen plans, builds, documents and supports OpenBao dynamic credentials for Valkey inside your own infrastructure, with the Valkey ACL work, OpenBao configuration and access model agreed in writing before the build starts. Engagements are fixed-scope, and the handover covers what your team needs to run the setup after go-live.
How we scope
- We confirm which Valkey deployments, OpenBao clusters and applications will receive dynamic or static credentials.
- We record the Valkey version, ACL features and username format each consumer requires before any configuration starts.
- We agree in writing which roles, lease lengths, root rotation steps and test cases are in scope.
How we build
- We configure the Valkey secrets engine, root credential rotation and ACL creation statements in a test environment first.
- We test that each role issues only the permissions it was designed for and that revocation removes the user cleanly.
- We check how application clients reconnect when leases expire, and record the results alongside the configuration.
How we hand over
- We deliver the configuration, role definitions and creation statements as versioned files your team can review and reuse.
- We document the username convention, lease behavior and the procedure for rotating the Valkey root credential.
- We walk your operators through troubleshooting steps for failed issuance, revocation and client reconnection.
How we support
- Ongoing support, upgrades and continuous testing are available as retainers after the initial handover.
- A retainer can cover reviews of OpenBao or Valkey version changes that affect the credential workflow.
- Ask any provider to confirm in writing which environments, versions and responsibilities their quote includes.

