# Using OpenBao as a key provider

> Configure an OpenBao secrets engine, token, and pg_tde key provider.

---

LLMS index: [llms.txt](/llms.txt)

---

> This is the Percona pg_tde 2.3.0 manual. For the paired build, backup tools and major upgrades, see [PG TDE on Mimus](/docs/tde/).

You can configure `pg_tde` to use OpenBao as a global key provider for managing encryption keys securely.

> [!NOTE]
> This guide assumes that your OpenBao server is already set up and accessible. OpenBao configuration is outside the scope of this document, see [OpenBao's official documentation](https://openbao.org/docs/) for more information.

## Example usage {#example-usage}

To register an OpenBao server as a global key provider:

```sql
SELECT pg_tde_add_global_key_provider_vault_v2(
    'provider-name',
    'url',
    'mount',
    'secret_token_path',
    'ca_path',
    'namespace'
);
```

## Parameter descriptions {#parameter-descriptions}

* `provider-name` is the name to identify this key provider
* `secret_token_path` is a path to the file that contains an access token with read and write access to the above mount point
* `url` is the URL of the OpenBao server
* `mount` is the mount point where the keyring should store the keys
* [optional] `ca_path` is the path of the CA file used for SSL verification
* [optional] `namespace` is the namespace within the OpenBao server. Read more about the [namespace support in OpenBao](https://openbao.org/blog/namespaces-announcement/)` (NOTE: You can use a namespace without ca_path. In this case, specify NULL as the ca_path value)

The following example is for testing purposes only. Use secure tokens and proper SSL validation in production environments:

```sql
SELECT pg_tde_add_global_key_provider_vault_v2(
    'my-openbao-provider',
    'https://openbao.example.com:8200',
    'secret/data',
    '/path/to/token_file',
    '/path/to/ca_cert.pem'
);
```

For more information on related functions, see the link below:

[Percona pg_tde Function Reference](/docs/tde/upstream/functions/)

## Next steps {#next-steps}

[Global Principal Key Configuration ](/docs/tde/upstream/global-key-provider-configuration/set-principal-key/)

[PG.CENTER edition](https://github.com/pgsty/doc.pg.center/blob/4410c32dc9186a22859008303f474b72a779f583/content/percona/global-key-provider-configuration/openbao.md) · [Upstream source](https://github.com/percona/pg_tde/blob/5dd7a9e4e3599d88546f5de67ff0f4ef3fe51a9a/documentation/docs/global-key-provider-configuration/openbao.md)

---

Backlinks:

- [Choose a provider](/docs/tde/upstream/global-key-provider-configuration/overview/)
