After you have configured Hashicorp Vault Transit Secrets Engine as stated in the Configuring section, you will be able to then encrypt your EDB Postgres distribution database.
Note
It is important to note that this doc is intended for versions 15.2 and above of EDB Postgres Advanced Server or versions 15.2 and above of EDB Postgres Extended Server as these versions support Transparent Data Encryption (TDE).
After the Hashicorp Vault Transit secrets engine is configured and a user/machine has a Vault token with the proper permissions, this was configured during your install and setup of Transit Secrets Engine, it can use this secrets engine to encrypt a key.
Perform initdb for the Database
After you have enabled Hashicorp Vault Transit Secrets Engine and created a key, you will be able to export the PGDATAKEYWRAPCMD and PGDATAKEYUNWRAPCMD to wrap and unwrap your encryption key and initialize your database.
Login to your EDB Postgres distribution as the database superuser, for example sudo su - enterprisedb.
Navigate to the /bin directory where your executables live. In our example it is /usr/lib/edb-as/15/bin.
Perform your initdb per your database requirements, for example: ./initdb -D dd12 -y.
If all is successful you should get an output that looks like this:
Start your database and navigate to your /data directory to view the postgresql.conf file to ensure that your data_encryption_key_unwrap_command that you set with your export PGDATAUNWRAPCMD is present under the Authentication section.
Encrypt Plaintext Data
Hashicorp Vault Transit Secrets Engine can also encrypt some plaintext data. However any plaintext data needs to be base64-encoded. This is a requirement as Hashicorp Vault does not require that the plaintext data is "text", it could also be another type of file.
As an added note, Hashicorp Vault does not store any data, that is up to the database user. For any more information on Hashicorp Vault Transit Secrets Engine visit the Hashicorp documentation.
For more information on how TDE is incorporated with EDB Postgres Advanced Server and EDB Postgres Extended Server visit the EDB Transparent Data Encryption documentation.