Oracle database secrets engine
Oracle is one of the supported plugins for the database secrets engine. This plugin generates database credentials dynamically based on configured roles for Oracle Database, and also supports Static Roles.
See the database secrets engine docs for more information about setting up the database secrets engine.
The Oracle secrets engine uses the pure-Go
sijms/go-ora driver, so it does not
require the Oracle Instant Client and the plugin binary builds with
CGO_ENABLED=0.
Oracle identifiers are case-folded to upper-case unless double-quoted. The default dynamic-username template produces an upper-case, underscore-separated identifier truncated to 30 characters (the historical Oracle identifier limit, kept for the widest compatibility across Oracle versions).
Capabilities
| Plugin Name | Root Credential Rotation | Dynamic Roles | Static Roles | Username Customization |
|---|---|---|---|---|
oracle-database-plugin | Yes | Yes | Yes | Yes |
Setup
-
Enable the database secrets engine if it is not already enabled:
$ bao secrets enable databaseSuccess! Enabled the database secrets engine at: database/By default, the secrets engine will enable at the name of the engine. To enable the secrets engine at a different path, use the
-pathargument. -
Configure OpenBao with the proper plugin and connection information:
$ bao write database/config/my-oracle-database \plugin_name="oracle-database-plugin" \allowed_roles="my-role" \connection_url="oracle://{{username}}:{{password}}@oracle.example.com:1521/XEPDB1" \username="SYSTEM" \password="oracle"Success! Data written to: database/config/my-oracle-database -
Configure a role that maps a name in OpenBao to a set of SQL statements to execute to create the database credential:
$ bao write database/roles/my-role \db_name="my-oracle-database" \creation_statements="CREATE USER {{name}} IDENTIFIED BY \"{{password}}\"; \GRANT CREATE SESSION TO {{name}}; \GRANT SELECT ANY TABLE TO {{name}};" \default_ttl="1h" \max_ttl="24h"Success! Data written to: database/roles/my-roleThe
{{name}},{{username}},{{password}}, and{{expiration}}fields will be populated by the plugin with dynamically generated values. Oracle has no native user expiration, so{{expiration}}is informational only — OpenBao's lease and its revocation of the user at expiry are what actually bound the credential's lifetime.
Usage
After the secrets engine is configured and a user/machine has an OpenBao token with the proper permission, it can generate credentials.
-
Generate a new credential by reading from the
/credsendpoint with the name of the role:$ bao read database/creds/my-roleKey Value--- -----lease_id database/creds/my-role/2f6a614c-4aa2-7b19-24b9-ad944a8d4de6lease_duration 1hlease_renewable truepassword SsnoaA-8Tv4t34f41baDusername V_TOKEN_MY_ROLE_A1B2C3D4_1717000000
API
The full list of configurable options can be seen in the Oracle database plugin API page.
For more information on the database secrets engine's HTTP API please see the Database secrets engine API page.