Skip to content

Commit 4affafc

Browse files
authored
DOCS-functions-codeclean (#343)
Initial update as I apply code formatting and improving important information using note and important markers.
1 parent 2ca6bb5 commit 4affafc

File tree

1 file changed

+89
-26
lines changed

1 file changed

+89
-26
lines changed

contrib/pg_tde/documentation/docs/functions.md

Lines changed: 89 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -76,15 +76,39 @@ The Vault provider connects to a HashiCorp Vault or an OpenBao server, and store
7676
Use the following functions to add the Vault provider:
7777

7878
```sql
79-
SELECT pg_tde_add_database_key_provider_vault_v2('provider-name','secret_token','url','mount','ca_path');
80-
SELECT pg_tde_add_global_key_provider_vault_v2('provider-name','secret_token','url','mount','ca_path');
79+
SELECT pg_tde_add_database_key_provider_vault_v2(
80+
'provider-name',
81+
'secret_token',
82+
'url','mount',
83+
'ca_path'
84+
);
85+
86+
SELECT pg_tde_add_global_key_provider_vault_v2(
87+
'provider-name',
88+
'secret_token',
89+
'url','mount',
90+
'ca_path'
91+
);
8192
```
8293

8394
These functions change the Vault provider:
8495

8596
```sql
86-
SELECT pg_tde_change_database_key_provider_vault_v2('provider-name','secret_token','url','mount','ca_path');
87-
SELECT pg_tde_change_global_key_provider_vault_v2('provider-name','secret_token','url','mount','ca_path');
97+
SELECT pg_tde_change_database_key_provider_vault_v2(
98+
'provider-name',
99+
'secret_token',
100+
'url',
101+
'mount',
102+
'ca_path'
103+
);
104+
105+
SELECT pg_tde_change_global_key_provider_vault_v2(
106+
'provider-name',
107+
'secret_token',
108+
'url',
109+
'mount',
110+
'ca_path'
111+
);
88112
```
89113

90114
where:
@@ -93,11 +117,12 @@ where:
93117
* `url` is the URL of the Vault server
94118
* `mount` is the mount point on the Vault server where the key provider should store the keys
95119
* `secret_token` is an access token with read and write access to the above mount point
96-
* [optional] `ca_path` is the path of the CA file used for SSL verification
120+
* **[optional]** `ca_path` is the path of the CA file used for SSL verification
97121

98122
All parameters can be either strings, or JSON objects [referencing remote parameters](how-to/external-parameters.md).
99123

100-
**Never specify the secret token directly, use a remote parameter instead.**
124+
!!! important
125+
Never specify the secret token directly, use a remote parameter instead.
101126

102127
#### Adding or modifying KMIP providers
103128

@@ -155,7 +180,8 @@ where:
155180
* `client-certificate` is the path to the client certificate.
156181
* `client-key` is the path to the client key.
157182

158-
The specified access parameters require permission to read and write keys at the server.
183+
!!! note
184+
The specified access parameters require permission to read and write keys at the server.
159185

160186
All parameters can be either strings, or JSON objects [referencing remote parameters](how-to/external-parameters.md).
161187

@@ -165,28 +191,44 @@ This provider manages database keys using a local keyfile.
165191

166192
This function is intended for development or quick testing, and stores the keys unencrypted in the specified data file.
167193

168-
**It is not recommended for production.**
194+
!!! important
195+
Local keyfile providers are **not recommended** for production environments, they lack the security and manageability of external key management systems.
169196

170197
Add a local keyfile provider:
171198

172199
```sql
173-
SELECT pg_tde_add_database_key_provider_file('provider-name','/path/to/the/key/provider/data.file');
174-
SELECT pg_tde_add_global_key_provider_file('provider-name','/path/to/the/key/provider/data.file');
200+
SELECT pg_tde_add_database_key_provider_file(
201+
'provider-name',
202+
'/path/to/the/key/provider/data.file'
203+
);
204+
205+
SELECT pg_tde_add_global_key_provider_file(
206+
'provider-name',
207+
'/path/to/the/key/provider/data.file'
208+
);
175209
```
176210

177211
Change a local keyfile provider:
178212

179213
```sql
180-
SELECT pg_tde_change_database_key_provider_file('provider-name','/path/to/the/key/provider/data.file');
181-
SELECT pg_tde_change_global_key_provider_file('provider-name','/path/to/the/key/provider/data.file');
214+
SELECT pg_tde_change_database_key_provider_file(
215+
'provider-name',
216+
'/path/to/the/key/provider/data.file'
217+
);
218+
219+
SELECT pg_tde_change_global_key_provider_file(
220+
'provider-name',
221+
'/path/to/the/key/provider/data.file'
222+
);
182223
```
183224

184225
where:
185226

186227
* `provider-name` is the name of the provider. You can specify any name, it's for you to identify the provider.
187228
* `/path/to/the/key/provider/data.file` is the path to the key provider file.
188229

189-
All parameters can be either strings, or JSON objects [referencing remote parameters](how-to/external-parameters.md).
230+
!!! note
231+
All parameters can be either strings, or JSON objects [referencing remote parameters](how-to/external-parameters.md).
190232

191233
### Delete a provider
192234

@@ -206,7 +248,8 @@ These functions list the details of all key providers for the current database o
206248
* `pg_tde_list_all_database_key_providers()`
207249
* `pg_tde_list_all_global_key_providers()`
208250

209-
**All configuration values include possibly sensitive values, such as passwords. Never specify these directly, use the remote configuration option instead.**
251+
!!! important
252+
All configuration values include possibly sensitive values, such as passwords. **Never** specify these directly, use the remote configuration option instead.
210253

211254
## Principal key management
212255

@@ -219,7 +262,11 @@ Princial keys are stored on key providers by the name specified in this function
219262
Creates or rotates the principal key for the current database using the specified database key provider and key name.
220263

221264
```sql
222-
SELECT pg_tde_set_key_using_database_key_provider('name-of-the-key','provider-name','ensure_new_key');
265+
SELECT pg_tde_set_key_using_database_key_provider(
266+
'name-of-the-key',
267+
'provider-name',
268+
'ensure_new_key'
269+
);
223270
```
224271

225272
The `ensure_new_key` parameter instructs the function how to handle a principal key during key rotation:
@@ -233,7 +280,11 @@ SELECT pg_tde_set_key_using_database_key_provider('name-of-the-key','provider-na
233280
Creates or rotates the global principal key using the specified global key provider and the key name. This key is used for global settings like WAL encryption.
234281

235282
```sql
236-
SELECT pg_tde_set_key_using_global_key_provider('name-of-the-key','provider-name','ensure_new_key');
283+
SELECT pg_tde_set_key_using_global_key_provider(
284+
'name-of-the-key',
285+
'provider-name',
286+
'ensure_new_key'
287+
);
237288
```
238289

239290
The `ensure_new_key` parameter instructs the function how to handle a principal key during key rotation:
@@ -247,7 +298,11 @@ Creates or rotates the global principal key using the specified global key provi
247298
Creates or rotates the server principal key using the specified global key provider. Use this function to set a principal key for WAL encryption.
248299

249300
```sql
250-
SELECT pg_tde_set_server_key_using_global_key_provider('name-of-the-key','provider-name','ensure_new_key');
301+
SELECT pg_tde_set_server_key_using_global_key_provider(
302+
'name-of-the-key',
303+
'provider-name',
304+
'ensure_new_key'
305+
);
251306
```
252307

253308
The `ensure_new_key` parameter instructs the function how to handle a principal key during key rotation:
@@ -263,7 +318,11 @@ Creates or rotates the default principal key for the server using the specified
263318
The default key is automatically used as a principal key by any database that doesn't have an individual key provider and key configuration.
264319

265320
```sql
266-
SELECT pg_tde_set_default_key_using_global_key_provider('name-of-the-key','provider-name','ensure_new_key');
321+
SELECT pg_tde_set_default_key_using_global_key_provider(
322+
'name-of-the-key',
323+
'provider-name',
324+
'ensure_new_key'
325+
);
267326
```
268327

269328
The `ensure_new_key` parameter instructs the function how to handle a principal key during key rotation:
@@ -283,13 +342,17 @@ tables and indexes.
283342
To verify that a table is encrypted, run the following statement:
284343

285344
```sql
286-
SELECT pg_tde_is_encrypted('table_name');
345+
SELECT pg_tde_is_encrypted(
346+
'table_name'
347+
);
287348
```
288349

289350
You can also verify if the table in a custom schema is encrypted. Pass the schema name for the function as follows:
290351

291352
```sql
292-
SELECT pg_tde_is_encrypted('schema.table_name');
353+
SELECT pg_tde_is_encrypted(
354+
'schema.table_name'
355+
);
293356
```
294357

295358
This can additionally be used to verify that indexes and sequences are encrypted.
@@ -299,23 +362,23 @@ This can additionally be used to verify that indexes and sequences are encrypted
299362
Displays information about the principal key for the current database, if it exists.
300363

301364
```sql
302-
SELECT pg_tde_key_info()
365+
SELECT pg_tde_key_info();
303366
```
304367

305368
### pg_tde_server_key_info
306369

307370
Displays information about the principal key for the server scope, if exists.
308371

309372
```sql
310-
SELECT pg_tde_server_key_info()
373+
SELECT pg_tde_server_key_info();
311374
```
312375

313376
### pg_tde_default_key_info
314377

315378
Displays the information about the default principal key, if it exists.
316379

317380
```sql
318-
SELECT pg_tde_default_key_info()
381+
SELECT pg_tde_default_key_info();
319382
```
320383

321384
### pg_tde_verify_key
@@ -331,7 +394,7 @@ This function checks that the current database has a properly functional encrypt
331394
If any of the above checks fail, the function reports an error.
332395

333396
```sql
334-
SELECT pg_tde_verify_key()
397+
SELECT pg_tde_verify_key();
335398
```
336399

337400
### pg_tde_verify_server_key
@@ -347,7 +410,7 @@ This function checks that the server scope has a properly functional encryption
347410
If any of the above checks fail, the function reports an error.
348411

349412
```sql
350-
SELECT pg_tde_verify_server_key()
413+
SELECT pg_tde_verify_server_key();
351414
```
352415

353416
### pg_tde_verify_default_key
@@ -363,5 +426,5 @@ This function checks that the default key is properly configured, which means:
363426
If any of the above checks fail, the function reports an error.
364427

365428
```sql
366-
SELECT pg_tde_verify_default_key()
429+
SELECT pg_tde_verify_default_key();
367430
```

0 commit comments

Comments
 (0)