After you have configured all of the Hashicorp Vault certificates, as stated in the Configuring section, you will be able to use them in conjunction with your EDB Postgres distribution.
Note
It is important to note that this doc is intended for versions 15.2 and above of EDB Postgres Advanced Server and versions 15.2 and above of EDB Postgres Extended Server as these versions support Transparent Data Encryption (TDE).
To implement Hashicorp Vault Secrets Engine with your EDB Postgres distribution, you must ensure that you have the following downloaded to your system:
edb-tde-kmip-client downloaded from your EDB Repos access
All of the .pem files that you created in the Configuring section, key.pem, cert.pem and ca.pem, need to be copied to the system where your EDB Postgres distribution is installed. For our example, all of the .pem files and the edb_tde_kmip_client.py program are in the /tmp/ directory.
Check Prerequisites and Download edb-tde-kmip-client
Ensure that you have the prerequisite software (Python and Pykmip) installed on your system as stated in the Configuring section.
To install the edb-tde-kmip-client on your system assume root user and issue the install command for edb-tde-kmip-client. For our example we installed it on a RHEL8 Server so it would be dnf install edb-tde-kmip-client.
You should receive some output that looks like the following:
Create pykmip.conf File
On your system where you have your EDB Postgres distribution, navigate to the directory where you have saved your .pem files and the edb_tde_kmip_client.py client.
In that directory create a file called pykmip.conf and input the following:
Host
Port
Keyfile
Certfile
Ca_certs
For example:
Note
For more information on the pykmip.conf file and the contents of it you can visit the pykmip documentation.
Create a Key on Hashicorp Vault Secrets Engine
On your system where you have your EDB Postgres distribution, assume root user to create the key on the Hashicorp Vault Secrets Engine.
Type python3 and then input the following, making adjustments per your system setup and directory paths:
If this runs without error then your key has been successfully created. You cannot view keys that you create in Hashicorp Vault.
Verify Encryption and Decryption
To ensure that your key you created will be able to encrypt and decrypt data, run the following two commands as the root user on your system with your EDB Postgres distribution.
If this is successful it should produce the output of secret.
Perform initdb for the Database
After you have completed the above steps 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 Superuser. For our example: enterprisedb user, 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, which you set with your export PGDATAUNWRAPCMD, is present under the Authentication section.
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.