Implementing Hashicorp Vault with EDB Postgres Advanced Server version 15.2 and above and EDB Postgres Extended Server version 15.2 and above requires the following components:
Note
The EDB Postgres Advanced Server version 15.2 and above and EDB Postgres Extended Server version 15.2 and above, products will be referred to as EDB Postgres distribution. The specific distribution type will be dependent upon customer need or preference.
EDB Postgres Distribution (15.2 or later)
Hashicorp Vault Enterprise version 1.13.2+ent or 1.12.6+ent
A running EDB Postgres distribution with Python and pykmip installed
Hashicorp Vault Enterprise edition with enterprise licensing installed and deployed per your VM environment
Check/Install Python on Server
Many Unix-compatible operating systems such as macOS and some Linux distributions have Python installed by default as it is included in a base installation.
To check your version of Python on your machine, or to see if it is installed, simply type python3 and it will return the version. You can also type ps -ef |grep python to return a python running process.
If you run a check and find that your system does not have Python installed, you can follow the docs and download it from Python.org. Simply select your specific OS and download and install on your system.
Install Pykmip
Once you have your EDB Repository installed on your server, you can then install the Pykmip utility that is needed.
As root user issue the install python3-pykmip command, for our example we have a RHEL8 server so it would be dnf install python3-pymkip.
The output should look something like:
Configure Hashicorp Vault KMIP Secrets Engine
Note
You have to set your environment variable with Hashicorp Vault before you can configure the Hashicorp Vault server using the API IP address and port. If you receive this error message “Get "https://127.0.0.1:8200/v1/sys/seal-status": http: server gave HTTP response to HTTPS client” you need to issue this in your command line export VAULT_ADDR="http://127.0.0.1:8200".
After your Hashicorp Vault configuration is installed and deployed per the guidelines in the Hashicorp documentation, you will then need to enable the KMIP capabilities.
Assume root user.
When you are the root user, type vault secrets enable kmip.
You will then need to configure the Hashicorp Vault secrets engine with the desired kmip listener address.
Enter vault write kmip/config listen_addrs=0.0.0.0:5696.
Enter vault write -f kmip/scope/*scope_name* to create the scope that will be used to define the allowed operations a role can perform.
Note
To view your scopes you have created you can enter vault list kmip/scope.
Enter vault write kmip/scope/*scope_name*/role/*role_name* operation_all=true to define the role for the scope. In our example the role of admin is for the scope edb.
You can read your scope and role with this command vault read kmip/scope/*scope_name*/role/*role_name*
Generate Client Certificates
After a scope and role have been created you will need to generate client certificates that will be used within your pykmip.conf file for key management. These certificates can be used to establish communication with Hashicorp Vault’s KMIP Server.
Generate the client certificate, this will provide the CA Chain, the private key and the certificate.
Enter vault write -f -field=certificate \ kmip/scope/*scope_name*/role/*role_name*/credential/generate > *certificate_name*.pem.
In our example we used role: edb, scope: admin and certificate name: kmip-cert.pem.
To view your certificates type cat *certificate_name*.pem* and this will return the certificates from Hashicorp Vault.
You will need to separate the individual certificates into .pem files so they can be used in your pykmip.conf file.
Note
Make sure to include ----BEGIN ------ and ----END ------ in the .pem certificate files.
Create a key.pem file contains the private key in the certificate chain.
Create a cert.pem file contains the first certificate in the certificate chain.
Create a ca.pem file contains the last two certificates in the certificate chain.
Now that you have all of the required certificates you are ready to use Hashicorp Vault Secrets Engine with your EDB Postgres distribution with TDE.