Skip to content

Commit d0d6ac9

Browse files
TDE: improvements and fixes for DOCS-1147
1 parent 8da1d07 commit d0d6ac9

File tree

7 files changed

+21
-21
lines changed

7 files changed

+21
-21
lines changed

product_docs/docs/tde/15/enabling/enabling_tde.mdx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@ Create a new EDB Postgres Advanced Server cluster with TDE enabled.
1212

1313
## Worked example
1414

15-
This example uses EDB Postgres Advanced Server 15 running on a Linux platform. It uses OpenSSL to define the passphrase to wrap and unwrap the generated data encryption key.
15+
This example uses EDB Postgres Advanced Server 16 running on a Linux platform. It uses OpenSSL to define the passphrase to wrap and unwrap the generated data encryption key.
1616

1717
1. Set the data encryption key (wrap) and decryption (unwrap) environment variables:
1818

1919
```shell
20-
export PGDATAKEYWRAPCMD='openssl enc -e -aes-128-cbc -pass pass:<password> -out %p'
21-
export PGDATAKEYUNWRAPCMD='openssl enc -d -aes-128-cbc -pass pass:<password> -in %p'
20+
export PGDATAKEYWRAPCMD='openssl enc -e -aes-128-cbc -pass pass:<password> -out "%p"'
21+
export PGDATAKEYUNWRAPCMD='openssl enc -d -aes-128-cbc -pass pass:<password> -in "%p"'
2222
```
2323

2424
!!!note
@@ -28,21 +28,21 @@ This example uses EDB Postgres Advanced Server 15 running on a Linux platform. I
2828
1. Initialize the cluster using `initdb` with encryption enabled. This command sets the `data_encryption_key_unwrap_command` parameter in the `postgresql.conf` file.
2929

3030
```shell
31-
/usr/edb/as15/bin/initdb --data-encryption -D /var/lib/edb/as15/data
31+
/usr/edb/as16/bin/initdb --data-encryption -D /var/lib/edb/as16/data
3232
```
3333

3434
1. Start the cluster:
3535

3636
```shell
37-
/usr/edb/as15/bin/pg_ctl -D /var/lib/edb/as15/data start
37+
/usr/edb/as16/bin/pg_ctl -D /var/lib/edb/as16/data start
3838
```
3939

4040
1. Run grep on `postgresql.conf` to verify the setting of `data_encryption_key_unwrap_command`:
4141

4242
```shell
43-
grep data_encryption_key_unwrap_command /var/lib/edb/as15/data/postgresql.conf
43+
grep data_encryption_key_unwrap_command /var/lib/edb/as16/data/postgresql.conf
4444
__OUTPUT__
45-
data_encryption_key_unwrap_command = 'openssl enc -d -aes-128-cbc -pass pass:<password> -in %p'
45+
data_encryption_key_unwrap_command = 'openssl enc -d -aes-128-cbc -pass pass:<password> -in "%p"'
4646
```
4747

4848
1. [Verify that data encryption is enabled](verifying_tde).

product_docs/docs/tde/15/enabling/enabling_tde_epas.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@ Use [pg_dumpall](https://www.postgresql.org/docs/current/app-pg-dumpall.html), [
5454
1. Set environment variables to export the `wrap` and `unwrap` commands:
5555

5656
```
57-
export PGDATAKEYWRAPCMD='openssl enc -e -aes-128-cbc -pass pass:ok -out %p'
58-
export PGDATAKEYUNWRAPCMD='openssl enc -d -aes-128-cbc -pass pass:ok -in %p'
57+
export PGDATAKEYWRAPCMD='openssl enc -e -aes-128-cbc -pass pass:ok -out "%p"'
58+
export PGDATAKEYUNWRAPCMD='openssl enc -d -aes-128-cbc -pass pass:ok -in "%p"'
5959
```
6060

6161
!!!note

product_docs/docs/tde/15/enabling/postgres_to_extended.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@ This example upgrades a PostgreSQL 16 instance to EDB Postgres Extended Server 1
5454
1. Set environment variables to export the `wrap` and `unwrap` commands:
5555

5656
```
57-
export PGDATAKEYWRAPCMD='openssl enc -e -aes-128-cbc -pass pass:ok -out %p'
58-
export PGDATAKEYUNWRAPCMD='openssl enc -d -aes-128-cbc -pass pass:ok -in %p'
57+
export PGDATAKEYWRAPCMD='openssl enc -e -aes-128-cbc -pass pass:ok -out "%p"'
58+
export PGDATAKEYUNWRAPCMD='openssl enc -d -aes-128-cbc -pass pass:ok -in "%p"'
5959
```
6060

6161
!!!note

product_docs/docs/tde/15/encrypted_files/wal_files.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ Alternatively, you can set the `PGDATAKEYUNWRAPCMD` environment variable before
4141
This example uses `pg_waldump` to display the WAL log of an encrypted cluster that uses `openssl` to wrap the data encryption key:
4242

4343
```
44-
pg_waldump --data-encryption --key-file-name=pg_encryption/key.bin --key-unwrap-command='openssl enc -d -aes-128-cbc -pass pass:<passphrase> -in %p'
44+
pg_waldump --data-encryption --key-file-name=pg_encryption/key.bin --key-unwrap-command='openssl enc -d -aes-128-cbc -pass pass:<passphrase> -in "%p"'
4545
```
4646

4747
## Resetting a corrupt TDE-encrypted WAL file
@@ -59,5 +59,5 @@ Alternatively, you can set the `PGDATAKEYUNWRAPCMD` environment variable before
5959
This example uses `pg_resetwal` to reset a corrupt encrypted WAL log of an encrypted cluster that uses `openssl` to wrap the data encryption key:
6060

6161
```
62-
pg_resetwal --key-unwrap-command='openssl enc -d -aes-128-cbc -pass pass:<passphrase> -in %p'
62+
pg_resetwal --key-unwrap-command='openssl enc -d -aes-128-cbc -pass pass:<passphrase> -in" "%p"'
6363
```

product_docs/docs/tde/15/secure_key/index.mdx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@ You must make the commands available to the TDE database server so it can wrap a
4848
<details><summary>Example</summary>
4949

5050
```shell
51-
PGDATAKEYWRAPCMD='openssl enc -e -aes128-wrap -pbkdf2 -out "%p"'
52-
PGDATAKEYUNWRAPCMD='openssl enc -d -aes128-wrap -pbkdf2 -in "%p"'
51+
PGDATAKEYWRAPCMD='openssl enc -e -aes-128-cbc -pbkdf2 -out "%p"'
52+
PGDATAKEYUNWRAPCMD='openssl enc -d -aes-128-cbc -pbkdf2 -in "%p"'
5353
export PGDATAKEYWRAPCMD PGDATAKEYUNWRAPCMD
5454
#After these variables are set, you can initialize the server:
5555
initdb --data-encryption -D /var/lib/edb/as16/data
@@ -63,7 +63,7 @@ You must make the commands available to the TDE database server so it can wrap a
6363
<details><summary>Example</summary>
6464

6565
```shell
66-
initdb --data-encryption -D /var/lib/edb/as16/data --key-wrap-command='openssl enc -e -aes128-wrap -pbkdf2 -out "%p"' --key-unwrap-command='openssl enc -d -aes128-wrap -pbkdf2 -in "%p"'
66+
initdb --data-encryption -D /var/lib/edb/as16/data --key-wrap-command='openssl enc -e -aes-128-cbc -pbkdf2 -out "%p"' --key-unwrap-command='openssl enc -d -aes-128-cbc -pbkdf2 -in "%p"'
6767
```
6868

6969
</details>

product_docs/docs/tde/15/secure_key/key_store.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,8 @@ vault write -f transit/keys/pg-tde-master-1
8383
Use the `vault write` command with the `pg-tde-master-1` key to wrap and unwrap the data encryption key:
8484

8585
```
86-
PGDATAKEYWRAPCMD='base64 | vault write -field=ciphertext transit/encrypt/pg-tde-master-1 plaintext=- > %p'
87-
PGDATAKEYUNWRAPCMD='vault write -field=plaintext transit/decrypt/pg-tde-master-1 ciphertext=- < %p | base64 -d'
86+
PGDATAKEYWRAPCMD='base64 | vault write -field=ciphertext transit/encrypt/pg-tde-master-1 plaintext=- > "%p"'
87+
PGDATAKEYUNWRAPCMD='vault write -field=plaintext transit/decrypt/pg-tde-master-1 ciphertext=- < "%p" | base64 -d'
8888
```
8989

9090
## Thales CipherTrust Manager example

product_docs/docs/tde/15/secure_key/passphrase.mdx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ description: Learn how to secure your encryption key with a passphrase.
66
You can protect the data key with a passphrase using the OpenSSL command line utility. The following is an example that sets up this protection:
77

88
```shell
9-
initdb -D datadir -y --key-wrap-command='openssl enc -e -aes-128-cbc -pbkdf2 -out "%p"' --key-unwrap-command='openssl enc -d -aes-128-cbc -pbkdf2 -in "%p"'
9+
initdb -D datadir --data-encryption --key-wrap-command='openssl enc -e -aes-128-cbc -pbkdf2 -out "%p"' --key-unwrap-command='openssl enc -d -aes-128-cbc -pbkdf2 -in "%p"'
1010
```
1111

1212
This example wraps the randomly generated data key (done internally by initdb) by encrypting it with the AES-128-CBC (AESKW) algorithm. The encryption uses a key derived from a passphrase with the PBKDF2 key derivation function and a randomly generated salt. The terminal prompts for the passphrase. (See the openssl-enc manual page for details about these options. Available options vary across versions.) The initdb utility replaces `%p` with the name of the file that stores the wrapped key.
@@ -30,8 +30,8 @@ Key unwrap commands that prompt for passwords on the terminal don't work when th
3030
For example, for systemd, you can use `systemd-ask-password`:
3131

3232
```
33-
PGDATAKEYWRAPCMD="bash -c 'openssl enc -e -aes-128-cbc -pbkdf2 -out %p -pass file:<(sudo systemd-ask-password --no-tty)'"
34-
PGDATAKEYUNWRAPCMD="bash -c 'openssl enc -d -aes-128-cbc -pbkdf2 -in %p -pass file:<(sudo systemd-ask-password --no-tty)'"
33+
PGDATAKEYWRAPCMD="bash -c 'openssl enc -e -aes-128-cbc -pbkdf2 -out "%p" -pass file:<(sudo systemd-ask-password --no-tty)'"
34+
PGDATAKEYUNWRAPCMD="bash -c 'openssl enc -d -aes-128-cbc -pbkdf2 -in "%p" -pass file:<(sudo systemd-ask-password --no-tty)'"
3535
```
3636

3737
You also need an entry like in `/etc/sudoers`:

0 commit comments

Comments
 (0)