Skip to content

Commit fe0b268

Browse files
Merge pull request #6130 from EnterpriseDB/TDE/refresh
TDE refresh
2 parents b46a264 + ceb2b39 commit fe0b268

32 files changed

+723
-479
lines changed

product_docs/docs/postgres_distributed_for_kubernetes/1/tde.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ We show now how to use TDE with a passphrase stored in a Kubernetes Secret,
3333
which will be used to encrypt the EPAS binary key.
3434

3535
!!! Seealso "EPAS documentation"
36-
Please refer to [the EPAS documentation](https://www.enterprisedb.com/docs/tde/latest/key_stores/)
36+
Please refer to [the EPAS documentation](https://www.enterprisedb.com/docs/tde/latest/secure_key/)
3737
for details on the EPAS encryption key.
3838

3939
TDE on EDB Postgres Distributed for Kubernetes relies on the PG4K

product_docs/docs/postgres_for_kubernetes/1/tde.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ The basic approach is to store the passphrase in a Kubernetes secret. Such a
4141
passphrase will be used to encrypt the EPAS binary key.
4242

4343
!!! Seealso "EPAS documentation"
44-
Please refer to [the EPAS documentation](/tde/latest/key_stores/)
44+
Please refer to [the EPAS documentation](/tde/latest/secure_key/)
4545
for details on the EPAS encryption key.
4646

4747
Activating TDE on the operator is simple. In the `epas` section of the manifest,
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
---
2+
title: How does TDE encrypt data?
3+
description: How does the encryption of data work when TDE is enabled?
4+
---
5+
6+
TDE prevents unauthorized viewing of data in operating system files on the database server and on backup storage. Data becomes unintelligible for unauthorized users if it's stolen or misplaced.
7+
8+
Data encryption and decryption is managed by the database and doesn't require application changes or updated client drivers.
9+
10+
EDB Postgres Advanced Server and EDB Postgres Extended Server provide hooks to key management that's external to the database. These hooks allow for simple passphrase encrypt/decrypt or integration with enterprise key management solutions. See [Securing the data encryption key](../secure_key/) for more information.
11+
12+
## How does TDE encrypt data?
13+
14+
EDB TDE uses [OpenSSL](https://openssl-library.org/) to encrypt data files with the AES encryption algorithm. In Windows systems, TDE uses [OpenSSL 3](https://docs.openssl.org/3.0/). In Linux systems, TDE uses the OpenSSL version installed in the host operating system. To check the installed version, run `openssl version`. For more information, see the [OpenSSL documentation](https://docs.openssl.org/master/). If you're using a custom build not provided by the OpenSSL community, consult your vendor's documentation.
15+
16+
Starting with version 16, EDB TDE introduces the option to choose between AES-128 and AES-256 encryption algorithms during the initialization of the Postgres cluster. The choice between AES-128 and AES-256 hinges on balancing performance and security requirements. AES-128 is commonly advised for environments where performance efficiency and lower power consumption are pivotal, making it suitable for most applications. Conversely, AES-256 is recommended for scenarios demanding the highest level of security, often driven by regulatory mandates.
17+
18+
TDE uses AES-128-XTS or AES-256-XTS algorithms for encrypting data files. XTS uses a second value, known as the *tweak value*, to enhance the encryption. The XTS tweak value with TDE uses the database OID, the relfilenode, and the block number.
19+
20+
For write-ahead log (WAL) files, TDE uses AES-128-CTR or AES-256-CTR, incorporating the WAL's log sequence number (LSN) as the counter component.
21+
22+
Temporary files that are accessed by block are also encrypted using AES-128-XTS or AES-256-XTS. Other temporary files are encrypted using AES-128-CBC or AES-256-CBC.
23+
24+
## How is data stored on disk with TDE?
25+
26+
In this example, the data in the `tbfoo` table is encrypted. The `pg_relation_filepath` function locates the data file corresponding to the `tbfoo` table.
27+
28+
```sql
29+
insert into tbfoo values ('abc','123');
30+
INSERT 0 1
31+
32+
select pg_relation_filepath('tbfoo');
33+
34+
pg_relation_filepath
35+
----------------------
36+
base/5/16416
37+
```
38+
39+
Grepping the data looking for characters doesn't return anything. Viewing the last five lines returns the encrypted data:
40+
41+
```shell
42+
$ hexdump -C 16416 | grep abc
43+
$
44+
45+
$ hexdump -C 16416 | tail -5
46+
00001fc0 c8 0f 1d c8 9a 63 3d dc 7d 4e 68 98 b8 f2 5e 0a |.....c=.}Nh...^.|
47+
00001fd0 9a eb 20 1d 59 ad be 94 6e fd d5 6e ed 0a 72 8c |.. .Y...n..n..r.|
48+
00001fe0 7b 14 7f de 5b 63 e3 84 ba 6c e7 b0 a3 86 aa b9 |{...[c...l......|
49+
00001ff0 fe 4f 07 50 06 b7 ef 6a cd f9 84 96 b2 4b 25 12 |.O.P...j.....K%.|
50+
00002000
51+
```
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
title: About TDE
3+
description: Learn about TDE, how it works, what it encrypts and why to use it.
4+
indexCards: simple
5+
---
6+
7+
Transparent data encryption (TDE) is an optional feature supported by EDB Postgres Advanced Server and EDB Postgres Extended Server from version 15.
8+
9+
It encrypts user data stored in the database system.
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
---
2+
title: What's encrypted with TDE?
3+
description: Which data is encrypted when databases are initialized with TDE?
4+
---
5+
6+
TDE encrypts:
7+
8+
- The files underlying tables, sequences, indexes, including TOAST tables and system catalogs, and including all forks. These files are known as *data files*.
9+
10+
- The write-ahead log (WAL).
11+
12+
- Various temporary files that are used during query processing and database system operation.
13+
14+
!!! Note Implications
15+
16+
- Any WAL fetched from a server using TDE, including by streaming replication and archiving, is encrypted.
17+
18+
- A physical replica is necessarily encrypted (or not encrypted) in the same way and using the same keys as its primary server.
19+
20+
- If a server uses TDE, a base backup is automatically encrypted.
21+
22+
23+
The following aren't encrypted or otherwise disguised by TDE:
24+
25+
- Metadata internal to operating the database system that doesn't contain user data, such as the transaction status (for example, pg_subtrans and pg_xact).
26+
27+
- The file names and file system structure in the data directory. That means that the overall size of the database system, the number of databases, the number of tables, their relative sizes, as well as file system metadata such as last access time are all visible without decryption.
28+
29+
- Data in foreign tables.
30+
31+
- The server diagnostics log.
32+
33+
- Configuration files.
34+
35+
!!! Note Implications
36+
37+
Logical replication isn't affected by TDE. Publisher and subscriber can have different encryption settings. The payload of the logical replication protocol isn't encrypted. (You can use SSL.)
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
---
2+
title: Why should you use TDE?
3+
description: Learn about some of the use cases for TDE encryption.
4+
---
5+
6+
TDE encryption ensures that user data remains protected from unauthorized access.
7+
8+
When configured with a [data encryption key securing mechanism](../secure_key/), data stored on the database server and in backup is only accessible by users and processes with decryption keys.
9+
10+
Some use cases include:
11+
12+
- **Protection of sensitive personal data:** Industries like finance, e-commerce, healthcare, and government organizations often deal with personally identifiable information that must be protected to comply with data privacy regulations such as GDPR, HIPPA, PCI DSS.
13+
14+
- **Compliance with government standards:** Government institutions must comply with information processing standards like FIPS to ensure computer security and interoperability.
15+
16+
- **Protection of transactional data:** Financial institutions deal with transaction, account, and payment data that must be protected to prevent fraud and financial losses.
17+
18+
- **Protection of intellectual property:** Organizations safeguard proprietary information, designs, and plans to keep their competitive advantage, support brand value, and foster innovation.
19+
20+
- **Protection of data in cloud-based deployments and public web applications:** Encrypting a database's data provides an additional layer of security when infrastructure is shared, or when vulnerabilities could potentially infiltrate in an application's API.
21+
22+
When your data is encrypted, it becomes unintelligible if it's stolen or misplaced.
Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,13 @@
11
---
22
title: "Commands affected by TDE"
3-
navTitle: Affected commands
3+
description: Some commands work differently when TDE is enabled. Learn about differences.
44
---
55

6-
7-
86
When TDE is enabled, the following commands have TDE-specific options or read TDE settings in environment variables or configuration files:
97

10-
- [pg_waldump](/tde/latest/troubleshooting/#dumping-a-tde-encrypted-wal-file)
11-
- [pg_resetwal](/tde/latest/troubleshooting/#resetting-a-corrupt-tde-encrypted-wal-file)
12-
- [pg_verifybackup](/tde/latest/backups/#verify-a-backup-of-a-tde-system)
13-
- [pg_rewind](/tde/latest/backups/#resynchronize-timelines-in-a-tde-system)
14-
- [pg_upgrade](pg_upgrade_arguments)
15-
- [postgres](/tde/latest/single_user/)
16-
8+
- [initdb](./initdb_tde_options/)
9+
- [pg_waldump](././encrypted_files/wal_files/#dumping-a-tde-encrypted-wal-file)
10+
- [pg_resetwal](././encrypted_files/wal_files/#resetting-a-corrupt-tde-encrypted-wal-file)
11+
- [pg_verifybackup](././encrypted_files/backup_files/#verify-a-backup-of-a-tde-system)
12+
- [pg_rewind](././encrypted_files/backup_files/#resynchronize-timelines-in-a-tde-system)
13+
- [pg_upgrade](pg_upgrade_arguments)
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
---
2+
title: "Creating a database with TDE"
3+
description: Create a database server with TDE enabled.
4+
---
5+
6+
Create a new EDB Postgres Advanced Server cluster with TDE enabled.
7+
8+
- Set the environment variables to export the `wrap` and `unwrap` commands for encryption.
9+
- Initialize a server with encryption enabled.
10+
- Start the database server.
11+
- Verify TDE is enabled.
12+
13+
## Worked example
14+
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.
16+
17+
1. Set the data encryption key (wrap) and decryption (unwrap) environment variables:
18+
19+
```shell
20+
export PGDATAKEYWRAPCMD='openssl enc -e -aes-128-cbc -pass pass:ok -out %p'
21+
export PGDATAKEYUNWRAPCMD='openssl enc -d -aes-128-cbc -pass pass:ok -in %p'
22+
```
23+
!!!note
24+
- If you are on Windows you don't need the single quotes around the variable value.
25+
26+
- Ensure you replace `ok` with the passphrase you want to use to wrap the data encryption key.
27+
!!!
28+
29+
1. Initialize the cluster using `initdb` with encryption enabled. This command sets the `data_encryption_key_unwrap_command` parameter in the postgresql.conf file.
30+
31+
```shell
32+
/usr/edb/as15/bin/initdb --data-encryption -D /var/lib/edb/as15/data
33+
```
34+
35+
1. Start the cluster:
36+
37+
```shell
38+
/usr/edb/as15/bin/pg_ctl -D /var/lib/edb/as15/data start
39+
```
40+
41+
1. Run grep on postgresql.conf to verify the setting of `data_encryption_key_unwrap_command`:
42+
43+
```shell
44+
grep data_encryption_key_unwrap_command /var/lib/edb/as15/data/postgresql.conf
45+
__OUTPUT__
46+
data_encryption_key_unwrap_command = 'openssl enc -d -aes-128-cbc -pass pass:ok -in %p'
47+
```
48+
49+
1. [Verify that data encryption is enabled](verifying_tde).

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
---
2-
title: "Enabling TDE on an existing EDB Postgres Advanced Server cluster"
3-
navTitle: Enabling TDE on an existing EDB Postgres Advanced Server cluster
2+
title: "Enabling TDE on an existing EDB Postgres Advanced Server"
3+
description: Migrate your existing EDB Postgres Advanced Server to a new TDE-enabled database server.
44
deepToC: true
5+
redirects:
6+
- /tde/latest/enabling_tde_epas/ #generated for TDE/refresh
57
---
68

7-
## Enabling TDE on an EDB Postgres Advanced Server cluster
8-
99
Create a new EDB Postgres Advanced Server cluster with TDE enabled
1010
and use `pg_upgrade` to transfer data from the existing source cluster to the new encrypted cluster.
1111

@@ -61,7 +61,7 @@ Use [pg_dumpall](https://www.postgresql.org/docs/current/app-pg-dumpall.html), [
6161
!!!note
6262
Alternatively, use the `--key-unwrap-command=<command>` and `--key-wrap-command=<command>` arguments when initializing the encrypted server to include the `wrap` and `unwrap` commands.
6363

64-
See [Using initdb TDE options](enabling_tde/#using-initdb-tde-options) for more information on possible configurations.
64+
See [Using initdb TDE options](../initdb_tde_options/) for more information on possible configurations.
6565

6666
1. Initialize the new server with encryption:
6767

@@ -92,7 +92,7 @@ Use [pg_dumpall](https://www.postgresql.org/docs/current/app-pg-dumpall.html), [
9292
!!!note
9393
If you're using two different Postgres versions, use the psql utility of the encrypted server. Otherwise, the system will attempt to use psql from the previous instance.
9494

95-
1. To ensure the new server is encrypted, [check for TDE presence](enabling_tde/#checking-for-tde-presence-using-sql).
95+
1. To ensure the new server is encrypted, [check for TDE presence](verifying_tde).
9696

9797
### Upgrading to the encrypted server
9898

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
---
2+
title: Tutorials
3+
description: Review some examples of how to create a TDE-enabled database server.
4+
indexCards: simple
5+
navigation:
6+
- enabling_tde
7+
- enabling_tde_epas
8+
---
9+
10+
Create a TDE-enabled database server using `initdb`.
11+
12+
Or migrate an existing database instance by creating a TDE-enabled database server with `initdb` and then migrating data with `pg_upgrade`.

product_docs/docs/tde/15/upgrade_use_cases/postgres_to_extended.mdx renamed to product_docs/docs/tde/15/enabling/postgres_to_extended.mdx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
---
22
title: "Upgrading PostgreSQL to EDB Postgres Extended Server while enabling TDE"
33
navTitle: Upgrading PostgreSQL to EDB Postgres Extended Server
4+
description: Use pg_upgrade to upgrade the database version, change the Postgres distribution, or migrate to a TDE-enabled database.
45
deepToC: true
6+
redirects:
7+
- /tde/latest/upgrade_use_cases/postgres_to_extended/ #generated for TDE/refresh
58
---
69

710
Create a new EDB Postgres Extended Server cluster with TDE enabled and use pg_upgrade to transfer data from the existing PostgreSQL cluster to the new encrypted cluster.
@@ -58,7 +61,7 @@ This example upgrades a PostgreSQL 16 instance to EDB Postgres Extended Server 1
5861
!!!note
5962
Alternatively, use the `--key-unwrap-command=<command>` and `--key-wrap-command=<command>` arguments when initializing the encrypted server to include the `wrap` and `unwrap` commands.
6063

61-
See [Using initdb TDE options](../enabling_tde/#using-initdb-tde-options) for more information on possible configurations.
64+
See [Using initdb TDE options](../initdb_tde_options/) for more information on possible configurations.
6265

6366
1. Initialize the new server with encryption:
6467

@@ -89,7 +92,7 @@ This example upgrades a PostgreSQL 16 instance to EDB Postgres Extended Server 1
8992
!!!note
9093
If you're using two different Postgres versions, use the psql utility of the encrypted server. Otherwise, the system attempts to use psql from the previous instance.
9194

92-
1. To ensure the new server is encrypted, [check for TDE presence](../enabling_tde/#checking-for-tde-presence-using-sql).
95+
1. To ensure the new server is encrypted, [check for TDE presence](../enabling/verifying_tde/).
9396

9497
### Upgrading to the encrypted server
9598

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
---
2+
title: "Verifying TDE is enabled"
3+
description: Verify TDE is enabled after creating a database server.
4+
---
5+
6+
You can find out whether TDE is present on a server by querying the `data_encryption_version` column of the `pg_control_init` table.
7+
8+
A value of 0 means TDE isn't enabled. Any nonzero value reflects the version of TDE in use. Currently, when TDE is enabled, this value is 1.
9+
10+
```sql
11+
select data_encryption_version from pg_control_init();
12+
__OUTPUT__
13+
data_encryption_version
14+
-------------------------
15+
1
16+
(1 row)
17+
```
18+

0 commit comments

Comments
 (0)