OpenBao Rust SDK
openbao is a secure, typed, async Rust SDK for
OpenBao, the community-driven open source fork of
Vault. It is designed for audited secret workflows: HTTPS by default, no
redirect forwarding, strict path validation, secret-aware token types, and a
small reviewed dependency surface.
The crate name on crates.io is openbao; Rust imports are lowercase:
use Client;
This README documents the 0.5.0 release line. 0.5.0 builds on 0.4.0
with Userpass auth, JWT auth, database secrets, and typed Transit signing/JWS
ergonomics.
The crate is dual-licensed under MIT or Apache-2.0.
Current Status
Implemented now:
- Async client with typestate authentication.
- Direct token authentication with re-exported
openbao::SecretString. - AppRole login with secret-aware role ID, secret ID, token, and accessor handling.
- Kubernetes auth login plus config and role administration helpers.
- TLS certificate auth login, method config, CA role, and CRL administration helpers.
- JWT login plus JWT/OIDC auth method config and role administration helpers.
- Userpass login plus user create/read/list/delete, password update, and policy update helpers.
- Token create, lookup, accessor lookup/list, renew, revoke, and revoke-self helpers.
- KV v2 read, write, CAS write, patch, list, latest delete, version read, version delete, undelete, destroy, metadata, backend config, typed data, and secret-aware service config helpers.
- KV v1 read, write, delete, and list helpers.
- Database connection config, dynamic roles, static roles, root/static rotation, and credential helpers.
- PKI URL and CRL config, root/intermediate generation, intermediate signing and install, role write/read/list/delete, issue, sign, revoke, certificate list/read, issuer/key list/read/delete/update, issuer revoke, CA/key import, ACME config/EAB/directory URL, CRL rotate, and tidy helpers.
- Transit key create, read, list, delete, encrypt, decrypt, rewrap, data key, random, hash, HMAC, sign, verify, typed RSA/JWS signing options, and optional raw-byte helpers.
- System health, seal status, and loopback-only dev bootstrap helpers.
- Secret and auth mount enable, list, read, tune, and disable helpers.
- Response wrapping lookup, wrap, unwrap, and rewrap helpers.
- ACL policy list, read, write, delete, and prefix list helpers.
- Capability checks for the caller token, an explicit token, or a token accessor.
- Audit device list, enable, disable, and hash helpers.
- Safe exact lease lookup, renew, and revoke helpers.
- Plugin catalog list, type-list, register, read, delete, and backend reload helpers.
- Environment-based client construction from common OpenBao/Vault variables.
- Raw JSON request escape hatch for endpoints that are not typed yet.
- Local TLS OpenBao Podman stack on
9940and9941. - Real OpenBao integration test gate using the pinned OpenBao image.
Planned next:
0.6.0: SSH, TOTP, and explicitly gated production init/unseal/rekey/rotate APIs.0.7.0: cubbyhole, identity, Kubernetes secrets, LDAP secrets, and RabbitMQ.0.8.0: remaining auth methods and broader system backend automation.
See API Coverage and
Release Plan for the road to 1.0.0.
Trust Dashboard
| Area | Status |
|---|---|
| License | MIT OR Apache-2.0 |
| Rust edition | 2024 |
| MSRV | Rust 1.90.0 |
| Async runtime | Runtime-agnostic client; examples use Tokio |
| HTTP transport | reqwest with redirects disabled |
| Default TLS backend | Rustls |
| TLS floor | TLS 1.3 by default; TLS 1.2 requires explicit opt-in |
| Plain HTTP | Rejected by default; sensitive requests still require HTTPS |
| Token storage | openbao::SecretString (secrecy::SecretString) |
| Unsafe policy | unsafe_code = "forbid" |
| Path validation | Rejects traversal, query/fragment injection, empty segments, controls, and trailing periods |
| Error posture | API error strings are bounded and sanitized before formatting |
| Dependency policy | cargo deny plus RustSec audit in the release gate |
| Release evidence | fmt, clippy, tests, docs, deny, audit, SBOM, and real OpenBao integration |
| Pentest gate | Required before tagging a release |
Security details live in SECURITY.md. Release evidence and release sequencing live in release-notes and docs/RELEASE_PLAN.md.
Rust Version Support
The minimum supported Rust version is Rust 1.90.0. New deployments should
prefer the latest stable Rust; as of May 30, 2026, that is Rust 1.96.0.
The 0.5.0 release gate will refresh compatibility evidence across this
range before tagging:
| Rust | Required Evidence |
|---|---|
1.90.0 |
Full test suite and clippy. |
1.91.0 |
cargo check --all-features. |
1.92.0 |
cargo check --all-features. |
1.93.0 |
cargo check --all-features. |
1.94.0 |
cargo check --all-features. |
1.95.0 |
cargo check --all-features. |
1.96.0 |
cargo check --all-features. |
Install
[]
= "0.5"
= { = "1.0.228", = ["derive"] }
= { = "1.52.3", = ["macros", "rt-multi-thread"] }
Some advanced examples below use JSON helper types directly:
[]
= "1.0.150"
The crate defaults to the common SDK surface:
[]
= { = "0.5", = ["approle", "cert-auth", "database", "jwt-auth", "kubernetes-auth", "userpass", "token", "kv1", "kv2", "pki", "transit", "sys", "rustls-tls"] }
For a smaller build, disable defaults and opt into only what the application uses:
[]
= { = "0.5", = false, = ["kv2", "sys", "rustls-tls"] }
Features
| Feature | Default | Purpose |
|---|---|---|
approle |
yes | AppRole authentication helpers. |
cert-auth |
yes | TLS certificate auth login/config/role/CRL helpers. |
database |
yes | Database secrets engine config, role, credential, and rotation helpers. |
jwt-auth |
yes | JWT login plus JWT/OIDC config and role administration helpers. |
kubernetes-auth |
yes | Kubernetes auth login/config/role helpers. |
userpass |
yes | Userpass login and user administration helpers. |
token |
yes | Token lifecycle helpers. |
kv1 |
yes | KV v1 secrets engine helpers. |
kv2 |
yes | KV v2 secrets engine helpers. |
pki |
yes | PKI authority, issuer/key metadata/import, role, issue/sign, revoke, cert read/list, ACME config/EAB/directory URL, CRL config/rotate, and tidy helpers. |
transit |
yes | Transit cryptography helpers. |
transit-bytes |
no | Raw-byte Transit convenience helpers using base64-ng for OpenBao's base64 request/response fields. |
sys |
yes | System backend helpers. |
allow-sha1 |
no | Explicit opt-in for legacy Transit SHA-1 selection. Disabled by default. |
rustls-tls |
yes | Rustls transport configuration. |
native-tls |
no | Legacy native TLS support. Requires native-tls-acknowledged after audit. |
native-tls-acknowledged |
no | Explicit acknowledgment for audited native TLS builds. |
Support Matrix
Client, Transport, And TLS
| Capability | Status | Notes |
|---|---|---|
| Async client | Yes | Built on reqwest with a small public API surface. |
| Typestate auth | Yes | Separate unauthenticated and authenticated client states. |
| HTTPS by default | Yes | Plain HTTP is rejected unless loopback HTTP is explicitly enabled. |
| Redirect protection | Yes | Redirect following is disabled to avoid forwarding token headers. |
| Response size cap | Yes | 32 MiB default with per-client lowering for small-response workflows. |
| TLS floor | Yes | TLS 1.3 minimum by default; audited legacy deployments can opt down to TLS 1.2. |
| Custom CA roots | Yes | Extra root certificates can be merged with the platform trust store. |
| Root-only trust stores | Yes | System roots can be bypassed by using only configured root certificates. |
| Client TLS identity | Yes | Optional mutual TLS client identity for TLS certificate auth. |
| Connection timeout | Yes | 5-second connection timeout by default; caller overrides are bounded. |
| User agent fingerprinting | Yes | Default user agent omits the exact crate version. |
| Namespace header | Yes | X-Vault-Namespace support for namespace-aware deployments. |
| Environment construction | Yes | Reads OPENBAO_*, BAO_*, and VAULT_* aliases with secure defaults. |
| Raw JSON requests | Yes | Escape hatch for endpoints that are not typed yet. |
Authentication
| Capability | Status | Notes |
|---|---|---|
| Direct token auth | Yes | Tokens are accepted as SecretString. |
X-Vault-Token |
Yes | Default documented OpenBao-compatible token header. |
| Bearer auth | Yes | Optional Authorization: Bearer header mode. |
| AppRole login | Yes | Role ID and secret ID are secret-aware; returned token is wrapped. |
| Token accessor handling | Yes | Accessors are treated as secret material. |
| Token lifecycle helpers | Yes | Lookup, accessor lookup/list, renew, revoke, revoke-self, and create helpers. |
| Kubernetes auth | Yes | Login, auth method config, and role administration helpers. |
| TLS certificate auth | Yes | Login, auth method config, CA role administration, and CRL helpers. |
| JWT/OIDC | Yes | JWT login plus JWT/OIDC auth method config and role administration helpers. Browser OIDC callback helpers are still planned. |
| Userpass auth | Yes | Login and user create/read/list/delete, password update, and policy update helpers. |
Secret Engines
| Capability | Status | Notes |
|---|---|---|
| KV v2 read/write | Yes | Typed serialization and deserialization. |
| KV v2 CAS write | Yes | Optional check-and-set version support. |
| KV v2 patch | Yes | JSON merge patch content type. |
| KV v2 list/delete versions | Yes | Metadata list, latest delete, soft delete, undelete, and destroy. |
| KV v2 metadata/config | Yes | Backend, per-key metadata, typed data, and secret-aware service config helpers. |
| KV v1 | Yes | Read, write, delete, and list helpers. |
| Database credentials | Yes | Connection config/list/read/delete, dynamic roles/credentials, static roles/credentials, and root/static rotation helpers. |
| Transit | Yes | Key create/read/list/delete, encrypt, decrypt, rewrap, data key, random, hash, HMAC, sign, verify, typed RSA/JWS signing options, and optional raw-byte helpers. |
| PKI | Partial | Authority generation/signing/install, URL/CRL config, roles, issue, sign, revoke, certificate list/read, issuer/key list/read/delete/update, issuer revoke, CA/key import, ACME config/EAB/directory URL, CRL rotate, and tidy are implemented. |
| SSH and TOTP | Planned | Planned for 0.6.0. |
| Identity and remaining engines | Planned | Planned for 0.7.0. |
System Backend And Operations
| Capability | Status | Notes |
|---|---|---|
| Health | Yes | Accepts OpenBao active, standby, sealed, and uninitialized health statuses. |
| Init status | Yes | Typed /sys/init status helper. |
| Seal status | Yes | Typed /sys/seal-status helper. |
| Dev bootstrap | Yes | Fresh numeric-loopback dev instances only; not for production or HSM/KMS deployments. |
| Mount management | Yes | Secret and auth mount enable/list/read/tune/disable helpers. |
| Response wrapping | Yes | Lookup, wrap, unwrap, and rewrap helpers. |
| Policies and capabilities | Yes | ACL policy helpers plus self/token/accessor capability checks. |
| Audit devices | Yes | Enable, list, disable, and audit hash helpers. |
| Lease helpers | Yes | Safe exact lookup, renew, and revoke; prefix/force/tidy operations are intentionally not exposed. |
| Plugin catalog | Yes | List, type-list, register, read, delete, and mounted backend reload helpers. |
| Production init, unseal, rekey, rotate | Planned | Explicit safety documentation in 0.6.0. |
| Quotas, metrics, namespaces | Planned | Planned in the 0.8.0 operations line. |
Examples
Create a client from an existing token:
use ;
use SecretString;
async
Create an authenticated client from environment variables:
use ;
async
Configure a stricter client with a namespace and root-only trust store:
use ;
use Certificate;
use SecretString;
async
Authenticate with AppRole:
use ;
use SecretString;
async
Authenticate with Userpass:
use ;
async
Authenticate with JWT:
use ;
async
Write and read KV v2 data:
use ;
use SecretString;
use ;
async
Use KV v2 check-and-set, patch, and version operations:
use ;
use ;
use SecretString;
use Serialize;
async
Load service configuration from KV v2:
use ;
use SecretString;
use Deserialize;
async
Read dynamic database credentials:
use ;
async
Use a KV v1 mount:
use ;
use SecretString;
use ;
async
Encrypt and decrypt through Transit:
use ;
use ;
use ;
async
Encrypt and decrypt raw bytes with the optional transit-bytes feature:
use ;
use ;
async
Sign data for JWS/JWT-style ECDSA workflows:
use ;
use ;
async
Create, inspect, renew, and revoke a child token:
use TokenCreateRequest;
use ;
use SecretString;
use BTreeMap;
async
Enable a KV v2 mount:
use ;
use SecretString;
async
Wrap and unwrap JSON data:
use ;
use SecretString;
use ;
async
Write an ACL policy and check capabilities:
use ;
use PolicyWriteRequest;
async
Enable an audit device and calculate an audit hash:
use ;
use AuditEnableRequest;
use BTreeMap;
async
Look up and renew one exact lease:
use ;
use SecretString;
async
Read and reload a plugin catalog entry:
use ;
use ;
use SecretString;
async
Call an endpoint that is not typed yet:
use ;
use Method;
use SecretString;
use Value;
async
The raw request layer is intentionally low level. Prefer typed helpers when the crate supports an endpoint; use raw JSON to bridge missing OpenBao APIs while coverage grows.
Local OpenBao Dev Instance
The local dev stack uses Podman, TLS, a private CA, and loopback-only ports in
the requested 994x range.
Prepare the rootless Podman volume and TLS assets without starting OpenBao:
This project does not require a /srv directory tree for local development:
raft data lives in a Podman-managed volume, and TLS material lives in the
ignored deploy/podman/dev-state/ directory.
Endpoints:
- API:
https://127.0.0.1:9940 - Cluster:
https://127.0.0.1:9941 - CA certificate:
deploy/podman/dev-state/tls/dev-ca.crt
Initialize and unseal OpenBao using bao operator init and
bao operator unseal, then export BAO_ADDR=https://127.0.0.1:9940 and
BAO_CACERT=deploy/podman/dev-state/tls/dev-ca.crt.
For disposable local development, the crate can initialize and unseal a fresh numeric-loopback instance directly:
use ;
use Certificate;
async
bootstrap_dev is not a production initialization ceremony. It creates root
and unseal material in process memory, uses Shamir keys, refuses non-loopback
targets, and refuses already initialized servers. Do not use it with HSM/KMS
auto-unseal, shared environments, or any instance that requires operator key
ceremony.
Run the real OpenBao integration flow:
The integration script creates a fresh TLS dev instance, initializes and
unseals it, stores the root token in a temporary 0600 file for the test
process, and removes that file when the run exits.
Release Discipline
Run the normal local checks:
Run the current release gate:
Set OPENBAO_SKIP_INTEGRATION=1 only when Podman is unavailable; release
candidate validation should run the integration gate.
No release tag should be cut unless the matching pentest report status is reviewed and recorded in the release notes.