diff --git a/contrib/pg_tde/documentation/docs/how-to/multi-tenant-setup.md b/contrib/pg_tde/documentation/docs/how-to/multi-tenant-setup.md index 247a1878c254b..19a9974b3df28 100644 --- a/contrib/pg_tde/documentation/docs/how-to/multi-tenant-setup.md +++ b/contrib/pg_tde/documentation/docs/how-to/multi-tenant-setup.md @@ -50,18 +50,27 @@ Load the `pg_tde` at startup time. The extension requires additional shared memo ## Key provider configuration -You must do these steps for every database where you have created the extension. +You must do these steps for every database where you have created the extension. For more information on configurations, please see the [Configure Key Management (KMS)](../global-key-provider-configuration/index.md) topic. 1. Set up a key provider. === "With KMIP server" + The KMIP server setup is out of scope of this document. + Make sure you have obtained the root certificate for the KMIP server and the keypair for the client. The client key needs permissions to create / read keys on the server. Find the [configuration guidelines for the HashiCorp Vault Enterprise KMIP Secrets Engine](https://developer.hashicorp.com/vault/tutorials/enterprise/kmip-engine). For testing purposes, you can use the PyKMIP server which enables you to set up required certificates. To use a real KMIP server, make sure to obtain the valid certificates issued by the key management appliance. ```sql - SELECT pg_tde_add_database_key_provider_kmip('provider-name','kmip-addr', 5696, '/path_to/client_cert.pem', '/path_to/client_key.pem', '/path_to/server_certificate.pem'); + SELECT pg_tde_add_database_key_provider_kmip( + 'provider-name', + 'kmip-addr', + 5696, + '/path_to/client_cert.pem', + '/path_to/client_key.pem', + '/path_to/server_certificate.pem' + ); ``` where: @@ -76,7 +85,14 @@ You must do these steps for every database where you have created the extension. :material-information: Warning: This example is for testing purposes only: ```sql - SELECT pg_tde_add_database_key_provider_kmip('kmip', '127.0.0.1', 5696, '/tmp/client_cert_jane_doe.pem', '/tmp/client_key_jane_doe.pem', '/tmp/server_certificate.pem'); + SELECT pg_tde_add_database_key_provider_kmip( + 'kmip', + '127.0.0.1', + 5696, + '/tmp/client_cert_jane_doe.pem', + '/tmp/client_key_jane_doe.pem', + '/tmp/server_certificate.pem' + ); ``` === "With HashiCorp Vault" @@ -84,7 +100,13 @@ You must do these steps for every database where you have created the extension. The Vault server setup is out of scope of this document. ```sql - SELECT pg_tde_add_database_key_provider_vault_v2('provider-name', 'url', 'mount', 'secret_token_path', 'ca_path'); + SELECT pg_tde_add_database_key_provider_vault_v2( + 'provider-name', + 'url', + 'mount', + 'secret_token_path', + 'ca_path' + ); ``` where: @@ -96,8 +118,14 @@ You must do these steps for every database where you have created the extension. :material-information: Warning: This example is for testing purposes only: - ``` - SELECT pg_tde_add_database_key_provider_file_vault_v2('my-vault','http://vault.vault.svc.cluster.local:8200,'secret/data','hvs.zPuyktykA...example...ewUEnIRVaKoBzs2', NULL); + ```sql + SELECT pg_tde_add_database_key_provider_file_vault_v2( + 'my-vault', + 'http://vault.vault.svc.cluster.local:8200', + 'secret/data', + 'hvs.zPuyktykA...example...ewUEnIRVaKoBzs2', + NULL + ); ``` === "With a keyring file (not recommended)" @@ -105,30 +133,42 @@ You must do these steps for every database where you have created the extension. This setup is intended for development and stores the keys unencrypted in the specified data file. ```sql - SELECT pg_tde_add_database_key_provider_file('provider-name', '/path/to/the/keyring/data.file'); + SELECT pg_tde_add_database_key_provider_file( + 'provider-name', + '/path/to/the/keyring/data.file' + ); ``` :material-information: Warning: This example is for testing purposes only: ```sql - SELECT pg_tde_add_database_key_provider_file('file-keyring', '/tmp/pg_tde_test_local_keyring.per'); + SELECT pg_tde_add_database_key_provider_file( + 'file-keyring', + '/tmp/pg_tde_test_local_keyring.per' + ); ``` 2. Create a key ```sql - SELECT pg_tde_create_key_using_database_key_provider('name-of-the-key', 'provider-name'); + SELECT pg_tde_create_key_using_database_key_provider( + 'name-of-the-key', + 'provider-name' + ); ``` where: * `name-of-the-key` is the name of the principal key. You will use this name to identify the key. - * `provider-name` is the name of the key provider you added before. The principal key will be associated with this provider. + * `provider-name` is the name of the key provider you added before. The principal key is associated with this provider and it is the location where it is stored and fetched from. :material-information: Warning: This example is for testing purposes only: ```sql - SELECT pg_tde_create_key_using_database_key_provider('test-db-master-key', 'file-vault'); + SELECT pg_tde_create_key_using_database_key_provider( + 'test-db-master-key', + 'file-vault' + ); ``` !!! note @@ -137,7 +177,10 @@ You must do these steps for every database where you have created the extension. 3. Use the key as principal key ```sql - SELECT pg_tde_set_key_using_database_key_provider('name-of-the-key', 'provider-name'); + SELECT pg_tde_set_key_using_database_key_provider( + 'name-of-the-key', + 'provider-name' + ); ``` where: @@ -148,5 +191,8 @@ You must do these steps for every database where you have created the extension. :material-information: Warning: This example is for testing purposes only: ```sql - SELECT pg_tde_set_key_using_database_key_provider('test-db-master-key','file-vault'); + SELECT pg_tde_set_key_using_database_key_provider( + 'test-db-master-key', + 'file-vault' + ); ``` diff --git a/contrib/pg_tde/documentation/docs/how-to/uninstall.md b/contrib/pg_tde/documentation/docs/how-to/uninstall.md index 7901f778fd8f4..16a97e179a86e 100644 --- a/contrib/pg_tde/documentation/docs/how-to/uninstall.md +++ b/contrib/pg_tde/documentation/docs/how-to/uninstall.md @@ -1,34 +1,50 @@ # Uninstall pg_tde -If you no longer wish to use TDE in your deployment, you can remove the `pg_tde` extension. To do so, your user must have the superuser privileges, or a database owner privileges in case you only want to remove it from a single database. +If you no longer wish to use TDE in your deployment, you can remove the `pg_tde` extension. To do so, you must have superuser privileges, or database owner privileges in case you only want to remove it from a single database. -Here's how to do it: +!!! warning + This process removes the extension, but does not decrypt data automatically. Only uninstall the extension after all encrypted data **has been removed or decrypted**. -1. Drop the extension using the `DROP EXTENSION` command: +To uninstall `pg_tde`, follow these steps: + +1. Decrypt or drop encrypted tables: + + Before removing the extension, you must either **decrypt** or **drop** all encrypted tables: + + - To decrypt a table, run: ```sql - DROP EXTENSION pg_tde; + ALTER TABLE