Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 9b23b51

Browse files
committed
Suggestion for documentation DO NOT MERGE
I think it's much easier to read if we use named parameters in our example sql code, especially with functions that have many parameters.
1 parent 0c151ea commit 9b23b51

File tree

1 file changed

+68
-16
lines changed

1 file changed

+68
-16
lines changed

contrib/pg_tde/documentation/docs/wal-encryption.md

+68-16
Original file line numberDiff line numberDiff line change
@@ -19,50 +19,102 @@ Before turning WAL encryption on, you must follow the steps below to create your
1919
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.
2020

2121
```sql
22-
SELECT pg_tde_add_global_key_provider_kmip('provider-name','kmip-addr', 5696, '/path_to/server_certificate.pem', '/path_to/client_cert.pem', '/path_to/client_key.pem');
22+
SELECT pg_tde_add_global_key_provider_kmip(
23+
provider_name => <provider-name>,
24+
kmip_host => <kmip-addr>,
25+
kmip_port => 5696,
26+
kmip_ca_path => <server-certificate>,
27+
kmip_cert_path => <client-cert>,
28+
kmip_key_path => <client-key>
29+
);
2330
```
2431

2532
where:
2633

27-
* `provider-name` is the name of the provider. You can specify any name, it's for you to identify the provider.
28-
* `kmip-addr` is the IP address of a domain name of the KMIP server
29-
* `port` is the port to communicate with the KMIP server. Typically used port is 5696.
30-
* `server-certificate` is the path to the certificate file for the KMIP server.
31-
* `client-cert` is the path to the client certificate.
32-
* `client-key` is the path to the client key.
34+
* `<provider-name>` is the name of the provider. You can specify any name, it's for you to identify the provider.
35+
* `<kmip-addr>` is the IP address of a domain name of the KMIP server
36+
* `<port>` is the port to communicate with the KMIP server. Typically used port is 5696.
37+
* `<server-certificate>` is the path to the certificate file for the KMIP server.
38+
* `<client-cert>` is the path to the client certificate.
39+
* `<client-key>` is the path to the client key.
3340
3441
<i warning>:material-information: Warning:</i> This example is for testing purposes only:
3542
3643
```
37-
SELECT pg_tde_add_key_using_global_key_provider_kmip('kmip','127.0.0.1', 5696, '/tmp/server_certificate.pem', '/tmp/client_cert_jane_doe.pem', '/tmp/client_key_jane_doe.pem');
44+
SELECT pg_tde_add_key_using_global_key_provider_kmip(
45+
provider_name => 'kmip',
46+
kmip_host => '127.0.0.1',
47+
kmip_port => 5696,
48+
kmip_ca_path => '/opt/server_certificate.pem',
49+
kmip_cert_path => '/opt/client_cert_jane_doe.pem',
50+
kmip_key_path => '/opt/client_key_jane_doe.pem'
51+
);
3852
```
3953
4054
=== "With HashiCorp Vault"
4155
4256
```sql
43-
SELECT pg_tde_add_global_key_provider_vault_v2('provider-name', 'secret_token', 'url', 'mount', 'ca_path');
57+
SELECT pg_tde_add_global_key_provider_vault_v2(
58+
provider_name => <provider-name>,
59+
vault_token => <secret_token>,
60+
vault_url => <url>,
61+
vault_mount_path => <mount>,
62+
vault_ca_path => <ca-path>
63+
);
4464
```
4565
4666
where:
4767
48-
* `provider-name` is the name you define for the key provider
49-
* `url` is the URL of the Vault server
50-
* `mount` is the mount point where the keyring should store the keys
51-
* `secret_token` is an access token with read and write access to the above mount point
52-
* [optional] `ca_path` is the path of the CA file used for SSL verification
68+
* `<provider-name>` is the name you define for the key provider
69+
* `<url>` is the URL of the Vault server
70+
* `<mount>` is the mount point where the keyring should store the keys
71+
* `<secret-token>` is an access token with read and write access to the above mount point
72+
* [optional] `<ca-path>` is the path of the CA file used for SSL verification
73+
74+
<i warning>:material-information: Warning:</i> This example is for testing purposes only:
75+
76+
```
77+
SELECT pg_tde_add_key_using_global_key_provider_vault_v2(
78+
provider_name => 'vault_v2',
79+
vault_token => 'secret_token',
80+
vault_url => 'http://127.0.0.1',
81+
vault_mount_path => 'secrets',
82+
vault_ca_path => '/opt/server_certificate.pem'
83+
);
84+
```
5385
5486
=== "With keyring file"
5587
5688
This setup is **not recommended**, as it is intended for development. The keys are stored **unencrypted** in the specified data file.
5789
5890
```sql
59-
SELECT pg_tde_add_global_key_provider_file('provider-name','/path/to/the/keyring/data.file');
91+
SELECT pg_tde_add_global_key_provider_file(
92+
provier_name => <provider-name>,
93+
file_path => <path>
94+
);
95+
```
96+
97+
where:
98+
99+
* `<provider-name>` is the name you define for the key provider
100+
* `<path>` is the key data file
101+
102+
<i warning>:material-information: Warning:</i> This example is for testing purposes only:
103+
104+
```sql
105+
SELECT pg_tde_add_global_key_provider_file(
106+
provier_name => 'provider-name',
107+
file_path => '/path/to/the/keyring/data.file'
108+
);
60109
```
61110
62111
3. Create principal key
63112
64113
```sql
65-
SELECT pg_tde_set_server_key_using_global_key_provider('key', 'provider-name');
114+
SELECT pg_tde_set_server_key_using_global_key_provider(
115+
key_name => 'key',
116+
provider_name => 'provider-name'
117+
);
66118
```
67119
68120
4. Enable WAL level encryption using the `ALTER SYSTEM` command. You need the privileges of the superuser to run this command:

0 commit comments

Comments
 (0)